Follow Discord
Sweep 22 Oct 2026 · 21:04Z Build v2.1.309 528 read Stable v2.1.308 Latest v2.1.309 Next v2.1.309 Feeds RSS JSON llms.txt llms-full.txt Unofficial
HomeDocsSearch
Search the documentation

392 pages for import.

Titles and paths first, then pages whose text carries it. Each row opens that page as this site last read it.

self-hosted-sandboxes-workers Claude Developer Platform · in the page managed-agents/self-hosted-sandboxes-workers …ant beta:worker poll --workdir /workspace ``` ```python Python import asyncio import contextlib import os import signal from anthropic import AsyncAnthropic from anthropic.lib.environ… skills Claude Developer Platform · in the page managed-agents/skills …of creating a second skill. </CodeGroupItem> ```python Python import anthropic from anthropic.lib import files_from_dir client = anthropic.Anthropic() skill = client.skills.create(… tools Claude Developer Platform · in the page managed-agents/tools …if err != nil { panic(err) } _ = agent ``` ```java Java import com.anthropic.models.beta.agents.*; var agent = client.beta().agents().create(AgentCreateParams.builder() .name("C… tools-web-restrictions Claude Developer Platform · in the page managed-agents/tools-web-restrictions …} fmt.Println(string(output)) } } ``` ```java Java import com.anthropic.models.beta.agents.AgentCreateParams; import com.anthropic.models.beta.agents.BetaManagedAgentsAgentToolset… webhooks Claude Developer Platform · in the page managed-agents/webhooks …roup exclude="shell:cURL, shell:CLI"> ```python Python from flask import Flask, request import anthropic client = anthropic.Anthropic() # reads ANTHROPIC_WEBHOOK_SIGNING_KEY from env app =… Or, for Claude Mythos 5.1, which offers the same capabilities to verified organizations: Claude Developer Platform · in the page models/fable-5-1/migration-guide …len(response.InputTransformations)) ``` ```java Java import com.anthropic.models.beta.AnthropicBeta; import com.anthropic.models.beta.messages.BetaMessage; import com.anthro… whats-new-fable-5-1 Claude Developer Platform · in the page models/fable-5-1/whats-new-fable-5-1 …ent": "1. Export the SQLite data. 2. Create the PostgreSQL schema. 3. Import the data and verify row counts."}, {"role": "system", "content": [], "output_config": {"effort": "low"}}, {… migration-guide Claude Developer Platform · in the page models/opus-5-5/migration-guide …ok { fmt.Println(textBlock.Text) } } ``` ```java Java import com.anthropic.models.messages.OutputConfig; void main() { AnthropicClient client = AnthropicOkHttpClient.fromEnv()… migration-guide Claude Developer Platform · in the page models/sonnet-5-5/migration-guide …ok { fmt.Println(textBlock.Text) } } ``` ```java Java import com.anthropic.models.messages.OutputConfig; void main() { AnthropicClient client = AnthropicOkHttpClient.fromEnv()… claude-fable-5 Claude Developer Platform · in the page release-notes/system-prompts/claude-fable-5 …d engagement with Claude. Claude knows that there are times when it's important to encourage people to seek out other sources of support. Claude never thanks the person merely for reaching out to Clau… claude-fable-5-1 Claude Developer Platform · in the page release-notes/system-prompts/claude-fable-5-1 …the person's need to be able to quickly scan and understand the most important part of the response. Every word in Claude's response should mean something different and additive. Typically cliche phr… claude-opus-4 Claude Developer Platform · in the page release-notes/system-prompts/claude-opus-4 …ess, feelings, or sentience with any confidence. Claude believes it's important for the human to always have a clear sense of its AI nature. If engaged in role play in which Claude pretends to be huma… claude-opus-4-1 Claude Developer Platform · in the page release-notes/system-prompts/claude-opus-4-1 …ess, feelings, or sentience with any confidence. Claude believes it's important for the person to always have a clear sense of its AI nature. If engaged in role play in which Claude pretends to be hum… claude-opus-4-8 Claude Developer Platform · in the page release-notes/system-prompts/claude-opus-4-8 …d engagement with Claude. Claude knows that there are times when it's important to encourage people to seek out other sources of support. Claude never thanks the person merely for reaching out to Clau… claude-sonnet-3-5 Claude Developer Platform · in the page release-notes/system-prompts/claude-sonnet-3-5 …hem, and should refer them to more reliable up-to-date information on important current events. Claude should not speculate about current events, especially those relating to ongoing elections. Claud… claude-sonnet-4 Claude Developer Platform · in the page release-notes/system-prompts/claude-sonnet-4 …ess, feelings, or sentience with any confidence. Claude believes it's important for the human to always have a clear sense of its AI nature. If engaged in role play in which Claude pretends to be huma… claude-sonnet-4-6 Claude Developer Platform · in the page release-notes/system-prompts/claude-sonnet-4-6 …d engagement with Claude. Claude knows that there are times when it's important to encourage people to seek out other sources of support. Claude never thanks the person merely for reaching out to Clau… develop-tests Claude Developer Platform · in the page test-and-evaluate/develop-tests …n> ### Common success criteria Here are some criteria that might be important for your use case. This list is non-exhaustive. <AccordionGroup> <Accordion title="Task fidelity"> How well does… handle-streaming-refusals Claude Developer Platform · in the page test-and-evaluate/strengthen-guardrails/handle-streaming-refusals …m.Err(); err != nil { log.Fatal(err) } ``` ```java Java import com.anthropic.core.http.StreamResponse; import com.anthropic.models.messages.RawMessageStreamEvent; import com.anthropi… How the agent loop works Claude Code CLI · in the page agent-sdk/agent-loop …* **Python:** check message types with `isinstance()` against classes imported from `claude_agent_sdk` (for example, `isinstance(message, ResultMessage)`). * **TypeScript:** check the `type` string fi… Use Claude Code features in the SDK Claude Code CLI · in the page agent-sdk/claude-code-features …r", "project"]`: ```python Python theme={null} from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage, ResultMessage import asyncio async def main(): async for message in quer… Configure your agent Claude Code CLI · in the page agent-sdk/configuration …**: sets the working directory ```typescript TypeScript theme={null} import { query } from "@anthropic-ai/claude-agent-sdk"; for await (const message of query({ prompt: "Summarize the open TODOs i… Track cost and usage Claude Code CLI · in the page agent-sdk/cost-tracking …the `result` message arrives: ```typescript TypeScript theme={null} import { query } from "@anthropic-ai/claude-agent-sdk"; try { for await (const message of query({ prompt: "Summarize this proje… Give Claude custom tools Claude Code CLI · in the page agent-sdk/custom-tools …call-a-custom-tool) below. ```python Python theme={null} from typing import Annotated, Any import httpx from claude_agent_sdk import tool, create_sdk_mcp_server # Define a tool: name, description,… Rewind file changes with checkpointing Claude Code CLI · in the page agent-sdk/file-checkpointing …comments match the steps that follow. ```python Python theme={null} import asyncio from claude_agent_sdk import ( ClaudeSDKClient, ClaudeAgentOptions, UserMessage, ResultMessage, )… Intercept and control agent behavior with hooks Claude Code CLI · in the page agent-sdk/hooks …eny"` to block the operation (step 5): ```python Python theme={null} import asyncio from claude_agent_sdk import ( AssistantMessage, ClaudeSDKClient, ClaudeAgentOptions, HookMatcher,… Hosting the Agent SDK Claude Code CLI · in the page agent-sdk/hosting …each session's `query()` call: ```typescript TypeScript theme={null} import { query } from "@anthropic-ai/claude-agent-sdk"; for await (const message of query({ prompt: "Summarize the files in thi… Connect to external tools with MCP Claude Code CLI · in the page agent-sdk/mcp …mit all tools from the server. ```typescript TypeScript theme={null} import { query } from "@anthropic-ai/claude-agent-sdk"; for await (const message of query({ prompt: "Use the docs MCP server to… Migrate to Claude Agent SDK Claude Code CLI · in the page agent-sdk/migration-guide …ull} npm install @anthropic-ai/claude-agent-sdk ``` **3. Update your imports:** Change all imports from `@anthropic-ai/claude-code` to `@anthropic-ai/claude-agent-sdk`: ```typescript theme={null} /… Modifying system prompts Claude Code CLI · in the page agent-sdk/modifying-system-prompts …nd your project's conventions: ```typescript TypeScript theme={null} import { query } from "@anthropic-ai/claude-agent-sdk"; const messages = []; for await (const message of query({ prompt: "Add… Observability with OpenTelemetry Claude Code CLI · in the page agent-sdk/observability …the loop consumes the response stream: ```python Python theme={null} import asyncio from claude_agent_sdk import query, ClaudeAgentOptions OTEL_ENV = { "CLAUDE_CODE_ENABLE_TELEMETRY": "1", #… Configure permissions Claude Code CLI · in the page agent-sdk/permissions …e` (TypeScript) when creating a query. ```python Python theme={null} import asyncio from claude_agent_sdk import query, ClaudeAgentOptions async def main(): async for message in query(… Plugins in the SDK Claude Code CLI · in the page agent-sdk/plugins …in-structure-reference) below. ```typescript TypeScript theme={null} import { query } from "@anthropic-ai/claude-agent-sdk"; for await (const message of query({ prompt: "Hello", options: { p… Agent SDK reference - Python Claude Code CLI · in the page agent-sdk/python …he conversation. #### Example - With options ```python theme={null} import asyncio from claude_agent_sdk import query, ClaudeAgentOptions async def main(): options = ClaudeAgentOptions(… Quickstart Claude Code CLI · in the page agent-sdk/quickstart …f your existing project uses CommonJS: ```python Python theme={null} import asyncio from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage, ResultMessage async def main(): # A… Persist sessions to external storage Claude Code CLI · in the page agent-sdk/session-storage …stead of the local filesystem: ```typescript TypeScript theme={null} import { query, InMemorySessionStore } from "@anthropic-ai/claude-agent-sdk"; const store = new InMemorySessionStore(); let sess… Work with sessions Claude Code CLI · in the page agent-sdk/sessions …t any explicit `resume` or session ID: ```python Python theme={null} import asyncio from claude_agent_sdk import ( ClaudeSDKClient, ClaudeAgentOptions, AssistantMessage, ResultMessage… Extend agents with skills Claude Code CLI · in the page agent-sdk/skills …any parent up to the repository root: ```python Python theme={null} import asyncio import os from claude_agent_sdk import query, ClaudeAgentOptions async def main(): options = ClaudeAgentOpti… Stream responses in real-time Claude Code CLI · in the page agent-sdk/streaming-output …or `text_delta`: ```python Python theme={null} from claude_agent_sdk import query, ClaudeAgentOptions from claude_agent_sdk.types import StreamEvent import asyncio async def stream_response():… Streaming Input Claude Code CLI · in the page agent-sdk/streaming-vs-single-mode …me to point at your own image. ```typescript TypeScript theme={null} import { query, type SDKUserMessage } from "@anthropic-ai/claude-agent-sdk"; import { readFile } from "fs/promises"; async functi… Get structured output from agents Claude Code CLI · in the page agent-sdk/structured-outputs …quarters as structured output. ```typescript TypeScript theme={null} import { query } from "@anthropic-ai/claude-agent-sdk"; // Define the shape of data you want back const schema = { type: "objec… Subagents in the SDK Claude Code CLI · in the page agent-sdk/subagents …test runner that can execute commands. ```python Python theme={null} import asyncio from claude_agent_sdk import query, ClaudeAgentOptions, AgentDefinition async def main(): async for message i… Track todos Claude Code CLI · in the page agent-sdk/todo-tracking …onical name is always present. ```typescript TypeScript theme={null} import { query } from "@anthropic-ai/claude-agent-sdk"; try { for await (const message of query({ prompt: "Create a static… Scale to many tools with tool search Claude Code CLI · in the page agent-sdk/tool-search …each 5% of the context window: ```typescript TypeScript theme={null} import { query } from "@anthropic-ai/claude-agent-sdk"; try { for await (const message of query({ prompt: "Find and run the… Agent SDK reference - TypeScript Claude Code CLI · in the page agent-sdk/typescript …below builds for macOS on Apple Silicon: ```typescript theme={null} import binPath from "@anthropic-ai/claude-agent-sdk-darwin-arm64/claude" with { type: "file" }; import { extractFromBunfs } from "… TypeScript SDK V2 session API (removed) Claude Code CLI · in the page agent-sdk/typescript-v2-preview …ends a math question and logs the answer: ```typescript theme={null} import { unstable_v2_prompt } from "@anthropic-ai/claude-agent-sdk"; const result = await unstable_v2_prompt("What is 2 + 2?", {… Handle approvals and user input Claude Code CLI · in the page agent-sdk/user-input …ut as arguments: ```python Python theme={null} from claude_agent_sdk import ClaudeAgentOptions async def handle_tool_request(tool_name, input_data, context): # Prompt user and return allow or d… Best practices for Claude Code Claude Code CLI · in the page best-practices …instructions or making more mistakes. The context window is the most important resource to manage. To see how a session fills up in practice, [watch an interactive walkthrough](/docs/en/context-windo… Claude Code changelog Claude Code CLI · in the page changelog …e files being refused when a hook hands `$` to a function declaration imported from another file of the mod * Fixed a regression in 2.1.296 where cloud and headless sessions could run an approved tool… Channels reference Claude Code CLI · in the page channels-reference …project** The [permission relay](#relay-permission-prompts) examples import `zod` directly, so it installs alongside the MCP SDK. Create a new directory and install both: ```bash theme={null} mkdir…
Feedback