# anthropics/claude-cookbooks architecture

> Architecture diagram of the GitHub repository anthropics/claude-cookbooks, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anthropics/claude-cookbooks
- Repository: https://github.com/anthropics/claude-cookbooks

## Overview

Claude Cookbooks is a collection of copyable examples for developers building Claude applications, not one integrated runtime. A representative user workflow is to choose a recipe, adapt its prompt/tool or retrieval example, and use Claude or an external service to produce a result. The tree also contains standalone agents and hosting examples. Edges are limited to relationships stated in the README or visible in the supplied source index/excerpts; many recipe internals were not sampled, so their connections are intentionally omitted.

Main entry points: [`README.md`](https://github.com/anthropics/claude-cookbooks/blob/main/README.md) (Claude Cookbooks), [`claude_agent_sdk/hosting/kubernetes/gateway/main.py`](https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/hosting/kubernetes/gateway/main.py) (Kubernetes Gateway), [`capabilities/content_moderation/pipeline.py`](https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/content_moderation/pipeline.py) (Policy Compiler and Extractor), [`capabilities/retrieval_augmented_generation/evaluation/provider_retrieval.py`](https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/retrieval_augmented_generation/evaluation/provider_retrieval.py) (RAG Retrieval and Reranking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_moderation["Moderation"]
  node_moderation_pipeline["Policy Compiler and Extractor<br/>[pipeline.py]"]
  node_moderation_engine["Rule Engine<br/>[engine.py]"]
  node_moderation_eval["Moderation Evaluation<br/>[run_eval.py]"]
end

subgraph group_retrieval["Retrieval and SQL"]
  node_classification_prompts["Classification Prompts<br/>[prompts.py]"]
  node_rag_provider["RAG Retrieval and Reranking"]
  node_text_sql_prompts["Text-to-SQL Prompts<br/>[prompts.py]"]
  node_text_sql_vectordb[("Evaluation Vector DB<br/>[vectordb.py]")]
  node_mongodb_config["MongoDB Configuration<br/>[config.py]"]
end

subgraph group_agents["Agents and Hosting"]
  node_research_agent["Research Agent<br/>[agent.py]"]
  node_agent_server["Agent HTTP Server<br/>[server.py]"]
  node_gateway_main["Kubernetes Gateway<br/>[main.py]"]
  node_gateway_k8s["Pod Provisioning<br/>[k8s.py]"]
  node_gateway_proxy["Session Proxy<br/>[proxy.py]"]
  node_agent_visualizer["Agent Visualizer"]
  node_url_utils["URL Utilities<br/>[url_utils.py]"]
end

subgraph group_tooling["Tool Use"]
  node_code_review_demo["Memory Code Review Demo"]
  node_memory_tool["Memory Operations<br/>[memory_tool.py]"]
  node_customer_tools["Customer Service Tools"]
  node_customer_api["Ticket API"]
end

node_developer(("Developer"))
node_cookbook["Claude Cookbooks<br/>[README.md]"]
node_anthropic(("Claude API"))
node_external_knowledge[("External Knowledge")]

node_developer -->|"chooses recipe"| node_cookbook
node_cookbook -->|"offers moderation"| node_moderation_pipeline
node_cookbook -->|"offers evaluations"| node_moderation_eval
node_cookbook -->|"offers classification"| node_classification_prompts
node_cookbook -->|"offers retrieval"| node_rag_provider
node_cookbook -->|"offers SQL examples"| node_text_sql_prompts
node_cookbook -->|"offers agent examples"| node_research_agent
node_cookbook -->|"offers tool-use examples"| node_code_review_demo
node_moderation_pipeline -->|"evaluates rules"| node_moderation_engine
node_agent_server -->|"runs agent"| node_research_agent
node_gateway_main -->|"provisions pods"| node_gateway_k8s
node_gateway_main -->|"relays sessions"| node_gateway_proxy
node_code_review_demo -->|"executes memory"| node_memory_tool
node_customer_tools -->|"uses ticket API"| node_customer_api
node_text_sql_prompts -->|"references vector DB"| node_text_sql_vectordb
node_developer -.->|"integrates Claude"| node_anthropic
node_rag_provider -.->|"retrieves knowledge"| node_external_knowledge

click node_cookbook "https://github.com/anthropics/claude-cookbooks/blob/main/README.md"
click node_moderation_pipeline "https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/content_moderation/pipeline.py"
click node_moderation_engine "https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/content_moderation/engine.py"
click node_moderation_eval "https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/content_moderation/evaluation/run_eval.py"
click node_classification_prompts "https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/classification/evaluation/prompts.py"
click node_rag_provider "https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/retrieval_augmented_generation/evaluation/provider_retrieval.py"
click node_text_sql_prompts "https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/text_to_sql/evaluation/prompts.py"
click node_text_sql_vectordb "https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/text_to_sql/evaluation/vectordb.py"
click node_research_agent "https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/research_agent/agent.py"
click node_agent_server "https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/hosting/server.py"
click node_gateway_main "https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/hosting/kubernetes/gateway/main.py"
click node_gateway_k8s "https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/hosting/kubernetes/gateway/k8s.py"
click node_gateway_proxy "https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/hosting/kubernetes/gateway/proxy.py"
click node_agent_visualizer "https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/utils/agent_visualizer.py"
click node_url_utils "https://github.com/anthropics/claude-cookbooks/blob/main/managed_agents/example_data/orchestrate/src/url_utils.py"
click node_mongodb_config "https://github.com/anthropics/claude-cookbooks/blob/main/managed_agents/mongodb_on_cma/config.py"
click node_code_review_demo "https://github.com/anthropics/claude-cookbooks/blob/main/tool_use/memory_demo/code_review_demo.py"
click node_memory_tool "https://github.com/anthropics/claude-cookbooks/blob/main/tool_use/memory_tool.py"
click node_customer_tools "https://github.com/anthropics/claude-cookbooks/blob/main/tool_use/utils/customer_service_tools.py"
click node_customer_api "https://github.com/anthropics/claude-cookbooks/blob/main/tool_use/utils/customer_service_api.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_moderation_pipeline,node_moderation_engine,node_moderation_eval toneBlue
class node_classification_prompts,node_rag_provider,node_text_sql_prompts,node_text_sql_vectordb,node_mongodb_config,node_external_knowledge toneAmber
class node_research_agent,node_agent_server,node_gateway_main,node_gateway_k8s,node_gateway_proxy,node_agent_visualizer,node_url_utils,node_anthropic toneMint
class node_code_review_demo,node_memory_tool,node_customer_tools,node_customer_api toneRose
class node_developer toneIndigo
class node_cookbook toneTeal
```

## Components

### Moderation

- [Policy Compiler and Extractor](https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/content_moderation/pipeline.py): `capabilities/content_moderation/pipeline.py`
- [Rule Engine](https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/content_moderation/engine.py): `capabilities/content_moderation/engine.py`
- [Moderation Evaluation](https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/content_moderation/evaluation/run_eval.py): `capabilities/content_moderation/evaluation/run_eval.py`

### Retrieval and SQL

- [Classification Prompts](https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/classification/evaluation/prompts.py): `capabilities/classification/evaluation/prompts.py`
- [RAG Retrieval and Reranking](https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/retrieval_augmented_generation/evaluation/provider_retrieval.py): `capabilities/retrieval_augmented_generation/evaluation/provider_retrieval.py`
- [Text-to-SQL Prompts](https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/text_to_sql/evaluation/prompts.py): `capabilities/text_to_sql/evaluation/prompts.py`
- [Evaluation Vector DB](https://github.com/anthropics/claude-cookbooks/blob/main/capabilities/text_to_sql/evaluation/vectordb.py): `capabilities/text_to_sql/evaluation/vectordb.py`
- [MongoDB Configuration](https://github.com/anthropics/claude-cookbooks/blob/main/managed_agents/mongodb_on_cma/config.py): `managed_agents/mongodb_on_cma/config.py`

### Agents and Hosting

- [Research Agent](https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/research_agent/agent.py): `claude_agent_sdk/research_agent/agent.py`
- [Agent HTTP Server](https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/hosting/server.py): `claude_agent_sdk/hosting/server.py`
- [Kubernetes Gateway](https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/hosting/kubernetes/gateway/main.py): `claude_agent_sdk/hosting/kubernetes/gateway/main.py`
- [Pod Provisioning](https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/hosting/kubernetes/gateway/k8s.py): `claude_agent_sdk/hosting/kubernetes/gateway/k8s.py`
- [Session Proxy](https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/hosting/kubernetes/gateway/proxy.py): `claude_agent_sdk/hosting/kubernetes/gateway/proxy.py`
- [Agent Visualizer](https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/utils/agent_visualizer.py): `claude_agent_sdk/utils/agent_visualizer.py`
- [URL Utilities](https://github.com/anthropics/claude-cookbooks/blob/main/managed_agents/example_data/orchestrate/src/url_utils.py): `managed_agents/example_data/orchestrate/src/url_utils.py`

### Tool Use

- [Memory Code Review Demo](https://github.com/anthropics/claude-cookbooks/blob/main/tool_use/memory_demo/code_review_demo.py): `tool_use/memory_demo/code_review_demo.py`
- [Memory Operations](https://github.com/anthropics/claude-cookbooks/blob/main/tool_use/memory_tool.py): `tool_use/memory_tool.py`
- [Customer Service Tools](https://github.com/anthropics/claude-cookbooks/blob/main/tool_use/utils/customer_service_tools.py): `tool_use/utils/customer_service_tools.py`
- [Ticket API](https://github.com/anthropics/claude-cookbooks/blob/main/tool_use/utils/customer_service_api.py): `tool_use/utils/customer_service_api.py`

### Other components

- **Developer**
- [Claude Cookbooks](https://github.com/anthropics/claude-cookbooks/blob/main/README.md): `README.md`
- **Claude API**
- **External Knowledge**

## Connections

- Developer → Claude Cookbooks: chooses recipe (evidence: `README.md`)
- Claude Cookbooks → Policy Compiler and Extractor: offers moderation (evidence: `README.md`)
- Claude Cookbooks → Moderation Evaluation: offers evaluations (evidence: `README.md`)
- Claude Cookbooks → Classification Prompts: offers classification (evidence: `README.md`)
- Claude Cookbooks → RAG Retrieval and Reranking: offers retrieval (evidence: `README.md`)
- Claude Cookbooks → Text-to-SQL Prompts: offers SQL examples (evidence: `README.md`)
- Claude Cookbooks → Research Agent: offers agent examples (evidence: `README.md`)
- Claude Cookbooks → Memory Code Review Demo: offers tool-use examples (evidence: `README.md`)
- Policy Compiler and Extractor → Rule Engine: evaluates rules (evidence: `capabilities/content_moderation/pipeline.py`)
- Agent HTTP Server → Research Agent: runs agent (evidence: `claude_agent_sdk/hosting/server.py`)
- Kubernetes Gateway → Pod Provisioning: provisions pods (evidence: `claude_agent_sdk/hosting/kubernetes/gateway/main.py`)
- Kubernetes Gateway → Session Proxy: relays sessions (evidence: `claude_agent_sdk/hosting/kubernetes/gateway/main.py`)
- Memory Code Review Demo → Memory Operations: executes memory (evidence: `tool_use/memory_demo/code_review_demo.py`)
- Customer Service Tools → Ticket API: uses ticket API (evidence: `tool_use/utils/customer_service_tools.py`)
- Text-to-SQL Prompts → Evaluation Vector DB: references vector DB (evidence: `capabilities/text_to_sql/evaluation/prompts.py`)
- Developer → Claude API: integrates Claude (evidence: `README.md`)
- RAG Retrieval and Reranking → External Knowledge: retrieves knowledge (evidence: `README.md`)
