What this read moved
1–25 of 25about-claude/use-case-guides/commerce-agents New page · 84 lines, new page
## The shopping agent ## The merchant agent ## Vertical examples ## Where it runs ## Build your own with the Claude Code plugin ## Get started
A whole new page. There's nothing to diff it against, so here is what it says.
---
title: Commerce agent
url: https://platform.claude.com/docs/en/about-claude/use-case-guides/commerce-agents
description: Build a shopping agent and a merchant agent on Claude using Claude for commerce, an open-source blueprint with working implementations on the Messages API, the Claude Agent SDK, and Claude Managed Agents.
---
This guide shows how to build commerce agents on Claude: a shopping agent that customers use inside your app, and a merchant agent for the people running the store, whether that is the business's own operations staff or the sellers on its platform. It does that through Claude for commerce, an open-source blueprint with a working implementation of each agent on the [Messages API](https://platform.claude.com/docs/en/build-with-claude/working-with-messages), the [Claude Agent SDK](https://code.claude.com/docs/en/agent-sdk/overview), and [Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview), runnable examples for retail, travel, telecom, and entertainment, and a Claude Code plugin that scaffolds the same design against your own systems.
The code, setup instructions, and safety documentation are in the [Claude for commerce repository on GitHub](https://github.com/anthropics/commerce-agents). For how the agents are built and why, including the single-agent-with-skills design, UI components as tools, harness-enforced safety, prompt caching, memory, and evals, read the engineering post [A guide to the anatomy of effective commerce agents](https://claude.com/blog/the-anatomy-of-effective-commerce-agents).
<Note>
The blueprint is a reference implementation to fork and adapt, not a supported product or hosted service.
</Note>
## The shopping agent
The shopping agent lives inside your app and reaches your systems through a single backend interface that you implement over your catalog, cart, preferences, order, policy, and fulfillment services. No method on that interface places an order or moves money. In a conversation the agent can:
* Search the catalog, compare finalists, and turn a described need into a shortlist and a recommendation.
* Plan a coordinated set of items toward a goal such as a trip, an event, or a room, and fit it to a budget.
* Show products, comparisons, plans, order status, and the cart as UI components rendered in the conversation.
* Fill the cart and hand off to your checkout.
* Answer order, delivery, return, and policy questions from your own order and policy systems.
* Remember what a customer asks it to remember and apply it in later sessions.
Five skills load on demand to cover search and discovery, purchase research, planning toward a goal, customer care, and memory and personalization. Rules the agent needs on most turns, such as grounding, cart and checkout semantics, and presentation, live in the system prompt instead.
The agent states products, prices, availability, and store terms only from tool results in the conversation, and cart writes accept only product IDs that a catalog or order tool returned in that session. Checkout stages a summary the customer confirms in your app. If you use a hosted checkout, your back end returns its URL and the host renders it without passing it through the model.
## The merchant agent
The merchant agent supports the people running the store. It reaches your analytics, catalog, inventory, pricing, and campaign systems through its own backend interface, and it can:
* Explain how the business is doing: why a metric moved, which segment drove it, and pace against a comparable period. An optional analysis delegate runs read-only queries under a time and size budget.
* Present a daily digest of what needs attention, including low stock, slow movers, and order exceptions.
* Improve listing content and fix catalog data from material the operator supplies.
* Recommend price changes and promotions within the store's guardrails, with a margin preview.
* Draft marketing campaigns with audiences, placements, and budget.
Its five skills cover performance insights, inventory and operations, catalog and listings, pricing and promotions, and marketing campaigns.
Every write the merchant agent proposes, whether a listing update, a price change, an inventory action, a promotion, or a campaign, is a staged change with a server-generated ID that the operator sees as a preview card. Guardrails such as maximum price move, promotion depth, restock size, campaign budget, and protected fields are checked when the change is staged and again when it is applied. The change applies only after a person approves it outside the conversation: a button in the merchant portal on the Messages API path, a confirmation prompt in the Agent SDK console, or an [always-ask permission policy](https://platform.claude.com/docs/en/managed-agents/permission-policies) on the apply tool on Claude Managed Agents. An approval typed in chat approves nothing.
## Vertical examples
Each example includes a customer storefront and a merchant portal over fictional data.
| Vertical | Storefront | Merchant portal |
| ------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| Retail | Search, comparison, plans, cart, checkout, and memory over the built-in components | Daily digest, staged restocks and listing fixes, and the analysis delegate over a SQL view |
| Travel | Date-bound inventory and an itinerary component | Occupancy calendar and date-window rate moves |
| Telecom | Account context, a plan matrix, and server-authored fee disclosures | Plan mix, price moves that state the lines affected, and protected regulated fees |
| Entertainment | Timed holds, waitlists, transfers, a venue map, and all-in fee disclosures | Event pacing, hold releases that add real capacity, and fee-preserving price moves |
## Where it runs
The Messages API and Agent SDK runtimes run against the Claude API, [Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock), [Google Cloud's Agent Platform](https://platform.claude.com/docs/en/build-with-claude/claude-on-vertex-ai), or [Microsoft Foundry](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry), or through your own gateway. The Claude Managed Agents path runs on the Claude API. The repository's deployment guide shows where each path selects its platform and which model ID format each expects.
## Build your own with the Claude Code plugin
The blueprint ships with a [Claude Code](https://code.claude.com/docs/en/overview) plugin that reads the cloned repository as its reference and builds an agent against your own systems. Its four commands cover the path from nothing to a tested agent:
| Command | What it does |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `/scaffold-commerce-agent` | Interviews you about your stack, plays the plan back, and scaffolds a shopping agent, a merchant agent, or both on the reference packages |
| `/add-commerce-flow` | Adds one flow to an existing agent by copying its skill, wiring the tools it calls, and writing its first eval cases |
| `/author-commerce-evals` | Builds an eval suite with a runner, the first cases against your own catalog, and a replay gate for CI |
| `/review-commerce-agent` | Maps an agent you already run, compares it with the reference, and converts the parts you pick |
The plugin also carries six skills on the architecture, prompt caching, UI as tools, trust and safety, evals, and merchant operations, which load whenever a Claude Code conversation matches them. Installation instructions are in the repository README.
To adapt the reference by hand instead, implement the shopping or merchant backend interface over your services, switch off the systems you don't have with the configuration flags so their tools and prompt lines drop out, and set your brand name, assistant name, and voice. The repository's backend guide walks through identity and credentials, ordered flows, checkout hand-off, and products with options. A pilot can implement search and product details and stub the rest.
## Get started
<CardGroup cols={2}>
<Card title="Claude for commerce on GitHub" icon="github-logo" href="https://github.com/anthropics/commerce-agents">
Clone the blueprint and run both agents locally.
</Card>
<Card title="A guide to the anatomy of effective commerce agents" icon="book" href="https://claude.com/blog/the-anatomy-of-effective-commerce-agents">
Read how the agents are built and why.
</Card>
</CardGroup>
about-claude/use-case-guides/overview Changed · +9 / -1 lines
## Choosing a build path
from line 1
11---
22title: Guides to common use cases
33url: https://platform.claude.com/docs/en/about-claude/use-case-guides/overview
4description: "Explore production guides for building common Claude use cases: ticket routing, customer support agents, content moderation, and legal summarization."
4description: "Explore production guides for building common Claude use cases: ticket routing, customer support agents, content moderation, legal summarization, and commerce agents."
55---
66
77Claude is designed to excel in a variety of tasks. Explore these in-depth production guides to learn how to build common use cases with Claude.
from line 22
2222 <Card title="Legal summarization" icon="book" href="https://platform.claude.com/docs/en/about-claude/use-case-guides/legal-summarization">
2323 Summarize legal documents using Claude to extract key information and expedite research.
2424 </Card>
25
26 <Card title="Commerce agent" icon="building" href="https://platform.claude.com/docs/en/about-claude/use-case-guides/commerce-agents">
27 Build shopping and merchant agents from an open-source blueprint that runs on the Messages API, the Claude Agent SDK, and Claude Managed Agents.
28 </Card>
2529</CardGroup>
30
31## Choosing a build path
32
33The three paths for building with Claude differ in how much control you keep and how much of the implementation you offload to Anthropic. The [Messages API](https://platform.claude.com/docs/en/build-with-claude/working-with-messages) gives you the most control: you write the agent loop and run your own tools and infrastructure. The [Claude Agent SDK](https://code.claude.com/docs/en/agent-sdk/overview) sits in between, providing the agent loop and tool execution in a process you operate. With [Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview), you offload the most: Anthropic hosts the agent loop, tool execution, and runtime for you.
2634
agents-and-tools/tool-use/browser-use-tool Changed · +7 / -5 lines
from line 9
99- Supported models: `claude-fable-5-1`, `claude-mythos-5-1`, `claude-fable-5`, `claude-mythos-5`, `claude-opus-5`, `claude-sonnet-5`, `claude-opus-4-8`
1010- Platforms: Claude API, Google Cloud; not available on Claude Platform on AWS, Amazon Bedrock, Microsoft Foundry
1111
12The browser use tool lets Claude navigate, read, and interact with webpages in a browser that your application runs. It works with the page both through its structure (the accessibility tree, elements, forms, and tabs) and through pixels (screenshots and viewport coordinates), whereas the [computer use tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool) works with a whole desktop through screenshots and coordinates alone. It's an Anthropic-defined [client toolset](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference#client-toolsets): one `browser_toolset_20260801` entry in your `tools` array gives Claude 27 member tools by default, such as `navigate`, `read_page`, `left_click`, and `screenshot`, plus four more (`javascript_exec`, `file_upload`, `read_console`, and `read_network`) when you [enable them](https://platform.claude.com/docs/en/agents-and-tools/tool-use/browser-use-tool#enable-optional-member-tools). Your application runs every call against its own browser automation; nothing runs on Anthropic's side. It isn't currently available in [Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/tools). This page says "your application" for the agent loop that calls the Messages API and "your executor" for the part of it that drives the browser and produces tool results.
12The browser use tool lets Claude navigate, read, and interact with webpages in a browser that your application runs. Claude works with the page both through its structure (the accessibility tree, elements, forms, and tabs) and through screenshots and viewport coordinates.
1313
14Choose browser use over computer use when the task stays inside webpages: Claude can read a page's structure, act on an element by reference in addition to by coordinate, set form values directly, and work across tabs, and you don't need to run a desktop. If Claude only needs to read pages you can point it to, or to find sources on the web, the [web fetch tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool) and [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool) are lighter still, because they're [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools) that the API runs for you with no browser to operate. Choose browser use instead when pages build their content with JavaScript or the task means acting on the page rather than only reading it.
14The tool is an Anthropic-defined [client toolset](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference#client-toolsets): one `browser_toolset_20260801` entry in `tools` gives Claude 27 member tools by default, such as `navigate`, `read_page`, `left_click`, and `screenshot`, plus four more when you [enable them](https://platform.claude.com/docs/en/agents-and-tools/tool-use/browser-use-tool#enable-optional-member-tools). Your application runs every call against its own browser automation; nothing runs on Anthropic's side. The tool isn't currently available in [Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/tools).
1515
16Choose browser use when the task stays inside webpages and means acting on them, or when pages build their content with JavaScript. When a task needs a whole desktop, use the [computer use tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool), which works through screenshots and coordinates alone. For reading pages you can point Claude to, or finding sources on the web, the [web fetch tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool) and [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool) are lighter. They're [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools) that the API runs for you, with no browser to operate.
17
1618With browser use, Claude reads and acts on live webpages, so everything a page supplies is untrusted input and the actions Claude takes can have real effects. See [Security considerations](https://platform.claude.com/docs/en/agents-and-tools/tool-use/browser-use-tool#security-considerations) before you deploy.
1719
1820## Quick start
from line 222
220222}
221223```
222224
223Your executor runs `navigate`, then `read_page`, and your application returns one `tool_result` per block in its next request, echoing `toolset_name` on each. The `navigate` result reports the tab it loaded in a `browser_state` block; the `read_page` result is text in which every element carries a reference:
225Your executor (the part of your application that drives the browser and produces tool results) runs `navigate`, then `read_page`. Your application returns one `tool_result` per block in its next request, echoing `toolset_name` on each. The `navigate` result reports the tab it loaded in a `browser_state` block; the `read_page` result is text in which every element carries a reference:
224226
225227```json
226228{
from line 266
264266
265267## How browser use works
266268
267Browser use runs as an agent loop: Claude returns member tool calls, your executor runs them against the browser, and you return the results until Claude answers in text.
269Browser use runs as an agent loop in your application: Claude returns member tool calls, your executor runs them against the browser, and you return the results until Claude answers in text.
268270
269271<Steps>
270272 <Step title="Provide Claude with the browser use tool and a user prompt" icon="tool">
build-with-claude/token-counting Changed · +4 / -2 lines
from line 20
2020
2121The [token counting](https://platform.claude.com/docs/en/api/messages-count-tokens) endpoint accepts the same structured list of inputs for creating a message, including support for system prompts, [tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview), [images](https://platform.claude.com/docs/en/build-with-claude/vision), and [PDFs](https://platform.claude.com/docs/en/build-with-claude/pdf-support). The response contains the total number of input tokens.
2222
23This endpoint returns an `invalid_request_error` for a few inputs that the Messages API accepts: [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools) such as web search, web fetch, code execution, and tool search (every server tool except the [advisor tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/advisor-tool)), the [MCP connector](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector), and `image` or `document` blocks with a `url` or `file` source. Send images and PDFs as base64 to count them. For requests that use server tools or MCP servers, the Messages API response reports the tokens used in its `usage` object.
24
2325<Note>
2426 The token count is an **estimate**. In some cases, the actual number of input tokens used when creating a message might differ by a small amount.
2527
from line 186
184186### Count tokens in messages with tools
185187
186188<Note>
187 [Server tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools) token counts only apply to the first sampling call.
189 Token counting supports client tools and the [advisor tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/advisor-tool). Requests that include other [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools) return an error. For the advisor tool, the count covers the executor's first sampling call only.
188190</Note>
189191
190192<CodeGroup>
from line 1108
11061108### Count tokens in messages with PDFs
11071109
11081110<Note>
1109 Token counting supports PDFs with the same [PDF support limitations](https://platform.claude.com/docs/en/build-with-claude/pdf-support#pdf-support-limitations) as the Messages API.
1111 Token counting supports base64-encoded PDFs with the same [PDF requirements](https://platform.claude.com/docs/en/build-with-claude/pdf-support#check-pdf-requirements) as the Messages API. This endpoint doesn't support `url` or `file` document sources.
11101112</Note>
11111113
11121114<CodeGroup>
managed-agents/events-and-streaming Changed · +23 / -7 lines
from line 505
505505 {
506506 foreach (var block in message.Content)
507507 {
508 Console.Write(block.Text);
508 if (block.Value is BetaManagedAgentsTextBlock textBlock)
509 {
510 Console.Write(textBlock.Text);
511 }
509512 }
510513 }
511514 else if (streamEvent.Value is BetaManagedAgentsSessionStatusIdleEvent)
from line 780
777780 {
778781 foreach (var block in message.Content)
779782 {
780 Console.Write(block.Text);
783 if (block.Value is BetaManagedAgentsTextBlock textBlock)
784 {
785 Console.Write(textBlock.Text);
786 }
781787 }
782788 }
783789 else if (streamEvent.Value is BetaManagedAgentsSessionStatusIdleEvent)
from line 1286
12801286 const preview = accumulateManagedAgentsEvent(previews.get(event.event_id), event);
12811287 if (preview) {
12821288 previews.set(event.event_id, preview);
1283 const text = preview.content.map((block) => block.text).join("");
1289 const text = preview.content
1290 .map((block) => (block.type === "text" ? block.text : ""))
1291 .join("");
12841292 console.log(`event_delta preview: ${JSON.stringify(text)}`);
12851293 }
12861294 } else if (event.type === "agent.message") {
from line 1295
12871295 // 3. The buffered event is the record: it replaces and closes the preview
12881296 const message = accumulateManagedAgentsEvent(previews.get(event.id), event);
12891297 previews.delete(event.id);
1290 const text = message.content.map((block) => block.text).join("");
1298 const text = message.content
1299 .map((block) => (block.type === "text" ? block.text : ""))
1300 .join("");
12911301 console.log(`agent.message ${event.id} ${JSON.stringify(text)}`);
12921302 } else if (event.type === "span.model_request_end") {
12931303 // 4. No more deltas are coming. Close any preview that was never reconciled.
from line 1369
13591369 {
13601370 // Deltas are best-effort: discard the preview and use the buffered event
13611371 previews.Remove(message.ID);
1362 Console.WriteLine($"agent.message {message.ID} {string.Concat(message.Content.Select(block => block.Text))}");
1372 var text = string.Concat(message.Content.Select(block =>
1373 block.TryPickBetaManagedAgentsTextBlock(out var textBlock) ? textBlock.Text : ""));
1374 Console.WriteLine($"agent.message {message.ID} {text}");
13631375 }
13641376 else if (streamEvent.TryPickSpanModelRequestEndEvent(out _))
13651377 {
from line 1700
16881700 } else if (event.type === "agent.message") {
16891701 // The buffered event is the authoritative record; render its content.
16901702 process.stdout.write("\n");
1691 const text = event.content.map((block) => block.text).join("");
1703 const text = event.content
1704 .map((block) => (block.type === "text" ? block.text : ""))
1705 .join("");
16921706 console.log(text);
16931707 } else if (event.type === "session.thread_status_idle") {
16941708 break;
from line 1734
17201734 {
17211735 // The buffered event is the authoritative record; render its content.
17221736 Console.WriteLine();
1723 Console.WriteLine(string.Concat(message.Content.Select(block => block.Text)));
1737 var text = string.Concat(message.Content.Select(block =>
1738 block.TryPickBetaManagedAgentsTextBlock(out var textBlock) ? textBlock.Text : ""));
1739 Console.WriteLine(text);
17241740 }
17251741 else if (streamEvent.TryPickSessionThreadStatusIdleEvent(out _))
17261742 {
managed-agents/files Changed · +51 / -20 lines
from line 242
242242Mount multiple files by adding entries to the `resources` array:
243243
244244<CodeGroup>
245 ```json cURL
246 "resources": [
247 { "type": "file", "file_id": "file_abc123", "mount_path": "/data.csv" },
248 { "type": "file", "file_id": "file_def456", "mount_path": "/config.json" },
249 { "type": "file", "file_id": "file_ghi789", "mount_path": "/src/main.py" }
250 ]
245 ```bash cURL
246 curl -fsSL https://api.anthropic.com/v1/sessions \
247 -H "x-api-key: $ANTHROPIC_API_KEY" \
248 -H "anthropic-version: 2023-06-01" \
249 -H "anthropic-beta: managed-agents-2026-04-01" \
250 -H "content-type: application/json" \
251 -d '{
252 "agent": "agent_01J8XkN5uT3vHpLqRfWdY2",
253 "environment_id": "env_01K2mPsT7hNwR4jXuLvCqD8",
254 "resources": [
255 {
256 "type": "file",
257 "file_id": "file_011CNha8iCJcU1wXNR6q4V8w",
258 "mount_path": "/data.csv"
259 },
260 {
261 "type": "file",
262 "file_id": "file_011CPMxVD3fHLUhvTqtsQA5w",
263 "mount_path": "/config.json"
264 },
265 {
266 "type": "file",
267 "file_id": "file_011CRb3kQ7tWx9ZsLmDe2Vh4",
268 "mount_path": "/src/main.py"
269 }
270 ]
271 }'
251272 ```
252273
253 ```yaml CLI
254 resources:
255 - type: file
256 file_id: file_abc123
257 mount_path: /data.csv
258 - type: file
259 file_id: file_def456
260 mount_path: /config.json
261 - type: file
262 file_id: file_ghi789
263 mount_path: /src/main.py
264 ```
274 <MultiFileExample language="cli" label="CLI">
275 ```bash CLI
276 ant beta:sessions create \
277 --agent agent_01J8XkN5uT3vHpLqRfWdY2 \
278 --environment-id env_01K2mPsT7hNwR4jXuLvCqD8 < session.yaml
279 ```
280
281 <File filename="session.yaml">
282 ```yaml
283 resources:
284 - type: file
285 file_id: file_011CNha8iCJcU1wXNR6q4V8w
286 mount_path: /data.csv
287 - type: file
288 file_id: file_011CPMxVD3fHLUhvTqtsQA5w
289 mount_path: /config.json
290 - type: file
291 file_id: file_011CRb3kQ7tWx9ZsLmDe2Vh4
292 mount_path: /src/main.py
293 ```
294 </File>
295 </MultiFileExample>
265296
266297 ```python Python
267298 resources = [
managed-agents/multiagent-orchestration Changed · +3 / -2 lines
from line 258
258258* `{"type": "self"}` allows the coordinator to spawn copies of itself. If the session was created with [agent configuration overrides](https://platform.claude.com/docs/en/managed-agents/sessions#override-agent-configuration-for-a-session), those overrides also apply to these copies; roster entries referenced by ID are unaffected.
259259* `{"type": "advisor", "model": "<model id>"}` gives the session's primary thread an advisor it can consult mid-turn. At most one advisor entry per roster. See [Give the session an advisor](https://platform.claude.com/docs/en/managed-agents/multiagent-orchestration#give-the-session-an-advisor).
260260
261In an [`ant apply`](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/scripting#version-controlling-api-resources) agent file (the CLI tab), a roster entry can also be the path to another agent's file, such as `./reviewer.md`. Apply creates that agent first and replaces the path with a pinned `{"type": "agent", "id": ..., "version": ...}` reference.
261In an [`ant apply`](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/apply) agent file (the CLI tab), a roster entry can also be the path to another agent's file, such as `./reviewer.md`. Apply creates that agent first and replaces the path with a pinned `{"type": "agent", "id": ..., "version": ...}` reference.
262262
263263The coordinator's configuration, including its `multiagent.agents` roster, is snapshotted when the coordinator is created or updated. Referenced agents stay pinned to the versions resolved at that time and do not automatically pick up later updates to their definitions. To delegate to a newer version of a referenced agent, [update the coordinator](https://platform.claude.com/docs/en/managed-agents/agent-setup#update-an-agent) so its roster references that version.
264264
from line 821
821821
822822 ```typescript TypeScript
823823 for await (const thread of client.beta.sessions.threads.list(session.id)) {
824 console.log(`[${thread.agent.name}] ${thread.status}`);
824 const name = thread.agent.type === "agent" ? thread.agent.name : "advisor";
825 console.log(`[${name}] ${thread.status}`);
825826 }
826827 ```
827828
managed-agents/quickstart Changed · +19 / -8 lines
from line 37
3737 For Linux environments, download the release binary directly.
3838
3939 ```bash
40 VERSION=1.29.0
40 VERSION=1.30.0
4141 OS=$(uname -s | tr '[:upper:]' '[:lower:]')
4242 case $(uname -m) in
4343 x86_64) ARCH=amd64 ;;
from line 336
336336
337337 The `agent_toolset_20260401` tool type enables the full set of pre-built agent tools (bash, file operations, web search, and more). See [Tools](https://platform.claude.com/docs/en/managed-agents/tools) for the complete list and per-tool configuration options.
338338
339 Save the returned `agent.id` (the CLI's [`ant apply`](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/scripting#version-controlling-api-resources) prints it and records it in `claude-lock.json`). You'll reference it in every session you create.
339 Save the returned `agent.id` (the CLI's [`ant apply`](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/apply) prints it and records it in `claude-lock.json`). You'll reference it in every session you create.
340340 </Step>
341341
342342 <Step title="Create an environment">
from line 623
623623 match event.type:
624624 case "agent.message":
625625 for block in event.content:
626 print(block.text, end="")
626 if block.type == "text":
627 print(block.text, end="")
627628 case "agent.tool_use":
628629 print(f"\n[Using tool: {event.name}]")
629630 case "session.status_idle":
from line 654
653654 for await (const event of stream) {
654655 if (event.type === "agent.message") {
655656 for (const block of event.content) {
656 process.stdout.write(block.text);
657 if (block.type === "text") {
658 process.stdout.write(block.text);
659 }
657660 }
658661 } else if (event.type === "agent.tool_use") {
659662 console.log(`\n[Using tool: ${event.name}]`);
from line 697
694697 {
695698 foreach (var block in message.Content)
696699 {
697 Console.Write(block.Text);
700 if (block.Value is BetaManagedAgentsTextBlock textBlock)
701 {
702 Console.Write(textBlock.Text);
703 }
698704 }
699705 }
700706 else if (ev.Value is BetaManagedAgentsAgentToolUseEvent toolUse)
from line 743
737743 switch event := stream.Current().AsAny().(type) {
738744 case anthropic.BetaManagedAgentsAgentMessageEvent:
739745 for _, block := range event.Content {
740 fmt.Print(block.Text)
746 if block.Type == "text" {
747 fmt.Print(block.Text)
748 }
741749 }
742750 case anthropic.BetaManagedAgentsAgentToolUseEvent:
743751 fmt.Printf("\n[Using tool: %s]\n", event.Name)
from line 802
794802 // Process streaming events
795803 foreach ($stream as $event) {
796804 match ($event->type) {
797 'agent.message' => print(implode('', array_map(fn($block) => $block->text, $event->content))),
805 'agent.message' => array_walk(
806 $event->content,
807 static fn ($block) => $block->type === 'text' ? print($block->text) : null,
808 ),
798809 'agent.tool_use' => print("\n[Using tool: {$event->name}]\n"),
799810 'session.status_idle' => print("\n\nAgent finished.\n"),
800811 default => null,
from line 832
821832 stream.each do |event|
822833 case event.type
823834 in :"agent.message"
824 event.content.each { print it.text }
835 event.content.each { print it.text if it.type == :text }
825836 in :"agent.tool_use"
826837 puts "\n[Using tool: #{event.name}]"
827838 in :"session.status_idle"
agents-and-tools/mcp-tunnels/concepts Changed · +1 / -1 lines
from line 5
55---
66
77<Note>
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/claude-managed-agents) to try them.
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/mcp-tunnels) to try them.
99</Note>
1010
1111This page defines the terms used throughout the [MCP tunnels](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/overview) documentation. Several components appear under different names in configuration files, container images, and prose; the following tables give one canonical name for each and list the aliases you may encounter.
agents-and-tools/mcp-tunnels/console Changed · +1 / -1 lines
from line 5
55---
66
77<Note>
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/claude-managed-agents) to try them.
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/mcp-tunnels) to try them.
99</Note>
1010
1111This page covers the Console side of an MCP tunnels deployment: creating a tunnel, registering your CA certificate, retrieving the tunnel token, and attaching the [upstream MCP servers](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/concepts#components) to an agent. [Deploy MCP tunnels with Helm](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/deploy-helm) and [Deploy MCP tunnels with Docker Compose](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/deploy-compose) cover running the [tunnel stack](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/concepts#components) inside your network.
agents-and-tools/mcp-tunnels/deploy-compose Changed · +1 / -1 lines
from line 5
55---
66
77<Note>
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/claude-managed-agents) to try them.
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/mcp-tunnels) to try them.
99</Note>
1010
1111This guide deploys the [tunnel stack](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/concepts#components) as hardened containers on a single host. The same configuration can be replicated across multiple hosts for availability.
agents-and-tools/mcp-tunnels/deploy-helm Changed · +1 / -1 lines
from line 5
55---
66
77<Note>
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/claude-managed-agents) to try them.
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/mcp-tunnels) to try them.
99</Note>
1010
1111The Anthropic Helm chart installs the [tunnel stack](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/concepts#components) as a single Deployment and attaches it to your tunnel: one the chart's setup hook creates for you, or an existing tunnel you created in the [Console](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/console#create-a-tunnel).
agents-and-tools/mcp-tunnels/overview Changed · +1 / -1 lines
from line 7
77MCP tunnels let you connect Claude to Model Context Protocol (MCP) servers that run inside your private network. Traffic flows over an outbound-only connection, so you don't need to open inbound firewall ports, expose services to the public internet, or allowlist Anthropic's IP ranges on your origin.
88
99<Note>
10 MCP tunnels are in research preview. [Request access](https://claude.com/form/claude-managed-agents) to try them. They are provided "as-is" without any uptime, support, or continuity commitment, and they depend on a third-party network provider (Cloudflare) that makes no availability commitment for the underlying transport. Anthropic may modify or discontinue MCP tunnels at any time.
10 MCP tunnels are in research preview. [Request access](https://claude.com/form/mcp-tunnels) to try them. They are provided "as-is" without any uptime, support, or continuity commitment, and they depend on a third-party network provider (Cloudflare) that makes no availability commitment for the underlying transport. Anthropic may modify or discontinue MCP tunnels at any time.
1111</Note>
1212
1313For Zero Data Retention and HIPAA BAA eligibility, see [API and data retention](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention#feature-eligibility).
agents-and-tools/mcp-tunnels/quickstart Changed · +1 / -1 lines
from line 5
55---
66
77<Note>
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/claude-managed-agents) to try them.
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/mcp-tunnels) to try them.
99</Note>
1010
1111This quickstart takes you from zero to Claude calling a private MCP server through a tunnel. It uses Docker Compose with [manual](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/concepts#credential-provisioning) credential provisioning, which is the shortest path for local testing. For production deployments, see [Deploy with Helm](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/deploy-helm) or [Deploy with Docker Compose](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/deploy-compose).
agents-and-tools/mcp-tunnels/reference Changed · +1 / -1 lines
from line 5
55---
66
77<Note>
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/claude-managed-agents) to try them.
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/mcp-tunnels) to try them.
99</Note>
1010
1111## Proxy configuration
agents-and-tools/mcp-tunnels/security Changed · +1 / -1 lines
from line 5
55---
66
77<Note>
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/claude-managed-agents) to try them.
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/mcp-tunnels) to try them.
99</Note>
1010
1111The tunnel architecture provides strong defaults (outbound-only connectivity, end-to-end encryption, and IP validation), but the overall security of your [tunnel stack](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/concepts#components) also depends on how you configure and operate it. This page covers recommended hardening, breach response, and how to decommission a tunnel.
agents-and-tools/mcp-tunnels/troubleshooting Changed · +1 / -1 lines
from line 5
55---
66
77<Note>
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/claude-managed-agents) to try them.
8 MCP tunnels are in research preview. [Request access](https://claude.com/form/mcp-tunnels) to try them.
99</Note>
1010
1111A request through the tunnel can fail at one of three layers; diagnose them in order: the outbound connection to the [tunnel edge](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/concepts#components), the [inner TLS](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/concepts#components) from Anthropic to your [proxy](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/concepts#components), then routing and IP validation toward the [upstream MCP server](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/concepts#components).
build-with-claude/mid-conversation-system-messages Changed · +1 / -1 lines
from line 473
473473
474474You can still set the top-level `system` field for instructions that should apply to the entire conversation. Reserve mid-conversation system messages for instructions that only become relevant later, or that you want to add without invalidating the cached prefix.
475475
476A `role: "system"` message can also carry `output_config.effort` to change the [effort](https://platform.claude.com/docs/en/build-with-claude/effort) level from the next `user` turn on. This is in beta on Claude Fable 5.1, Claude Mythos 5.1, and Claude Opus 5 on the Claude API and requires the `mid-conversation-output-config-2026-07-01` beta header. See [Per-message effort](https://platform.claude.com/docs/en/build-with-claude/effort#change-effort-mid-conversation-beta).
476A `role: "system"` message can also carry `output_config.effort` to change the [effort](https://platform.claude.com/docs/en/build-with-claude/effort) level from the next `user` turn on. This is in beta on Claude Fable 5.1, Claude Mythos 5.1, and Claude Opus 5 on the Claude API and Google Cloud, and requires the `mid-conversation-output-config-2026-07-01` beta header. See [Per-message effort](https://platform.claude.com/docs/en/build-with-claude/effort#change-effort-mid-conversation-beta).
477477
478478<CodeGroup>
479479 ```bash cURL
build-with-claude/vision-coordinates Changed · +1 / -1 lines
from line 472
472472* [PDF pages](https://platform.claude.com/docs/en/build-with-claude/pdf-support) are rasterized server-side at dimensions you don't control; the `document` block does not accept the field (an image block nested inside a document's content accepts it like any other).
473473* A marked image whose dimensions cannot be determined is rejected rather than passed through: that rejection reports that the image's source dimensions could not be determined, not the resize message quoted above. No image that sets `"error"` reaches the model resized.
474474
475The [Token counting](https://platform.claude.com/docs/en/build-with-claude/token-counting) endpoint honors `transformations` too, rejecting an embedded image exactly as the Messages API would, so you can check whether an embedded image fits without being resized, before running inference. Counting never fetches images supplied by URL or file ID, so a marked image from those sources is checked only at Messages time, as described above.
475The [Token counting](https://platform.claude.com/docs/en/build-with-claude/token-counting) endpoint honors `transformations` too, rejecting an embedded image exactly as the Messages API would, so you can check whether an embedded image fits without being resized, before running inference. Counting rejects images supplied by URL or file ID rather than fetching them, so a marked image from those sources is checked only at Messages time.
476476
477477## Rescale coordinates when you cannot pre-resize
478478
manage-claude/api-and-data-retention Changed · +1 / -1 lines
from line 16
1616* Only what is technically necessary for the feature to work is retained. Conversation content (your prompts and Claude's outputs) is not retained by default; the exception is [Covered Models](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention#model-specific-data-retention-requirements), which require 30-day retention.
1717* Retained data is purged on the shortest practical time to live (TTL), and Anthropic aims to give customers control over how long data is retained. What is held, and the retention duration where a specific TTL applies, is documented on each feature's page.
1818
19Several retention models sit outside the ZDR and HIPAA arrangements described on this page. Data accessible through the [Compliance API](https://platform.claude.com/docs/en/manage-claude/compliance-api) follows its own retention model. The [Activity Feed](https://platform.claude.com/docs/en/manage-claude/compliance-activity-feed) retains data for 6 years. Chat, file, and project content from claude.ai follows your organization's retention policy set in [claude.ai > Organization settings > Data and privacy](https://claude.ai/admin-settings/data-privacy-controls). [Local session transcripts](https://platform.claude.com/docs/en/manage-claude/compliance-sessions#retrieve-local-sessions) (from sessions on users' machines, in apps such as Cowork and Claude Code) are stored for 6 years by default, or for your organization's custom conversation retention period when a finite one is set (the same claude.ai setting). [Remote session transcripts](https://platform.claude.com/docs/en/manage-claude/compliance-sessions#retrieve-remote-sessions) (Cowork in the cloud) are retained for 6 years, unless a user deletes the session sooner. The Compliance API does not capture local sessions for which ZDR is in effect, or any local sessions from organizations with HIPAA readiness enabled.
19Several retention models sit outside the ZDR and HIPAA arrangements described on this page. Data accessible through the [Compliance API](https://platform.claude.com/docs/en/manage-claude/compliance-api) follows its own retention model. The [Activity Feed](https://platform.claude.com/docs/en/manage-claude/compliance-activity-feed) retains data for 6 years. Chat, file, and project content from claude.ai follows your organization's retention policy set in [claude.ai > Organization settings > Data and privacy](https://claude.ai/admin-settings/data-privacy-controls), unless a user deletes it sooner. [Local session transcripts](https://platform.claude.com/docs/en/manage-claude/compliance-sessions#retrieve-local-sessions) (from sessions on users' machines, in apps such as Cowork and Claude Code) are stored for 6 years by default, or for your organization's custom conversation retention period when a finite one is set (the same claude.ai setting). [Remote session transcripts](https://platform.claude.com/docs/en/manage-claude/compliance-sessions#retrieve-remote-sessions) (Cowork in the cloud) are retained for 6 years, unless a user deletes the session sooner. The Compliance API does not capture local sessions for which ZDR is in effect, or any local sessions from organizations with HIPAA readiness enabled.
2020
2121## Zero data retention (ZDR)
2222
managed-agents/migration Changed · +3 / -1 lines
from line 907
907907 {
908908 if (streamEvent.Value is BetaManagedAgentsAgentMessageEvent message)
909909 {
910 Console.WriteLine(string.Concat(message.Content.Select(block => block.Text)));
910 var text = string.Concat(message.Content.Select(block =>
911 block.Value is BetaManagedAgentsTextBlock textBlock ? textBlock.Text : ""));
912 Console.WriteLine(text);
911913 }
912914 else if (streamEvent.Value is BetaManagedAgentsAgentCustomToolUseEvent toolUse)
913915 {
managed-agents/self-hosted-sandboxes Changed · +2 / -2 lines
from line 214
214214 For Linux environments, download the release binary directly.
215215
216216 ```bash
217 VERSION=1.29.0
217 VERSION=1.30.0
218218 OS=$(uname -s | tr '[:upper:]' '[:lower:]')
219219 case $(uname -m) in
220220 x86_64) ARCH=amd64 ;;
from line 252
252252
253253 ```text
254254 FROM your-base-image
255 ARG ANT_VERSION=1.29.0
255 ARG ANT_VERSION=1.30.0
256256 ARG TARGETARCH
257257 RUN ARCH=$([ "$TARGETARCH" = "arm64" ] && echo arm64 || echo amd64) && \
258258 curl -fsSL "https://github.com/anthropics/anthropic-cli/releases/download/v${ANT_VERSION}/ant_${ANT_VERSION}_linux_${ARCH}.tar.gz" \
models/fable-5-1/migration-guide Changed · +2 / -2 lines
from line 1561
15611561* If your interface renders progress text between tool calls, set `thinking.display` to `"updates"` (beta) or `"summarized"` and prompt for updates.
15621562* If you change effort between requests, move the change to a [per-message effort](https://platform.claude.com/docs/en/build-with-claude/effort#change-effort-mid-conversation-beta) `role: "system"` message (beta) to keep cache hits.
15631563* Handle `stop_reason: "refusal"` and read `stop_details.category`. Consider `fallbacks: "default"` (beta).
1564* Re-evaluate `effort` with a fresh sweep, starting at `high`, and re-baseline cost and latency on your own workloads. Token counts are roughly unchanged. Prompt cache reads cost a quarter of the Claude Fable 5 rate.
1564* Re-evaluate `effort` with a fresh sweep, starting at `high`, and re-baseline cost and latency on your own workloads. The tokenizer is unchanged. Prompt cache reads cost a quarter of the Claude Fable 5 rate.
15651565
15661566## Migrating to Claude Fable 5.1 from Claude Opus 5
15671567
from line 1601
16011601* Replace forced `tool_choice` (`any` or `tool`) with `auto` plus an explicit instruction (`user` turn or mid-conversation system message) and `strict: true` tools, or with JSON outputs.
16021602* If your interface renders text between tool calls, set `display: "updates"` (beta) or `"summarized"` and render the non-empty `thinking` blocks.
16031603* Apply the preserved-thinking, history-editing, behavior, effort, and fallback items from the [Claude Fable 5 checklist](https://platform.claude.com/docs/en/models/fable-5-1/migration-guide#migration-checklist-fable-5-1-from-fable-5).
1604* Re-baseline cost on your own workloads. Token counts are roughly unchanged. Per-token pricing differs.
1604* Re-baseline cost on your own workloads. The tokenizer is unchanged. Per-token pricing differs.
16051605
16061606## Migrating to Claude Fable 5.1 from Claude Opus 4.8 or earlier
16071607
models/fable-5-1/whats-new-fable-5-1 Changed · +2 / -2 lines
from line 65
6565
6666### Change effort mid-conversation (beta)
6767
68On Claude Fable 5.1 you can change the [effort](https://platform.claude.com/docs/en/build-with-claude/effort) level mid-conversation without invalidating the prompt cache. Raise it for a hard step and lower it for routine ones. Per-message effort is in beta: include the `mid-conversation-output-config-2026-07-01` beta header. Claude Fable 5.1, Claude Mythos 5.1, and Claude Opus 5 support it on the Claude API.
68On Claude Fable 5.1 you can change the [effort](https://platform.claude.com/docs/en/build-with-claude/effort) level mid-conversation without invalidating the prompt cache. Raise it for a hard step and lower it for routine ones. Per-message effort is in beta: include the `mid-conversation-output-config-2026-07-01` beta header. Claude Fable 5.1, Claude Mythos 5.1, and Claude Opus 5 support it on the Claude API and Google Cloud.
6969
7070<CodeGroup>
7171 ```bash cURL
from line 477
4774772. Pass thinking blocks back unchanged and keep the history append-only. If your code builds the `messages` array itself, run the [history-editing check](https://platform.claude.com/docs/en/models/fable-5-1/migration-guide#fable-5-1-preserved-thinking): move per-turn reminders you currently inject and delete to [turn-scoped system messages](https://platform.claude.com/docs/en/models/fable-5-1/whats-new-fable-5-1#turn-scoped-system-messages-beta), move `system` and `tools` changes to mid-conversation system messages, trim context server-side or strip thinking blocks from turns you carry across a client-side summary, then pick a production [`prefix_mismatch_behavior`](https://platform.claude.com/docs/en/build-with-claude/thinking#preserved-thinking-controls) and monitor `input_transformations`.
4784783. Re-tune effort from the default (`high`), and consider [changing it mid-conversation](https://platform.claude.com/docs/en/models/fable-5-1/whats-new-fable-5-1#change-effort-mid-conversation-beta) instead of holding one level for the whole session.
4794794. In agent loops, watch for one tool call per turn where Claude Fable 5 batched several, and add the per-turn note from [Prompting Claude Fable 5.1](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-fable-5-1).
4805. Re-run your evals. Refusal handling, fallback, fallback credit, and token counts carry over unchanged. Cache reads cost less (see [Pricing](https://platform.claude.com/docs/en/models/fable-5-1/whats-new-fable-5-1#pricing)), and default behavior differs in the ways listed under [Changed from Claude Fable 5](https://platform.claude.com/docs/en/models/fable-5-1/whats-new-fable-5-1#changed-from-claude-fable-5).
4805. Re-run your evals. Refusal handling, fallback, fallback credit, and the tokenizer carry over unchanged. Cache reads cost less (see [Pricing](https://platform.claude.com/docs/en/models/fable-5-1/whats-new-fable-5-1#pricing)), and default behavior differs in the ways listed under [Changed from Claude Fable 5](https://platform.claude.com/docs/en/models/fable-5-1/whats-new-fable-5-1#changed-from-claude-fable-5).
481481
482482See the [migration guide](https://platform.claude.com/docs/en/models/fable-5-1/migration-guide) for step-by-step instructions, including from Claude Opus 5 and earlier models.
483483
release-notes/overview Changed · +1 / -0 lines
from line 15
1515### September 3, 2026
1616
1717* Version 1.30.0 of the `ant` CLI adds `ant apply`, which creates and updates agents, environments, skills, memory stores, and deployments from files in your repository. Describe each resource in a file, run `ant apply`, and approve the plan it prints. Commit the `claude-lock.json` lockfile it writes so that later runs, on your machine or in CI, update the same resources instead of creating new ones. See [Manage resources as code with ant apply](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/apply).
18* [Per-message effort](https://platform.claude.com/docs/en/build-with-claude/effort#change-effort-mid-conversation-beta) changes, in beta, are also available on [Google Cloud](https://platform.claude.com/docs/en/build-with-claude/claude-on-vertex-ai) for Claude Fable 5.1, Claude Mythos 5.1, and Claude Opus 5, with the same `mid-conversation-output-config-2026-07-01` beta header.
1819
1920### September 1, 2026
2021