Skip to content
Try CosmosBook demo
Back to Guides

Anthropic Agent SDK: What It Ships vs. What It Leaves to You

May 3, 2026Last updated: Aug 10, 2026
Molisha Shah
Molisha Shah
Anthropic Agent SDK: What It Ships vs. What It Leaves to You

The Anthropic Agent SDK ships a production-quality agent loop, tool use protocol, streaming, session persistence, and OpenTelemetry observability, while everything that spans more than one agent remains work for the adopting team.

TL;DR

The Anthropic Agent SDK covers single-agent tool-use loops well, and its 2026 releases added sessions, checkpointing, cost tracking, and telemetry export. One agent is now well served. Two agents sharing work, a repository too large for one context window, and a policy that outlives a session are still an in-house build.

Where the SDK Boundary Sits in the Production Stack

Engineering teams evaluating the Anthropic Agent SDK face one gap in particular: the distance between a working demo and a production deployment. Anthropic's guidance on building effective AI agents recommends finding the simplest solution possible and increasing complexity only when needed. The SDK draws its boundary at one agent process, so applications design their own coordination patterns around it.

The result is a clean API boundary with a large build cost behind it. One team running four agents in production documented what that took: ClaudeSDKClient with bypassPermissions, Docker containers, Kafka event streaming, Neo4j and Memgraph graph databases, and 15 active MCP servers. This guide maps what ships, what has to be written locally, and where a platform closes the difference.

What Anthropic Ships: Agent Loops, Tool Use, Streaming, Guardrails

The Anthropic Agent SDK arrives as two packages, and the separation matters before any architecture decision. anthropic (v0.121.0 as of August 2026), from the anthropic-sdk-python repository, is the core API client for the Messages API, streaming, tool use, prompt caching, and model configuration. claude-agent-sdk (v0.2.134) is the agent harness extracted from Claude Code, and it ships the agent loop, built-in tools, subagent spawning, and MCP integration.

ComponentWhat ShipsPackage
Agent loopGather context, take action, verify work, repeatclaude-agent-sdk
Built-in toolsbash, read, write, web_search; MCP integrationclaude-agent-sdk
Tool use protocolClient tools plus server tools (two-tier model)anthropic
StreamingSSE events, sync and async streams, text_stream iteratoranthropic
Prompt caching5-minute default, 1-hour extended; cache reads bill at 0.1x inputanthropic
Permission systemRoutes tool requests through safety checks before dispatchclaude-agent-sdk
Context compactionAutomatic compaction with a PreCompact hook for interceptionclaude-agent-sdk
Subagent spawningagents: dict[str, AgentDefinition] in optionsclaude-agent-sdk
Resource limitsmax_turns and max_budget_usd in ClaudeAgentOptionsclaude-agent-sdk
Session persistencelist_sessions, get_session_messages, external storageclaude-agent-sdk
Managed infrastructureClaude Managed Agents, public beta since April 2026anthropic

The tool use system is mature. It supports parallel tool calls with multiple tool_use blocks per response, deferred loading through the tool search tool so large catalogs stay out of the opening context, strict schema enforcement, and per-tool streaming via eager_input_streaming.

python
with client.messages.stream(
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
model="claude-sonnet-4-6",
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)

Teams discover one architectural fact late. The Claude Agent SDK runs its agent loop inside a prebuilt CLI binary bundled in a platform-specific wheel, separate from the Python process, and Anthropic does not document how the two communicate. Published wheels run roughly 77 to 87 MiB depending on platform, which affects Docker image budgets and CI/CD design choices.

What Anthropic Leaves to You: Coordination, Context, Governance

The Anthropic Agent SDK closed several gaps early adopters worked around. Sessions persist and export to external storage, file changes checkpoint and rewind, and OpenTelemetry traces, metrics, and logs export through documented configuration. Each improvement stops at the edge of one agent process, and the harder problems start where two agents meet.

Context Window Management

Compaction fires automatically as a session approaches its limit, and the SDK exposes a PreCompact hook plus session fields reporting whether autocompact runs and at what threshold. Engineers building long-running assistants account for what compaction preserves, because a Claude Code filing tracks state that does not survive the boundary. ML6 puts effective working context at 60,000 to 80,000 tokens before quality degrades, against a nominal 200,000-token window. That gap sets how often compaction fires.

Multi-Agent Orchestration

Teams assign different tool access to individual subagents. The pattern many want, a coordinator with read-only access delegating to specialists with scoped write access, is not available natively. Handoff mechanisms exist for agents approaching their output limits, and teams needing richer topologies reach for open-source agent orchestrators. Anthropic's engineering team has acknowledged that a small change to a lead agent's prompt can shift subagent behavior unpredictably.

Security

Prompt injection remains a structural problem in architectures that pass untrusted content into model context, and OWASP guidance emphasizes careful handling of untrusted data.

The SDK now exposes sandbox configuration through SandboxSettings, covering bash sandboxing, network allowlists, and command exclusions. That protects one process. Deciding which agents may touch which systems across an organization, and proving afterward what each one did, sits outside the SDK's scope. The table below summarizes documented gap categories, including the compaction lifecycle control in a Python SDK issue and degradation at context limits in a Claude Code issue.

Gap CategorySpecific Missing Capability
ContextNo graceful degradation at context limits; state loss across the compaction boundary
OrchestrationNo per-agent permission scoping; no structured agent handoffs
CoordinationNo shared memory across agents or teammates
GovernanceNo organization-level policy or expert registry

How the SDK Fits into a Wider Agent Platform Stack

The Agent SDK is one component in the production agent stack. Higher layers reach teams through Anthropic-managed services, SDK features, or a platform.

LangChain's analysis of agent harnesses frames the organizing principle: an agent decomposes into a model supplying intelligence and a harness making that intelligence useful. Anthropic adds a production caveat, that the harness encodes assumptions about what the model cannot do alone and those assumptions go stale as models improve.

text
Layer 8: Managed Infrastructure <- Claude Managed Agents (public beta, April 2026)
Layer 7: Observability & Evaluation <- SDK provides: OpenTelemetry traces, metrics, logs; cost tracking
Layer 6: Auth / RBAC / Human-in-Loop <- SDK provides: can_use_tool and permission modes
Layer 5: Multi-Agent Coordination <- SDK provides: subagents-as-tools
Layer 4: Orchestration / Durability <- SDK provides: sessions, checkpointing, external session storage
Layer 3: Organizational Memory <- SDK provides: none
Layer 2: Context Engineering <- SDK provides: compaction, tool search
Layer 1: SDK / API Primitives
Layer 0: Model

Layer 3 is where the SDK stops. A session persists for one agent in one repository, and nothing carries a correction made on Monday into another engineer's run on Thursday.

Augment Cosmos approaches the stack from the opposite direction. Cosmos is Augment Code's unified cloud agents platform, generally available and included on every paid plan. It consolidates these layers into one set of shared primitives, including an agent runtime, the Context Engine, lifecycle triggers, a shared file system with organization and user level memory, and isolated sandboxes. That is one alternative to assembling Layers 2 through 7 from independent components, and it sits in a growing field of agentic OS platforms.

Capabilities and Gaps: What Works and What Does Not

Tool use is the SDK's strongest component. Prompt caching cuts repeated-prefix cost tenfold, $0.30/MTok cached against $3.00/MTok uncached at Claude Sonnet 4.6 pricing, and the hook system (PreToolUse, PostToolUse, Stop, SubagentStart) extends tool-level interception.

Two rough edges catch engineers repeatedly. The boundary between SDK behavior and Claude Code-only features stays blurred, even though the documentation gap that once hid implemented option fields has closed. And AgentDefinition uses camelCase while ClaudeAgentOptions uses snake_case, following the CLI's JSON schema over Python conventions, so a snake_case keyword raises a TypeError at construction. Model behavior adds its own surprises. One bug report describes Opus 4.7 silently downgrading to Sonnet 4.6 mid-session, and a separate filing describes responses that never reached the session store.

The Build Cost of What Is Missing

Teams using commercial orchestration frameworks still build custom infrastructure for the layers a framework does not cover. Spotify's advertising team built its media planning system on Google's Agent Development Kit and Vertex AI, then supplied session storage from Google Cloud and observability from Apollo, its own service framework. Frameworks shift the engineering burden; they do not remove it. Published field reports show where the work concentrates:

Platform LayerWhat the Evidence Shows
Context and memoryEffective context runs below nominal window size, so compaction policy needs tuning
Multi-agent orchestrationCoordinator prompt changes propagate unpredictably to subagents
Security hardeningSandboxing covers one process; cross-system authorization stays with the app
ObservabilityTelemetry exports; correlating it across agent observability tools stays custom work
Evaluation pipelineReview cycles run two to four weeks, and cost scales with agent traffic
State Persistence / Durable ExecutionModerate: schema migrations, scaling
Durable executionCheckpoints resume a session; distributed workflow recovery does not follow

A ZenML review of 1,200 catalogued production deployments found the core skills are distributed systems and platform engineering, the work of managing state, consistency, and consensus across agents. That changes who a team needs to hire. Evaluation carries the steepest ongoing cost. One data leader reported evaluation spend running at ten times the baseline agent workload, and practitioner field notes put major error-analysis cycles at two to four weeks, with weekly spot checks until failure patterns stabilize.

How Cosmos Fills the Gaps Anthropic Intentionally Leaves Open

Cosmos takes on the coordination, context, and governance work the Agent SDK leaves to custom engineering, and three primitives carry it. Environments define where agents run and what they can touch across laptops, development VMs, Augment's cloud, and a customer's own cloud. Experts define how agents behave, which tools they use, and which events they subscribe to, from GitHub pull requests to Linear status changes and schedules. Sessions turn prompts into auditable, replayable workflows that stay private or get promoted into a shared capability.

Cosmos ships reference Experts for deep code review, pull request authoring, end-to-end testing, and incident response, so teams start from working configurations instead of assembling their own from spec-driven development tools. On cross-service work, agents share architectural understanding because the Context Engine semantically indexes code relationships across 400,000+ files instead of rebuilding partial context each session.

DimensionClaude Agent SDK (Base)Augment Cosmos
Execution modelSingle-session agent processEvent-triggered Experts across the lifecycle
Context scopePer-session prompt, 60,000 to 80,000 effective tokensPersistent semantic index across 400,000+ files
MemorySession-scoped, caller-supplied external storageShared file system with organization and user level memory
Reuse across a teamConfiguration shared through source controlExpert Registry for discovery and promotion
Model providersClaude, via the API or a cloud providerPrism routing plus bring-your-own-key across Anthropic, OpenAI, Bedrock, Vertex, and open source
ComplianceNot applicableSOC 2 Type II, ISO/IEC 42001, GDPR

Governance draws the sharpest line between an SDK and a platform. Teams decide which steps need a human, and Cosmos holds the run at that checkpoint instead of waiting for the final pull request. Every Session captures what ran, so the audit trail belongs to the runtime.

Two constraints cut against Cosmos. Large codebases require an initial indexing pass before the Context Engine adds value, so a monorepo evaluation starts slower than a library import. Cosmos is also a platform commitment, and a team needing one scripted agent inside an existing pipeline gets more from the SDK alone.

Production Readiness Checklist: SDK Plus Platform Requirements

This checklist separates what the SDK provides natively from what a team writes before deploying. Items marked [CRITICAL] have documented failure modes in production.

Open source
augmentcode/augment-swebench-agent882
Star on GitHub

Security

Security failures show up at the boundaries. External content enters context, MCP servers get added without review, and tool access never gets scoped to least privilege. The SDK provides two of these controls; teams build the rest.

  • 🟢 Permission system routing tool requests through safety checks, plus SandboxSettings for bash and network access (SDK-native)
  • 🔴 [CRITICAL] Prompt injection defenses, since web retrieval, database reads, file reads, and tool outputs all count as untrusted data
  • 🔴 [CRITICAL] MCP server supply chain review before any new server enters the tool list
  • 🔴 Least-privilege tool access with documented justification, plus tested emergency shutdown

Guardrails and Cost Controls

Cost overruns come from runaway loops and missing budget enforcement, not per-token pricing. The SDK ships per-session limits, and teams layer aggregate enforcement above them.

  • 🟢 Streaming refusal handling, plus max_turns and max_budget_usd per-session ceilings (SDK-native)
  • 🔴 [CRITICAL] Aggregate spending limits across sessions, since SDK budgets bind one query
  • 🔴 [CRITICAL] Circuit breakers against runaway multi-agent conversations that raise cost undetected

Both red items need enforcement outside the agent process, since the SDK sees one query.

Observability and Error Handling

Agent observability differs structurally from web service monitoring. Teams need traces covering every tool call, retry decisions that separate recoverable from unrecoverable errors, and deployments that account for in-flight agent work.

  • 🟢 OpenTelemetry traces, metrics, and logs, plus cost and usage tracking (SDK-native)
  • 🔴 [CRITICAL] Trace correlation across agents, sessions, and state transitions
  • 🔴 [CRITICAL] Agent loop detection with alerting routed to on-call engineers
  • 🔴 Retry logic with exponential backoff, plus a deployment strategy accounting for in-flight agents

Export solves collection. Correlation and alerting stay with the team.

Compliance

Compliance for agent systems extends requirements that already apply to model deployments, and all of it belongs in place before agents reach customer data.

  • 🟢 Trust and compliance portal at trust.anthropic.com
  • 🔴 EU AI Act applicability assessment. Regulation (EU) 2026/1744 entered into force 27 July 2026, moving high-risk obligations for stand-alone Annex III systems to 2 December 2027 and Annex I embedded systems to 2 August 2028. Article 50 transparency duties applied from 2 August 2026 and were not deferred. Penalties reach €15M or 3% of global annual turnover.
  • 🔴 Immutable audit logging with session ID, agent ID, step number, input and output hashes, and timestamp
  • 🔴 PII controls that strip or pseudonymize at the input layer

Audit logging and PII handling get designed once, then inherited by every agent added later, which puts them ahead of the first deployment.

Start with a Platform Assessment Before Your Next Agent Deployment

The Anthropic Agent SDK provides stable primitives for tool use, streaming, sessions, and single-agent loops, and its 2026 releases closed the observability and persistence gaps early production teams hit first. The remaining work is organizational. Agents have to hand work to each other, context has to travel between repositories and engineers, and policy has to survive the session that created it. Teams should audit which layers they can staff and which they would adopt. The SDK boundary is clean; the decision is how much of the surrounding stack to own.

FAQ

Written by

Molisha Shah

Molisha Shah

Molisha is an early GTM and Customer Champion at Augment Code, where she focuses on helping developers understand and adopt modern AI coding practices. She writes about clean code principles, agentic development environments, and how teams are restructuring their workflows around AI agents. She holds a degree in Business and Cognitive Science from UC Berkeley.


Get Started

Give your codebase the agents it deserves

Install Augment to get started. Works with codebases of any size, from side projects to enterprise monorepos.