Source: raw/claude-cookbooks-main/ — see also multi-agent research pattern deep-dive and chief-of-staff agent template deep-dive (2026-05-23 batch)

The official Anthropic cookbook repository (github.com/anthropics/anthropic-cookbook) containing Jupyter notebooks and Python examples for building with the Claude API. This article catalogs the cookbooks as a CCA-F study resource, organizing them by exam domain relevance. Each notebook provides hands-on code you can run to internalize the patterns tested on the exam.

Repository Overview

  • Language: Python (Jupyter notebooks)
  • License: MIT
  • Key directories: tool_use/, capabilities/, misc/, multimodal/, patterns/agents/, claude_agent_sdk/, managed_agents/, skills/, extended_thinking/
  • Prerequisites: Anthropic API key, Python 3.10+, uv for dependency management
  • Setup: uv sync --all-extras, then cp .env.example .env and add your ANTHROPIC_API_KEY

Cookbooks by Exam Domain

Domain 1: Agentic Architecture & Orchestration (27%)

These notebooks demonstrate the agentic loop lifecycle, coordinator-subagent patterns, and multi-agent orchestration:

NotebookPathWhat it teaches
Customer Service Agenttool_use/customer_service_agent.ipynbFull agentic loop: tool calls, stop_reason checking, conversation management. Directly maps to Task 1.1
Orchestrator Workerspatterns/agents/orchestrator_workers.ipynbCoordinator-subagent pattern with parallel workers. Maps to Tasks 1.2, 1.3
Basic Workflowspatterns/agents/basic_workflows.ipynbPrompt chaining, routing, parallelization patterns. Maps to Task 1.6
Evaluator Optimizerpatterns/agents/evaluator_optimizer.ipynbIterative refinement loops where evaluator guides optimizer. Maps to Task 1.6
Sub-Agentsmultimodal/using_sub_agents.ipynbSpawning sub-agents for parallel processing. Maps to Task 1.3
One-Liner Research Agentclaude_agent_sdk/00_The_one_liner_research_agent.ipynbMinimal Agent SDK setup. Maps to Tasks 1.1, 1.3
Chief of Staff Agentclaude_agent_sdk/01_The_chief_of_staff_agent.ipynbMulti-agent delegation with coordinator. Maps to Tasks 1.2, 1.3
Session Browserclaude_agent_sdk/05_Building_a_session_browser.ipynbSession management and state inspection. Maps to Task 1.7

Managed Agents cookbooks (advanced agentic patterns):

  • CMA_orchestrate_issue_to_pr.ipynb — end-to-end orchestration from GitHub issue to PR
  • CMA_iterate_fix_failing_tests.ipynb — iterative test-fixing loops
  • CMA_gate_human_in_the_loop.ipynb — human-in-the-loop gating patterns
  • CMA_operate_in_production.ipynb — production operation patterns
  • CMA_explore_unfamiliar_codebase.ipynb — codebase exploration strategies

Domain 2: Tool Design & MCP Integration (18%)

These notebooks cover tool definition, structured errors, tool choice configuration, and tool search patterns:

NotebookPathWhat it teaches
Calculator Tooltool_use/calculator_tool.ipynbBasic tool definition with JSON schema. Maps to Task 2.1
Parallel Toolstool_use/parallel_tools.ipynbParallel tool execution patterns. Maps to Task 2.3
Tool Choicetool_use/tool_choice.ipynbauto, any, and forced tool selection. Maps to Task 2.3
Tool Search (Embeddings)tool_use/tool_search_with_embeddings.ipynbSemantic tool search for large tool sets. Maps to Task 2.3
Tool Search (Alternate)tool_use/tool_search_alternate_approaches.ipynbAlternative approaches to tool discovery. Maps to Task 2.3
Programmatic Tool Callingtool_use/programmatic_tool_calling_ptc.ipynbProgrammatic (non-LLM) tool execution. Maps to Tasks 2.1, 2.3
Context Engineering Toolstool_use/context_engineering/context_engineering_tools.ipynbContext-aware tool design. Maps to Tasks 2.1, 2.4
Memory Cookbooktool_use/memory_cookbook.ipynbPersistent memory tools. Maps to Task 2.4
Automatic Context Compactiontool_use/automatic-context-compaction.ipynbAutomatic context management. Maps to Tasks 2.4, 5.4
Tool Use with Pydantictool_use/tool_use_with_pydantic.ipynbSchema validation with Pydantic. Maps to Task 2.1
Tool Evaluationtool_evaluation/tool_evaluation.ipynbEvaluating tool use quality. Maps to Task 2.1
Threat Intel Agenttool_use/threat_intel_enrichment_agent.ipynbMulti-tool agent for security. Maps to Tasks 2.1, 2.3

Domain 3: Claude Code Configuration & Workflows (20%)

The cookbooks repo itself demonstrates Claude Code configuration patterns:

ResourcePathWhat it teaches
Root CLAUDE.mdCLAUDE.mdProject-level configuration with coding standards, model aliases, git workflow. Maps to Task 3.1
Slash Commands.claude/commands/Project-scoped commands (notebook-review, review-pr, link-review, model-check). Maps to Task 3.2
Skills.claude/skills/cookbook-audit/SKILL.mdSkill with style guide reference, demonstrating SKILL.md frontmatter. Maps to Task 3.2
Code Reviewer Agent.claude/agents/code-reviewer.mdAgent definition for automated code review. Maps to Task 3.6
Skills Notebooksskills/notebooks/01_skills_introduction.ipynbIntroduction to skills system. Maps to Task 3.2
Skills Custom Devskills/notebooks/03_skills_custom_development.ipynbBuilding custom skills. Maps to Task 3.2

Domain 4: Prompt Engineering & Structured Output (20%)

These notebooks demonstrate structured output, few-shot prompting, batch processing, and validation patterns:

NotebookPathWhat it teaches
Extracting Structured JSONtool_use/extracting_structured_json.ipynbJSON extraction via tool_use. Maps to Task 4.3
Enable JSON Modemisc/how_to_enable_json_mode.ipynbReliable JSON output. Maps to Task 4.3
Batch Processingmisc/batch_processing.ipynbMessage Batches API usage, custom_id correlation. Maps to Task 4.5
Building Evalsmisc/building_evals.ipynbAutomated evaluation patterns. Maps to Tasks 4.4, 4.6
Generate Test Casesmisc/generate_test_cases.ipynbTest case generation. Maps to Task 3.5
Moderation Filtermisc/building_moderation_filter.ipynbContent classification with structured output. Maps to Task 4.1
Using Citationsmisc/using_citations.ipynbCitation tracking in output. Maps to Task 5.6
Classification Guidecapabilities/classification/guide.ipynbClassification patterns with explicit criteria. Maps to Task 4.1
Summarization Guidecapabilities/summarization/guide.ipynbSummarization with structured output. Maps to Task 4.3
RAG Guidecapabilities/retrieval_augmented_generation/guide.ipynbRetrieval-augmented generation. Maps to Tasks 4.2, 5.1
Vision with Toolstool_use/vision_with_tools.ipynbMultimodal structured extraction. Maps to Task 4.3
Metapromptmisc/metaprompt.ipynbPrompt generation and refinement. Maps to Task 4.1

Domain 5: Context Management & Reliability (15%)

These notebooks address context window management, prompt caching, session memory, and long-document handling:

NotebookPathWhat it teaches
Prompt Cachingmisc/prompt_caching.ipynbCache-aware prompt design, cost reduction. Maps to Task 5.1
Speculative Cachingmisc/speculative_prompt_caching.ipynbAdvanced caching strategies. Maps to Task 5.1
Session Memory Compactionmisc/session_memory_compaction.ipynbCompacting long conversation history. Maps to Tasks 5.1, 5.4
Automatic Context Compactiontool_use/automatic-context-compaction.ipynbAutomated context management. Maps to Task 5.4
PDF Upload Summarizationmisc/pdf_upload_summarization.ipynbHandling long documents. Maps to Task 5.1
Sampling Past Max Tokensmisc/sampling_past_max_tokens.ipynbWorking beyond token limits. Maps to Task 5.1
Observability Agentclaude_agent_sdk/02_The_observability_agent.ipynbAgent monitoring and observability. Maps to Task 5.3
SRE Agentclaude_agent_sdk/03_The_site_reliability_agent.ipynbReliability patterns in practice. Maps to Task 5.3
Prompt Versioning & Rollbackmanaged_agents/CMA_prompt_versioning_and_rollback.ipynbManaging prompt versions for reliability. Maps to Task 5.3

Extended Thinking (Cross-Domain)

NotebookPathWhat it teaches
Extended Thinkingextended_thinking/extended_thinking.ipynbChain-of-thought reasoning patterns. Relevant to Tasks 4.1, 4.6
Extended Thinking + Toolsextended_thinking/extended_thinking_with_tool_use.ipynbCombining reasoning with tool use. Relevant to Tasks 1.1, 4.3

Work through the notebooks in this order to build knowledge progressively:

  1. Week 1 — Tool Foundations: calculator_tool tool_choice parallel_tools extracting_structured_json
  2. Week 2 — Agentic Patterns: customer_service_agent basic_workflows orchestrator_workers evaluator_optimizer
  3. Week 3 — Production Concerns: batch_processing prompt_caching session_memory_compaction building_evals
  4. Week 4 — Advanced Agents: Agent SDK notebooks (00-05) Managed Agents notebooks context_engineering_tools

Key Takeaways

  • The cookbooks repository provides runnable code for nearly every CCA-F task statement — use it as your hands-on lab
  • Domain 1 (Agentic Architecture) has the richest notebook coverage: the patterns/agents/, claude_agent_sdk/, and managed_agents/ directories together cover all 7 task statements
  • Domain 2 (Tool Design) is well covered by the tool_use/ directory — especially tool_choice.ipynb and programmatic_tool_calling_ptc.ipynb
  • Domain 3 (Claude Code Config) is best studied by examining the repo’s own .claude/ directory structure rather than running notebooks
  • The misc/batch_processing.ipynb notebook is essential for Task 4.5 (batch strategies) — one of the most concrete exam topics
  • Domain 5 (Context & Reliability) content is spread across misc/ (caching, compaction) and the Agent SDK (observability, SRE patterns)

2026-05-23 batch refresh

Recompiled against the local raw/claude-cookbooks-main/ tree dump. Two new deep-dive articles split out from this overview to capture reusable artifacts the table-of-notebooks doesn’t carry full detail on:

  • anthropic-cookbook-research-agent-prompts — distills the three-role multi-agent research pattern (lead + parallel subagents + citations agent) shipped in patterns/agents/prompts/. Load-bearing rules: lead’s depth-first/breadth-first/straightforward classifier, subagent’s 5-15-tool-call OODA budget with web_fetch-after-web_search mandate, citations agent’s whitespace-exact no-rewrite contract.
  • anthropic-cookbook-chief-of-staff-agent — documents the Claude Agent SDK coordinator template (TechStart SaaS): CLAUDE.md business state + two domain subagents (financial-analyst + recruiter) + three commands (/budget-impact, /strategic-brief, /talent-scan) + two output styles (executive, technical). Re-use checklist for swapping in a different 2-domain coordinator.

The rest of the 2026-05-23 raw dump (.claude/agents/, .claude/commands/, .github/, capabilities/*/README.md, managed_agents/example_data/*, skills/custom_skills/*, third_party/*) is recorded in .manifest.json but stays linked through the tables above rather than each getting its own article — most are README pointers or sample data, not new technique surface.

2026-05-24 infra refresh — Workload Identity Federation for claude-code-action

Source: raw/anthropic-watch-anthropic-cookbook-commit-3c30b020594de29a7f24ee579c511ac3ac45fb6a.md (commit 3c30b020, PR #662, author zenexer-ant, merged 2026-05-24T21:44:59Z).

Anthropic migrated the cookbook repo’s six claude-code-action-invoking workflows from the static ANTHROPIC_API_KEY repo secret to Workload Identity Federation — the GitHub Actions job exchanges its OIDC token for a short-lived access token at run time. The federation rule is repository_id-pinned, so the trust scope is the specific repository, not the whole GitHub org. Reusable pattern for anyone running claude-code-action in their own repos:

  • Drop the long-lived ANTHROPIC_API_KEY secret. The static-secret model leaks if the repo is compromised or the secret is shared with a contributor; WIF tokens are scoped to one job run.
  • Add permissions: id-token: write to every workflow that invokes claude-code-action (all six in the cookbook repo lacked it pre-migration). This is the GitHub side of the OIDC handshake.
  • Pin claude-code-action to v1.0.132 or later. The WIF inputs landed in v1.0.130; @v1 is a moving tag and silently rolls forward.
  • anthropic_workspace_id is optional. Anthropic’s default workspace already matches the federation rule for org-default cases. Provide it explicitly only when targeting a non-default workspace.
  • Two notebook-execution steps still on static keys. notebook-quality.yml and notebook-tests.yml pass ANTHROPIC_API_KEY as an env var into nbconvert / pytest — those need a separate inline OIDC exchange (TODO comments in the commit). Both gracefully degrade when the secret is absent (notebook-tests has an explicit skip-guard; notebook-quality catches per-notebook failures), so the partial migration doesn’t break the repo while the inline-OIDC pattern is being worked out.

Operator takeaway. If you’re using claude-code-action in your own repo with a stored API key, this commit is the reference template for moving off it. Read the diff alongside Anthropic’s WIF docs to wire the federation rule on your side (one-time setup per repo). Doesn’t apply to notebook execution paths yet — keep those on managed secrets until Anthropic publishes the inline-OIDC pattern.

Try It

  1. Clone the repo: git clone https://github.com/anthropics/anthropic-cookbook.git and set up your API key
  2. Run customer_service_agent.ipynb first — it is the single most exam-relevant notebook, covering the agentic loop, tool use, and conversation management in one example
  3. Modify the examples — after running each notebook, change something (add a tool, modify the schema, break something intentionally) to see what happens
  4. Build your own cookbook — create a notebook that combines patterns from at least 3 different cookbooks into one integrated system
  5. Use the cookbooks as flashcards — for each notebook, write down which exam task statement it maps to without looking at this article