Meta Model API

Start here

Overview
Quickstart
Authentication
Models
SDKs and libraries
Pricing and rate limits

Capabilities

Tool calling
Tool search
Search grounding
Image understanding
Video understanding
File handling
Reasoning
Structured output
Prompt caching
Token counting

Protocols

Choosing an API
Responses API
Chat Completions API
Messages API

Cookbook

All recipes
API fundamentals
Agent patterns
Use cases
Building with Muse Code

Muse Code

Overview
Authentication and billing
Permissions and safety
Working with the agent
Configuration and context
Extending and automating

Muse Glimmer

Overview
Get the model
Prompting guide
Quantization
Speculative decoding
Run inference
Customization

Agent guides

Coding agents
Agent frameworks
Computer use

API reference

Introduction
Error handling
Status
Responses
Chat completions
Messages
Files
Models

Log in

--- meta: title: Agent patterns — Meta Model API cookbook description: Cookbook recipes for turning Muse Spark into an agent — the core loop, interleaved reasoning and tool use, context management, and validated edits. keywords: cookbook, agent patterns, agent loop, tool use, context management, Muse Spark cms: layout: large in_page_nav: false alias: /model-api/docs/cookbook/agent-patterns target: aidmc --- # Agent patterns Turn a model into an agent. These loops handle planning, self-correction, and staying coherent across long runs. Part of the [Cookbook](/docs/cookbook). <tile-group col="3"> <tile color="purple" icon="robot-head" href="/docs/cookbook/basic-agent-loop" title="Basic agent loop"> Wire up the core perceive-decide-act loop.</tile> <tile color="purple" icon="robot-head" href="/docs/cookbook/interleaved-reasoning-tool-use" title="Interleaved reasoning and tool use"> Interleave reasoning with tool calls in a single turn.</tile> <tile color="purple" icon="robot-head" href="/docs/cookbook/multi-turn-context-management" title="Multi-turn context management"> Keep context under control across a long agent run.</tile> <tile color="purple" icon="robot-head" href="/docs/cookbook/search-and-replace-edits" title="Search-and-replace edits"> Make exact-match file edits that stay reviewable.</tile> <tile color="purple" icon="robot-head" href="/docs/cookbook/alert-fatigue-copilot" title="Alert fatigue copilot"> Pull grounded patterns from noisy alerts, then probe, chat, and self-assess with strict JSON.</tile> </tile-group>

Agent patterns

Turn a model into an agent. These loops handle planning, self-correction, and staying coherent across long runs. Part of the Cookbook.
Basic agent loop Wire up the core perceive-decide-act loop.
Interleaved reasoning and tool use Interleave reasoning with tool calls in a single turn.
Multi-turn context management Keep context under control across a long agent run.
Search-and-replace edits Make exact-match file edits that stay reviewable.
Alert fatigue copilot Pull grounded patterns from noisy alerts, then probe, chat, and self-assess with strict JSON.
Was this page helpful?