Cette page est affichée en anglais. Une traduction française est en cours.
SkillsApr 6, 2026·3 min de lecture

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.

Anthropic
Anthropic · Community
Prêt pour agents

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.

Needs Confirmation · 66/100Policy : confirmer
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Community
Point d'entrée
Claude Agent SDK Demos — 8 Official Example Projects
Commande avec revue préalable
npx -y tokrepo@latest install 5e902544-bf5c-4d78-85e9-85f4c2fe281e --target codex

Dry-run d'abord, confirmez les écritures, puis lancez cette commande.

TL;DR
Eight official Anthropic demos showing Claude Agent SDK patterns for email, research, and more.
§01

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.

§02

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.

§03

How to use

  1. Clone the repository: git clone https://github.com/anthropics/anthropic-cookbook
  2. Navigate to the agent SDK demos directory
  3. Install dependencies: pip install anthropic
  4. Run any demo: python email_agent.py
§04

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...
§05

Related on TokRepo

§06

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

What is the Claude Agent SDK?+

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.

Which demo should I start with?+

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.

Do the demos work with Claude Sonnet or Opus?+

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.

Can I use these patterns in production?+

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.

Are the demos open source?+

Yes. The demos are released under the MIT license. You can use, modify, and distribute the code freely.

Sources citées (3)
🙏

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

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires