Cookbook
Recipes that run the first time you copy them.
Each recipe solves one focused problem, shows working code, and points to what’s next. Start with API fundamentals to nail the primitives, then layer on agent loops and full use cases. Colab notebooks + standalone Python files.
Muse Code recipes
AGENT PATTERNSThe core patterns that get the most out of Muse Code, straight from the launch materials.
>
Agent fan-out
Split one big job across multiple subagents, each in its own worktree, so nothing collides mid-flight and your working copy stays clean.
>Bundled skills
Put a rough idea in, get a grilled, taste-checked feature out — the built-in /plan, /grill, and /goal playbooks doing the work.
>Goal tracking
Set your goal and Muse Code keeps an agent on task, so what you originally wanted is what gets merged.
API fundamentals
10 recipesProve each API primitive works and get a starting point you can build on.
01Quickstart: chat completionsMake your first Muse Spark call by pointing the OpenAI SDK at one new base URL.↗02Streaming responsesRender tokens as they generate and read the final usage chunk.↗03Tool and function callingDetect tool calls and run the execute-and-feed-back loop.↗04Structured outputGet schema-guaranteed JSON that parses on the first try.↗05Prompt cachingReuse a stable prompt prefix and track cached tokens.↗06Reasoning and thinking tokensControl reasoning effort and replay reasoning across turns.↗07Vision inputSend images by URL or base64 and get structured analysis back.↗08Long contextPack repo-scale context into the 1M-token context window.↗09Error handling and retryBack off with jitter and skip retries on client errors.↗10Search groundingGround responses in live web search results with inline citations.↗
Agent patterns
5 recipesBuild the loops that turn a model into an agent: planning, parallel work, and self-correction.
01Basic agent loopWire up the core perceive-decide-act agent loop.↗02Interleaved reasoningInterleave reasoning with tool calls in a single turn.↗03Multi-turn context managementManage growing context across a long agent run.↗04Validated in-place editsValidated search-and-replace edits with a coding agent.↗05Alert fatigue copilotExtract grounded patterns from a noisy alert feed, then probe, chat, and self-assess with strict-JSON output.↗
Use cases
13 recipesEnd-to-end patterns: multimodal perception, orchestration, and full applications.
01Chart analysisRead charts and extract structured data from images.↗02Error screenshot fixDiagnose a bug from an error screenshot and fix it.↗03Smart glasses with OpenClawHands-free look-and-ask on Ray-Ban Meta glasses.↗04Generating slidesGenerate a slide deck from a prompt or source content.↗05Browser-verified web designBuild a website with a coding agent that checks its own work in a real browser.↗06Iterative game devBuild a browser game end-to-end with a coding agent, verified in a real browser.↗07Sandboxed executionExecute model-generated code in a sandbox.↗08Multi-agent product studioOrchestrate a four-profile team (PM, backend, frontend, tech writer) coordinating through a shared Kanban board.↗09One-shot game devBuild a complete 3D browser game in a single pass — an AGENTS.md plus one structured prompt, no iteration loop.↗10Perception groundingIdentify food in a fridge photo and pin interactive health-score dots at pixel locations.↗11GitHub repo agentAutonomous GitHub Actions bot — triage, PR review, AI-slop detection, and bug-fix PRs — on OpenCode + Muse Spark.↗12Computer useDrive a Linux desktop from screenshots — the agent finds an app, opens it, and plays it in a Cua sandbox.↗13macOS computer useDrive a real Mac from screenshots with metacua, a native Swift + Python computer-use agent.↗
Every recipe needs one thing: a key.
Get a Model API account at dev.meta.ai, create an API key, and export it as MODEL_API_KEY. The API is drop-in compatible with the OpenAI SDK — see the quickstart snippet in the docs.