Claude Cookbook
TL;DR Highlight
Anthropic published a cookbook of recipes for agents, tool calling, RAG, and caching with Claude
Who Should Read
Backend developers building agents or RAG on the Claude API who want official example code to reference
Core Mechanics
- Claude Cookbook is a collection of examples
- It gathers practical guides and examples for using Claude, grouped by category.
- Categories include Agent Patterns, Tools, RAG & Retrieval, Evals, Observability, Multimodal, Skills, Thinking, and Fine-Tuning.
- Recipes for tool-calling efficiency
- Programmatic tool calling (PTC) has Claude write code that calls tools in a code execution environment, cutting latency and token use.
- Tool search with embeddings uses semantic embeddings to discover tools dynamically, scaling to thousands of tools.
- Recipes for long-context management
- Automatic context compaction compresses conversation history for long-running agents.
- Session memory compaction compacts instantly using background threading and prompt caching.
- Recipes for cost and speed
- The Message Batches API recipe claims a 50% cost reduction via asynchronous processing.
- Speculative prompt caching warms the cache while users type to reduce time-to-first-token.
- Recipes for RAG and evals
- Contextual retrieval improves RAG accuracy by adding context to chunks before embedding.
- Evaluator optimizer is a loop where one LLM generates and another gives feedback.
- The Cost Optimization guide applies cost levers one at a time, driven by evals.
- Many recent Managed Agents entries
- They cover budgets, memory stores, OpenTelemetry tracing, and subagent orchestration.
- One recipe has Claude review agent sessions for security issues.
Community Reactions
- Opinion that official guides are pointless
- Commenters said most of this is trivial, will be baked into harnesses, and agent workflow material feels like theatre.
- Another view was that such recipes get absorbed into the next model version.
- Criticism of the frontend aesthetics examples
- Commenters said the before and after images are both bland, or just bland with gradients.
- Others pointed out even basic UI like table spacing is off.
- Maintenance worries and alternatives
- One commenter said Copilot and OpenAI cookbooks started with many examples and later went unmaintained.
- The OpenAI Cookbook was suggested as another resource.
- Opinion that the best CLAUDE.md is none
- One commenter argued tech stack and test style should be obvious from the code, so CLAUDE.md isn't needed.
How to Apply
- Find one pattern you use in the Cookbook
- If your agent has many tools or high token use, read the PTC and Tool search with embeddings recipes today.
- Note what differs from your current implementation.
- Add context compaction to long agent sessions
- Try the Automatic context compaction recipe on an agent with long conversations.
- Compare token counts and answer quality before and after.
- Apply caching and batching to repeated calls
- Move non-realtime bulk requests to the Message Batches API.
- For latency-sensitive paths, measure time-to-first-token with the Speculative prompt caching recipe.
Try It
# Paste into Claude (simple prompt for choosing a Cookbook recipe)
I run a service on the Claude API.
{{service description}}
My current problem is:
{{latency, cost, context overflow, too many tools, etc.}}
Prioritize which of these Claude Cookbook recipes to apply first.
- Programmatic tool calling
- Tool search with embeddings
- Automatic context compaction
- Speculative prompt caching
- Batch processing with Message Batches API
- Contextual retrieval
For each recipe, give one line on why and a 30-minute experiment.
Next: open the notebook for the top recipe and compare it against your code.Terminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques