Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
264 changes: 132 additions & 132 deletions content/.metadata.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions content/en/agents-and-tools/tool-use/server-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ When using domain filters:
Invalid domain formats are rejected at request time with a 400 `invalid_request_error`.

<Note>
Request-level domain restrictions work together with any organization-level domain restrictions configured in Claude Console. Request-level `allowed_domains` must be a subset of the organization-level allowed list; entries outside it cause the API to return a validation error. A request-level allowed list that includes a domain your organization blocks is rejected with a `400` error that names the conflicting entries.
In a Messages API request, request-level domain restrictions work together with any organization-level domain restrictions configured in Claude Console. Request-level `allowed_domains` must be a subset of the organization-level allowed list; entries outside it cause the API to return a validation error. A request-level allowed list that includes a domain your organization blocks is rejected with a `400` error that names the conflicting entries.
</Note>

<Warning>
Expand All @@ -1073,7 +1073,7 @@ Invalid domain formats are rejected at request time with a 400 `invalid_request_

[Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) uses the same `allowed_domains` and `blocked_domains` fields on the `web_search` and `web_fetch` entries of the agent toolset. On Managed Agents, each list holds at most 64 entries, domains listed for `web_fetch` cannot include a path, and fields specific to the Messages API tools, such as `max_uses`, `citations`, and `cache_control`, are not available. See [Domain list rules](https://platform.claude.com/docs/en/managed-agents/tools-web-restrictions#domain-list-rules) for the full rules.

Organization-level web search and web fetch settings in the Claude Console apply to Messages API requests only. They do not apply to Managed Agents sessions, which use the per-tool lists on the agent toolset instead. For a session in a cloud environment with `limited` networking, the environment's `allowed_hosts` also applies to `web_search` and `web_fetch`; see [Networking](https://platform.claude.com/docs/en/managed-agents/environments#networking). The per-tool lists restrict these tools further, within the hosts that `allowed_hosts` allows.
Your organization's web search settings on the [**Capabilities**](https://platform.claude.com/settings/capabilities) page of the Claude Console apply to Messages API requests and to Managed Agents sessions. In a session, the agent receives only the search results that both the organization's domain restrictions and the agent's per-tool lists allow. For a session in a cloud environment with `limited` networking, the environment's `allowed_hosts` also applies to `web_search` and `web_fetch`; see [Networking](https://platform.claude.com/docs/en/managed-agents/environments#networking). The per-tool lists restrict these tools further, within the hosts that `allowed_hosts` allows.

## Dynamic filtering with code execution

Expand Down
4 changes: 2 additions & 2 deletions content/en/agents-and-tools/tool-use/web-search-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ The following examples use `web_search_20260318`:
## How to use web search

<Note>
Web search is enabled for your organization unless an administrator has disabled it in the [Claude Console](https://platform.claude.com/settings/capabilities), where they can also restrict which domains it searches. If it's disabled, a request that includes the tool fails with a 400 `invalid_request_error` that says web search is not enabled, rather than an [error code](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool#errors) inside a search result.
Web search is enabled for your organization unless an administrator has disabled it in the [Claude Console](https://platform.claude.com/settings/capabilities), where they can also restrict which domains it searches. If it's disabled, a Messages API request that includes the tool fails with a 400 `invalid_request_error` that says web search is not enabled, rather than an [error code](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool#errors) inside a search result. With web search off, `web_search` calls in a [Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) session return an error result to the agent, and the session continues.
</Note>

These organization-level settings in the Claude Console apply to Messages API requests only. [Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) sessions use the per-tool `allowed_domains` and `blocked_domains` lists on the agent toolset instead; see [Restrict web search and web fetch domains](https://platform.claude.com/docs/en/managed-agents/tools-web-restrictions). For a session in a cloud environment with `limited` networking, the environment's `allowed_hosts` also applies to `web_search` and `web_fetch`; see [Networking](https://platform.claude.com/docs/en/managed-agents/environments#networking). The per-tool lists restrict these tools further, within the hosts that `allowed_hosts` allows.
Your organization's web search settings in the Claude Console apply to Messages API requests and to Managed Agents sessions. In a session, the agent receives only the search results that both the organization's domain restrictions and the agent's per-tool lists allow; see [Restrict web search and web fetch domains](https://platform.claude.com/docs/en/managed-agents/tools-web-restrictions). For a session in a cloud environment with `limited` networking, the environment's `allowed_hosts` also applies to `web_search` and `web_fetch`; see [Networking](https://platform.claude.com/docs/en/managed-agents/environments#networking). The per-tool lists restrict these tools further, within the hosts that `allowed_hosts` allows.

Provide the web search tool in your API request:

Expand Down
2 changes: 1 addition & 1 deletion content/en/api/opentelemetry/spans.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ The span has the [token usage attributes](https://platform.claude.com/docs/en/ap
| `anthropic.request.service_tier` | `string` | The request's [`service_tier`](https://platform.claude.com/docs/en/api/messages/create#create.service_tier). Absent when the request doesn't set it. |
| `anthropic.thinking.type` | `string` | The request's [`thinking.type`](https://platform.claude.com/docs/en/api/messages/create#create.thinking). Absent when the request doesn't set it. |
| `anthropic.thinking.budget_tokens` | `int` | The [`budget_tokens`](https://platform.claude.com/docs/en/api/messages#thinking_config_enabled.budget_tokens) in the request's [`thinking`](https://platform.claude.com/docs/en/api/messages/create#create.thinking) object. Absent when the request doesn't set it. |
| `anthropic.beta` | `string[]` | Only on the SDK span. The beta names in the request's [`anthropic-beta`](https://platform.claude.com/docs/en/api/beta/messages/create#create.betas) header. |
| `anthropic.beta` | `string[]` | The beta names in the request's [`anthropic-beta`](https://platform.claude.com/docs/en/api/beta/messages/create#create.betas) header. |
| `gen_ai.system_instructions` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`SystemInstructions`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-system-instructions.json) schema. The request's [`system`](https://platform.claude.com/docs/en/api/messages/create#create.system) prompt. |
| `gen_ai.input.messages` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`InputMessages`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-input-messages.json) schema. The request's [`messages`](https://platform.claude.com/docs/en/api/messages/create#create.messages). |
| `gen_ai.output.messages` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`OutputMessages`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-output-messages.json) schema. The response's [`content`](https://platform.claude.com/docs/en/api/messages/create#message), as one `assistant` message.<br />**SDK:** On a stream, only when the application reads the stream as [Tracing a stream](https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk#trace-a-stream) describes. |
Expand Down
2 changes: 1 addition & 1 deletion content/en/build-with-claude/compaction-threshold.md
Original file line number Diff line number Diff line change
Expand Up @@ -2918,7 +2918,7 @@ Here's an example that uses `pause_after_compaction` to preserve the prior excha
}
: message
)
.filter((message) => message.content.length > 0);
.filter((message) => message.role !== "assistant" || message.content.length > 0);

// Build new message list: compaction + preserved messages
const messagesAfterCompaction: Anthropic.Beta.Messages.BetaMessageParam[] = [
Expand Down
49 changes: 24 additions & 25 deletions content/en/build-with-claude/search-results.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ Returning search results from your custom tools enables dynamic RAG applications


# Build up the conversation in a list, starting with the user's question
messages = [
MessageParam(role="user", content="How do I configure the timeout settings?")
messages: list[MessageParam] = [
{"role": "user", "content": "How do I configure the timeout settings?"}
]

# Create a message with the tool
Expand All @@ -157,18 +157,18 @@ Returning search results from your custom tools enables dynamic RAG applications
tool_result = search_knowledge_base(tool_use.input["query"])

# Append Claude's turn, then the tool result, to the running conversation
messages.append(MessageParam(role="assistant", content=response.content))
messages.append({"role": "assistant", "content": response.content})
messages.append(
MessageParam(
role="user",
content=[
{
"role": "user",
"content": [
ToolResultBlockParam(
type="tool_result",
tool_use_id=tool_use.id,
content=tool_result, # Search results go here
)
],
)
}
)

# Send the tool result back
Expand Down Expand Up @@ -870,7 +870,7 @@ You can also provide search results directly in user messages. This is useful fo
```

```python Python
from anthropic.types import MessageParam, TextBlockParam, SearchResultBlockParam
from anthropic.types import TextBlockParam, SearchResultBlockParam

client = Anthropic()

Expand All @@ -879,9 +879,9 @@ You can also provide search results directly in user messages. This is useful fo
model="claude-opus-5-5",
max_tokens=1024,
messages=[
MessageParam(
role="user",
content=[
{
"role": "user",
"content": [
SearchResultBlockParam(
type="search_result",
source="https://docs.company.com/api-reference",
Expand Down Expand Up @@ -911,7 +911,7 @@ You can also provide search results directly in user messages. This is useful fo
text="Based on these search results, how do I authenticate API requests and what are the rate limits?",
),
],
)
}
],
)

Expand Down Expand Up @@ -1439,7 +1439,6 @@ The following example replays a complete conversation. The first user message ca

```python Python
from anthropic.types import (
MessageParam,
SearchResultBlockParam,
TextBlockParam,
ToolResultBlockParam,
Expand All @@ -1465,9 +1464,9 @@ The following example replays a complete conversation. The first user message ca
max_tokens=1024,
tools=[knowledge_base_tool],
messages=[
MessageParam(
role="user",
content=[
{
"role": "user",
"content": [
SearchResultBlockParam(
type="search_result",
source="https://docs.company.com/overview",
Expand All @@ -1485,10 +1484,10 @@ The following example replays a complete conversation. The first user message ca
text="What does Acme Dashboard do, and what plans is it available on?",
),
],
),
MessageParam(
role="assistant",
content=[
},
{
"role": "assistant",
"content": [
TextBlockParam(
type="text", text="Let me check the pricing information."
),
Expand All @@ -1499,10 +1498,10 @@ The following example replays a complete conversation. The first user message ca
input={"query": "Acme Dashboard pricing plans"},
),
],
),
MessageParam(
role="user",
content=[
},
{
"role": "user",
"content": [
ToolResultBlockParam(
type="tool_result",
tool_use_id="toolu_01A09q90qw90lq917835lq9",
Expand All @@ -1522,7 +1521,7 @@ The following example replays a complete conversation. The first user message ca
],
)
],
),
},
],
)

Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/claude-code/agent-sdk/subagents.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Focus on:
| `tools` | `string[]` | No | Array of allowed tool names. If omitted, inherits every [tool available to subagents](/docs/en/sub-agents#available-tools) |
| `disallowedTools` | `string[]` | No | Array of tool names to remove from the agent's tool set. MCP server-level patterns are also accepted: `mcp__server` or `mcp__server__*` removes every tool from that server, and `mcp__*` removes every MCP tool from any server |
| `model` | `string` | No | Model override for this agent. Accepts an alias such as `'fable'`, `'opus'`, `'sonnet'`, `'haiku'`, `'inherit'`, or a full model ID. `'inherit'` uses the main model. When you omit it, Claude Code picks the model in the [subagent model order](/docs/en/sub-agents#choose-a-model) |
| `skills` | `string[]` | No | List of skill names to preload into the agent's context at startup. Unlisted skills remain invocable through the Skill tool |
| `skills` | `string[]` | No | List of skill names to preload into the agent's context at startup. At most the [first 32 distinct names](/docs/en/sub-agents#preload-skills-into-subagents) in the list are preloaded. Unlisted skills remain invocable through the Skill tool |
| `memory` | `'user' \| 'project' \| 'local'` | No | Memory source for this agent |
| `mcpServers` | `(string \| object)[]` | No | MCP servers available to this agent, by name or inline config |
| `initialPrompt` | `string` | No | Auto-submitted as the first user turn when this agent runs as the main thread agent. Ignored when the agent is invoked as a subagent |
Expand Down Expand Up @@ -323,7 +323,7 @@ for await (const message of query({

Claude invokes subagents through the Agent tool. To detect when a subagent is invoked, check for `tool_use` blocks where `name` is `"Agent"`.

Messages from within a subagent's context include a `parent_tool_use_id` field. In TypeScript, each assistant and user message a subagent produces also carries [`agent_id`](/docs/en/agent-sdk/typescript#sdkassistantmessage): the `task_id` of that subagent's [task events](/docs/en/agent-sdk/typescript#sdktaskstartedmessage). `agent_id` requires TypeScript Agent SDK v0.3.292 or later.
Messages from within a subagent's context include a `parent_tool_use_id` field. In TypeScript, each assistant and user message a subagent produces also carries [`agent_id`](/docs/en/agent-sdk/typescript#sdkassistantmessage): the `task_id` of that subagent's [task events](/docs/en/agent-sdk/typescript#sdktaskstartedmessage). `agent_id` stays the same when you [resume the subagent](#resume-subagents). `agent_id` requires TypeScript Agent SDK v0.3.292 or later.

> [!NOTE]
>
Expand Down
Loading
Loading