Claude Cookbook
6 hours ago
- Reproduce Claude's agentic search benchmark scores using the Messages API with programmatic tool calling, server-side compaction, and task budgets.
- Detect safety classifier blocks on Claude Fable 5 and fall back to Opus 4.8 with client-side or server-side fallback, including streaming and billing changes.
- Implement async multi-agent orchestration with fixed N-agent teams using a shared hub or dynamically spawned subagents.
- Deploy a research agent through three tiers of operational maturity: Docker, Modal, and Kubernetes, using the same container image and HTTP interface.
- Coordinate a heterogeneous specialist team using a multiagent coordinator configuration with scoped toolsets for tasks like sales proposals.
- Build a grade-and-revise loop with Outcomes where a writer drafts a research brief, a grader checks it against a rubric, and feedback drives revisions.
- Give Claude Managed Agents a Memory store to learn and remember user preferences across interactions.
- Build a vulnerability-discovery agent for cybersecurity that threat-models a C target, hunts memory-safety bugs, and triages findings into a structured report.
- Wire Claude into an on-call flow for SRE incident response, where the agent reads logs and runbooks, pinpoints root cause, opens a fix PR, and waits for approval.
- Build a data analyst agent that turns a CSV into a narrative HTML report with interactive charts using a sandboxed environment.
- Build a Slack data analyst bot that can be mentioned with a CSV to get an analysis report in-thread with multi-turn follow-ups.
- Create a Managed Agents tutorial that iterates on a failing test suite by having an agent fix planted bugs in a Python package.
- Build a production setup for Managed Agents with vault-backed MCP credentials, idled webhook patterns, and resource lifecycle CRUD verbs.
- Implement prompt versioning and rollback for Managed Agents by creating versions, evaluating against test sets, shipping updates, and detecting regressions.
- Build a threat intelligence enrichment agent that investigates IOCs by querying multiple sources, cross-referencing findings, and mapping to MITRE ATT&CK.
- List, read, rename, tag, and fork Agent SDK sessions on disk to build a conversation history sidebar without a transcript parser.
- Build knowledge graphs from unstructured text using Claude for entity extraction, relation mining, deduplication, and multi-hop querying.
- Compare context engineering strategies for long-running agents, including memory, compaction, and tool clearing, and learn their costs and composition.
- Port an OpenAI Agents SDK app to the Claude Agent SDK by mapping each primitive through a single expense-approval agent example.
- Build an incident response agent with read-write MCP tools for autonomous diagnosis, remediation, and post-mortem documentation.
- Manage long-running Claude conversations with instant session memory compaction using background threading and prompt caching.
- Reduce latency and token consumption by letting Claude write code that calls tools programmatically in a code execution environment.
- Scale Claude applications to thousands of tools using semantic embeddings for dynamic tool discovery.
- Manage context limits in long-running agentic workflows by automatically compressing conversation history.
- Build a low-latency voice assistant using ElevenLabs for speech-to-text and text-to-speech combined with Claude.
- Give Claude a crop tool to zoom into image regions for detailed analysis of charts, documents, and diagrams.
- Guide Claude to produce distinctive, polished frontend designs avoiding generic aesthetics.
- Build financial dashboards and portfolio analytics using Claude's Excel, PowerPoint, and PDF skills.
- Create, deploy, and manage custom skills that extend Claude with specialized organizational workflows.
- Create documents, analyze data, and automate workflows with Claude's Excel, PowerPoint, and PDF skills.
- Build a research agent using the Claude Code SDK with WebSearch for autonomous research.
- Build multi-agent systems with subagents, hooks, output styles, and plan mode features for a chief of staff agent.
- Connect agents to external systems via MCP servers for GitHub monitoring and CI workflows.
- Run parallel agent evaluations on tools independently from evaluation task files.
- Programmatically access and analyze Claude API usage and cost data via the Admin API.
- Build AI agents with persistent memory using Claude's memory tool and context editing.
- Reduce time-to-first-token by warming cache speculatively while users formulate their queries.
- Enable parallel tool calls on Claude 3.7 Sonnet using a batch tool meta-pattern workaround.
- Use Claude's extended thinking for transparent step-by-step reasoning with budget management.
- Combine extended thinking with tools for transparent reasoning during multi-step workflows.
- Implement three simple multi-LLM workflow patterns that trade cost or latency for improved performance.
- Use an evaluator-optimizer workflow pattern with one LLM for generation and another for evaluation in a feedback loop.
- Use a central LLM to dynamically delegate tasks to worker LLMs and synthesize their combined results.
- Process large volumes of Claude requests asynchronously with a 50% cost reduction using batches.
- Convert natural language queries to SQL using RAG, chain-of-thought, and self-improvement techniques.
- Improve RAG accuracy by adding context to chunks before embedding with prompt caching.
- Finetune Claude 3 Haiku on Amazon Bedrock for custom tasks.
- Generate synthetic test cases to evaluate and improve Claude prompt templates.
- Cache and reuse prompt context for cost savings and faster responses with detailed instructions.
- Summarize legal documents with evaluation and advanced techniques.
- Build and optimize RAG systems with Claude using summary indexing and reranking techniques.
- Build classification systems with Claude using RAG and chain-of-thought for insurance tickets.
- Control how Claude selects tools using the tool_choice parameter for forced or auto selection.
- Combine Claude's vision with tools to extract structured data from images like nutrition labels.
- Generate longer responses beyond the max_tokens limit using prefill technique with message continuation.
- Optimize image processing performance with Claude's vision capabilities.
- Create validated tools using Pydantic models for type-safe Claude tool use interactions.
- Transcribe audio with Deepgram and generate interview questions using Claude.
- Integrate the Wolfram Alpha LLM API as Claude tool for computational queries.
- Provide Claude with a calculator tool for arithmetic operations and mathematical problem solving.
- Build a customer service chatbot with Claude using tools for customer lookup and order management.
- Extract structured JSON data from various inputs using Claude's tool use capabilities.
- Use a metaprompt tool to generate starting prompts for tasks to solve the blank-page problem.
- Enable Claude to provide detailed source citations when answering document-based questions.
- Build RAG agents with Claude 3 using LangChain v1's updated agent framework patterns.
- Fetch and summarize web page content using Claude 3 Haiku via URL extraction.
- Analyze financial reports using Haiku sub-agents for extraction and Opus for synthesis.
- Use LlamaIndex's Anthropic MultiModal LLM abstraction for image understanding and reasoning.
- Build a chatbot RAG system with Claude and MongoDB using tech news as a knowledge base.
- Build robust evaluation systems to measure and improve Claude's performance on key metrics.
- Build customizable content moderation filters by defining rules and categories in prompts.
- Get reliable JSON output from Claude using effective prompting techniques without constrained sampling.
- Generate SQL queries from natural language questions using Claude with database schema context.
- Pass images to the Claude 3 API for vision-based text analysis.
- Extract and structure unstructured text from images and PDFs using Claude 3's vision.
- Extract insights from charts, graphs, and presentations using Claude's vision analysis capabilities.
- Build RAG for large document collections using DocumentAgents with the ReAct Agent pattern.
- Create ReAct agents with LlamaIndex for tool-based reasoning and action workflows.
- Build a basic RAG pipeline with LlamaIndex for document retrieval and question answering.
- Route queries to different indices using LlamaIndex RouterQueryEngine for multi-document search.
- Decompose complex queries into sub-questions across multiple documents using LlamaIndex SubQuestionQueryEngine.
- Connect Claude with the Pinecone vector database for retrieval-augmented generation and semantic search.
- Process and summarize PDF documents using the Claude API with text extraction and encoding.
- Use a legacy notebook showing iterative Wikipedia searches with Claude 2 for research workflows.