Claude Agent SDK Demos — 8 Official Example Projects
Official demo collection by Anthropic showcasing the Claude Agent SDK: email agent, research agent, resume generator, chat app, Excel processing, and more. MIT license, 2,100+ stars.
Installation avec revue préalable
Cet actif nécessite une revue. Le prompt copié demande un dry-run, affiche les écritures, puis continue seulement après confirmation.
npx -y tokrepo@latest install 5e902544-bf5c-4d78-85e9-85f4c2fe281e --target codexDry-run d'abord, confirmez les écritures, puis lancez cette commande.
What it is
This is the official demo collection by Anthropic showcasing the Claude Agent SDK. It includes eight example projects: an email agent, a research agent, a resume generator, a chat application, an Excel processing agent, and more. Each demo demonstrates a different SDK pattern for building production AI agents.
The collection targets developers learning the Claude Agent SDK who want working reference implementations rather than documentation alone.
How it saves time or tokens
Starting from a working demo eliminates the blank-page problem. Each example includes the agent loop, tool definitions, error handling, and state management patterns that you would otherwise build from scratch. Copy the closest example, modify it for your use case, and deploy.
The demos also serve as integration tests for the SDK. They demonstrate patterns that are verified to work, reducing debugging time.
How to use
- Clone the repository:
git clone https://github.com/anthropics/anthropic-cookbook - Navigate to the agent SDK demos directory
- Install dependencies:
pip install anthropic - Run any demo:
python email_agent.py
Example
# Simplified research agent pattern from the demos
import anthropic
client = anthropic.Anthropic()
def research_agent(query: str) -> str:
tools = [
{
'name': 'web_search',
'description': 'Search the web for information',
'input_schema': {
'type': 'object',
'properties': {
'query': {'type': 'string', 'description': 'Search query'}
},
'required': ['query']
}
}
]
messages = [{'role': 'user', 'content': query}]
while True:
response = client.messages.create(
model='claude-sonnet-4-20250514',
max_tokens=4096,
tools=tools,
messages=messages
)
if response.stop_reason == 'end_turn':
return response.content[0].text
# Handle tool use and continue the loop
messages.append({'role': 'assistant', 'content': response.content})
# Process tool calls...
Related on TokRepo
- AI agent tools -- Agent frameworks and SDKs
- Coding tools -- Developer tools and examples
Common pitfalls
- Demos use hardcoded API keys in some examples; replace with environment variables before deploying
- The agent loop pattern requires proper stop condition handling; infinite loops occur if tool results are not formatted correctly
- Some demos depend on external services (email, web search); configure those services before running
Questions fréquentes
The Claude Agent SDK is Anthropic's official library for building AI agents that use Claude. It provides tool use, multi-turn conversations, and agent loop patterns. The SDK is available in Python and TypeScript.
Start with the chat application demo for the simplest agent loop. Move to the research agent for tool use patterns. The email agent demonstrates multi-step workflows with real external service integration.
Yes. The demos work with any Claude model. Specify the model ID in the API call. Sonnet is recommended for most agent tasks due to its balance of quality and cost.
Yes. The patterns demonstrated in the demos (agent loops, tool handling, error recovery) are production-grade. Add authentication, logging, and rate limiting for your specific deployment.
Yes. The demos are released under the MIT license. You can use, modify, and distribute the code freely.
Sources citées (3)
- Anthropic Cookbook— Official Anthropic demo collection for Claude Agent SDK
- Anthropic Docs— Claude Agent SDK documentation
- Anthropic Docs— Tool use patterns for Claude agents
En lien sur TokRepo
Source et remerciements
Created by Anthropic. Licensed under MIT.
claude-agent-sdk-demos — ⭐ 2,100+
Thank you to Anthropic for providing these comprehensive SDK demonstrations.
Fil de discussion
Actifs similaires
Anthropic Agent SDK — Build Production AI Agents
Official Anthropic SDK for building AI agents with tool use, memory, and orchestration. Production-grade agent framework with Claude as the backbone for autonomous tasks.
Claude Agent SDK — Build Agents with Claude Code Power
Anthropic's official TypeScript SDK for building AI agents with Claude Code's full capabilities — file editing, command execution, codebase understanding, and complex workflows. npm package.
Claude Swarm — Multi-Agent Orchestration with SDK
Python-based multi-agent orchestration built on Claude Agent SDK. Opus decomposes tasks, Haiku workers execute in parallel waves with real-time TUI dashboard and budget control.
AgentSight — Zero-Instrumentation Agent Observability
AgentSight is an MIT eBPF tool that records LLM/agent traffic without SDK changes, helping you observe Claude Code or Gemini CLI interactions locally.