Loading...
    • Build
    • Admin
    • Models & pricing
    • Client SDKs
    • API Reference
    Search...
    ⌘K
    First steps
    Intro to ClaudeQuickstart
    Building with Claude
    Features overviewUsing the Messages APIHandling stop reasons
    Model capabilities
    Extended thinkingAdaptive thinkingEffortFast mode (beta: research preview)Structured outputsCitationsStreaming MessagesBatch processingSearch resultsStreaming refusalsMultilingual supportEmbeddings
    Tools
    OverviewHow tool use worksWeb search toolWeb fetch toolCode execution toolMemory toolBash toolComputer use toolText editor tool
    Tool infrastructure
    Tool searchProgrammatic tool callingFine-grained tool streaming
    Context management
    Context windowsCompactionContext editingPrompt cachingToken counting
    Working with files
    Files APIPDF supportImages and vision
    Skills
    OverviewQuickstartBest practicesSkills for enterpriseSkills in the API
    MCP
    Remote MCP serversMCP connector
    Prompt engineering
    OverviewPrompting best practicesConsole prompting tools
    Test and evaluate
    Define success and build evaluationsUsing the Evaluation Tool in ConsoleReducing latency
    Strengthen guardrails
    Reduce hallucinationsIncrease output consistencyMitigate jailbreaksReduce prompt leak
    Resources
    Glossary
    Release notes
    Claude Platform
    Console
    Log in
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Partners

    • Amazon Bedrock
    • Google Cloud's Vertex AI

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Help and security

    • Availability
    • Status
    • Support
    • Discord

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    Define your agent

    Define your agent

    Create a reusable, versioned agent configuration.

    Was this page helpful?

    • Agent configuration fields
    • Create an agent
    • Update an agent
    • Update semantics
    • Agent lifecycle
    • List versions
    • Archive an agent
    • Next steps

    An agent is a reusable, versioned configuration that defines persona and capabilities. It bundles the model, system prompt, tools, MCP servers, and skills that shape how Claude behaves during a session.

    Create the agent once as a reusable resource and reference it by ID each time you start a session. Agents are versioned and easier to manage across many sessions.

    All Managed Agents API requests require the managed-agents-2026-04-01 beta header. The SDK sets the beta header automatically.

    Agent configuration fields

    FieldDescription
    nameRequired. A human-readable name for the agent.
    modelRequired. The Claude model that powers the agent. All Claude 4.5 and later models are supported.
    systemA system prompt that defines the agent's behavior and persona. The system prompt is distinct from user messages, which should describe the work to be done.
    toolsThe tools available to the agent. Combines pre-built agent tools, MCP tools, and custom tools.
    mcp_serversMCP servers that provide standardized third-party capabilities.
    skillsSkills that supply domain-specific context with progressive disclosure.
    callable_agentsOther agents this agent can invoke for multi-agent orchestration. This is a research preview feature; request access to try it.
    descriptionA description of what the agent does.
    metadataArbitrary key-value pairs for your own tracking.

    Create an agent

    The following example defines a coding agent that uses Claude Sonnet 4.6 with access to the pre-built agent toolset. The toolset lets the agent write code, read files, search the web, and more. See the agent tools reference for the full list of supported tools.

    To use Claude Opus 4.6 with fast mode, pass model as an object: {"id": "claude-opus-4-6", "speed": "fast"}.

    The response echoes your configuration and adds id, version, created_at, updated_at, and archived_at fields. The version starts at 1 and increments each time you update the agent.

    {
      "id": "agent_01HqR2k7vXbZ9mNpL3wYcT8f",
      "type": "agent",
      "name": "Coding Assistant",
      "model": {
        "id": "claude-sonnet-4-6",
        "speed": "standard"
      },
      "system": "You are a helpful coding agent.",
      "description": null,
      "tools": [
        {
          "type": "agent_toolset_20260401",
          "default_config": {
            "permission_policy": { "type": "always_allow" }
          }
        }
      ],
      "skills": [],
      "mcp_servers": [],
      "metadata": {},
      "version": 1,
      "created_at": "2026-04-03T18:24:10.412Z",
      "updated_at": "2026-04-03T18:24:10.412Z",
      "archived_at": null
    }

    Update an agent

    Updating an agent generates a new version. Pass the current version to ensure you're updating from a known state.

    Update semantics

    • Omitted fields are preserved. You only need to include the fields you want to change.

    • Scalar fields (model, system, name, etc.) are replaced with the new value. system and description can be cleared by passing null. model and name are mandatory and cannot be cleared.

    • Array fields (tools, mcp_servers, skills, callable_agents) are fully replaced by the new array. To clear an array field entirely, pass null or an empty array.

    Agent lifecycle

    OperationBehavior
    UpdateGenerates a new agent version.
    List versionsFetch the full version history to track changes over time.
    ArchiveThe agent becomes read-only. New sessions cannot reference it, but existing sessions continue to run.

    List versions

    Fetch the full version history to track how an agent has changed over time.

    Archive an agent

    Archiving makes the agent read-only. Existing sessions continue to run, but new sessions cannot reference the agent. The response sets archived_at to the archive timestamp.

    Next steps

    • Configure tools to customize which capabilities the agent can use.
    • Attach skills for domain-specific expertise.
    • Start a session that references your agent.
    agent=$(curl -fsSL https://api.anthropic.com/v1/agents \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -H "anthropic-beta: managed-agents-2026-04-01" \
      -H "content-type: application/json" \
      -d '{
        "name": "Coding Assistant",
        "model": "claude-sonnet-4-6",
        "system": "You are a helpful coding agent.",
        "tools": [{"type": "agent_toolset_20260401"}]
      }')
    
    AGENT_ID=$(jq -r '.id' <<< "$agent")
    AGENT_VERSION=$(jq -r '.version' <<< "$agent")
    updated_agent=$(curl -fsSL "https://api.anthropic.com/v1/agents/$AGENT_ID" \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -H "anthropic-beta: managed-agents-2026-04-01" \
      -H "content-type: application/json" \
      -d @- <<EOF
    {
      "version": $AGENT_VERSION,
      "system": "You are a helpful coding agent. Always write tests."
    }
    EOF
    )
    
    echo "New version: $(jq -r '.version' <<< "$updated_agent")"

    Metadata is merged at the key level. Keys you provide are added or updated. Keys you omit are preserved. To delete a specific key, set its value to an empty string.

  1. No-op detection. If the update produces no change relative to the current version, no new version is created and the existing version is returned.

  2. curl -fsSL "https://api.anthropic.com/v1/agents/$AGENT_ID/versions" \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -H "anthropic-beta: managed-agents-2026-04-01" \
      | jq -r '.data[] | "Version \(.version): \(.updated_at)"'
    archived=$(curl -fsSL -X POST "https://api.anthropic.com/v1/agents/$AGENT_ID/archive" \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -H "anthropic-beta: managed-agents-2026-04-01")
    
    echo "Archived at: $(jq -r '.archived_at' <<< "$archived")"