en/agent-sdk/hosting.md +245 −80
4 4
5# Hosting the Agent SDK5# Hosting the Agent SDK
6 6
77> Deploy and host Claude Agent SDK in production environments> Deploy the Agent SDK in production: subprocess architecture, session persistence, scaling, observability, and multi-tenant isolation for Docker, Kubernetes, and sandbox providers.
8 8
99The Claude Agent SDK differs from traditional stateless LLM APIs in that it maintains conversational state and executes commands in a persistent environment. This guide covers the architecture, hosting considerations, and best practices for deploying SDK-based agents in production.The Agent SDK spawns and supervises a `claude` CLI subprocess that owns a shell, a working directory, and session files on disk. Hosting it is not like hosting a stateless API wrapper. Every running agent is a long-lived process tied to local state, which shapes how you allocate resources, persist sessions, and scale across tenants.
10
11This page covers self-hosting on your own infrastructure: understand [the subprocess model](#the-subprocess-model), [choose a session pattern](#choose-a-session-pattern), [provision the container](#provision-the-container), and [handle production concerns](#handle-production-concerns) like persistence, observability, auth, and multi-tenant isolation. For deployable Dockerfiles and Kubernetes manifests, see the [hosting cookbook](https://github.com/anthropics/claude-cookbooks/tree/main/claude_agent_sdk/hosting).
12
13If you do not need infrastructure control, custom isolation, or your own data plane, consider [Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) instead: a hosted REST API where Anthropic runs the agent and the sandbox, so your application sends events and streams back results with no hosting infrastructure to operate.
10 14
11<Info>15<Info>
1216 For security hardening beyond basic sandboxing (including network controls, credential management, and isolation options), see [Secure Deployment](/en/agent-sdk/secure-deployment). For security hardening beyond basic sandboxing, including network controls, credential management, and isolation options, see [Secure Deployment](/en/agent-sdk/secure-deployment).
13</Info>17</Info>
14 18
1519## Hosting Requirements## The subprocess model
20
21Every hosting decision on this page follows from how the SDK runs the agent. When your code calls `query()`, the SDK spawns a separate `claude` CLI process and talks to it over stdio. That subprocess owns the shell, the working directory, and the JSONL session transcripts on local disk.
22
23<img src="https://mintcdn.com/claude-code/Akpoo6g0xDlAmvHv/images/agent-sdk/hosting-subprocess.svg?fit=max&auto=format&n=Akpoo6g0xDlAmvHv&q=85&s=d348cc9687d47e0bc954075fd88d0e60" alt="Request flow: client to your app, which spawns a claude CLI subprocess over stdio inside the container; the subprocess writes to local disk and calls api.anthropic.com over HTTPS" width="920" height="220" data-path="images/agent-sdk/hosting-subprocess.svg" />
24
25One agent session maps to one subprocess. Running N concurrent sessions means N subprocesses, each with its own process tree and transcript file. By default they all inherit your application's working directory, so pass `cwd` on each `query()` call when sessions need separate filesystems:
26
27<CodeGroup>
28 ```typescript TypeScript theme={null}
29 query({ prompt, options: { cwd: "/work/session-a" } })
30 ```
31
32 ```python Python theme={null}
33 query(prompt=prompt, options=ClaudeAgentOptions(cwd="/work/session-a"))
34 ```
35</CodeGroup>
36
37### State that lives on local disk
38
39Three kinds of agent state live on the container's filesystem by default. None of them survive a container restart, a scale-down, or a move to a different node.
40
41| State | Default location |
42| --------------------------- | ------------------------------------------------------------------------------------------------ |
43| Session transcripts | `~/.claude/projects/`, or the `projects/` directory under `CLAUDE_CONFIG_DIR` if set |
44| `CLAUDE.md` memory files | `~/.claude/CLAUDE.md` for the user tier and the session's working directory for the project tier |
45| Working-directory artifacts | The session's working directory |
46
47To persist transcripts across hosts, configure a [`SessionStore` adapter](/en/agent-sdk/session-storage). Memory files and other working-directory artifacts need their own storage strategy, such as a mounted volume or an object-store sync.
48
49For how sessions, resumption, and forking work at the API level, see [Sessions](/en/agent-sdk/sessions).
50
51## Choose a session pattern
52
53These four patterns cover session lifecycle: how long a container lives relative to the sessions it serves. For where the container runs, the [hosting cookbook](https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/07_Hosting_the_agent.ipynb) has [deployable code](https://github.com/anthropics/claude-cookbooks/tree/main/claude_agent_sdk/hosting) for local Docker, Modal, and Kubernetes. Choose a session pattern here and a deployment target from the cookbook.
54
55### Ephemeral sessions
56
57Create a container for each user task and destroy it when the task completes. Best for one-off tasks. The user may still interact with the AI while the task is completing, but once completed the container is destroyed.
58
59Example workloads include bug investigation and fix, invoice and receipt extraction, document translation, and media transformation.
60
61The container runs a one-shot entrypoint that calls the SDK and exits. The example below shows a minimal TypeScript version. Save it as `entrypoint.mts` or set `"type": "module"` in `package.json` so top-level `await` is available.
62
63```typescript theme={null}
64import { query } from "@anthropic-ai/claude-agent-sdk";
65
66const prompt = process.env.TASK_PROMPT!;
67for await (const message of query({ prompt, options: { maxTurns: 20 } })) {
68 console.log(message);
69}
70```
71
72### Long-running sessions
73
74Run persistent container instances, often hosting multiple SDK processes per container, to serve ongoing work. Best for agents that take autonomous action, serve content, or handle high-volume message streams.
75
76Example workloads include an email agent that triages and responds to incoming mail, a site builder that hosts a per-user editable site through container ports, and a chat bot that handles continuous traffic from a platform like Slack.
77
78The container exposes an HTTP or WebSocket endpoint and maps each active session to a long-lived query and the subprocess behind it. In TypeScript, use [`streamInput()`](/en/agent-sdk/typescript#query-object) to add turns to an active session and [`startup()`](/en/agent-sdk/typescript#startup) to pre-warm subprocesses ahead of incoming traffic. In Python, use [`ClaudeSDKClient`](/en/agent-sdk/python#claudesdkclient) to hold a session open across turns. Size the container so it can hold the maximum number of concurrent sessions in memory.
79
80### Hybrid sessions
81
82Ephemeral containers that hydrate from a [`SessionStore`](/en/agent-sdk/session-storage) on startup and persist updates back. Best for sessions that span many interactions but sit idle between them. The container spins down during idle periods and spins back up when the user returns.
83
84Example workloads include a personal project manager with intermittent check-ins, deep research that pauses and resumes over hours, and a customer support agent that loads ticket history across interactions.
85
86Tune your provider's idle timeout to how frequently you expect users to return. Shutting a container down without a `SessionStore` configured loses the transcript with it, so the store is required for this pattern, not optional.
87
88The pattern hinges on resuming a session by ID with a shared store attached:
89
90<CodeGroup>
91 ```typescript TypeScript theme={null}
92 import { query, type SessionStore } from "@anthropic-ai/claude-agent-sdk";
93
94 declare const userInput: string;
95 declare const sessionId: string; // looked up from your database by user
96 declare const sessionStore: SessionStore; // S3, Redis, Postgres, or your own adapter
97
98 for await (const message of query({
99 prompt: userInput,
100 options: { resume: sessionId, sessionStore },
101 })) {
102 // ...
103 }
104 ```
105
106 ```python Python theme={null}
107 from claude_agent_sdk import query, ClaudeAgentOptions
108
109 async for message in query(
110 prompt=user_input,
111 options=ClaudeAgentOptions(
112 resume=session_id, # looked up from your database by user
113 session_store=session_store, # S3, Redis, Postgres, or your own adapter
114 ),
115 ):
116 ...
117 ```
118</CodeGroup>
119
120See [Session storage](/en/agent-sdk/session-storage) for the full `SessionStore` interface and reference adapters.
121
122### Multi-agent container
123
124Run multiple SDK subprocesses inside one container. Best for agents that must collaborate closely, for example multi-agent simulations where the agents interact with each other in a shared environment.
125
126Give each agent its own working directory so they do not overwrite each other's files, and isolate settings loading so per-agent `CLAUDE.md` files do not leak across agents. See [Multi-tenant isolation](#multi-tenant-isolation) for the specific options.
127
128## Provision the container
129
130### Container-based sandboxing
131
132Run the SDK inside a sandboxed container for process isolation, resource limits, network control, and an ephemeral filesystem. Several providers specialize in sandboxed container environments that fit the Agent SDK's model.
133
134Questions to answer when choosing a provider:
135
136* **Who runs the sandbox**: a sandbox-as-a-service provider operates the infrastructure for you, while self-hosted options give you software to run on your own.
137* **Cold-start latency**: how long from "create a sandbox" to "ready to accept the first request." Ephemeral patterns need sub-second starts. Long-running patterns tolerate more.
138* **Persistent storage**: whether the provider offers durable volumes or only ephemeral disk. The hybrid pattern needs durable storage somewhere, whether in the sandbox or alongside it.
139* **Pricing model**: per-second, per-request, or flat hourly billing. Per-second pricing suits bursty ephemeral workloads. Hourly suits long-running sessions.
140* **Networking**: support for custom egress rules, outbound proxies, and private VPC peering for regulated environments.
16 141
17142### Container-Based SandboxingProviders to evaluate:
18 143
19144For security and isolation, the SDK should run inside a sandboxed container environment. This provides process isolation, resource limits, network control, and ephemeral filesystems.* [Modal Sandbox](https://modal.com/docs/guide/sandbox), with a [demo implementation](https://modal.com/docs/examples/claude-slack-gif-creator)
145* [Cloudflare Sandboxes](https://github.com/cloudflare/sandbox-sdk)
146* [Daytona](https://www.daytona.io/)
147* [E2B](https://e2b.dev/)
148* [Fly Machines](https://fly.io/docs/machines/)
149* [Vercel Sandbox](https://vercel.com/docs/functions/sandbox)
20 150
21151The SDK also supports [programmatic sandbox configuration](/en/agent-sdk/typescript#sandboxsettings) for command execution.For self-hosted options such as Docker, gVisor, and Firecracker, and detailed isolation configuration, see [Isolation Technologies](/en/agent-sdk/secure-deployment#isolation-technologies).
22 152
23153### System Requirements### Runtime dependencies
24 154
25155Each SDK instance requires:The container needs only your SDK's language runtime:
26 156
27157* **Runtime dependencies*** Python 3.10+ for the Python SDK, or Node.js 18+ for the TypeScript SDK
28158 * Python 3.10+ for the Python SDK, or Node.js 18+ for the TypeScript SDK* Both SDK packages bundle a native Claude Code binary for the host platform, so no separate Claude Code or Node.js install is needed for the spawned CLI
29 * Both SDK packages bundle a native Claude Code binary for the host platform, so no separate Claude Code or Node.js install is needed for the spawned CLI
30 159
31160* **Resource allocation**The bundled binary is pinned to the SDK package version, so updating the SDK is how you update the CLI. The SDK follows semver: take patch releases continuously and review the [TypeScript](https://github.com/anthropics/claude-agent-sdk-typescript/blob/main/CHANGELOG.md) or [Python](https://github.com/anthropics/claude-agent-sdk-python/blob/main/CHANGELOG.md) changelog before taking a minor.
32 * Recommended: 1GiB RAM, 5GiB of disk, and 1 CPU (vary this based on your task as needed)
33 161
34162* **Network access**### Resources
35 * Outbound HTTPS to `api.anthropic.com`
36 * Optional: Access to MCP servers or external tools
37 163
38164## Understanding the SDK Architecture1 GiB RAM, 5 GiB disk, and 1 CPU per agent is a reasonable starting point for a freshly started instance. Memory usage grows with session length and tool activity, so size for the session lengths and concurrency you actually need rather than the idle baseline. See [Scaling and concurrency](#scaling-and-concurrency) for how to work out agents per host.
39 165
40166Unlike stateless API calls, the Claude Agent SDK operates as a **long-running process** that:### Network
41 167
42168* **Executes commands** in a persistent shell environmentThe SDK needs outbound HTTPS to `api.anthropic.com`, or to your provider's regional endpoint when running on Bedrock or Vertex. If your agents use [MCP servers](/en/agent-sdk/mcp) or external tools, they need outbound access to those endpoints as well. For production, route outbound traffic through an egress proxy that enforces domain allowlists, injects credentials, and logs requests. See [Secure Deployment](/en/agent-sdk/secure-deployment) for the full pattern.
43* **Manages file operations** within a working directory
44* **Handles tool execution** with context from previous interactions
45 169
46170## Sandbox Provider OptionsFor inbound traffic, expose an HTTP or WebSocket port on the container. Your application handles client requests on that port and calls the SDK internally; the subprocess itself does not listen on the network.
47 171
48172Several providers specialize in secure container environments for AI code execution:## Handle production concerns
49 173
50174* **[Modal Sandbox](https://modal.com/docs/guide/sandbox)** - [demo implementation](https://modal.com/docs/examples/claude-slack-gif-creator)Work through these decisions before shipping a self-hosted agent.
51* **[Cloudflare Sandboxes](https://github.com/cloudflare/sandbox-sdk)**
52* **[Daytona](https://www.daytona.io/)**
53* **[E2B](https://e2b.dev/)**
54* **[Fly Machines](https://fly.io/docs/machines/)**
55* **[Vercel Sandbox](https://vercel.com/docs/functions/sandbox)**
56 175
57176For self-hosted options (Docker, gVisor, Firecracker) and detailed isolation configuration, see [Isolation Technologies](/en/agent-sdk/secure-deployment#isolation-technologies).### Session and state persistence
58 177
59178## Production Deployment PatternsDefault local disk is lost on restart, scale-down, or a move to a different node. For any session a user expects to resume, mirror the transcript to durable storage with a [`SessionStore` adapter](/en/agent-sdk/session-storage). See [Reference implementations](/en/agent-sdk/session-storage#reference-implementations) for S3, Redis, and Postgres adapters and a conformance suite for your own.
60 179
61180### Pattern 1: Ephemeral SessionsThree things to know about how `SessionStore` behaves:
62 181
63182Create a new container for each user task, then destroy it when complete.* **Transcripts only**: `SessionStore` mirrors transcripts, not `CLAUDE.md` memory files or other working-directory artifacts. Mount a shared volume or sync those separately.
183* **Mirror, not replacement**: the subprocess writes to local disk first, and the store receives a copy of each batch. Local writes remain authoritative.
184* **`mirror_error` messages**: if the store rejects or times out, the SDK emits a `{ type: "system", subtype: "mirror_error" }` message and continues the query without retry. Alert on these if store durability matters.
64 185
65186Best for one-off tasks, the user may still interact with the AI while the task is completing, but once completed the container is destroyed.### Observability
66 187
67188**Examples:**Agent SDK agents are long-lived processes that spawn tool calls across many API round-trips. Without telemetry you cannot see which tools ran, how long they took, or where a session stalled.
68 189
69190* Bug Investigation & Fix: Debug and resolve a specific issue with relevant contextThe SDK inherits OpenTelemetry configuration from the environment. Set the OTEL environment variables at the container or orchestrator level so every `query()` call exports spans, metrics, and log events to your collector. The example below enables OTLP export for all three signals. `CLAUDE_CODE_ENHANCED_TELEMETRY_BETA` is required only for traces; omit it if you export metrics and logs alone.
70* Invoice Processing: Extract and structure data from receipts/invoices for accounting systems
71* Translation Tasks: Translate documents or content batches between languages
72* Image/Video Processing: Apply transformations, optimizations, or extract metadata from media files
73 191
74192### Pattern 2: Long-Running Sessions```bash title=".env" theme={null}
193CLAUDE_CODE_ENABLE_TELEMETRY=1
194CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1
195OTEL_TRACES_EXPORTER=otlp
196OTEL_METRICS_EXPORTER=otlp
197OTEL_LOGS_EXPORTER=otlp
198OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
199OTEL_EXPORTER_OTLP_ENDPOINT=http://collector.example.com:4318
200```
75 201
76202Maintain persistent container instances for long running tasks. Often times running *multiple* Claude Agent processes inside of the container based on demand.Prompt text and tool inputs are not included in exports by default. See [Control sensitive data in exports](/en/agent-sdk/observability#control-sensitive-data-in-exports) for the opt-in flags, and [Observability](/en/agent-sdk/observability) for the full signal catalog.
77 203
78204Best for proactive agents that take action without the users input, agents that serve content or agents that process high amounts of messages.### Auth and secrets
79 205
80206**Examples:**Three auth concerns matter at hosting time:
81 207
82208* Email Agent: Monitors incoming emails and autonomously triages, responds, or takes actions based on content* **Anthropic API**: the subprocess reads `ANTHROPIC_API_KEY` from its environment. Supply it from your secret manager, or set `ANTHROPIC_BASE_URL` to route model calls through a proxy that injects the key outside the container. See [Credential management](/en/agent-sdk/secure-deployment#credential-management) for the proxy pattern and the [SDK overview](/en/agent-sdk/overview#get-started) for supported authentication methods.
83209* Site Builder: Hosts custom websites per user with live editing capabilities served through container ports* **Inbound**: put authentication at a gateway in front of the agent container. The agent should receive pre-authenticated requests and should not be the component that validates user tokens.
84210* High-Frequency Chat Bots: Handles continuous message streams from platforms like Slack where rapid response times are critical* **Outbound tools**: keep tool credentials out of the agent environment. Route outbound calls through a proxy that injects API keys after the request leaves the container. The agent makes the call; the proxy adds the credential.
85 211
86212### Pattern 3: Hybrid Sessions### Scaling and concurrency
87 213
88214Ephemeral containers that are hydrated with history and state, possibly from a database or from the SDK's session resumption features.Each session runs in its own subprocess, so concurrency on a host is bounded by how many subprocesses its RAM can hold.
89 215
90216Best for containers with intermittent interaction from the user that kicks off work and spins down when the work is completed but can be continued.Size each host with this formula:
91 217
92218**Examples:**```text theme={null}
219agents per host = (host RAM - overhead) / (per-session RAM ceiling)
220```
93 221
94222* Personal Project Manager: Helps manage ongoing projects with intermittent check-ins, maintains context of tasks, decisions, and progressMeasure the per-session ceiling by running a representative session to your target length under your expected tool load and recording peak RSS. The 1 GiB starting point in [Resources](#resources) is a floor, not the ceiling.
95* Deep Research: Conducts multi-hour research tasks, saves findings and resumes investigation when user returns
96* Customer Support Agent: Handles support tickets that span multiple interactions, loads ticket history and customer context
97 223
98224### Pattern 4: Single ContainersHorizontal-scale routing depends on your pattern. For long-running sessions, where containers hold many sessions, run a pool of containers behind a load balancer and pin each session to one container using consistent hashing on `sessionId`. A pinned session keeps hitting the same container, and therefore the same running subprocess, until it is evicted or the container restarts.
99 225
100226Run multiple Claude Agent SDK processes in one global container.Large fanouts of concurrent [subagents](/en/agent-sdk/subagents) from a single session can hit API rate limits. Break the work into smaller batches rather than issuing one wide dispatch.
101 227
102228Best for agents that must collaborate closely together. This is likely the least popular pattern because you will have to prevent agents from overwriting each other.### Cost
103 229
104230**Examples:**Anthropic token cost typically dominates container infrastructure cost by an order of magnitude or more. A minimally provisioned container runs roughly \$0.05 per hour, while a single long agent session can spend dollars in tokens. See [Cost tracking](/en/agent-sdk/cost-tracking) for per-session token accounting.
105 231
106232* **Simulations**: Agents that interact with each other in simulations such as video games.### Multi-tenant isolation
107 233
108234## FAQDefault SDK behavior reads settings and `CLAUDE.md` memory files from the filesystem. In a shared container that serves multiple tenants, those files can leak one tenant's context into another tenant's session.
109 235
110236### How do I communicate with my sandboxes?To isolate tenants inside a shared container:
111 237
112238When hosting in containers, expose ports to communicate with your SDK instances. Your application can expose HTTP/WebSocket endpoints for external clients while the SDK runs internally within the container.* Pass `settingSources: []` in TypeScript or `setting_sources=[]` in Python so no filesystem settings load.
239* Set `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` in `env`. [Auto memory](/en/memory#auto-memory) at `~/.claude/projects/<project>/memory/` loads into the system prompt regardless of `settingSources`. See [What settingSources does not control](/en/agent-sdk/claude-code-features#what-settingsources-does-not-control) for the other inputs that load unconditionally.
240* Point `CLAUDE_CONFIG_DIR` at a per-tenant directory so tenants do not share the `~/.claude.json` global config.
241* Use a per-tenant working directory. Pass `cwd` explicitly on every `query()` call.
242* Apply per-tenant egress rules at your proxy, such as distinct outbound IPs, credentials, or domain allowlists, so a compromised tenant cannot exfiltrate data via another tenant's outbound policy.
113 243
114244### What is the cost of hosting a container?The example below applies the four SDK-level options together. Construct `tenantDir` and `configDir` so each tenant gets a path no other tenant can read. In TypeScript, `env` replaces the subprocess environment, so spread `...process.env` to keep inherited variables like `PATH` and `ANTHROPIC_API_KEY`. In Python, `env` is merged on top of the inherited environment.
115 245
116246The dominant cost of serving agents is the tokens; containers vary based on what you provision, but a minimum cost is roughly 5 cents per hour running.<CodeGroup>
247 ```typescript TypeScript theme={null}
248 import { query } from "@anthropic-ai/claude-agent-sdk";
117 249
118250### When should I shut down idle containers vs. keeping them warm? declare const prompt: string;
251 declare const tenantDir: string;
252 declare const configDir: string;
119 253
120254This is likely provider dependent, different sandbox providers will let you set different criteria for idle timeouts after which a sandbox might spin down. for await (const message of query({
121255You will want to tune this timeout based on how frequent you think user response might be. prompt,
256 options: {
257 cwd: tenantDir,
258 settingSources: [],
259 env: {
260 ...process.env,
261 CLAUDE_CONFIG_DIR: configDir,
262 CLAUDE_CODE_DISABLE_AUTO_MEMORY: "1",
263 },
264 },
265 })) {
266 // ...
267 }
268 ```
122 269
123270### How often should I update the Claude Code CLI? ```python Python theme={null}
271 from claude_agent_sdk import query, ClaudeAgentOptions
124 272
125273The Claude Code CLI is versioned with semver, so any breaking changes will be versioned. async for message in query(
274 prompt=prompt,
275 options=ClaudeAgentOptions(
276 cwd=tenant_dir,
277 setting_sources=[],
278 env={
279 "CLAUDE_CONFIG_DIR": config_dir,
280 "CLAUDE_CODE_DISABLE_AUTO_MEMORY": "1",
281 },
282 ),
283 ):
284 ...
285 ```
286</CodeGroup>
126 287
127288### How do I monitor container health and agent performance?For per-tenant network controls, see [Secure Deployment](/en/agent-sdk/secure-deployment).
128 289
129290Since containers are just servers the same logging infrastructure you use for the backend will work for containers.## Known limitations
130 291
131292### How long can an agent session run before timing out?Plan around these in your deployment design.
132 293
133294An agent session will not timeout, but consider setting a 'maxTurns' property to prevent Claude from getting stuck in a loop.| Limitation | What to do |
295| --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
296| No top-level session timeout | A session does not time out on its own. Set `maxTurns` in `Options` to bound how many tool-use round trips the agent takes before stopping. |
297| Memory growth over long sessions | Cap session length or recycle subprocesses periodically. See [Scaling and concurrency](#scaling-and-concurrency). |
298| Large parallel-subagent fanouts can hit rate limits | Break work into smaller batches rather than issuing one wide dispatch. |
299| No per-subagent wall-clock deadline | Cap each [subagent](/en/agent-sdk/subagents) with `maxTurns` in its `AgentDefinition`. For background subagents only, `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS` sets a stall watchdog that fires when a `run_in_background` subagent stops producing output; it is not a total-runtime deadline. |
134 300
135301## Next Steps## Next steps
136 302
137303* [Secure Deployment](/en/agent-sdk/secure-deployment) - Network controls, credential management, and isolation hardening* [Hosting cookbook](https://github.com/anthropics/claude-cookbooks/blob/main/claude_agent_sdk/07_Hosting_the_agent.ipynb): notebook walkthrough with [deployable code](https://github.com/anthropics/claude-cookbooks/tree/main/claude_agent_sdk/hosting) for Docker, Modal, and Kubernetes.
138304* [TypeScript SDK - Sandbox Settings](/en/agent-sdk/typescript#sandboxsettings) - Configure sandbox programmatically* [Session storage](/en/agent-sdk/session-storage): persist transcripts across hosts with a `SessionStore` adapter.
139305* [Sessions Guide](/en/agent-sdk/sessions) - Learn about session management* [Observability](/en/agent-sdk/observability): export OTEL traces, metrics, and logs to your collector.
140306* [Permissions](/en/agent-sdk/permissions) - Configure tool permissions* [Secure deployment](/en/agent-sdk/secure-deployment): network controls, credential management, and isolation hardening.
141307* [Cost Tracking](/en/agent-sdk/cost-tracking) - Monitor API usage* [Cost tracking](/en/agent-sdk/cost-tracking): per-session token and cost accounting.
142* [MCP Integration](/en/agent-sdk/mcp) - Extend with custom tools