766 pages for runs.
Titles and paths first, then pages whose text carries it. Each row opens that page as this site last read it.
How the agent loop works
Claude Code CLI · in the page
agent-sdk/agent-loop
…start.md) for the installs that do. When you start an agent, the SDK runs the same [execution loop that powers Claude Code](https://code.claude.com/docs/en/how-claude-code-works.md#the-agentic-loop):…
Use Claude Code features in the SDK
Claude Code CLI · in the page
agent-sdk/claude-code-features
…console.log(`\nResult: ${message.result}`); } } ``` When this runs, the assistant's response prints to stdout, followed by a final result line once the run completes. Each source loads settin…
Configure your agent
Claude Code CLI · in the page
agent-sdk/configuration
…Python. Each field is optional, and a session started with no options runs with the SDK's defaults. The example below configures a session that summarizes a project's open TODOs. Pairs read as TypeScr…
Track cost and usage
Claude Code CLI · in the page
agent-sdk/cost-tracking
…field requires Claude Code v2.1.246 or later. The following example runs a query and prints the cost and token breakdown for each model used: ```typescript theme={null} import { query } from "@anth…
Give Claude custom tools
Claude Code CLI · in the page
agent-sdk/custom-tools
…nal fields, or nested objects. * **Handler:** the async function that runs when Claude calls the tool. It receives the validated arguments and must return an object with: * `content` (required): an…
Intercept and control agent behavior with hooks
Claude Code CLI · in the page
agent-sdk/hooks
…e hook doesn't run. To block Bash writes to a file where [the sandbox runs](https://code.claude.com/docs/en/sandboxing.md), see the sandbox configuration for [Python](https://code.claude.com/docs/en/a…
Hosting the Agent SDK
Claude Code CLI · in the page
agent-sdk/hosting
…eamed results through the client SDKs or the REST API. Tool execution runs in an Anthropic-managed cloud sandbox or a [self-hosted sandbox](https://platform.claude.com/docs/en/managed-agents/self-host…
Connect to external tools with MCP
Claude Code CLI · in the page
agent-sdk/mcp
…s the SQL query, and returns the results. DBHub's `execute_sql` tool runs whatever SQL the agent emits, including writes, unless you restrict it. Setting `readonly = true` in the [DBHub configuration…
Modifying system prompts
Claude Code CLI · in the page
agent-sdk/modifying-system-prompts
…name, scope, and persona. * **Different permission model**: the agent runs autonomously without a human approving each step, or operates on a narrow set of resources. Claude Code's prompt assumes a hu…
Observability with OpenTelemetry
Claude Code CLI · in the page
agent-sdk/observability
…e/opentelemetry). ## How telemetry flows from the SDK The Agent SDK runs the Claude Code CLI as a child process and communicates with it over a local pipe. The CLI has OpenTelemetry instrumentation…
Agent SDK overview
Claude Code CLI · in the page
agent-sdk/overview
…Agent SDK, the CLI, the Client SDK, and Managed Agents differ in who runs the agent, what comes built in, and how you reach it. | You want to | Use | What you get | | - | - | - | | Embed Claude Code…
Configure permissions
Claude Code CLI · in the page
agent-sdk/permissions
…ssion-modes-that-can-approve-an-always_ask-call) before your callback runs. **4. Permission mode** Apply the active [permission mode](#permission-modes): * In `bypassPermissions` mode, Claude Code…
Agent SDK reference - Python
Claude Code CLI · in the page
agent-sdk/python
…### `create_sdk_mcp_server()` Create an in-process MCP server that runs within your Python application. ```python theme={null} def create_sdk_mcp_server( name: str, version: str = "1.0.0",…
Quickstart
Claude Code CLI · in the page
agent-sdk/quickstart
…r agent script use top-level `await`, and [tsx](https://tsx.hirok.io) runs TypeScript files directly. npm prints `added N packages` when the install succeeds. > [tab] TypeScript (existing project) >…
Securely deploying AI agents
Claude Code CLI · in the page
agent-sdk/secure-deployment
…* **Permissions system**: Permission rules decide whether a tool call runs, is blocked, or asks for approval first. For the forms a Bash rule misses and how rules combine with permission modes, see [W…
Persist sessions to external storage
Claude Code CLI · in the page
agent-sdk/session-storage
…`InMemorySessionStore` for development and testing. The example below runs a query with the store attached, captures the session ID from the result message, then resumes from the store in a second `qu…
Work with sessions
Claude Code CLI · in the page
agent-sdk/sessions
…current directory. You don't track anything. Works well when your app runs one conversation at a time. * **Resume** takes a specific session ID. You track the ID. Required when you have multiple sessi…
Extend agents with skills
Claude Code CLI · in the page
agent-sdk/skills
…commands**: execute logic coded into the Claude Code process the SDK runs, for example `/compact` * **Bundled skills**: prompt artifacts included with Claude Code, for example `/code-review` * **Your…
Send messages to a running agent
Claude Code CLI · in the page
agent-sdk/streaming-vs-single-mode
…n open so your application can send it more than one message while it runs. You can also attach images to a message and stop a response partway through to redirect Claude. > [!NOTE] > > Streaming inp…
Subagents in the SDK
Claude Code CLI · in the page
agent-sdk/subagents
…them gives you four benefits: * **Context isolation**: each subagent runs in its own conversation, which starts fresh unless the subagent is a [fork](https://code.claude.com/docs/en/sub-agents.md#for…
Track todos
Claude Code CLI · in the page
agent-sdk/todo-tracking
…ermission-modes) for the alternatives. * **Turn limit**: each example runs until the agent finishes and yields its final result message. If a session reaches its turn limit first, that result message…
Troubleshoot the Agent SDK
Claude Code CLI · in the page
agent-sdk/troubleshooting
…irm `claude --version` works in the same environment your application runs in. Processes you launch outside your shell, such as from an IDE or a service manager, often run with a different `PATH`. Th…
Agent SDK reference - TypeScript
Claude Code CLI · in the page
agent-sdk/typescript
…elete the platform package that doesn't match the libc where your app runs; for a glibc runtime on x64, that's `rm -rf node_modules/@anthropic-ai/claude-agent-sdk-linux-x64-musl`. On a development mac…
Handle approvals and user input
Claude Code CLI · in the page
agent-sdk/user-input
…G] > > **An earlier step can allow or deny a call before `canUseTool` runs.** The [permission evaluation flow](https://code.claude.com/docs/en/agent-sdk/permissions.md#how-permissions-are-evaluated) c…
Orchestrate teams of Claude Code sessions
Claude Code CLI · in the page
agent-teams
…ons, Claude doesn't spawn teammates, and a subagent that Claude names runs as an ordinary [subagent](https://code.claude.com/docs/en/sub-agents.md) even with agent teams enabled. ## Start your first…
Manage multiple agents with agent view
Claude Code CLI · in the page
agent-view
…s in parallel](https://code.claude.com/docs/en/agents.md). Agent view runs sessions on your machine and you dispatch each one; to have Claude start and track parallel sessions in the cloud from one co…
Run agents in parallel
Claude Code CLI · in the page
agents
…letting Claude coordinate a group of workers, and in whether the work runs on your machine or in the cloud. | Approach | What it gives you | Use it when | | :- | :- | :- | | [Subagents](https://code.…
Claude Code on Amazon Bedrock
Claude Code CLI · in the page
amazon-bedrock
…errors#aws-default-chain-credential-resolve-timed-out). If your chain runs an interactive sign-in that legitimately needs longer, such as browser-based SSO with MFA through a wrapper like `aws-vault`,…
Claude Approvals
Claude Code CLI · in the page
approvals
…or-paid-claude-plans), by tokens, for the Code Reviews and classifier runs that a policy starts. See [what starts a charge](https://code.claude.com/docs/en/approvals-setup.md#what-approvals-costs). #…
Claude Approvals classifiers
Claude Code CLI · in the page
approvals-classifiers
…s `repo/change_risk`, as in `"repo/change_risk = low"` 3. **Approvals runs it on a pull request**: for example, when a pull request opens ready for review and changes a file that the rule matches. See…
Claude Approvals policy file reference
Claude Code CLI · in the page
approvals-policy
…quential` | The default for this file's rules. See [When a classifier runs](https://code.claude.com/docs/en/approvals-classifiers.md#when-a-classifier-runs) | | `locals` | No | Map of names to values…
Set up Claude Approvals
Claude Code CLI · in the page
approvals-setup
…cles/12429409-extra-usage-for-paid-claude-plans) to pay for the model runs that a policy starts * The [Claude GitHub App](https://github.com/apps/claude), installed on the repository and [linked to yo…
Share session output as artifacts
Claude Code CLI · in the page
artifacts
…side * Keep an investigation timeline that fills in while a long task runs * Send a teammate a link instead of pasting output into Slack * Publish a status board that [pulls fresh data through MCP con…
Authentication
Claude Code CLI · in the page
authentication
…Bedrock and Agent Platform. * **Cloud gateway**: if your organization runs a self-hosted [Claude apps gateway](https://code.claude.com/docs/en/claude-apps-gateway), sign in with corporate SSO through…
Configure auto mode
Claude Code CLI · in the page
auto-mode-config
…policy boundary. > [!NOTE] > > The classifier is a second gate that runs after the [permissions system](https://code.claude.com/docs/en/permissions.md). To block Claude's [matching calls](https://co…
Best practices for Claude Code
Claude Code CLI · in the page
best-practices
…et-claude-run-without-you) applies the same four points to unattended runs, and [What you can stop doing](#what-you-can-stop-doing) lists the advice that current models have made unnecessary. > [!NOT…
Champion kit
Claude Code CLI · in the page
champion-kit
…he setup worth the effort?" | Installation takes roughly two minutes, runs in the terminal, and requires no IDE extension. Running `/init` once is sufficient to begin working. | [Quickstart](https://c…
Claude Code changelog
Claude Code CLI · in the page
changelog
…ay what they act on, review findings show as a list, many long failed runs show their first failure, and edits show more counts * \[VSCode] Improved the new look: permission cards ask in plain words,…
Push events into a running session with channels
Claude Code CLI · in the page
channels
…## Quickstart Fakechat is an officially supported demo channel that runs a chat UI on localhost, with nothing to authenticate and no external service to configure. Once you install and enable fakec…
Channels reference
Claude Code CLI · in the page
channels-reference
…w A channel is an [MCP](https://modelcontextprotocol.io) server that runs on the same machine as Claude Code. Claude Code spawns it as a subprocess and communicates over stdio. Your channel server is…
Checkpointing
Claude Code CLI · in the page
checkpointing
…ckpoints. Whether rewinding restores them depends on how the subagent runs: * **Foreground forked skill**: a [skill with `context: fork`](https://code.claude.com/docs/en/skills#run-skills-in-a-subage…
Claude apps gateway for Amazon Bedrock, Claude Platform on AWS, Google Cloud, and Microsoft Foundry
Claude Code CLI · in the page
claude-apps-gateway
…. It is included in the `claude` binary, so the same executable that runs Claude Code on a laptop runs the gateway server with `claude gateway --config gateway.yaml`. This page covers: * [Why Claud…
Claude apps gateway configuration
Claude Code CLI · in the page
claude-apps-gateway-config
…e-apps-gateway#quickstart), which builds a minimal working config and runs it. Once you have a config you're happy with, the [deployment guide](https://code.claude.com/docs/en/claude-apps-gateway-depl…
Claude apps gateway deployment and operations
Claude Code CLI · in the page
claude-apps-gateway-deploy
…rnet too. > > Choose the gateway's address before you choose where it runs. Usually that's a private address that users reach on your internal network or over a VPN. If your internal network uses publ…
Deploy Claude apps gateway on AWS
Claude Code CLI · in the page
claude-apps-gateway-on-aws
…cation Load Balancer fronting the gateway (ECS Fargate or EKS), which runs in private subnets alongside an Amazon RDS for PostgreSQL instance for session state. The gateway signs users in via OIDC aga…
Deploy Claude apps gateway on Google Cloud
Claude Code CLI · in the page
claude-apps-gateway-on-gcp
…e clients connect over HTTPS to the gateway (Cloud Run or GKE), which runs inside a VPC alongside a private-IP Cloud SQL database for session state. The gateway signs users in via OIDC against Google…
Use Claude Code in the cloud
Claude Code CLI · in the page
claude-code-on-the-web
…admin-settings/roles). A cloud session is a Claude Code session that runs on cloud infrastructure. By default it runs on infrastructure Anthropic manages, or on your organization's [self-hosted envir…
Explore the .claude directory
Claude Code CLI · in the page
claude-directory
…single-file commands: a prompt saved as `.claude/commands/deploy.md` runs as `/deploy`. For a new command, use a [skill](#ce-skills), which can bundle reference docs, templates, or scripts alongside…
Claude Code with Claude Models on Google Cloud (Anthropic managed)
Claude Code CLI · in the page
claude-models-on-google-cloud-anthropic-managed
…anaged) > Configure Claude Code to use the Claude API that Anthropic runs through your Google Cloud project, with Google Cloud credentials, IAM, and Marketplace billing. Claude Models on Google Clou…
Claude Code on Claude Platform on AWS
Claude Code CLI · in the page
claude-platform-on-aws
…n/amazon-bedrock#advanced-credential-configuration) so Claude Code re-runs your login command and retries instead of failing. Add the command to your [settings file](https://code.claude.com/docs/en/se…