# Beta

## Domain Types

### Beta API Error

- `class BetaApiError:`

  - `required string Message`

  - `JsonElement Type "api_error"constant`

### Beta Authentication Error

- `class BetaAuthenticationError:`

  - `required string Message`

  - `JsonElement Type "authentication_error"constant`

### Beta Billing Error

- `class BetaBillingError:`

  - `required string Message`

  - `JsonElement Type "billing_error"constant`

### Beta Error

- `class BetaError: A class that can be one of several variants.union`

  - `class BetaInvalidRequestError:`

    - `required string Message`

    - `JsonElement Type "invalid_request_error"constant`

  - `class BetaAuthenticationError:`

    - `required string Message`

    - `JsonElement Type "authentication_error"constant`

  - `class BetaBillingError:`

    - `required string Message`

    - `JsonElement Type "billing_error"constant`

  - `class BetaPermissionError:`

    - `required string Message`

    - `JsonElement Type "permission_error"constant`

  - `class BetaNotFoundError:`

    - `required string Message`

    - `JsonElement Type "not_found_error"constant`

  - `class BetaRateLimitError:`

    - `required string Message`

    - `JsonElement Type "rate_limit_error"constant`

  - `class BetaGatewayTimeoutError:`

    - `required string Message`

    - `JsonElement Type "timeout_error"constant`

  - `class BetaApiError:`

    - `required string Message`

    - `JsonElement Type "api_error"constant`

  - `class BetaOverloadedError:`

    - `required string Message`

    - `JsonElement Type "overloaded_error"constant`

### Beta Error Response

- `class BetaErrorResponse:`

  - `required BetaError Error`

    - `class BetaInvalidRequestError:`

      - `required string Message`

      - `JsonElement Type "invalid_request_error"constant`

    - `class BetaAuthenticationError:`

      - `required string Message`

      - `JsonElement Type "authentication_error"constant`

    - `class BetaBillingError:`

      - `required string Message`

      - `JsonElement Type "billing_error"constant`

    - `class BetaPermissionError:`

      - `required string Message`

      - `JsonElement Type "permission_error"constant`

    - `class BetaNotFoundError:`

      - `required string Message`

      - `JsonElement Type "not_found_error"constant`

    - `class BetaRateLimitError:`

      - `required string Message`

      - `JsonElement Type "rate_limit_error"constant`

    - `class BetaGatewayTimeoutError:`

      - `required string Message`

      - `JsonElement Type "timeout_error"constant`

    - `class BetaApiError:`

      - `required string Message`

      - `JsonElement Type "api_error"constant`

    - `class BetaOverloadedError:`

      - `required string Message`

      - `JsonElement Type "overloaded_error"constant`

  - `required string? RequestID`

  - `JsonElement Type "error"constant`

### Beta Gateway Timeout Error

- `class BetaGatewayTimeoutError:`

  - `required string Message`

  - `JsonElement Type "timeout_error"constant`

### Beta Invalid Request Error

- `class BetaInvalidRequestError:`

  - `required string Message`

  - `JsonElement Type "invalid_request_error"constant`

### Beta Not Found Error

- `class BetaNotFoundError:`

  - `required string Message`

  - `JsonElement Type "not_found_error"constant`

### Beta Overloaded Error

- `class BetaOverloadedError:`

  - `required string Message`

  - `JsonElement Type "overloaded_error"constant`

### Beta Permission Error

- `class BetaPermissionError:`

  - `required string Message`

  - `JsonElement Type "permission_error"constant`

### Beta Rate Limit Error

- `class BetaRateLimitError:`

  - `required string Message`

  - `JsonElement Type "rate_limit_error"constant`

# Models

## List Models

`ModelListPageResponse Beta.Models.List(ModelListParams?parameters, CancellationTokencancellationToken = default)`

**get** `/v1/models`

List available models.

The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first.

### Parameters

- `ModelListParams parameters`

  - `string afterID`

    Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.

  - `string beforeID`

    Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.

  - `Long limit`

    Query param: Number of items to return per page.

    Defaults to `20`. Ranges from `1` to `1000`.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class ModelListPageResponse:`

  - `required IReadOnlyList<BetaModelInfo> Data`

    - `required string ID`

      Unique model identifier.

    - `required BetaModelCapabilities? Capabilities`

      Model capability information.

      - `required BetaCapabilitySupport Batch`

        Whether the model supports the Batch API.

        - `required Boolean Supported`

          Whether this capability is supported by the model.

      - `required BetaCapabilitySupport Citations`

        Whether the model supports citation generation.

      - `required BetaCapabilitySupport CodeExecution`

        Whether the model supports code execution tools.

      - `required BetaContextManagementCapability ContextManagement`

        Context management support and available strategies.

        - `required BetaCapabilitySupport? ClearThinking20251015`

          Indicates whether a capability is supported.

        - `required BetaCapabilitySupport? ClearToolUses20250919`

          Indicates whether a capability is supported.

        - `required BetaCapabilitySupport? Compact20260112`

          Indicates whether a capability is supported.

        - `required Boolean Supported`

          Whether this capability is supported by the model.

      - `required BetaEffortCapability Effort`

        Effort (reasoning_effort) support and available levels.

        - `required BetaCapabilitySupport High`

          Whether the model supports high effort level.

        - `required BetaCapabilitySupport Low`

          Whether the model supports low effort level.

        - `required BetaCapabilitySupport Max`

          Whether the model supports max effort level.

        - `required BetaCapabilitySupport Medium`

          Whether the model supports medium effort level.

        - `required Boolean Supported`

          Whether this capability is supported by the model.

        - `required BetaCapabilitySupport? Xhigh`

          Indicates whether a capability is supported.

      - `required BetaCapabilitySupport ImageInput`

        Whether the model accepts image content blocks.

      - `required BetaCapabilitySupport PdfInput`

        Whether the model accepts PDF content blocks.

      - `required BetaCapabilitySupport StructuredOutputs`

        Whether the model supports structured output / JSON mode / strict tool schemas.

      - `required BetaThinkingCapability Thinking`

        Thinking capability and supported type configurations.

        - `required Boolean Supported`

          Whether this capability is supported by the model.

        - `required BetaThinkingTypes Types`

          Supported thinking type configurations.

          - `required BetaCapabilitySupport Adaptive`

            Whether the model supports thinking with type 'adaptive' (auto).

          - `required BetaCapabilitySupport Enabled`

            Whether the model supports thinking with type 'enabled'.

    - `required DateTimeOffset CreatedAt`

      RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.

    - `required string DisplayName`

      A human-readable name for the model.

    - `required Long? MaxInputTokens`

      Maximum input context window size in tokens for this model.

    - `required Long? MaxTokens`

      Maximum value for the `max_tokens` parameter when using this model.

    - `JsonElement Type "model"constant`

      Object type.

      For Models, this is always `"model"`.

  - `required string? FirstID`

    First ID in the `data` list. Can be used as the `before_id` for the previous page.

  - `required Boolean HasMore`

    Indicates if there are more results in the requested page direction.

  - `required string? LastID`

    Last ID in the `data` list. Can be used as the `after_id` for the next page.

### Example

```csharp
ModelListParams parameters = new();

var page = await client.Beta.Models.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "claude-opus-4-6",
      "capabilities": {
        "batch": {
          "supported": true
        },
        "citations": {
          "supported": true
        },
        "code_execution": {
          "supported": true
        },
        "context_management": {
          "clear_thinking_20251015": {
            "supported": true
          },
          "clear_tool_uses_20250919": {
            "supported": true
          },
          "compact_20260112": {
            "supported": true
          },
          "supported": true
        },
        "effort": {
          "high": {
            "supported": true
          },
          "low": {
            "supported": true
          },
          "max": {
            "supported": true
          },
          "medium": {
            "supported": true
          },
          "supported": true,
          "xhigh": {
            "supported": true
          }
        },
        "image_input": {
          "supported": true
        },
        "pdf_input": {
          "supported": true
        },
        "structured_outputs": {
          "supported": true
        },
        "thinking": {
          "supported": true,
          "types": {
            "adaptive": {
              "supported": true
            },
            "enabled": {
              "supported": true
            }
          }
        }
      },
      "created_at": "2026-02-04T00:00:00Z",
      "display_name": "Claude Opus 4.6",
      "max_input_tokens": 0,
      "max_tokens": 0,
      "type": "model"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id"
}
```

## Get a Model

`BetaModelInfo Beta.Models.Retrieve(ModelRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/models/{model_id}`

Get a specific model.

The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID.

### Parameters

- `ModelRetrieveParams parameters`

  - `required string modelID`

    Model identifier or alias.

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaModelInfo:`

  - `required string ID`

    Unique model identifier.

  - `required BetaModelCapabilities? Capabilities`

    Model capability information.

    - `required BetaCapabilitySupport Batch`

      Whether the model supports the Batch API.

      - `required Boolean Supported`

        Whether this capability is supported by the model.

    - `required BetaCapabilitySupport Citations`

      Whether the model supports citation generation.

    - `required BetaCapabilitySupport CodeExecution`

      Whether the model supports code execution tools.

    - `required BetaContextManagementCapability ContextManagement`

      Context management support and available strategies.

      - `required BetaCapabilitySupport? ClearThinking20251015`

        Indicates whether a capability is supported.

      - `required BetaCapabilitySupport? ClearToolUses20250919`

        Indicates whether a capability is supported.

      - `required BetaCapabilitySupport? Compact20260112`

        Indicates whether a capability is supported.

      - `required Boolean Supported`

        Whether this capability is supported by the model.

    - `required BetaEffortCapability Effort`

      Effort (reasoning_effort) support and available levels.

      - `required BetaCapabilitySupport High`

        Whether the model supports high effort level.

      - `required BetaCapabilitySupport Low`

        Whether the model supports low effort level.

      - `required BetaCapabilitySupport Max`

        Whether the model supports max effort level.

      - `required BetaCapabilitySupport Medium`

        Whether the model supports medium effort level.

      - `required Boolean Supported`

        Whether this capability is supported by the model.

      - `required BetaCapabilitySupport? Xhigh`

        Indicates whether a capability is supported.

    - `required BetaCapabilitySupport ImageInput`

      Whether the model accepts image content blocks.

    - `required BetaCapabilitySupport PdfInput`

      Whether the model accepts PDF content blocks.

    - `required BetaCapabilitySupport StructuredOutputs`

      Whether the model supports structured output / JSON mode / strict tool schemas.

    - `required BetaThinkingCapability Thinking`

      Thinking capability and supported type configurations.

      - `required Boolean Supported`

        Whether this capability is supported by the model.

      - `required BetaThinkingTypes Types`

        Supported thinking type configurations.

        - `required BetaCapabilitySupport Adaptive`

          Whether the model supports thinking with type 'adaptive' (auto).

        - `required BetaCapabilitySupport Enabled`

          Whether the model supports thinking with type 'enabled'.

  - `required DateTimeOffset CreatedAt`

    RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.

  - `required string DisplayName`

    A human-readable name for the model.

  - `required Long? MaxInputTokens`

    Maximum input context window size in tokens for this model.

  - `required Long? MaxTokens`

    Maximum value for the `max_tokens` parameter when using this model.

  - `JsonElement Type "model"constant`

    Object type.

    For Models, this is always `"model"`.

### Example

```csharp
ModelRetrieveParams parameters = new() { ModelID = "model_id" };

var betaModelInfo = await client.Beta.Models.Retrieve(parameters);

Console.WriteLine(betaModelInfo);
```

#### Response

```json
{
  "id": "claude-opus-4-6",
  "capabilities": {
    "batch": {
      "supported": true
    },
    "citations": {
      "supported": true
    },
    "code_execution": {
      "supported": true
    },
    "context_management": {
      "clear_thinking_20251015": {
        "supported": true
      },
      "clear_tool_uses_20250919": {
        "supported": true
      },
      "compact_20260112": {
        "supported": true
      },
      "supported": true
    },
    "effort": {
      "high": {
        "supported": true
      },
      "low": {
        "supported": true
      },
      "max": {
        "supported": true
      },
      "medium": {
        "supported": true
      },
      "supported": true,
      "xhigh": {
        "supported": true
      }
    },
    "image_input": {
      "supported": true
    },
    "pdf_input": {
      "supported": true
    },
    "structured_outputs": {
      "supported": true
    },
    "thinking": {
      "supported": true,
      "types": {
        "adaptive": {
          "supported": true
        },
        "enabled": {
          "supported": true
        }
      }
    }
  },
  "created_at": "2026-02-04T00:00:00Z",
  "display_name": "Claude Opus 4.6",
  "max_input_tokens": 0,
  "max_tokens": 0,
  "type": "model"
}
```

## Domain Types

### Beta Capability Support

- `class BetaCapabilitySupport:`

  Indicates whether a capability is supported.

  - `required Boolean Supported`

    Whether this capability is supported by the model.

### Beta Context Management Capability

- `class BetaContextManagementCapability:`

  Context management capability details.

  - `required BetaCapabilitySupport? ClearThinking20251015`

    Indicates whether a capability is supported.

    - `required Boolean Supported`

      Whether this capability is supported by the model.

  - `required BetaCapabilitySupport? ClearToolUses20250919`

    Indicates whether a capability is supported.

  - `required BetaCapabilitySupport? Compact20260112`

    Indicates whether a capability is supported.

  - `required Boolean Supported`

    Whether this capability is supported by the model.

### Beta Effort Capability

- `class BetaEffortCapability:`

  Effort (reasoning_effort) capability details.

  - `required BetaCapabilitySupport High`

    Whether the model supports high effort level.

    - `required Boolean Supported`

      Whether this capability is supported by the model.

  - `required BetaCapabilitySupport Low`

    Whether the model supports low effort level.

  - `required BetaCapabilitySupport Max`

    Whether the model supports max effort level.

  - `required BetaCapabilitySupport Medium`

    Whether the model supports medium effort level.

  - `required Boolean Supported`

    Whether this capability is supported by the model.

  - `required BetaCapabilitySupport? Xhigh`

    Indicates whether a capability is supported.

### Beta Model Capabilities

- `class BetaModelCapabilities:`

  Model capability information.

  - `required BetaCapabilitySupport Batch`

    Whether the model supports the Batch API.

    - `required Boolean Supported`

      Whether this capability is supported by the model.

  - `required BetaCapabilitySupport Citations`

    Whether the model supports citation generation.

  - `required BetaCapabilitySupport CodeExecution`

    Whether the model supports code execution tools.

  - `required BetaContextManagementCapability ContextManagement`

    Context management support and available strategies.

    - `required BetaCapabilitySupport? ClearThinking20251015`

      Indicates whether a capability is supported.

    - `required BetaCapabilitySupport? ClearToolUses20250919`

      Indicates whether a capability is supported.

    - `required BetaCapabilitySupport? Compact20260112`

      Indicates whether a capability is supported.

    - `required Boolean Supported`

      Whether this capability is supported by the model.

  - `required BetaEffortCapability Effort`

    Effort (reasoning_effort) support and available levels.

    - `required BetaCapabilitySupport High`

      Whether the model supports high effort level.

    - `required BetaCapabilitySupport Low`

      Whether the model supports low effort level.

    - `required BetaCapabilitySupport Max`

      Whether the model supports max effort level.

    - `required BetaCapabilitySupport Medium`

      Whether the model supports medium effort level.

    - `required Boolean Supported`

      Whether this capability is supported by the model.

    - `required BetaCapabilitySupport? Xhigh`

      Indicates whether a capability is supported.

  - `required BetaCapabilitySupport ImageInput`

    Whether the model accepts image content blocks.

  - `required BetaCapabilitySupport PdfInput`

    Whether the model accepts PDF content blocks.

  - `required BetaCapabilitySupport StructuredOutputs`

    Whether the model supports structured output / JSON mode / strict tool schemas.

  - `required BetaThinkingCapability Thinking`

    Thinking capability and supported type configurations.

    - `required Boolean Supported`

      Whether this capability is supported by the model.

    - `required BetaThinkingTypes Types`

      Supported thinking type configurations.

      - `required BetaCapabilitySupport Adaptive`

        Whether the model supports thinking with type 'adaptive' (auto).

      - `required BetaCapabilitySupport Enabled`

        Whether the model supports thinking with type 'enabled'.

### Beta Model Info

- `class BetaModelInfo:`

  - `required string ID`

    Unique model identifier.

  - `required BetaModelCapabilities? Capabilities`

    Model capability information.

    - `required BetaCapabilitySupport Batch`

      Whether the model supports the Batch API.

      - `required Boolean Supported`

        Whether this capability is supported by the model.

    - `required BetaCapabilitySupport Citations`

      Whether the model supports citation generation.

    - `required BetaCapabilitySupport CodeExecution`

      Whether the model supports code execution tools.

    - `required BetaContextManagementCapability ContextManagement`

      Context management support and available strategies.

      - `required BetaCapabilitySupport? ClearThinking20251015`

        Indicates whether a capability is supported.

      - `required BetaCapabilitySupport? ClearToolUses20250919`

        Indicates whether a capability is supported.

      - `required BetaCapabilitySupport? Compact20260112`

        Indicates whether a capability is supported.

      - `required Boolean Supported`

        Whether this capability is supported by the model.

    - `required BetaEffortCapability Effort`

      Effort (reasoning_effort) support and available levels.

      - `required BetaCapabilitySupport High`

        Whether the model supports high effort level.

      - `required BetaCapabilitySupport Low`

        Whether the model supports low effort level.

      - `required BetaCapabilitySupport Max`

        Whether the model supports max effort level.

      - `required BetaCapabilitySupport Medium`

        Whether the model supports medium effort level.

      - `required Boolean Supported`

        Whether this capability is supported by the model.

      - `required BetaCapabilitySupport? Xhigh`

        Indicates whether a capability is supported.

    - `required BetaCapabilitySupport ImageInput`

      Whether the model accepts image content blocks.

    - `required BetaCapabilitySupport PdfInput`

      Whether the model accepts PDF content blocks.

    - `required BetaCapabilitySupport StructuredOutputs`

      Whether the model supports structured output / JSON mode / strict tool schemas.

    - `required BetaThinkingCapability Thinking`

      Thinking capability and supported type configurations.

      - `required Boolean Supported`

        Whether this capability is supported by the model.

      - `required BetaThinkingTypes Types`

        Supported thinking type configurations.

        - `required BetaCapabilitySupport Adaptive`

          Whether the model supports thinking with type 'adaptive' (auto).

        - `required BetaCapabilitySupport Enabled`

          Whether the model supports thinking with type 'enabled'.

  - `required DateTimeOffset CreatedAt`

    RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.

  - `required string DisplayName`

    A human-readable name for the model.

  - `required Long? MaxInputTokens`

    Maximum input context window size in tokens for this model.

  - `required Long? MaxTokens`

    Maximum value for the `max_tokens` parameter when using this model.

  - `JsonElement Type "model"constant`

    Object type.

    For Models, this is always `"model"`.

### Beta Thinking Capability

- `class BetaThinkingCapability:`

  Thinking capability details.

  - `required Boolean Supported`

    Whether this capability is supported by the model.

  - `required BetaThinkingTypes Types`

    Supported thinking type configurations.

    - `required BetaCapabilitySupport Adaptive`

      Whether the model supports thinking with type 'adaptive' (auto).

      - `required Boolean Supported`

        Whether this capability is supported by the model.

    - `required BetaCapabilitySupport Enabled`

      Whether the model supports thinking with type 'enabled'.

### Beta Thinking Types

- `class BetaThinkingTypes:`

  Supported thinking type configurations.

  - `required BetaCapabilitySupport Adaptive`

    Whether the model supports thinking with type 'adaptive' (auto).

    - `required Boolean Supported`

      Whether this capability is supported by the model.

  - `required BetaCapabilitySupport Enabled`

    Whether the model supports thinking with type 'enabled'.

# Messages

## Create a Message

`BetaMessage Beta.Messages.Create(MessageCreateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/messages`

Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.

The Messages API can be used for either single queries or stateless multi-turn conversations.

Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup)

### Parameters

- `MessageCreateParams parameters`

  - `required Long maxTokens`

    Body param: The maximum number of tokens to generate before stopping.

    Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.

    Set to `0` to populate the [prompt cache](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#pre-warming-the-cache) without generating a response.

    Different models have different maximum values for this parameter.  See [models](https://docs.claude.com/en/docs/models-overview) for details.

  - `required IReadOnlyList<BetaMessageParam> messages`

    Body param: Input messages.

    Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.

    Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.

    If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.

    Example with a single `user` message:

    ```json
    [{"role": "user", "content": "Hello, Claude"}]
    ```

    Example with multiple conversational turns:

    ```json
    [
      {"role": "user", "content": "Hello there."},
      {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
      {"role": "user", "content": "Can you explain LLMs in plain English?"},
    ]
    ```

    Example with a partially-filled response from Claude:

    ```json
    [
      {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
      {"role": "assistant", "content": "The best answer is ("},
    ]
    ```

    Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:

    ```json
    {"role": "user", "content": "Hello, Claude"}
    ```

    ```json
    {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
    ```

    See [input examples](https://docs.claude.com/en/api/messages-examples).

    Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API.

    There is a limit of 100,000 messages in a single request.

    - `required Content Content`

      - `string`

      - `IReadOnlyList<BetaContentBlockParam>`

        - `class BetaTextBlockParam:`

          - `required string Text`

          - `JsonElement Type "text"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

            - `JsonElement Type "ephemeral"constant`

            - `Ttl Ttl`

              The time-to-live for the cache control breakpoint.

              This may be one the following values:

              - `5m`: 5 minutes
              - `1h`: 1 hour

              Defaults to `5m`.

              - `"5m"Ttl5m`

              - `"1h"Ttl1h`

          - `IReadOnlyList<BetaTextCitationParam>? Citations`

            - `class BetaCitationCharLocationParam:`

              - `required string CitedText`

              - `required Long DocumentIndex`

              - `required string? DocumentTitle`

              - `required Long EndCharIndex`

              - `required Long StartCharIndex`

              - `JsonElement Type "char_location"constant`

            - `class BetaCitationPageLocationParam:`

              - `required string CitedText`

              - `required Long DocumentIndex`

              - `required string? DocumentTitle`

              - `required Long EndPageNumber`

              - `required Long StartPageNumber`

              - `JsonElement Type "page_location"constant`

            - `class BetaCitationContentBlockLocationParam:`

              - `required string CitedText`

                The full text of the cited block range, concatenated.

                Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

              - `required Long DocumentIndex`

              - `required string? DocumentTitle`

              - `required Long EndBlockIndex`

                Exclusive 0-based end index of the cited block range in the source's `content` array.

                Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

              - `required Long StartBlockIndex`

                0-based index of the first cited block in the source's `content` array.

              - `JsonElement Type "content_block_location"constant`

            - `class BetaCitationWebSearchResultLocationParam:`

              - `required string CitedText`

              - `required string EncryptedIndex`

              - `required string? Title`

              - `JsonElement Type "web_search_result_location"constant`

              - `required string Url`

            - `class BetaCitationSearchResultLocationParam:`

              - `required string CitedText`

                The full text of the cited block range, concatenated.

                Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

              - `required Long EndBlockIndex`

                Exclusive 0-based end index of the cited block range in the source's `content` array.

                Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

              - `required Long SearchResultIndex`

                0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

                Counted separately from `document_index`; server-side web search results are not included in this count.

              - `required string Source`

              - `required Long StartBlockIndex`

                0-based index of the first cited block in the source's `content` array.

              - `required string? Title`

              - `JsonElement Type "search_result_location"constant`

        - `class BetaImageBlockParam:`

          - `required Source Source`

            - `class BetaBase64ImageSource:`

              - `required string Data`

              - `required MediaType MediaType`

                - `"image/jpeg"ImageJpeg`

                - `"image/png"ImagePng`

                - `"image/gif"ImageGif`

                - `"image/webp"ImageWebP`

              - `JsonElement Type "base64"constant`

            - `class BetaUrlImageSource:`

              - `JsonElement Type "url"constant`

              - `required string Url`

            - `class BetaFileImageSource:`

              - `required string FileID`

              - `JsonElement Type "file"constant`

          - `JsonElement Type "image"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaRequestDocumentBlock:`

          - `required Source Source`

            - `class BetaBase64PdfSource:`

              - `required string Data`

              - `JsonElement MediaType "application/pdf"constant`

              - `JsonElement Type "base64"constant`

            - `class BetaPlainTextSource:`

              - `required string Data`

              - `JsonElement MediaType "text/plain"constant`

              - `JsonElement Type "text"constant`

            - `class BetaContentBlockSource:`

              - `required Content Content`

                - `string`

                - `IReadOnlyList<BetaContentBlockSourceContent>`

                  - `class BetaTextBlockParam:`

                  - `class BetaImageBlockParam:`

              - `JsonElement Type "content"constant`

            - `class BetaUrlPdfSource:`

              - `JsonElement Type "url"constant`

              - `required string Url`

            - `class BetaFileDocumentSource:`

              - `required string FileID`

              - `JsonElement Type "file"constant`

          - `JsonElement Type "document"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `BetaCitationsConfigParam? Citations`

            - `Boolean Enabled`

          - `string? Context`

          - `string? Title`

        - `class BetaSearchResultBlockParam:`

          - `required IReadOnlyList<BetaTextBlockParam> Content`

            - `required string Text`

            - `JsonElement Type "text"constant`

            - `BetaCacheControlEphemeral? CacheControl`

              Create a cache control breakpoint at this content block.

            - `IReadOnlyList<BetaTextCitationParam>? Citations`

          - `required string Source`

          - `required string Title`

          - `JsonElement Type "search_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `BetaCitationsConfigParam Citations`

        - `class BetaThinkingBlockParam:`

          - `required string Signature`

          - `required string Thinking`

          - `JsonElement Type "thinking"constant`

        - `class BetaRedactedThinkingBlockParam:`

          - `required string Data`

          - `JsonElement Type "redacted_thinking"constant`

        - `class BetaToolUseBlockParam:`

          - `required string ID`

          - `required IReadOnlyDictionary<string, JsonElement> Input`

          - `required string Name`

          - `JsonElement Type "tool_use"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

              - `JsonElement Type "direct"constant`

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

              - `required string ToolID`

              - `JsonElement Type "code_execution_20250825"constant`

            - `class BetaServerToolCaller20260120:`

              - `required string ToolID`

              - `JsonElement Type "code_execution_20260120"constant`

        - `class BetaToolResultBlockParam:`

          - `required string ToolUseID`

          - `JsonElement Type "tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Content Content`

            - `string`

            - `IReadOnlyList<Block>`

              - `class BetaTextBlockParam:`

              - `class BetaImageBlockParam:`

              - `class BetaSearchResultBlockParam:`

              - `class BetaRequestDocumentBlock:`

              - `class BetaToolReferenceBlockParam:`

                Tool reference block that can be included in tool_result content.

                - `required string ToolName`

                - `JsonElement Type "tool_reference"constant`

                - `BetaCacheControlEphemeral? CacheControl`

                  Create a cache control breakpoint at this content block.

          - `Boolean IsError`

        - `class BetaServerToolUseBlockParam:`

          - `required string ID`

          - `required IReadOnlyDictionary<string, JsonElement> Input`

          - `required Name Name`

            - `"advisor"Advisor`

            - `"web_search"WebSearch`

            - `"web_fetch"WebFetch`

            - `"code_execution"CodeExecution`

            - `"bash_code_execution"BashCodeExecution`

            - `"text_editor_code_execution"TextEditorCodeExecution`

            - `"tool_search_tool_regex"ToolSearchToolRegex`

            - `"tool_search_tool_bm25"ToolSearchToolBm25`

          - `JsonElement Type "server_tool_use"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

            - `class BetaServerToolCaller20260120:`

        - `class BetaWebSearchToolResultBlockParam:`

          - `required BetaWebSearchToolResultBlockParamContent Content`

            - `IReadOnlyList<BetaWebSearchResultBlockParam>`

              - `required string EncryptedContent`

              - `required string Title`

              - `JsonElement Type "web_search_result"constant`

              - `required string Url`

              - `string? PageAge`

            - `class BetaWebSearchToolRequestError:`

              - `required BetaWebSearchToolResultErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"max_uses_exceeded"MaxUsesExceeded`

                - `"too_many_requests"TooManyRequests`

                - `"query_too_long"QueryTooLong`

                - `"request_too_large"RequestTooLarge`

              - `JsonElement Type "web_search_tool_result_error"constant`

          - `required string ToolUseID`

          - `JsonElement Type "web_search_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

            - `class BetaServerToolCaller20260120:`

        - `class BetaWebFetchToolResultBlockParam:`

          - `required Content Content`

            - `class BetaWebFetchToolResultErrorBlockParam:`

              - `required BetaWebFetchToolResultErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"url_too_long"UrlTooLong`

                - `"url_not_allowed"UrlNotAllowed`

                - `"url_not_in_prior_context"UrlNotInPriorContext`

                - `"url_not_accessible"UrlNotAccessible`

                - `"unsupported_content_type"UnsupportedContentType`

                - `"too_many_requests"TooManyRequests`

                - `"max_uses_exceeded"MaxUsesExceeded`

                - `"unavailable"Unavailable`

              - `JsonElement Type "web_fetch_tool_result_error"constant`

            - `class BetaWebFetchBlockParam:`

              - `required BetaRequestDocumentBlock Content`

              - `JsonElement Type "web_fetch_result"constant`

              - `required string Url`

                Fetched content URL

              - `string? RetrievedAt`

                ISO 8601 timestamp when the content was retrieved

          - `required string ToolUseID`

          - `JsonElement Type "web_fetch_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

            - `class BetaServerToolCaller20260120:`

        - `class BetaAdvisorToolResultBlockParam:`

          - `required Content Content`

            - `class BetaAdvisorToolResultErrorParam:`

              - `required ErrorCode ErrorCode`

                - `"max_uses_exceeded"MaxUsesExceeded`

                - `"prompt_too_long"PromptTooLong`

                - `"too_many_requests"TooManyRequests`

                - `"overloaded"Overloaded`

                - `"unavailable"Unavailable`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `JsonElement Type "advisor_tool_result_error"constant`

            - `class BetaAdvisorResultBlockParam:`

              - `required string Text`

              - `JsonElement Type "advisor_result"constant`

              - `string? StopReason`

            - `class BetaAdvisorRedactedResultBlockParam:`

              - `required string EncryptedContent`

                Opaque blob produced by a prior response; must be round-tripped verbatim.

              - `JsonElement Type "advisor_redacted_result"constant`

              - `string? StopReason`

          - `required string ToolUseID`

          - `JsonElement Type "advisor_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaCodeExecutionToolResultBlockParam:`

          - `required BetaCodeExecutionToolResultBlockParamContent Content`

            Code execution result with encrypted stdout for PFC + web_search results.

            - `class BetaCodeExecutionToolResultErrorParam:`

              - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `JsonElement Type "code_execution_tool_result_error"constant`

            - `class BetaCodeExecutionResultBlockParam:`

              - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

                - `required string FileID`

                - `JsonElement Type "code_execution_output"constant`

              - `required Long ReturnCode`

              - `required string Stderr`

              - `required string Stdout`

              - `JsonElement Type "code_execution_result"constant`

            - `class BetaEncryptedCodeExecutionResultBlockParam:`

              Code execution result with encrypted stdout for PFC + web_search results.

              - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

                - `required string FileID`

                - `JsonElement Type "code_execution_output"constant`

              - `required string EncryptedStdout`

              - `required Long ReturnCode`

              - `required string Stderr`

              - `JsonElement Type "encrypted_code_execution_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "code_execution_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaBashCodeExecutionToolResultBlockParam:`

          - `required Content Content`

            - `class BetaBashCodeExecutionToolResultErrorParam:`

              - `required ErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `"output_file_too_large"OutputFileTooLarge`

              - `JsonElement Type "bash_code_execution_tool_result_error"constant`

            - `class BetaBashCodeExecutionResultBlockParam:`

              - `required IReadOnlyList<BetaBashCodeExecutionOutputBlockParam> Content`

                - `required string FileID`

                - `JsonElement Type "bash_code_execution_output"constant`

              - `required Long ReturnCode`

              - `required string Stderr`

              - `required string Stdout`

              - `JsonElement Type "bash_code_execution_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "bash_code_execution_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaTextEditorCodeExecutionToolResultBlockParam:`

          - `required Content Content`

            - `class BetaTextEditorCodeExecutionToolResultErrorParam:`

              - `required ErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `"file_not_found"FileNotFound`

              - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

              - `string? ErrorMessage`

            - `class BetaTextEditorCodeExecutionViewResultBlockParam:`

              - `required string Content`

              - `required FileType FileType`

                - `"text"Text`

                - `"image"Image`

                - `"pdf"Pdf`

              - `JsonElement Type "text_editor_code_execution_view_result"constant`

              - `Long? NumLines`

              - `Long? StartLine`

              - `Long? TotalLines`

            - `class BetaTextEditorCodeExecutionCreateResultBlockParam:`

              - `required Boolean IsFileUpdate`

              - `JsonElement Type "text_editor_code_execution_create_result"constant`

            - `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:`

              - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

              - `IReadOnlyList<string>? Lines`

              - `Long? NewLines`

              - `Long? NewStart`

              - `Long? OldLines`

              - `Long? OldStart`

          - `required string ToolUseID`

          - `JsonElement Type "text_editor_code_execution_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaToolSearchToolResultBlockParam:`

          - `required Content Content`

            - `class BetaToolSearchToolResultErrorParam:`

              - `required ErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `JsonElement Type "tool_search_tool_result_error"constant`

            - `class BetaToolSearchToolSearchResultBlockParam:`

              - `required IReadOnlyList<BetaToolReferenceBlockParam> ToolReferences`

                - `required string ToolName`

                - `JsonElement Type "tool_reference"constant`

                - `BetaCacheControlEphemeral? CacheControl`

                  Create a cache control breakpoint at this content block.

              - `JsonElement Type "tool_search_tool_search_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "tool_search_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaMcpToolUseBlockParam:`

          - `required string ID`

          - `required IReadOnlyDictionary<string, JsonElement> Input`

          - `required string Name`

          - `required string ServerName`

            The name of the MCP server

          - `JsonElement Type "mcp_tool_use"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaRequestMcpToolResultBlockParam:`

          - `required string ToolUseID`

          - `JsonElement Type "mcp_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Content Content`

            - `string`

            - `IReadOnlyList<BetaTextBlockParam>`

              - `required string Text`

              - `JsonElement Type "text"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

              - `IReadOnlyList<BetaTextCitationParam>? Citations`

          - `Boolean IsError`

        - `class BetaContainerUploadBlockParam:`

          A content block that represents a file to be uploaded to the container
          Files uploaded via this block will be available in the container's input directory.

          - `required string FileID`

          - `JsonElement Type "container_upload"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaCompactionBlockParam:`

          A compaction block containing summary of previous context.

          Users should round-trip these blocks from responses to subsequent requests
          to maintain context across compaction boundaries.

          When content is None, the block represents a failed compaction. The server
          treats these as no-ops. Empty string content is not allowed.

          - `JsonElement Type "compaction"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `string? Content`

            Summary of previously compacted content, or null if compaction failed

          - `string? EncryptedContent`

            Opaque metadata from prior compaction, to be round-tripped verbatim

        - `class BetaMidConversationSystemBlockParam:`

          System instructions that appear mid-conversation.

          Use this block to provide or update system-level instructions at a specific
          point in the conversation, rather than only via the top-level `system` parameter.

          - `required IReadOnlyList<BetaTextBlockParam> Content`

            System instruction text blocks.

            - `required string Text`

            - `JsonElement Type "text"constant`

            - `BetaCacheControlEphemeral? CacheControl`

              Create a cache control breakpoint at this content block.

            - `IReadOnlyList<BetaTextCitationParam>? Citations`

          - `JsonElement Type "mid_conv_system"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

    - `required Role Role`

      - `"user"User`

      - `"assistant"Assistant`

      - `"system"System`

  - `required Model model`

    Body param: The model that will complete your prompt.

    See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

  - `BetaCacheControlEphemeral? cacheControl`

    Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.

  - `Container? container`

    Body param: Container identifier for reuse across requests.

    - `class BetaContainerParams:`

      Container parameters with skills to be loaded.

      - `string? ID`

        Container id

      - `IReadOnlyList<BetaSkillParams>? Skills`

        List of skills to load in the container

        - `required string SkillID`

          Skill ID

        - `required Type Type`

          Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

          - `"anthropic"Anthropic`

          - `"custom"Custom`

        - `string Version`

          Skill version or 'latest' for most recent version

    - `string`

  - `BetaContextManagementConfig? contextManagement`

    Body param: Context management configuration.

    This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not.

  - `BetaDiagnosticsParam? diagnostics`

    Body param: Request-level diagnostics. Currently carries the previous response
    id for prompt-cache divergence reporting.

  - `string? inferenceGeo`

    Body param: Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used.

  - `IReadOnlyList<BetaRequestMcpServerUrlDefinition> mcpServers`

    Body param: MCP servers to be utilized in this request

    - `required string Name`

    - `JsonElement Type "url"constant`

    - `required string Url`

    - `string? AuthorizationToken`

    - `BetaRequestMcpServerToolConfiguration? ToolConfiguration`

      - `IReadOnlyList<string>? AllowedTools`

      - `Boolean? Enabled`

  - `BetaMetadata metadata`

    Body param: An object describing metadata about the request.

  - `BetaOutputConfig outputConfig`

    Body param: Configuration options for the model's output, such as the output format.

  - `BetaJsonOutputFormat? outputFormat`

    Body param: Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)

    A schema to specify Claude's output format in responses. This parameter will be removed in a future release.

  - `ServiceTier serviceTier`

    Body param: Determines whether to use priority capacity (if available) or standard capacity for this request.

    Anthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.

    - `"auto"Auto`

    - `"standard_only"StandardOnly`

  - `Speed? speed`

    Body param: The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference.

    - `"standard"Standard`

    - `"fast"Fast`

  - `IReadOnlyList<string> stopSequences`

    Body param: Custom text sequences that will cause the model to stop generating.

    Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.

    If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence.

  - `System system`

    Body param: System prompt.

    A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).

    - `string`

    - `IReadOnlyList<BetaTextBlockParam>`

      - `required string Text`

      - `JsonElement Type "text"constant`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `IReadOnlyList<BetaTextCitationParam>? Citations`

  - `Double temperature`

    Body param: Amount of randomness injected into the response.

    Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.

    Note that even with `temperature` of `0.0`, the results will not be fully deterministic.

  - `BetaThinkingConfigParam thinking`

    Body param: Configuration for enabling Claude's extended thinking.

    When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.

    See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details.

  - `BetaToolChoice toolChoice`

    Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.

  - `IReadOnlyList<BetaToolUnion> tools`

    Body param: Definitions of tools that the model may use.

    If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.

    There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).

    Each tool definition includes:

    * `name`: Name of the tool.
    * `description`: Optional, but strongly-recommended description of the tool.
    * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.

    For example, if you defined `tools` as:

    ```json
    [
      {
        "name": "get_stock_price",
        "description": "Get the current stock price for a given ticker symbol.",
        "input_schema": {
          "type": "object",
          "properties": {
            "ticker": {
              "type": "string",
              "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
            }
          },
          "required": ["ticker"]
        }
      }
    ]
    ```

    And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:

    ```json
    [
      {
        "type": "tool_use",
        "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
        "name": "get_stock_price",
        "input": { "ticker": "^GSPC" }
      }
    ]
    ```

    You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:

    ```json
    [
      {
        "type": "tool_result",
        "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
        "content": "259.75 USD"
      }
    ]
    ```

    Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.

    See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.

    - `class BetaTool:`

      - `required InputSchema InputSchema`

        [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.

        This defines the shape of the `input` that your tool accepts and that the model will produce.

        - `JsonElement Type "object"constant`

        - `IReadOnlyDictionary<string, JsonElement>? Properties`

        - `IReadOnlyList<string>? Required`

      - `required string Name`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `string Description`

        Description of what this tool does.

        Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.

      - `Boolean? EagerInputStreaming`

        Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

      - `Type? Type`

        - `"custom"Custom`

    - `class BetaToolBash20241022:`

      - `JsonElement Name "bash"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "bash_20241022"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolBash20250124:`

      - `JsonElement Name "bash"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "bash_20250124"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaCodeExecutionTool20250522:`

      - `JsonElement Name "code_execution"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "code_execution_20250522"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaCodeExecutionTool20250825:`

      - `JsonElement Name "code_execution"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "code_execution_20250825"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaCodeExecutionTool20260120:`

      Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).

      - `JsonElement Name "code_execution"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "code_execution_20260120"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolComputerUse20241022:`

      - `required Long DisplayHeightPx`

        The height of the display in pixels.

      - `required Long DisplayWidthPx`

        The width of the display in pixels.

      - `JsonElement Name "computer"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "computer_20241022"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? DisplayNumber`

        The X11 display number (e.g. 0, 1) for the display.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaMemoryTool20250818:`

      - `JsonElement Name "memory"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "memory_20250818"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolComputerUse20250124:`

      - `required Long DisplayHeightPx`

        The height of the display in pixels.

      - `required Long DisplayWidthPx`

        The width of the display in pixels.

      - `JsonElement Name "computer"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "computer_20250124"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? DisplayNumber`

        The X11 display number (e.g. 0, 1) for the display.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolTextEditor20241022:`

      - `JsonElement Name "str_replace_editor"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "text_editor_20241022"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolComputerUse20251124:`

      - `required Long DisplayHeightPx`

        The height of the display in pixels.

      - `required Long DisplayWidthPx`

        The width of the display in pixels.

      - `JsonElement Name "computer"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "computer_20251124"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? DisplayNumber`

        The X11 display number (e.g. 0, 1) for the display.

      - `Boolean EnableZoom`

        Whether to enable an action to take a zoomed-in screenshot of the screen.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolTextEditor20250124:`

      - `JsonElement Name "str_replace_editor"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "text_editor_20250124"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolTextEditor20250429:`

      - `JsonElement Name "str_replace_based_edit_tool"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "text_editor_20250429"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolTextEditor20250728:`

      - `JsonElement Name "str_replace_based_edit_tool"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "text_editor_20250728"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Long? MaxCharacters`

        Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaWebSearchTool20250305:`

      - `JsonElement Name "web_search"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "web_search_20250305"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `IReadOnlyList<string>? AllowedDomains`

        If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.

      - `IReadOnlyList<string>? BlockedDomains`

        If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? MaxUses`

        Maximum number of times the tool can be used in the API request.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

      - `BetaUserLocation? UserLocation`

        Parameters for the user's location. Used to provide more relevant search results.

        - `JsonElement Type "approximate"constant`

        - `string? City`

          The city of the user.

        - `string? Country`

          The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.

        - `string? Region`

          The region of the user.

        - `string? Timezone`

          The [IANA timezone](https://nodatime.org/TimeZones) of the user.

    - `class BetaWebFetchTool20250910:`

      - `JsonElement Name "web_fetch"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "web_fetch_20250910"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `IReadOnlyList<string>? AllowedDomains`

        List of domains to allow fetching from

      - `IReadOnlyList<string>? BlockedDomains`

        List of domains to block fetching from

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `BetaCitationsConfigParam? Citations`

        Citations configuration for fetched documents. Citations are disabled by default.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? MaxContentTokens`

        Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

      - `Long? MaxUses`

        Maximum number of times the tool can be used in the API request.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaWebSearchTool20260209:`

      - `JsonElement Name "web_search"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "web_search_20260209"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `IReadOnlyList<string>? AllowedDomains`

        If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.

      - `IReadOnlyList<string>? BlockedDomains`

        If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? MaxUses`

        Maximum number of times the tool can be used in the API request.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

      - `BetaUserLocation? UserLocation`

        Parameters for the user's location. Used to provide more relevant search results.

    - `class BetaWebFetchTool20260209:`

      - `JsonElement Name "web_fetch"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "web_fetch_20260209"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `IReadOnlyList<string>? AllowedDomains`

        List of domains to allow fetching from

      - `IReadOnlyList<string>? BlockedDomains`

        List of domains to block fetching from

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `BetaCitationsConfigParam? Citations`

        Citations configuration for fetched documents. Citations are disabled by default.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? MaxContentTokens`

        Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

      - `Long? MaxUses`

        Maximum number of times the tool can be used in the API request.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaWebFetchTool20260309:`

      Web fetch tool with use_cache parameter for bypassing cached content.

      - `JsonElement Name "web_fetch"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "web_fetch_20260309"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `IReadOnlyList<string>? AllowedDomains`

        List of domains to allow fetching from

      - `IReadOnlyList<string>? BlockedDomains`

        List of domains to block fetching from

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `BetaCitationsConfigParam? Citations`

        Citations configuration for fetched documents. Citations are disabled by default.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? MaxContentTokens`

        Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

      - `Long? MaxUses`

        Maximum number of times the tool can be used in the API request.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

      - `Boolean UseCache`

        Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.

    - `class BetaAdvisorTool20260301:`

      - `required Model Model`

        The model that will complete your prompt.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-mythos-preview"ClaudeMythosPreview`

          New class of intelligence, strongest in coding and cybersecurity

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Frontier intelligence for long-running agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

        - `"claude-opus-4-1"ClaudeOpus4_1`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-0"ClaudeOpus4_0`

          Powerful model for complex tasks

        - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

          Powerful model for complex tasks

        - `"claude-sonnet-4-0"ClaudeSonnet4_0`

          High-performance model with extended thinking

        - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

          High-performance model with extended thinking

        - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

          Fast and cost-effective model

      - `JsonElement Name "advisor"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "advisor_20260301"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `BetaCacheControlEphemeral? Caching`

        Caching for the advisor's own prompt. When set, each advisor call writes a cache entry at the given TTL so subsequent calls in the same conversation read the stable prefix. When omitted, the advisor prompt is not cached.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? MaxUses`

        Maximum number of times the tool can be used in the API request.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolSearchToolBm25_20251119:`

      - `JsonElement Name "tool_search_tool_bm25"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `required Type Type`

        - `"tool_search_tool_bm25_20251119"ToolSearchToolBm25_20251119`

        - `"tool_search_tool_bm25"ToolSearchToolBm25`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolSearchToolRegex20251119:`

      - `JsonElement Name "tool_search_tool_regex"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `required Type Type`

        - `"tool_search_tool_regex_20251119"ToolSearchToolRegex20251119`

        - `"tool_search_tool_regex"ToolSearchToolRegex`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaMcpToolset:`

      Configuration for a group of tools from an MCP server.

      Allows configuring enabled status and defer_loading for all tools
      from an MCP server, with optional per-tool overrides.

      - `required string McpServerName`

        Name of the MCP server to configure tools for

      - `JsonElement Type "mcp_toolset"constant`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `IReadOnlyDictionary<string, BetaMcpToolConfig>? Configs`

        Configuration overrides for specific tools, keyed by tool name

        - `Boolean DeferLoading`

        - `Boolean Enabled`

      - `BetaMcpToolDefaultConfig DefaultConfig`

        Default configuration applied to all tools from this server

        - `Boolean DeferLoading`

        - `Boolean Enabled`

  - `Long topK`

    Body param: Only sample from the top K options for each subsequent token.

    Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).

    Recommended for advanced use cases only.

  - `Double topP`

    Body param: Use nucleus sampling.

    In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`.

    Recommended for advanced use cases only.

  - `string? userProfileID`

    Body param: The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaMessage:`

  - `required string ID`

    Unique object identifier.

    The format and length of IDs may change over time.

  - `required BetaContainer? Container`

    Information about the container used in the request (for the code execution tool)

    - `required string ID`

      Identifier for the container used in this request

    - `required DateTimeOffset ExpiresAt`

      The time at which the container will expire.

    - `required IReadOnlyList<BetaSkill>? Skills`

      Skills loaded in the container

      - `required string SkillID`

        Skill ID

      - `required Type Type`

        Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

        - `"anthropic"Anthropic`

        - `"custom"Custom`

      - `required string Version`

        Skill version or 'latest' for most recent version

  - `required IReadOnlyList<BetaContentBlock> Content`

    Content generated by the model.

    This is an array of content blocks, each of which has a `type` that determines its shape.

    Example:

    ```json
    [{"type": "text", "text": "Hi, I'm Claude."}]
    ```

    If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.

    For example, if the input `messages` were:

    ```json
    [
      {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
      {"role": "assistant", "content": "The best answer is ("}
    ]
    ```

    Then the response `content` might be:

    ```json
    [{"type": "text", "text": "B)"}]
    ```

    - `class BetaTextBlock:`

      - `required IReadOnlyList<BetaTextCitation>? Citations`

        Citations supporting the text block.

        The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

        - `class BetaCitationCharLocation:`

          - `required string CitedText`

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndCharIndex`

          - `required string? FileID`

          - `required Long StartCharIndex`

          - `JsonElement Type "char_location"constant`

        - `class BetaCitationPageLocation:`

          - `required string CitedText`

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndPageNumber`

          - `required string? FileID`

          - `required Long StartPageNumber`

          - `JsonElement Type "page_location"constant`

        - `class BetaCitationContentBlockLocation:`

          - `required string CitedText`

            The full text of the cited block range, concatenated.

            Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndBlockIndex`

            Exclusive 0-based end index of the cited block range in the source's `content` array.

            Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

          - `required string? FileID`

          - `required Long StartBlockIndex`

            0-based index of the first cited block in the source's `content` array.

          - `JsonElement Type "content_block_location"constant`

        - `class BetaCitationsWebSearchResultLocation:`

          - `required string CitedText`

          - `required string EncryptedIndex`

          - `required string? Title`

          - `JsonElement Type "web_search_result_location"constant`

          - `required string Url`

        - `class BetaCitationSearchResultLocation:`

          - `required string CitedText`

            The full text of the cited block range, concatenated.

            Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

          - `required Long EndBlockIndex`

            Exclusive 0-based end index of the cited block range in the source's `content` array.

            Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

          - `required Long SearchResultIndex`

            0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

            Counted separately from `document_index`; server-side web search results are not included in this count.

          - `required string Source`

          - `required Long StartBlockIndex`

            0-based index of the first cited block in the source's `content` array.

          - `required string? Title`

          - `JsonElement Type "search_result_location"constant`

      - `required string Text`

      - `JsonElement Type "text"constant`

    - `class BetaThinkingBlock:`

      - `required string Signature`

      - `required string Thinking`

      - `JsonElement Type "thinking"constant`

    - `class BetaRedactedThinkingBlock:`

      - `required string Data`

      - `JsonElement Type "redacted_thinking"constant`

    - `class BetaToolUseBlock:`

      - `required string ID`

      - `required IReadOnlyDictionary<string, JsonElement> Input`

      - `required string Name`

      - `JsonElement Type "tool_use"constant`

      - `Caller Caller`

        Tool invocation directly from the model.

        - `class BetaDirectCaller:`

          Tool invocation directly from the model.

          - `JsonElement Type "direct"constant`

        - `class BetaServerToolCaller:`

          Tool invocation generated by a server-side tool.

          - `required string ToolID`

          - `JsonElement Type "code_execution_20250825"constant`

        - `class BetaServerToolCaller20260120:`

          - `required string ToolID`

          - `JsonElement Type "code_execution_20260120"constant`

    - `class BetaServerToolUseBlock:`

      - `required string ID`

      - `required IReadOnlyDictionary<string, JsonElement> Input`

      - `required Name Name`

        - `"advisor"Advisor`

        - `"web_search"WebSearch`

        - `"web_fetch"WebFetch`

        - `"code_execution"CodeExecution`

        - `"bash_code_execution"BashCodeExecution`

        - `"text_editor_code_execution"TextEditorCodeExecution`

        - `"tool_search_tool_regex"ToolSearchToolRegex`

        - `"tool_search_tool_bm25"ToolSearchToolBm25`

      - `JsonElement Type "server_tool_use"constant`

      - `Caller Caller`

        Tool invocation directly from the model.

        - `class BetaDirectCaller:`

          Tool invocation directly from the model.

        - `class BetaServerToolCaller:`

          Tool invocation generated by a server-side tool.

        - `class BetaServerToolCaller20260120:`

    - `class BetaWebSearchToolResultBlock:`

      - `required BetaWebSearchToolResultBlockContent Content`

        - `class BetaWebSearchToolResultError:`

          - `required BetaWebSearchToolResultErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"max_uses_exceeded"MaxUsesExceeded`

            - `"too_many_requests"TooManyRequests`

            - `"query_too_long"QueryTooLong`

            - `"request_too_large"RequestTooLarge`

          - `JsonElement Type "web_search_tool_result_error"constant`

        - `IReadOnlyList<BetaWebSearchResultBlock>`

          - `required string EncryptedContent`

          - `required string? PageAge`

          - `required string Title`

          - `JsonElement Type "web_search_result"constant`

          - `required string Url`

      - `required string ToolUseID`

      - `JsonElement Type "web_search_tool_result"constant`

      - `Caller Caller`

        Tool invocation directly from the model.

        - `class BetaDirectCaller:`

          Tool invocation directly from the model.

        - `class BetaServerToolCaller:`

          Tool invocation generated by a server-side tool.

        - `class BetaServerToolCaller20260120:`

    - `class BetaWebFetchToolResultBlock:`

      - `required Content Content`

        - `class BetaWebFetchToolResultErrorBlock:`

          - `required BetaWebFetchToolResultErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"url_too_long"UrlTooLong`

            - `"url_not_allowed"UrlNotAllowed`

            - `"url_not_in_prior_context"UrlNotInPriorContext`

            - `"url_not_accessible"UrlNotAccessible`

            - `"unsupported_content_type"UnsupportedContentType`

            - `"too_many_requests"TooManyRequests`

            - `"max_uses_exceeded"MaxUsesExceeded`

            - `"unavailable"Unavailable`

          - `JsonElement Type "web_fetch_tool_result_error"constant`

        - `class BetaWebFetchBlock:`

          - `required BetaDocumentBlock Content`

            - `required BetaCitationConfig? Citations`

              Citation configuration for the document

              - `required Boolean Enabled`

            - `required Source Source`

              - `class BetaBase64PdfSource:`

                - `required string Data`

                - `JsonElement MediaType "application/pdf"constant`

                - `JsonElement Type "base64"constant`

              - `class BetaPlainTextSource:`

                - `required string Data`

                - `JsonElement MediaType "text/plain"constant`

                - `JsonElement Type "text"constant`

            - `required string? Title`

              The title of the document

            - `JsonElement Type "document"constant`

          - `required string? RetrievedAt`

            ISO 8601 timestamp when the content was retrieved

          - `JsonElement Type "web_fetch_result"constant`

          - `required string Url`

            Fetched content URL

      - `required string ToolUseID`

      - `JsonElement Type "web_fetch_tool_result"constant`

      - `Caller Caller`

        Tool invocation directly from the model.

        - `class BetaDirectCaller:`

          Tool invocation directly from the model.

        - `class BetaServerToolCaller:`

          Tool invocation generated by a server-side tool.

        - `class BetaServerToolCaller20260120:`

    - `class BetaAdvisorToolResultBlock:`

      - `required Content Content`

        - `class BetaAdvisorToolResultError:`

          - `required ErrorCode ErrorCode`

            - `"max_uses_exceeded"MaxUsesExceeded`

            - `"prompt_too_long"PromptTooLong`

            - `"too_many_requests"TooManyRequests`

            - `"overloaded"Overloaded`

            - `"unavailable"Unavailable`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

          - `JsonElement Type "advisor_tool_result_error"constant`

        - `class BetaAdvisorResultBlock:`

          - `required string? StopReason`

            The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the tool's `max_tokens` value or the advisor model's policy cap.

          - `required string Text`

          - `JsonElement Type "advisor_result"constant`

        - `class BetaAdvisorRedactedResultBlock:`

          - `required string EncryptedContent`

            Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.

          - `required string? StopReason`

            The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`).

          - `JsonElement Type "advisor_redacted_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "advisor_tool_result"constant`

    - `class BetaCodeExecutionToolResultBlock:`

      - `required BetaCodeExecutionToolResultBlockContent Content`

        Code execution result with encrypted stdout for PFC + web_search results.

        - `class BetaCodeExecutionToolResultError:`

          - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"too_many_requests"TooManyRequests`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

          - `JsonElement Type "code_execution_tool_result_error"constant`

        - `class BetaCodeExecutionResultBlock:`

          - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

            - `required string FileID`

            - `JsonElement Type "code_execution_output"constant`

          - `required Long ReturnCode`

          - `required string Stderr`

          - `required string Stdout`

          - `JsonElement Type "code_execution_result"constant`

        - `class BetaEncryptedCodeExecutionResultBlock:`

          Code execution result with encrypted stdout for PFC + web_search results.

          - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

            - `required string FileID`

            - `JsonElement Type "code_execution_output"constant`

          - `required string EncryptedStdout`

          - `required Long ReturnCode`

          - `required string Stderr`

          - `JsonElement Type "encrypted_code_execution_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "code_execution_tool_result"constant`

    - `class BetaBashCodeExecutionToolResultBlock:`

      - `required Content Content`

        - `class BetaBashCodeExecutionToolResultError:`

          - `required ErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"too_many_requests"TooManyRequests`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `"output_file_too_large"OutputFileTooLarge`

          - `JsonElement Type "bash_code_execution_tool_result_error"constant`

        - `class BetaBashCodeExecutionResultBlock:`

          - `required IReadOnlyList<BetaBashCodeExecutionOutputBlock> Content`

            - `required string FileID`

            - `JsonElement Type "bash_code_execution_output"constant`

          - `required Long ReturnCode`

          - `required string Stderr`

          - `required string Stdout`

          - `JsonElement Type "bash_code_execution_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "bash_code_execution_tool_result"constant`

    - `class BetaTextEditorCodeExecutionToolResultBlock:`

      - `required Content Content`

        - `class BetaTextEditorCodeExecutionToolResultError:`

          - `required ErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"too_many_requests"TooManyRequests`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `"file_not_found"FileNotFound`

          - `required string? ErrorMessage`

          - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

        - `class BetaTextEditorCodeExecutionViewResultBlock:`

          - `required string Content`

          - `required FileType FileType`

            - `"text"Text`

            - `"image"Image`

            - `"pdf"Pdf`

          - `required Long? NumLines`

          - `required Long? StartLine`

          - `required Long? TotalLines`

          - `JsonElement Type "text_editor_code_execution_view_result"constant`

        - `class BetaTextEditorCodeExecutionCreateResultBlock:`

          - `required Boolean IsFileUpdate`

          - `JsonElement Type "text_editor_code_execution_create_result"constant`

        - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:`

          - `required IReadOnlyList<string>? Lines`

          - `required Long? NewLines`

          - `required Long? NewStart`

          - `required Long? OldLines`

          - `required Long? OldStart`

          - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "text_editor_code_execution_tool_result"constant`

    - `class BetaToolSearchToolResultBlock:`

      - `required Content Content`

        - `class BetaToolSearchToolResultError:`

          - `required ErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"too_many_requests"TooManyRequests`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

          - `required string? ErrorMessage`

          - `JsonElement Type "tool_search_tool_result_error"constant`

        - `class BetaToolSearchToolSearchResultBlock:`

          - `required IReadOnlyList<BetaToolReferenceBlock> ToolReferences`

            - `required string ToolName`

            - `JsonElement Type "tool_reference"constant`

          - `JsonElement Type "tool_search_tool_search_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "tool_search_tool_result"constant`

    - `class BetaMcpToolUseBlock:`

      - `required string ID`

      - `required IReadOnlyDictionary<string, JsonElement> Input`

      - `required string Name`

        The name of the MCP tool

      - `required string ServerName`

        The name of the MCP server

      - `JsonElement Type "mcp_tool_use"constant`

    - `class BetaMcpToolResultBlock:`

      - `required Content Content`

        - `string`

        - `IReadOnlyList<BetaTextBlock>`

          - `required IReadOnlyList<BetaTextCitation>? Citations`

            Citations supporting the text block.

            The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

          - `required string Text`

          - `JsonElement Type "text"constant`

      - `required Boolean IsError`

      - `required string ToolUseID`

      - `JsonElement Type "mcp_tool_result"constant`

    - `class BetaContainerUploadBlock:`

      Response model for a file uploaded to the container.

      - `required string FileID`

      - `JsonElement Type "container_upload"constant`

    - `class BetaCompactionBlock:`

      A compaction block returned when autocompact is triggered.

      When content is None, it indicates the compaction failed to produce a valid
      summary (e.g., malformed output from the model). Clients may round-trip
      compaction blocks with null content; the server treats them as no-ops.

      - `required string? Content`

        Summary of compacted content, or null if compaction failed

      - `required string? EncryptedContent`

        Opaque metadata from prior compaction, to be round-tripped verbatim

      - `JsonElement Type "compaction"constant`

  - `required BetaContextManagementResponse? ContextManagement`

    Context management response.

    Information about context management strategies applied during the request.

    - `required IReadOnlyList<AppliedEdit> AppliedEdits`

      List of context management edits that were applied.

      - `class BetaClearToolUses20250919EditResponse:`

        - `required Long ClearedInputTokens`

          Number of input tokens cleared by this edit.

        - `required Long ClearedToolUses`

          Number of tool uses that were cleared.

        - `JsonElement Type "clear_tool_uses_20250919"constant`

          The type of context management edit applied.

      - `class BetaClearThinking20251015EditResponse:`

        - `required Long ClearedInputTokens`

          Number of input tokens cleared by this edit.

        - `required Long ClearedThinkingTurns`

          Number of thinking turns that were cleared.

        - `JsonElement Type "clear_thinking_20251015"constant`

          The type of context management edit applied.

  - `required BetaDiagnostics? Diagnostics`

    Response envelope for request-level diagnostics. Present (possibly
    null) whenever the caller supplied `diagnostics` on the request.

    - `required CacheMissReason? CacheMissReason`

      Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.

      - `class BetaCacheMissModelChanged:`

        - `required Long CacheMissedInputTokens`

          Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

        - `JsonElement Type "model_changed"constant`

      - `class BetaCacheMissSystemChanged:`

        - `required Long CacheMissedInputTokens`

          Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

        - `JsonElement Type "system_changed"constant`

      - `class BetaCacheMissToolsChanged:`

        - `required Long CacheMissedInputTokens`

          Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

        - `JsonElement Type "tools_changed"constant`

      - `class BetaCacheMissMessagesChanged:`

        - `required Long CacheMissedInputTokens`

          Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

        - `JsonElement Type "messages_changed"constant`

      - `class BetaCacheMissPreviousMessageNotFound:`

        - `JsonElement Type "previous_message_not_found"constant`

      - `class BetaCacheMissUnavailable:`

        - `JsonElement Type "unavailable"constant`

  - `required Model Model`

    The model that will complete your prompt.

    See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

    - `"claude-opus-4-8"ClaudeOpus4_8`

      Frontier intelligence for long-running agents and coding

    - `"claude-opus-4-7"ClaudeOpus4_7`

      Frontier intelligence for long-running agents and coding

    - `"claude-mythos-preview"ClaudeMythosPreview`

      New class of intelligence, strongest in coding and cybersecurity

    - `"claude-opus-4-6"ClaudeOpus4_6`

      Frontier intelligence for long-running agents and coding

    - `"claude-sonnet-4-6"ClaudeSonnet4_6`

      Best combination of speed and intelligence

    - `"claude-haiku-4-5"ClaudeHaiku4_5`

      Fastest model with near-frontier intelligence

    - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

      Fastest model with near-frontier intelligence

    - `"claude-opus-4-5"ClaudeOpus4_5`

      Premium model combining maximum intelligence with practical performance

    - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

      Premium model combining maximum intelligence with practical performance

    - `"claude-sonnet-4-5"ClaudeSonnet4_5`

      High-performance model for agents and coding

    - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

      High-performance model for agents and coding

    - `"claude-opus-4-1"ClaudeOpus4_1`

      Exceptional model for specialized complex tasks

    - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

      Exceptional model for specialized complex tasks

    - `"claude-opus-4-0"ClaudeOpus4_0`

      Powerful model for complex tasks

    - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

      Powerful model for complex tasks

    - `"claude-sonnet-4-0"ClaudeSonnet4_0`

      High-performance model with extended thinking

    - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

      High-performance model with extended thinking

    - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

      Fast and cost-effective model

  - `JsonElement Role "assistant"constant`

    Conversational role of the generated message.

    This will always be `"assistant"`.

  - `required BetaRefusalStopDetails? StopDetails`

    Structured information about a refusal.

    - `required Category? Category`

      The policy category that triggered the refusal.

      `null` when the refusal doesn't map to a named category.

      - `"cyber"Cyber`

      - `"bio"Bio`

    - `required string? Explanation`

      Human-readable explanation of the refusal.

      This text is not guaranteed to be stable. `null` when no explanation is available for the category.

    - `JsonElement Type "refusal"constant`

  - `required BetaStopReason? StopReason`

    The reason that we stopped.

    This may be one the following values:

    * `"end_turn"`: the model reached a natural stopping point
    * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
    * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
    * `"tool_use"`: the model invoked one or more tools
    * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.
    * `"refusal"`: when streaming classifiers intervene to handle potential policy violations

    In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise.

    - `"end_turn"EndTurn`

    - `"max_tokens"MaxTokens`

    - `"stop_sequence"StopSequence`

    - `"tool_use"ToolUse`

    - `"pause_turn"PauseTurn`

    - `"compaction"Compaction`

    - `"refusal"Refusal`

    - `"model_context_window_exceeded"ModelContextWindowExceeded`

  - `required string? StopSequence`

    Which custom stop sequence was generated, if any.

    This value will be a non-null string if one of your custom stop sequences was generated.

  - `JsonElement Type "message"constant`

    Object type.

    For Messages, this is always `"message"`.

  - `required BetaUsage Usage`

    Billing and rate-limit usage.

    Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

    Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.

    For example, `output_tokens` will be non-zero, even for an empty string response from Claude.

    Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.

    - `required BetaCacheCreation? CacheCreation`

      Breakdown of cached tokens by TTL

      - `required Long Ephemeral1hInputTokens`

        The number of input tokens used to create the 1 hour cache entry.

      - `required Long Ephemeral5mInputTokens`

        The number of input tokens used to create the 5 minute cache entry.

    - `required Long? CacheCreationInputTokens`

      The number of input tokens used to create the cache entry.

    - `required Long? CacheReadInputTokens`

      The number of input tokens read from the cache.

    - `required string? InferenceGeo`

      The geographic region where inference was performed for this request.

    - `required Long InputTokens`

      The number of input tokens which were used.

    - `required IReadOnlyList<BetaIterationsUsageItems>? Iterations`

      Per-iteration token usage breakdown.

      Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:

      - Determine which iterations exceeded long context thresholds (>=200k tokens)
      - Calculate the true context window size from the last iteration
      - Understand token accumulation across server-side tool use loops

      - `class BetaMessageIterationUsage:`

        Token usage for a sampling iteration.

        - `required BetaCacheCreation? CacheCreation`

          Breakdown of cached tokens by TTL

        - `required Long CacheCreationInputTokens`

          The number of input tokens used to create the cache entry.

        - `required Long CacheReadInputTokens`

          The number of input tokens read from the cache.

        - `required Long InputTokens`

          The number of input tokens which were used.

        - `required Long OutputTokens`

          The number of output tokens which were used.

        - `JsonElement Type "message"constant`

          Usage for a sampling iteration

      - `class BetaCompactionIterationUsage:`

        Token usage for a compaction iteration.

        - `required BetaCacheCreation? CacheCreation`

          Breakdown of cached tokens by TTL

        - `required Long CacheCreationInputTokens`

          The number of input tokens used to create the cache entry.

        - `required Long CacheReadInputTokens`

          The number of input tokens read from the cache.

        - `required Long InputTokens`

          The number of input tokens which were used.

        - `required Long OutputTokens`

          The number of output tokens which were used.

        - `JsonElement Type "compaction"constant`

          Usage for a compaction iteration

      - `class BetaAdvisorMessageIterationUsage:`

        Token usage for an advisor sub-inference iteration.

        - `required BetaCacheCreation? CacheCreation`

          Breakdown of cached tokens by TTL

        - `required Long CacheCreationInputTokens`

          The number of input tokens used to create the cache entry.

        - `required Long CacheReadInputTokens`

          The number of input tokens read from the cache.

        - `required Long InputTokens`

          The number of input tokens which were used.

        - `required Model Model`

          The model that will complete your prompt.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `required Long OutputTokens`

          The number of output tokens which were used.

        - `JsonElement Type "advisor_message"constant`

          Usage for an advisor sub-inference iteration

    - `required Long OutputTokens`

      The number of output tokens which were used.

    - `required BetaOutputTokensDetails? OutputTokensDetails`

      Breakdown of output tokens by category.

      `output_tokens` remains the inclusive, authoritative total used for billing.
      This object provides a read-only decomposition for observability — for example,
      how many of the billed output tokens were spent on internal reasoning that may
      have been summarized before being returned to you.

      - `required Long ThinkingTokens`

        Number of output tokens the model generated as internal reasoning, including
        the thinking-block delimiter tokens.

        Reflects the raw reasoning the model produced, not the (possibly shorter)
        summarized thinking text returned in the response body. Computed by
        re-tokenizing the raw reasoning text, so it may differ from the model's exact
        generation count by a small number of tokens. Always ≤ `output_tokens`;
        `output_tokens - thinking_tokens` approximates the non-reasoning output.

    - `required BetaServerToolUsage? ServerToolUse`

      The number of server tool requests.

      - `required Long WebFetchRequests`

        The number of web fetch tool requests.

      - `required Long WebSearchRequests`

        The number of web search tool requests.

    - `required ServiceTier? ServiceTier`

      If the request used the priority, standard, or batch tier.

      - `"standard"Standard`

      - `"priority"Priority`

      - `"batch"Batch`

    - `required Speed? Speed`

      The inference speed mode used for this request.

      - `"standard"Standard`

      - `"fast"Fast`

### Example

```csharp
MessageCreateParams parameters = new()
{
    MaxTokens = 1024,
    Messages =
    [
        new()
        {
            Content = "Hello, world",
            Role = Role.User,
        },
    ],
    Model = Model.ClaudeOpus4_6,
};

var betaMessage = await client.Beta.Messages.Create(parameters);

Console.WriteLine(betaMessage);
```

#### Response

```json
{
  "id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",
  "container": {
    "id": "id",
    "expires_at": "2019-12-27T18:11:19.117Z",
    "skills": [
      {
        "skill_id": "pdf",
        "type": "anthropic",
        "version": "latest"
      }
    ]
  },
  "content": [
    {
      "citations": [
        {
          "cited_text": "cited_text",
          "document_index": 0,
          "document_title": "document_title",
          "end_char_index": 0,
          "file_id": "file_id",
          "start_char_index": 0,
          "type": "char_location"
        }
      ],
      "text": "Hi! My name is Claude.",
      "type": "text"
    }
  ],
  "context_management": {
    "applied_edits": [
      {
        "cleared_input_tokens": 0,
        "cleared_tool_uses": 0,
        "type": "clear_tool_uses_20250919"
      }
    ]
  },
  "diagnostics": {
    "cache_miss_reason": {
      "cache_missed_input_tokens": 0,
      "type": "model_changed"
    }
  },
  "model": "claude-opus-4-6",
  "role": "assistant",
  "stop_details": {
    "category": "cyber",
    "explanation": "explanation",
    "type": "refusal"
  },
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "type": "message",
  "usage": {
    "cache_creation": {
      "ephemeral_1h_input_tokens": 0,
      "ephemeral_5m_input_tokens": 0
    },
    "cache_creation_input_tokens": 2051,
    "cache_read_input_tokens": 2051,
    "inference_geo": "inference_geo",
    "input_tokens": 2095,
    "iterations": [
      {
        "cache_creation": {
          "ephemeral_1h_input_tokens": 0,
          "ephemeral_5m_input_tokens": 0
        },
        "cache_creation_input_tokens": 0,
        "cache_read_input_tokens": 0,
        "input_tokens": 0,
        "output_tokens": 0,
        "type": "message"
      }
    ],
    "output_tokens": 503,
    "output_tokens_details": {
      "thinking_tokens": 0
    },
    "server_tool_use": {
      "web_fetch_requests": 2,
      "web_search_requests": 0
    },
    "service_tier": "standard",
    "speed": "standard"
  }
}
```

## Count tokens in a Message

`BetaMessageTokensCount Beta.Messages.CountTokens(MessageCountTokensParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/messages/count_tokens`

Count the number of tokens in a Message.

The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it.

Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting)

### Parameters

- `MessageCountTokensParams parameters`

  - `required IReadOnlyList<BetaMessageParam> messages`

    Body param: Input messages.

    Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.

    Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.

    If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.

    Example with a single `user` message:

    ```json
    [{"role": "user", "content": "Hello, Claude"}]
    ```

    Example with multiple conversational turns:

    ```json
    [
      {"role": "user", "content": "Hello there."},
      {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
      {"role": "user", "content": "Can you explain LLMs in plain English?"},
    ]
    ```

    Example with a partially-filled response from Claude:

    ```json
    [
      {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
      {"role": "assistant", "content": "The best answer is ("},
    ]
    ```

    Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:

    ```json
    {"role": "user", "content": "Hello, Claude"}
    ```

    ```json
    {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
    ```

    See [input examples](https://docs.claude.com/en/api/messages-examples).

    Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API.

    There is a limit of 100,000 messages in a single request.

    - `required Content Content`

      - `string`

      - `IReadOnlyList<BetaContentBlockParam>`

        - `class BetaTextBlockParam:`

          - `required string Text`

          - `JsonElement Type "text"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

            - `JsonElement Type "ephemeral"constant`

            - `Ttl Ttl`

              The time-to-live for the cache control breakpoint.

              This may be one the following values:

              - `5m`: 5 minutes
              - `1h`: 1 hour

              Defaults to `5m`.

              - `"5m"Ttl5m`

              - `"1h"Ttl1h`

          - `IReadOnlyList<BetaTextCitationParam>? Citations`

            - `class BetaCitationCharLocationParam:`

              - `required string CitedText`

              - `required Long DocumentIndex`

              - `required string? DocumentTitle`

              - `required Long EndCharIndex`

              - `required Long StartCharIndex`

              - `JsonElement Type "char_location"constant`

            - `class BetaCitationPageLocationParam:`

              - `required string CitedText`

              - `required Long DocumentIndex`

              - `required string? DocumentTitle`

              - `required Long EndPageNumber`

              - `required Long StartPageNumber`

              - `JsonElement Type "page_location"constant`

            - `class BetaCitationContentBlockLocationParam:`

              - `required string CitedText`

                The full text of the cited block range, concatenated.

                Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

              - `required Long DocumentIndex`

              - `required string? DocumentTitle`

              - `required Long EndBlockIndex`

                Exclusive 0-based end index of the cited block range in the source's `content` array.

                Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

              - `required Long StartBlockIndex`

                0-based index of the first cited block in the source's `content` array.

              - `JsonElement Type "content_block_location"constant`

            - `class BetaCitationWebSearchResultLocationParam:`

              - `required string CitedText`

              - `required string EncryptedIndex`

              - `required string? Title`

              - `JsonElement Type "web_search_result_location"constant`

              - `required string Url`

            - `class BetaCitationSearchResultLocationParam:`

              - `required string CitedText`

                The full text of the cited block range, concatenated.

                Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

              - `required Long EndBlockIndex`

                Exclusive 0-based end index of the cited block range in the source's `content` array.

                Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

              - `required Long SearchResultIndex`

                0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

                Counted separately from `document_index`; server-side web search results are not included in this count.

              - `required string Source`

              - `required Long StartBlockIndex`

                0-based index of the first cited block in the source's `content` array.

              - `required string? Title`

              - `JsonElement Type "search_result_location"constant`

        - `class BetaImageBlockParam:`

          - `required Source Source`

            - `class BetaBase64ImageSource:`

              - `required string Data`

              - `required MediaType MediaType`

                - `"image/jpeg"ImageJpeg`

                - `"image/png"ImagePng`

                - `"image/gif"ImageGif`

                - `"image/webp"ImageWebP`

              - `JsonElement Type "base64"constant`

            - `class BetaUrlImageSource:`

              - `JsonElement Type "url"constant`

              - `required string Url`

            - `class BetaFileImageSource:`

              - `required string FileID`

              - `JsonElement Type "file"constant`

          - `JsonElement Type "image"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaRequestDocumentBlock:`

          - `required Source Source`

            - `class BetaBase64PdfSource:`

              - `required string Data`

              - `JsonElement MediaType "application/pdf"constant`

              - `JsonElement Type "base64"constant`

            - `class BetaPlainTextSource:`

              - `required string Data`

              - `JsonElement MediaType "text/plain"constant`

              - `JsonElement Type "text"constant`

            - `class BetaContentBlockSource:`

              - `required Content Content`

                - `string`

                - `IReadOnlyList<BetaContentBlockSourceContent>`

                  - `class BetaTextBlockParam:`

                  - `class BetaImageBlockParam:`

              - `JsonElement Type "content"constant`

            - `class BetaUrlPdfSource:`

              - `JsonElement Type "url"constant`

              - `required string Url`

            - `class BetaFileDocumentSource:`

              - `required string FileID`

              - `JsonElement Type "file"constant`

          - `JsonElement Type "document"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `BetaCitationsConfigParam? Citations`

            - `Boolean Enabled`

          - `string? Context`

          - `string? Title`

        - `class BetaSearchResultBlockParam:`

          - `required IReadOnlyList<BetaTextBlockParam> Content`

            - `required string Text`

            - `JsonElement Type "text"constant`

            - `BetaCacheControlEphemeral? CacheControl`

              Create a cache control breakpoint at this content block.

            - `IReadOnlyList<BetaTextCitationParam>? Citations`

          - `required string Source`

          - `required string Title`

          - `JsonElement Type "search_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `BetaCitationsConfigParam Citations`

        - `class BetaThinkingBlockParam:`

          - `required string Signature`

          - `required string Thinking`

          - `JsonElement Type "thinking"constant`

        - `class BetaRedactedThinkingBlockParam:`

          - `required string Data`

          - `JsonElement Type "redacted_thinking"constant`

        - `class BetaToolUseBlockParam:`

          - `required string ID`

          - `required IReadOnlyDictionary<string, JsonElement> Input`

          - `required string Name`

          - `JsonElement Type "tool_use"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

              - `JsonElement Type "direct"constant`

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

              - `required string ToolID`

              - `JsonElement Type "code_execution_20250825"constant`

            - `class BetaServerToolCaller20260120:`

              - `required string ToolID`

              - `JsonElement Type "code_execution_20260120"constant`

        - `class BetaToolResultBlockParam:`

          - `required string ToolUseID`

          - `JsonElement Type "tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Content Content`

            - `string`

            - `IReadOnlyList<Block>`

              - `class BetaTextBlockParam:`

              - `class BetaImageBlockParam:`

              - `class BetaSearchResultBlockParam:`

              - `class BetaRequestDocumentBlock:`

              - `class BetaToolReferenceBlockParam:`

                Tool reference block that can be included in tool_result content.

                - `required string ToolName`

                - `JsonElement Type "tool_reference"constant`

                - `BetaCacheControlEphemeral? CacheControl`

                  Create a cache control breakpoint at this content block.

          - `Boolean IsError`

        - `class BetaServerToolUseBlockParam:`

          - `required string ID`

          - `required IReadOnlyDictionary<string, JsonElement> Input`

          - `required Name Name`

            - `"advisor"Advisor`

            - `"web_search"WebSearch`

            - `"web_fetch"WebFetch`

            - `"code_execution"CodeExecution`

            - `"bash_code_execution"BashCodeExecution`

            - `"text_editor_code_execution"TextEditorCodeExecution`

            - `"tool_search_tool_regex"ToolSearchToolRegex`

            - `"tool_search_tool_bm25"ToolSearchToolBm25`

          - `JsonElement Type "server_tool_use"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

            - `class BetaServerToolCaller20260120:`

        - `class BetaWebSearchToolResultBlockParam:`

          - `required BetaWebSearchToolResultBlockParamContent Content`

            - `IReadOnlyList<BetaWebSearchResultBlockParam>`

              - `required string EncryptedContent`

              - `required string Title`

              - `JsonElement Type "web_search_result"constant`

              - `required string Url`

              - `string? PageAge`

            - `class BetaWebSearchToolRequestError:`

              - `required BetaWebSearchToolResultErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"max_uses_exceeded"MaxUsesExceeded`

                - `"too_many_requests"TooManyRequests`

                - `"query_too_long"QueryTooLong`

                - `"request_too_large"RequestTooLarge`

              - `JsonElement Type "web_search_tool_result_error"constant`

          - `required string ToolUseID`

          - `JsonElement Type "web_search_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

            - `class BetaServerToolCaller20260120:`

        - `class BetaWebFetchToolResultBlockParam:`

          - `required Content Content`

            - `class BetaWebFetchToolResultErrorBlockParam:`

              - `required BetaWebFetchToolResultErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"url_too_long"UrlTooLong`

                - `"url_not_allowed"UrlNotAllowed`

                - `"url_not_in_prior_context"UrlNotInPriorContext`

                - `"url_not_accessible"UrlNotAccessible`

                - `"unsupported_content_type"UnsupportedContentType`

                - `"too_many_requests"TooManyRequests`

                - `"max_uses_exceeded"MaxUsesExceeded`

                - `"unavailable"Unavailable`

              - `JsonElement Type "web_fetch_tool_result_error"constant`

            - `class BetaWebFetchBlockParam:`

              - `required BetaRequestDocumentBlock Content`

              - `JsonElement Type "web_fetch_result"constant`

              - `required string Url`

                Fetched content URL

              - `string? RetrievedAt`

                ISO 8601 timestamp when the content was retrieved

          - `required string ToolUseID`

          - `JsonElement Type "web_fetch_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

            - `class BetaServerToolCaller20260120:`

        - `class BetaAdvisorToolResultBlockParam:`

          - `required Content Content`

            - `class BetaAdvisorToolResultErrorParam:`

              - `required ErrorCode ErrorCode`

                - `"max_uses_exceeded"MaxUsesExceeded`

                - `"prompt_too_long"PromptTooLong`

                - `"too_many_requests"TooManyRequests`

                - `"overloaded"Overloaded`

                - `"unavailable"Unavailable`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `JsonElement Type "advisor_tool_result_error"constant`

            - `class BetaAdvisorResultBlockParam:`

              - `required string Text`

              - `JsonElement Type "advisor_result"constant`

              - `string? StopReason`

            - `class BetaAdvisorRedactedResultBlockParam:`

              - `required string EncryptedContent`

                Opaque blob produced by a prior response; must be round-tripped verbatim.

              - `JsonElement Type "advisor_redacted_result"constant`

              - `string? StopReason`

          - `required string ToolUseID`

          - `JsonElement Type "advisor_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaCodeExecutionToolResultBlockParam:`

          - `required BetaCodeExecutionToolResultBlockParamContent Content`

            Code execution result with encrypted stdout for PFC + web_search results.

            - `class BetaCodeExecutionToolResultErrorParam:`

              - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `JsonElement Type "code_execution_tool_result_error"constant`

            - `class BetaCodeExecutionResultBlockParam:`

              - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

                - `required string FileID`

                - `JsonElement Type "code_execution_output"constant`

              - `required Long ReturnCode`

              - `required string Stderr`

              - `required string Stdout`

              - `JsonElement Type "code_execution_result"constant`

            - `class BetaEncryptedCodeExecutionResultBlockParam:`

              Code execution result with encrypted stdout for PFC + web_search results.

              - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

                - `required string FileID`

                - `JsonElement Type "code_execution_output"constant`

              - `required string EncryptedStdout`

              - `required Long ReturnCode`

              - `required string Stderr`

              - `JsonElement Type "encrypted_code_execution_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "code_execution_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaBashCodeExecutionToolResultBlockParam:`

          - `required Content Content`

            - `class BetaBashCodeExecutionToolResultErrorParam:`

              - `required ErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `"output_file_too_large"OutputFileTooLarge`

              - `JsonElement Type "bash_code_execution_tool_result_error"constant`

            - `class BetaBashCodeExecutionResultBlockParam:`

              - `required IReadOnlyList<BetaBashCodeExecutionOutputBlockParam> Content`

                - `required string FileID`

                - `JsonElement Type "bash_code_execution_output"constant`

              - `required Long ReturnCode`

              - `required string Stderr`

              - `required string Stdout`

              - `JsonElement Type "bash_code_execution_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "bash_code_execution_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaTextEditorCodeExecutionToolResultBlockParam:`

          - `required Content Content`

            - `class BetaTextEditorCodeExecutionToolResultErrorParam:`

              - `required ErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `"file_not_found"FileNotFound`

              - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

              - `string? ErrorMessage`

            - `class BetaTextEditorCodeExecutionViewResultBlockParam:`

              - `required string Content`

              - `required FileType FileType`

                - `"text"Text`

                - `"image"Image`

                - `"pdf"Pdf`

              - `JsonElement Type "text_editor_code_execution_view_result"constant`

              - `Long? NumLines`

              - `Long? StartLine`

              - `Long? TotalLines`

            - `class BetaTextEditorCodeExecutionCreateResultBlockParam:`

              - `required Boolean IsFileUpdate`

              - `JsonElement Type "text_editor_code_execution_create_result"constant`

            - `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:`

              - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

              - `IReadOnlyList<string>? Lines`

              - `Long? NewLines`

              - `Long? NewStart`

              - `Long? OldLines`

              - `Long? OldStart`

          - `required string ToolUseID`

          - `JsonElement Type "text_editor_code_execution_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaToolSearchToolResultBlockParam:`

          - `required Content Content`

            - `class BetaToolSearchToolResultErrorParam:`

              - `required ErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `JsonElement Type "tool_search_tool_result_error"constant`

            - `class BetaToolSearchToolSearchResultBlockParam:`

              - `required IReadOnlyList<BetaToolReferenceBlockParam> ToolReferences`

                - `required string ToolName`

                - `JsonElement Type "tool_reference"constant`

                - `BetaCacheControlEphemeral? CacheControl`

                  Create a cache control breakpoint at this content block.

              - `JsonElement Type "tool_search_tool_search_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "tool_search_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaMcpToolUseBlockParam:`

          - `required string ID`

          - `required IReadOnlyDictionary<string, JsonElement> Input`

          - `required string Name`

          - `required string ServerName`

            The name of the MCP server

          - `JsonElement Type "mcp_tool_use"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaRequestMcpToolResultBlockParam:`

          - `required string ToolUseID`

          - `JsonElement Type "mcp_tool_result"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Content Content`

            - `string`

            - `IReadOnlyList<BetaTextBlockParam>`

              - `required string Text`

              - `JsonElement Type "text"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

              - `IReadOnlyList<BetaTextCitationParam>? Citations`

          - `Boolean IsError`

        - `class BetaContainerUploadBlockParam:`

          A content block that represents a file to be uploaded to the container
          Files uploaded via this block will be available in the container's input directory.

          - `required string FileID`

          - `JsonElement Type "container_upload"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `class BetaCompactionBlockParam:`

          A compaction block containing summary of previous context.

          Users should round-trip these blocks from responses to subsequent requests
          to maintain context across compaction boundaries.

          When content is None, the block represents a failed compaction. The server
          treats these as no-ops. Empty string content is not allowed.

          - `JsonElement Type "compaction"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `string? Content`

            Summary of previously compacted content, or null if compaction failed

          - `string? EncryptedContent`

            Opaque metadata from prior compaction, to be round-tripped verbatim

        - `class BetaMidConversationSystemBlockParam:`

          System instructions that appear mid-conversation.

          Use this block to provide or update system-level instructions at a specific
          point in the conversation, rather than only via the top-level `system` parameter.

          - `required IReadOnlyList<BetaTextBlockParam> Content`

            System instruction text blocks.

            - `required string Text`

            - `JsonElement Type "text"constant`

            - `BetaCacheControlEphemeral? CacheControl`

              Create a cache control breakpoint at this content block.

            - `IReadOnlyList<BetaTextCitationParam>? Citations`

          - `JsonElement Type "mid_conv_system"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

    - `required Role Role`

      - `"user"User`

      - `"assistant"Assistant`

      - `"system"System`

  - `required Model model`

    Body param: The model that will complete your prompt.

    See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

  - `BetaCacheControlEphemeral? cacheControl`

    Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.

  - `BetaContextManagementConfig? contextManagement`

    Body param: Context management configuration.

    This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not.

  - `IReadOnlyList<BetaRequestMcpServerUrlDefinition> mcpServers`

    Body param: MCP servers to be utilized in this request

    - `required string Name`

    - `JsonElement Type "url"constant`

    - `required string Url`

    - `string? AuthorizationToken`

    - `BetaRequestMcpServerToolConfiguration? ToolConfiguration`

      - `IReadOnlyList<string>? AllowedTools`

      - `Boolean? Enabled`

  - `BetaOutputConfig outputConfig`

    Body param: Configuration options for the model's output, such as the output format.

  - `BetaJsonOutputFormat? outputFormat`

    Body param: Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)

    A schema to specify Claude's output format in responses. This parameter will be removed in a future release.

  - `Speed? speed`

    Body param: The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference.

    - `"standard"Standard`

    - `"fast"Fast`

  - `System system`

    Body param: System prompt.

    A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).

    - `string`

    - `IReadOnlyList<BetaTextBlockParam>`

      - `required string Text`

      - `JsonElement Type "text"constant`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `IReadOnlyList<BetaTextCitationParam>? Citations`

  - `BetaThinkingConfigParam thinking`

    Body param: Configuration for enabling Claude's extended thinking.

    When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.

    See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details.

  - `BetaToolChoice toolChoice`

    Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.

  - `IReadOnlyList<Tool> tools`

    Body param: Definitions of tools that the model may use.

    If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.

    There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).

    Each tool definition includes:

    * `name`: Name of the tool.
    * `description`: Optional, but strongly-recommended description of the tool.
    * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.

    For example, if you defined `tools` as:

    ```json
    [
      {
        "name": "get_stock_price",
        "description": "Get the current stock price for a given ticker symbol.",
        "input_schema": {
          "type": "object",
          "properties": {
            "ticker": {
              "type": "string",
              "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
            }
          },
          "required": ["ticker"]
        }
      }
    ]
    ```

    And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:

    ```json
    [
      {
        "type": "tool_use",
        "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
        "name": "get_stock_price",
        "input": { "ticker": "^GSPC" }
      }
    ]
    ```

    You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:

    ```json
    [
      {
        "type": "tool_result",
        "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
        "content": "259.75 USD"
      }
    ]
    ```

    Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.

    See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.

    - `class BetaTool:`

      - `required InputSchema InputSchema`

        [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.

        This defines the shape of the `input` that your tool accepts and that the model will produce.

        - `JsonElement Type "object"constant`

        - `IReadOnlyDictionary<string, JsonElement>? Properties`

        - `IReadOnlyList<string>? Required`

      - `required string Name`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `string Description`

        Description of what this tool does.

        Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.

      - `Boolean? EagerInputStreaming`

        Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

      - `Type? Type`

        - `"custom"Custom`

    - `class BetaToolBash20241022:`

      - `JsonElement Name "bash"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "bash_20241022"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolBash20250124:`

      - `JsonElement Name "bash"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "bash_20250124"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaCodeExecutionTool20250522:`

      - `JsonElement Name "code_execution"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "code_execution_20250522"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaCodeExecutionTool20250825:`

      - `JsonElement Name "code_execution"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "code_execution_20250825"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaCodeExecutionTool20260120:`

      Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).

      - `JsonElement Name "code_execution"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "code_execution_20260120"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolComputerUse20241022:`

      - `required Long DisplayHeightPx`

        The height of the display in pixels.

      - `required Long DisplayWidthPx`

        The width of the display in pixels.

      - `JsonElement Name "computer"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "computer_20241022"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? DisplayNumber`

        The X11 display number (e.g. 0, 1) for the display.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaMemoryTool20250818:`

      - `JsonElement Name "memory"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "memory_20250818"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolComputerUse20250124:`

      - `required Long DisplayHeightPx`

        The height of the display in pixels.

      - `required Long DisplayWidthPx`

        The width of the display in pixels.

      - `JsonElement Name "computer"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "computer_20250124"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? DisplayNumber`

        The X11 display number (e.g. 0, 1) for the display.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolTextEditor20241022:`

      - `JsonElement Name "str_replace_editor"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "text_editor_20241022"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolComputerUse20251124:`

      - `required Long DisplayHeightPx`

        The height of the display in pixels.

      - `required Long DisplayWidthPx`

        The width of the display in pixels.

      - `JsonElement Name "computer"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "computer_20251124"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? DisplayNumber`

        The X11 display number (e.g. 0, 1) for the display.

      - `Boolean EnableZoom`

        Whether to enable an action to take a zoomed-in screenshot of the screen.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolTextEditor20250124:`

      - `JsonElement Name "str_replace_editor"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "text_editor_20250124"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolTextEditor20250429:`

      - `JsonElement Name "str_replace_based_edit_tool"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "text_editor_20250429"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolTextEditor20250728:`

      - `JsonElement Name "str_replace_based_edit_tool"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "text_editor_20250728"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

      - `Long? MaxCharacters`

        Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaWebSearchTool20250305:`

      - `JsonElement Name "web_search"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "web_search_20250305"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `IReadOnlyList<string>? AllowedDomains`

        If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.

      - `IReadOnlyList<string>? BlockedDomains`

        If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? MaxUses`

        Maximum number of times the tool can be used in the API request.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

      - `BetaUserLocation? UserLocation`

        Parameters for the user's location. Used to provide more relevant search results.

        - `JsonElement Type "approximate"constant`

        - `string? City`

          The city of the user.

        - `string? Country`

          The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.

        - `string? Region`

          The region of the user.

        - `string? Timezone`

          The [IANA timezone](https://nodatime.org/TimeZones) of the user.

    - `class BetaWebFetchTool20250910:`

      - `JsonElement Name "web_fetch"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "web_fetch_20250910"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `IReadOnlyList<string>? AllowedDomains`

        List of domains to allow fetching from

      - `IReadOnlyList<string>? BlockedDomains`

        List of domains to block fetching from

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `BetaCitationsConfigParam? Citations`

        Citations configuration for fetched documents. Citations are disabled by default.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? MaxContentTokens`

        Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

      - `Long? MaxUses`

        Maximum number of times the tool can be used in the API request.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaWebSearchTool20260209:`

      - `JsonElement Name "web_search"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "web_search_20260209"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `IReadOnlyList<string>? AllowedDomains`

        If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.

      - `IReadOnlyList<string>? BlockedDomains`

        If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? MaxUses`

        Maximum number of times the tool can be used in the API request.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

      - `BetaUserLocation? UserLocation`

        Parameters for the user's location. Used to provide more relevant search results.

    - `class BetaWebFetchTool20260209:`

      - `JsonElement Name "web_fetch"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "web_fetch_20260209"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `IReadOnlyList<string>? AllowedDomains`

        List of domains to allow fetching from

      - `IReadOnlyList<string>? BlockedDomains`

        List of domains to block fetching from

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `BetaCitationsConfigParam? Citations`

        Citations configuration for fetched documents. Citations are disabled by default.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? MaxContentTokens`

        Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

      - `Long? MaxUses`

        Maximum number of times the tool can be used in the API request.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaWebFetchTool20260309:`

      Web fetch tool with use_cache parameter for bypassing cached content.

      - `JsonElement Name "web_fetch"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "web_fetch_20260309"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `IReadOnlyList<string>? AllowedDomains`

        List of domains to allow fetching from

      - `IReadOnlyList<string>? BlockedDomains`

        List of domains to block fetching from

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `BetaCitationsConfigParam? Citations`

        Citations configuration for fetched documents. Citations are disabled by default.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? MaxContentTokens`

        Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

      - `Long? MaxUses`

        Maximum number of times the tool can be used in the API request.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

      - `Boolean UseCache`

        Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.

    - `class BetaAdvisorTool20260301:`

      - `required Model Model`

        The model that will complete your prompt.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-mythos-preview"ClaudeMythosPreview`

          New class of intelligence, strongest in coding and cybersecurity

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Frontier intelligence for long-running agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

        - `"claude-opus-4-1"ClaudeOpus4_1`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-0"ClaudeOpus4_0`

          Powerful model for complex tasks

        - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

          Powerful model for complex tasks

        - `"claude-sonnet-4-0"ClaudeSonnet4_0`

          High-performance model with extended thinking

        - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

          High-performance model with extended thinking

        - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

          Fast and cost-effective model

      - `JsonElement Name "advisor"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `JsonElement Type "advisor_20260301"constant`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `BetaCacheControlEphemeral? Caching`

        Caching for the advisor's own prompt. When set, each advisor call writes a cache entry at the given TTL so subsequent calls in the same conversation read the stable prefix. When omitted, the advisor prompt is not cached.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Long? MaxUses`

        Maximum number of times the tool can be used in the API request.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolSearchToolBm25_20251119:`

      - `JsonElement Name "tool_search_tool_bm25"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `required Type Type`

        - `"tool_search_tool_bm25_20251119"ToolSearchToolBm25_20251119`

        - `"tool_search_tool_bm25"ToolSearchToolBm25`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaToolSearchToolRegex20251119:`

      - `JsonElement Name "tool_search_tool_regex"constant`

        Name of the tool.

        This is how the tool will be called by the model and in `tool_use` blocks.

      - `required Type Type`

        - `"tool_search_tool_regex_20251119"ToolSearchToolRegex20251119`

        - `"tool_search_tool_regex"ToolSearchToolRegex`

      - `IReadOnlyList<AllowedCaller> AllowedCallers`

        - `"direct"Direct`

        - `"code_execution_20250825"CodeExecution20250825`

        - `"code_execution_20260120"CodeExecution20260120`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `Boolean DeferLoading`

        If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

      - `Boolean Strict`

        When true, guarantees schema validation on tool names and inputs

    - `class BetaMcpToolset:`

      Configuration for a group of tools from an MCP server.

      Allows configuring enabled status and defer_loading for all tools
      from an MCP server, with optional per-tool overrides.

      - `required string McpServerName`

        Name of the MCP server to configure tools for

      - `JsonElement Type "mcp_toolset"constant`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `IReadOnlyDictionary<string, BetaMcpToolConfig>? Configs`

        Configuration overrides for specific tools, keyed by tool name

        - `Boolean DeferLoading`

        - `Boolean Enabled`

      - `BetaMcpToolDefaultConfig DefaultConfig`

        Default configuration applied to all tools from this server

        - `Boolean DeferLoading`

        - `Boolean Enabled`

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaMessageTokensCount:`

  - `required BetaCountTokensContextManagementResponse? ContextManagement`

    Information about context management applied to the message.

    - `required Long OriginalInputTokens`

      The original token count before context management was applied

  - `required Long InputTokens`

    The total number of tokens across the provided list of messages, system prompt, and tools.

### Example

```csharp
MessageCountTokensParams parameters = new()
{
    Messages =
    [
        new()
        {
            Content = "Hello, world",
            Role = Role.User,
        },
    ],
    Model = Model.ClaudeOpus4_6,
};

var betaMessageTokensCount = await client.Beta.Messages.CountTokens(parameters);

Console.WriteLine(betaMessageTokensCount);
```

#### Response

```json
{
  "context_management": {
    "original_input_tokens": 0
  },
  "input_tokens": 2095
}
```

## Domain Types

### Beta Advisor Message Iteration Usage

- `class BetaAdvisorMessageIterationUsage:`

  Token usage for an advisor sub-inference iteration.

  - `required BetaCacheCreation? CacheCreation`

    Breakdown of cached tokens by TTL

    - `required Long Ephemeral1hInputTokens`

      The number of input tokens used to create the 1 hour cache entry.

    - `required Long Ephemeral5mInputTokens`

      The number of input tokens used to create the 5 minute cache entry.

  - `required Long CacheCreationInputTokens`

    The number of input tokens used to create the cache entry.

  - `required Long CacheReadInputTokens`

    The number of input tokens read from the cache.

  - `required Long InputTokens`

    The number of input tokens which were used.

  - `required Model Model`

    The model that will complete your prompt.

    See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

    - `"claude-opus-4-8"ClaudeOpus4_8`

      Frontier intelligence for long-running agents and coding

    - `"claude-opus-4-7"ClaudeOpus4_7`

      Frontier intelligence for long-running agents and coding

    - `"claude-mythos-preview"ClaudeMythosPreview`

      New class of intelligence, strongest in coding and cybersecurity

    - `"claude-opus-4-6"ClaudeOpus4_6`

      Frontier intelligence for long-running agents and coding

    - `"claude-sonnet-4-6"ClaudeSonnet4_6`

      Best combination of speed and intelligence

    - `"claude-haiku-4-5"ClaudeHaiku4_5`

      Fastest model with near-frontier intelligence

    - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

      Fastest model with near-frontier intelligence

    - `"claude-opus-4-5"ClaudeOpus4_5`

      Premium model combining maximum intelligence with practical performance

    - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

      Premium model combining maximum intelligence with practical performance

    - `"claude-sonnet-4-5"ClaudeSonnet4_5`

      High-performance model for agents and coding

    - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

      High-performance model for agents and coding

    - `"claude-opus-4-1"ClaudeOpus4_1`

      Exceptional model for specialized complex tasks

    - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

      Exceptional model for specialized complex tasks

    - `"claude-opus-4-0"ClaudeOpus4_0`

      Powerful model for complex tasks

    - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

      Powerful model for complex tasks

    - `"claude-sonnet-4-0"ClaudeSonnet4_0`

      High-performance model with extended thinking

    - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

      High-performance model with extended thinking

    - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

      Fast and cost-effective model

  - `required Long OutputTokens`

    The number of output tokens which were used.

  - `JsonElement Type "advisor_message"constant`

    Usage for an advisor sub-inference iteration

### Beta Advisor Redacted Result Block

- `class BetaAdvisorRedactedResultBlock:`

  - `required string EncryptedContent`

    Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.

  - `required string? StopReason`

    The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`).

  - `JsonElement Type "advisor_redacted_result"constant`

### Beta Advisor Redacted Result Block Param

- `class BetaAdvisorRedactedResultBlockParam:`

  - `required string EncryptedContent`

    Opaque blob produced by a prior response; must be round-tripped verbatim.

  - `JsonElement Type "advisor_redacted_result"constant`

  - `string? StopReason`

### Beta Advisor Result Block

- `class BetaAdvisorResultBlock:`

  - `required string? StopReason`

    The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the tool's `max_tokens` value or the advisor model's policy cap.

  - `required string Text`

  - `JsonElement Type "advisor_result"constant`

### Beta Advisor Result Block Param

- `class BetaAdvisorResultBlockParam:`

  - `required string Text`

  - `JsonElement Type "advisor_result"constant`

  - `string? StopReason`

### Beta Advisor Tool 20260301

- `class BetaAdvisorTool20260301:`

  - `required Model Model`

    The model that will complete your prompt.

    See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

    - `"claude-opus-4-8"ClaudeOpus4_8`

      Frontier intelligence for long-running agents and coding

    - `"claude-opus-4-7"ClaudeOpus4_7`

      Frontier intelligence for long-running agents and coding

    - `"claude-mythos-preview"ClaudeMythosPreview`

      New class of intelligence, strongest in coding and cybersecurity

    - `"claude-opus-4-6"ClaudeOpus4_6`

      Frontier intelligence for long-running agents and coding

    - `"claude-sonnet-4-6"ClaudeSonnet4_6`

      Best combination of speed and intelligence

    - `"claude-haiku-4-5"ClaudeHaiku4_5`

      Fastest model with near-frontier intelligence

    - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

      Fastest model with near-frontier intelligence

    - `"claude-opus-4-5"ClaudeOpus4_5`

      Premium model combining maximum intelligence with practical performance

    - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

      Premium model combining maximum intelligence with practical performance

    - `"claude-sonnet-4-5"ClaudeSonnet4_5`

      High-performance model for agents and coding

    - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

      High-performance model for agents and coding

    - `"claude-opus-4-1"ClaudeOpus4_1`

      Exceptional model for specialized complex tasks

    - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

      Exceptional model for specialized complex tasks

    - `"claude-opus-4-0"ClaudeOpus4_0`

      Powerful model for complex tasks

    - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

      Powerful model for complex tasks

    - `"claude-sonnet-4-0"ClaudeSonnet4_0`

      High-performance model with extended thinking

    - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

      High-performance model with extended thinking

    - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

      Fast and cost-effective model

  - `JsonElement Name "advisor"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "advisor_20260301"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `BetaCacheControlEphemeral? Caching`

    Caching for the advisor's own prompt. When set, each advisor call writes a cache entry at the given TTL so subsequent calls in the same conversation read the stable prefix. When omitted, the advisor prompt is not cached.

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Long? MaxUses`

    Maximum number of times the tool can be used in the API request.

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Advisor Tool Result Block

- `class BetaAdvisorToolResultBlock:`

  - `required Content Content`

    - `class BetaAdvisorToolResultError:`

      - `required ErrorCode ErrorCode`

        - `"max_uses_exceeded"MaxUsesExceeded`

        - `"prompt_too_long"PromptTooLong`

        - `"too_many_requests"TooManyRequests`

        - `"overloaded"Overloaded`

        - `"unavailable"Unavailable`

        - `"execution_time_exceeded"ExecutionTimeExceeded`

      - `JsonElement Type "advisor_tool_result_error"constant`

    - `class BetaAdvisorResultBlock:`

      - `required string? StopReason`

        The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the tool's `max_tokens` value or the advisor model's policy cap.

      - `required string Text`

      - `JsonElement Type "advisor_result"constant`

    - `class BetaAdvisorRedactedResultBlock:`

      - `required string EncryptedContent`

        Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.

      - `required string? StopReason`

        The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`).

      - `JsonElement Type "advisor_redacted_result"constant`

  - `required string ToolUseID`

  - `JsonElement Type "advisor_tool_result"constant`

### Beta Advisor Tool Result Block Param

- `class BetaAdvisorToolResultBlockParam:`

  - `required Content Content`

    - `class BetaAdvisorToolResultErrorParam:`

      - `required ErrorCode ErrorCode`

        - `"max_uses_exceeded"MaxUsesExceeded`

        - `"prompt_too_long"PromptTooLong`

        - `"too_many_requests"TooManyRequests`

        - `"overloaded"Overloaded`

        - `"unavailable"Unavailable`

        - `"execution_time_exceeded"ExecutionTimeExceeded`

      - `JsonElement Type "advisor_tool_result_error"constant`

    - `class BetaAdvisorResultBlockParam:`

      - `required string Text`

      - `JsonElement Type "advisor_result"constant`

      - `string? StopReason`

    - `class BetaAdvisorRedactedResultBlockParam:`

      - `required string EncryptedContent`

        Opaque blob produced by a prior response; must be round-tripped verbatim.

      - `JsonElement Type "advisor_redacted_result"constant`

      - `string? StopReason`

  - `required string ToolUseID`

  - `JsonElement Type "advisor_tool_result"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

### Beta Advisor Tool Result Error

- `class BetaAdvisorToolResultError:`

  - `required ErrorCode ErrorCode`

    - `"max_uses_exceeded"MaxUsesExceeded`

    - `"prompt_too_long"PromptTooLong`

    - `"too_many_requests"TooManyRequests`

    - `"overloaded"Overloaded`

    - `"unavailable"Unavailable`

    - `"execution_time_exceeded"ExecutionTimeExceeded`

  - `JsonElement Type "advisor_tool_result_error"constant`

### Beta Advisor Tool Result Error Param

- `class BetaAdvisorToolResultErrorParam:`

  - `required ErrorCode ErrorCode`

    - `"max_uses_exceeded"MaxUsesExceeded`

    - `"prompt_too_long"PromptTooLong`

    - `"too_many_requests"TooManyRequests`

    - `"overloaded"Overloaded`

    - `"unavailable"Unavailable`

    - `"execution_time_exceeded"ExecutionTimeExceeded`

  - `JsonElement Type "advisor_tool_result_error"constant`

### Beta All Thinking Turns

- `class BetaAllThinkingTurns:`

  - `JsonElement Type "all"constant`

### Beta Base64 Image Source

- `class BetaBase64ImageSource:`

  - `required string Data`

  - `required MediaType MediaType`

    - `"image/jpeg"ImageJpeg`

    - `"image/png"ImagePng`

    - `"image/gif"ImageGif`

    - `"image/webp"ImageWebP`

  - `JsonElement Type "base64"constant`

### Beta Base64 PDF Source

- `class BetaBase64PdfSource:`

  - `required string Data`

  - `JsonElement MediaType "application/pdf"constant`

  - `JsonElement Type "base64"constant`

### Beta Bash Code Execution Output Block

- `class BetaBashCodeExecutionOutputBlock:`

  - `required string FileID`

  - `JsonElement Type "bash_code_execution_output"constant`

### Beta Bash Code Execution Output Block Param

- `class BetaBashCodeExecutionOutputBlockParam:`

  - `required string FileID`

  - `JsonElement Type "bash_code_execution_output"constant`

### Beta Bash Code Execution Result Block

- `class BetaBashCodeExecutionResultBlock:`

  - `required IReadOnlyList<BetaBashCodeExecutionOutputBlock> Content`

    - `required string FileID`

    - `JsonElement Type "bash_code_execution_output"constant`

  - `required Long ReturnCode`

  - `required string Stderr`

  - `required string Stdout`

  - `JsonElement Type "bash_code_execution_result"constant`

### Beta Bash Code Execution Result Block Param

- `class BetaBashCodeExecutionResultBlockParam:`

  - `required IReadOnlyList<BetaBashCodeExecutionOutputBlockParam> Content`

    - `required string FileID`

    - `JsonElement Type "bash_code_execution_output"constant`

  - `required Long ReturnCode`

  - `required string Stderr`

  - `required string Stdout`

  - `JsonElement Type "bash_code_execution_result"constant`

### Beta Bash Code Execution Tool Result Block

- `class BetaBashCodeExecutionToolResultBlock:`

  - `required Content Content`

    - `class BetaBashCodeExecutionToolResultError:`

      - `required ErrorCode ErrorCode`

        - `"invalid_tool_input"InvalidToolInput`

        - `"unavailable"Unavailable`

        - `"too_many_requests"TooManyRequests`

        - `"execution_time_exceeded"ExecutionTimeExceeded`

        - `"output_file_too_large"OutputFileTooLarge`

      - `JsonElement Type "bash_code_execution_tool_result_error"constant`

    - `class BetaBashCodeExecutionResultBlock:`

      - `required IReadOnlyList<BetaBashCodeExecutionOutputBlock> Content`

        - `required string FileID`

        - `JsonElement Type "bash_code_execution_output"constant`

      - `required Long ReturnCode`

      - `required string Stderr`

      - `required string Stdout`

      - `JsonElement Type "bash_code_execution_result"constant`

  - `required string ToolUseID`

  - `JsonElement Type "bash_code_execution_tool_result"constant`

### Beta Bash Code Execution Tool Result Block Param

- `class BetaBashCodeExecutionToolResultBlockParam:`

  - `required Content Content`

    - `class BetaBashCodeExecutionToolResultErrorParam:`

      - `required ErrorCode ErrorCode`

        - `"invalid_tool_input"InvalidToolInput`

        - `"unavailable"Unavailable`

        - `"too_many_requests"TooManyRequests`

        - `"execution_time_exceeded"ExecutionTimeExceeded`

        - `"output_file_too_large"OutputFileTooLarge`

      - `JsonElement Type "bash_code_execution_tool_result_error"constant`

    - `class BetaBashCodeExecutionResultBlockParam:`

      - `required IReadOnlyList<BetaBashCodeExecutionOutputBlockParam> Content`

        - `required string FileID`

        - `JsonElement Type "bash_code_execution_output"constant`

      - `required Long ReturnCode`

      - `required string Stderr`

      - `required string Stdout`

      - `JsonElement Type "bash_code_execution_result"constant`

  - `required string ToolUseID`

  - `JsonElement Type "bash_code_execution_tool_result"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

### Beta Bash Code Execution Tool Result Error

- `class BetaBashCodeExecutionToolResultError:`

  - `required ErrorCode ErrorCode`

    - `"invalid_tool_input"InvalidToolInput`

    - `"unavailable"Unavailable`

    - `"too_many_requests"TooManyRequests`

    - `"execution_time_exceeded"ExecutionTimeExceeded`

    - `"output_file_too_large"OutputFileTooLarge`

  - `JsonElement Type "bash_code_execution_tool_result_error"constant`

### Beta Bash Code Execution Tool Result Error Param

- `class BetaBashCodeExecutionToolResultErrorParam:`

  - `required ErrorCode ErrorCode`

    - `"invalid_tool_input"InvalidToolInput`

    - `"unavailable"Unavailable`

    - `"too_many_requests"TooManyRequests`

    - `"execution_time_exceeded"ExecutionTimeExceeded`

    - `"output_file_too_large"OutputFileTooLarge`

  - `JsonElement Type "bash_code_execution_tool_result_error"constant`

### Beta Cache Control Ephemeral

- `class BetaCacheControlEphemeral:`

  - `JsonElement Type "ephemeral"constant`

  - `Ttl Ttl`

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    - `5m`: 5 minutes
    - `1h`: 1 hour

    Defaults to `5m`.

    - `"5m"Ttl5m`

    - `"1h"Ttl1h`

### Beta Cache Creation

- `class BetaCacheCreation:`

  - `required Long Ephemeral1hInputTokens`

    The number of input tokens used to create the 1 hour cache entry.

  - `required Long Ephemeral5mInputTokens`

    The number of input tokens used to create the 5 minute cache entry.

### Beta Cache Miss Messages Changed

- `class BetaCacheMissMessagesChanged:`

  - `required Long CacheMissedInputTokens`

    Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

  - `JsonElement Type "messages_changed"constant`

### Beta Cache Miss Model Changed

- `class BetaCacheMissModelChanged:`

  - `required Long CacheMissedInputTokens`

    Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

  - `JsonElement Type "model_changed"constant`

### Beta Cache Miss Previous Message Not Found

- `class BetaCacheMissPreviousMessageNotFound:`

  - `JsonElement Type "previous_message_not_found"constant`

### Beta Cache Miss System Changed

- `class BetaCacheMissSystemChanged:`

  - `required Long CacheMissedInputTokens`

    Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

  - `JsonElement Type "system_changed"constant`

### Beta Cache Miss Tools Changed

- `class BetaCacheMissToolsChanged:`

  - `required Long CacheMissedInputTokens`

    Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

  - `JsonElement Type "tools_changed"constant`

### Beta Cache Miss Unavailable

- `class BetaCacheMissUnavailable:`

  - `JsonElement Type "unavailable"constant`

### Beta Citation Char Location

- `class BetaCitationCharLocation:`

  - `required string CitedText`

  - `required Long DocumentIndex`

  - `required string? DocumentTitle`

  - `required Long EndCharIndex`

  - `required string? FileID`

  - `required Long StartCharIndex`

  - `JsonElement Type "char_location"constant`

### Beta Citation Char Location Param

- `class BetaCitationCharLocationParam:`

  - `required string CitedText`

  - `required Long DocumentIndex`

  - `required string? DocumentTitle`

  - `required Long EndCharIndex`

  - `required Long StartCharIndex`

  - `JsonElement Type "char_location"constant`

### Beta Citation Config

- `class BetaCitationConfig:`

  - `required Boolean Enabled`

### Beta Citation Content Block Location

- `class BetaCitationContentBlockLocation:`

  - `required string CitedText`

    The full text of the cited block range, concatenated.

    Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

  - `required Long DocumentIndex`

  - `required string? DocumentTitle`

  - `required Long EndBlockIndex`

    Exclusive 0-based end index of the cited block range in the source's `content` array.

    Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

  - `required string? FileID`

  - `required Long StartBlockIndex`

    0-based index of the first cited block in the source's `content` array.

  - `JsonElement Type "content_block_location"constant`

### Beta Citation Content Block Location Param

- `class BetaCitationContentBlockLocationParam:`

  - `required string CitedText`

    The full text of the cited block range, concatenated.

    Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

  - `required Long DocumentIndex`

  - `required string? DocumentTitle`

  - `required Long EndBlockIndex`

    Exclusive 0-based end index of the cited block range in the source's `content` array.

    Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

  - `required Long StartBlockIndex`

    0-based index of the first cited block in the source's `content` array.

  - `JsonElement Type "content_block_location"constant`

### Beta Citation Page Location

- `class BetaCitationPageLocation:`

  - `required string CitedText`

  - `required Long DocumentIndex`

  - `required string? DocumentTitle`

  - `required Long EndPageNumber`

  - `required string? FileID`

  - `required Long StartPageNumber`

  - `JsonElement Type "page_location"constant`

### Beta Citation Page Location Param

- `class BetaCitationPageLocationParam:`

  - `required string CitedText`

  - `required Long DocumentIndex`

  - `required string? DocumentTitle`

  - `required Long EndPageNumber`

  - `required Long StartPageNumber`

  - `JsonElement Type "page_location"constant`

### Beta Citation Search Result Location

- `class BetaCitationSearchResultLocation:`

  - `required string CitedText`

    The full text of the cited block range, concatenated.

    Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

  - `required Long EndBlockIndex`

    Exclusive 0-based end index of the cited block range in the source's `content` array.

    Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

  - `required Long SearchResultIndex`

    0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

    Counted separately from `document_index`; server-side web search results are not included in this count.

  - `required string Source`

  - `required Long StartBlockIndex`

    0-based index of the first cited block in the source's `content` array.

  - `required string? Title`

  - `JsonElement Type "search_result_location"constant`

### Beta Citation Search Result Location Param

- `class BetaCitationSearchResultLocationParam:`

  - `required string CitedText`

    The full text of the cited block range, concatenated.

    Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

  - `required Long EndBlockIndex`

    Exclusive 0-based end index of the cited block range in the source's `content` array.

    Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

  - `required Long SearchResultIndex`

    0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

    Counted separately from `document_index`; server-side web search results are not included in this count.

  - `required string Source`

  - `required Long StartBlockIndex`

    0-based index of the first cited block in the source's `content` array.

  - `required string? Title`

  - `JsonElement Type "search_result_location"constant`

### Beta Citation Web Search Result Location Param

- `class BetaCitationWebSearchResultLocationParam:`

  - `required string CitedText`

  - `required string EncryptedIndex`

  - `required string? Title`

  - `JsonElement Type "web_search_result_location"constant`

  - `required string Url`

### Beta Citations Config Param

- `class BetaCitationsConfigParam:`

  - `Boolean Enabled`

### Beta Citations Delta

- `class BetaCitationsDelta:`

  - `required Citation Citation`

    - `class BetaCitationCharLocation:`

      - `required string CitedText`

      - `required Long DocumentIndex`

      - `required string? DocumentTitle`

      - `required Long EndCharIndex`

      - `required string? FileID`

      - `required Long StartCharIndex`

      - `JsonElement Type "char_location"constant`

    - `class BetaCitationPageLocation:`

      - `required string CitedText`

      - `required Long DocumentIndex`

      - `required string? DocumentTitle`

      - `required Long EndPageNumber`

      - `required string? FileID`

      - `required Long StartPageNumber`

      - `JsonElement Type "page_location"constant`

    - `class BetaCitationContentBlockLocation:`

      - `required string CitedText`

        The full text of the cited block range, concatenated.

        Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

      - `required Long DocumentIndex`

      - `required string? DocumentTitle`

      - `required Long EndBlockIndex`

        Exclusive 0-based end index of the cited block range in the source's `content` array.

        Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

      - `required string? FileID`

      - `required Long StartBlockIndex`

        0-based index of the first cited block in the source's `content` array.

      - `JsonElement Type "content_block_location"constant`

    - `class BetaCitationsWebSearchResultLocation:`

      - `required string CitedText`

      - `required string EncryptedIndex`

      - `required string? Title`

      - `JsonElement Type "web_search_result_location"constant`

      - `required string Url`

    - `class BetaCitationSearchResultLocation:`

      - `required string CitedText`

        The full text of the cited block range, concatenated.

        Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

      - `required Long EndBlockIndex`

        Exclusive 0-based end index of the cited block range in the source's `content` array.

        Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

      - `required Long SearchResultIndex`

        0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

        Counted separately from `document_index`; server-side web search results are not included in this count.

      - `required string Source`

      - `required Long StartBlockIndex`

        0-based index of the first cited block in the source's `content` array.

      - `required string? Title`

      - `JsonElement Type "search_result_location"constant`

  - `JsonElement Type "citations_delta"constant`

### Beta Citations Web Search Result Location

- `class BetaCitationsWebSearchResultLocation:`

  - `required string CitedText`

  - `required string EncryptedIndex`

  - `required string? Title`

  - `JsonElement Type "web_search_result_location"constant`

  - `required string Url`

### Beta Clear Thinking 20251015 Edit

- `class BetaClearThinking20251015Edit:`

  - `JsonElement Type "clear_thinking_20251015"constant`

  - `Keep Keep`

    Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed.

    - `class BetaThinkingTurns:`

      - `JsonElement Type "thinking_turns"constant`

      - `required Long Value`

    - `class BetaAllThinkingTurns:`

      - `JsonElement Type "all"constant`

    - `class All:`

### Beta Clear Thinking 20251015 Edit Response

- `class BetaClearThinking20251015EditResponse:`

  - `required Long ClearedInputTokens`

    Number of input tokens cleared by this edit.

  - `required Long ClearedThinkingTurns`

    Number of thinking turns that were cleared.

  - `JsonElement Type "clear_thinking_20251015"constant`

    The type of context management edit applied.

### Beta Clear Tool Uses 20250919 Edit

- `class BetaClearToolUses20250919Edit:`

  - `JsonElement Type "clear_tool_uses_20250919"constant`

  - `BetaInputTokensClearAtLeast? ClearAtLeast`

    Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed.

    - `JsonElement Type "input_tokens"constant`

    - `required Long Value`

  - `ClearToolInputs? ClearToolInputs`

    Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)

    - `Boolean`

    - `IReadOnlyList<string>`

  - `IReadOnlyList<string>? ExcludeTools`

    Tool names whose uses are preserved from clearing

  - `BetaToolUsesKeep Keep`

    Number of tool uses to retain in the conversation

    - `JsonElement Type "tool_uses"constant`

    - `required Long Value`

  - `Trigger Trigger`

    Condition that triggers the context management strategy

    - `class BetaInputTokensTrigger:`

      - `JsonElement Type "input_tokens"constant`

      - `required Long Value`

    - `class BetaToolUsesTrigger:`

      - `JsonElement Type "tool_uses"constant`

      - `required Long Value`

### Beta Clear Tool Uses 20250919 Edit Response

- `class BetaClearToolUses20250919EditResponse:`

  - `required Long ClearedInputTokens`

    Number of input tokens cleared by this edit.

  - `required Long ClearedToolUses`

    Number of tool uses that were cleared.

  - `JsonElement Type "clear_tool_uses_20250919"constant`

    The type of context management edit applied.

### Beta Code Execution Output Block

- `class BetaCodeExecutionOutputBlock:`

  - `required string FileID`

  - `JsonElement Type "code_execution_output"constant`

### Beta Code Execution Output Block Param

- `class BetaCodeExecutionOutputBlockParam:`

  - `required string FileID`

  - `JsonElement Type "code_execution_output"constant`

### Beta Code Execution Result Block

- `class BetaCodeExecutionResultBlock:`

  - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

    - `required string FileID`

    - `JsonElement Type "code_execution_output"constant`

  - `required Long ReturnCode`

  - `required string Stderr`

  - `required string Stdout`

  - `JsonElement Type "code_execution_result"constant`

### Beta Code Execution Result Block Param

- `class BetaCodeExecutionResultBlockParam:`

  - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

    - `required string FileID`

    - `JsonElement Type "code_execution_output"constant`

  - `required Long ReturnCode`

  - `required string Stderr`

  - `required string Stdout`

  - `JsonElement Type "code_execution_result"constant`

### Beta Code Execution Tool 20250522

- `class BetaCodeExecutionTool20250522:`

  - `JsonElement Name "code_execution"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "code_execution_20250522"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Code Execution Tool 20250825

- `class BetaCodeExecutionTool20250825:`

  - `JsonElement Name "code_execution"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "code_execution_20250825"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Code Execution Tool 20260120

- `class BetaCodeExecutionTool20260120:`

  Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).

  - `JsonElement Name "code_execution"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "code_execution_20260120"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Code Execution Tool Result Block

- `class BetaCodeExecutionToolResultBlock:`

  - `required BetaCodeExecutionToolResultBlockContent Content`

    Code execution result with encrypted stdout for PFC + web_search results.

    - `class BetaCodeExecutionToolResultError:`

      - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

        - `"invalid_tool_input"InvalidToolInput`

        - `"unavailable"Unavailable`

        - `"too_many_requests"TooManyRequests`

        - `"execution_time_exceeded"ExecutionTimeExceeded`

      - `JsonElement Type "code_execution_tool_result_error"constant`

    - `class BetaCodeExecutionResultBlock:`

      - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

        - `required string FileID`

        - `JsonElement Type "code_execution_output"constant`

      - `required Long ReturnCode`

      - `required string Stderr`

      - `required string Stdout`

      - `JsonElement Type "code_execution_result"constant`

    - `class BetaEncryptedCodeExecutionResultBlock:`

      Code execution result with encrypted stdout for PFC + web_search results.

      - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

        - `required string FileID`

        - `JsonElement Type "code_execution_output"constant`

      - `required string EncryptedStdout`

      - `required Long ReturnCode`

      - `required string Stderr`

      - `JsonElement Type "encrypted_code_execution_result"constant`

  - `required string ToolUseID`

  - `JsonElement Type "code_execution_tool_result"constant`

### Beta Code Execution Tool Result Block Content

- `class BetaCodeExecutionToolResultBlockContent: A class that can be one of several variants.union`

  Code execution result with encrypted stdout for PFC + web_search results.

  - `class BetaCodeExecutionToolResultError:`

    - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

      - `"invalid_tool_input"InvalidToolInput`

      - `"unavailable"Unavailable`

      - `"too_many_requests"TooManyRequests`

      - `"execution_time_exceeded"ExecutionTimeExceeded`

    - `JsonElement Type "code_execution_tool_result_error"constant`

  - `class BetaCodeExecutionResultBlock:`

    - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

      - `required string FileID`

      - `JsonElement Type "code_execution_output"constant`

    - `required Long ReturnCode`

    - `required string Stderr`

    - `required string Stdout`

    - `JsonElement Type "code_execution_result"constant`

  - `class BetaEncryptedCodeExecutionResultBlock:`

    Code execution result with encrypted stdout for PFC + web_search results.

    - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

      - `required string FileID`

      - `JsonElement Type "code_execution_output"constant`

    - `required string EncryptedStdout`

    - `required Long ReturnCode`

    - `required string Stderr`

    - `JsonElement Type "encrypted_code_execution_result"constant`

### Beta Code Execution Tool Result Block Param

- `class BetaCodeExecutionToolResultBlockParam:`

  - `required BetaCodeExecutionToolResultBlockParamContent Content`

    Code execution result with encrypted stdout for PFC + web_search results.

    - `class BetaCodeExecutionToolResultErrorParam:`

      - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

        - `"invalid_tool_input"InvalidToolInput`

        - `"unavailable"Unavailable`

        - `"too_many_requests"TooManyRequests`

        - `"execution_time_exceeded"ExecutionTimeExceeded`

      - `JsonElement Type "code_execution_tool_result_error"constant`

    - `class BetaCodeExecutionResultBlockParam:`

      - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

        - `required string FileID`

        - `JsonElement Type "code_execution_output"constant`

      - `required Long ReturnCode`

      - `required string Stderr`

      - `required string Stdout`

      - `JsonElement Type "code_execution_result"constant`

    - `class BetaEncryptedCodeExecutionResultBlockParam:`

      Code execution result with encrypted stdout for PFC + web_search results.

      - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

        - `required string FileID`

        - `JsonElement Type "code_execution_output"constant`

      - `required string EncryptedStdout`

      - `required Long ReturnCode`

      - `required string Stderr`

      - `JsonElement Type "encrypted_code_execution_result"constant`

  - `required string ToolUseID`

  - `JsonElement Type "code_execution_tool_result"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

### Beta Code Execution Tool Result Block Param Content

- `class BetaCodeExecutionToolResultBlockParamContent: A class that can be one of several variants.union`

  Code execution result with encrypted stdout for PFC + web_search results.

  - `class BetaCodeExecutionToolResultErrorParam:`

    - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

      - `"invalid_tool_input"InvalidToolInput`

      - `"unavailable"Unavailable`

      - `"too_many_requests"TooManyRequests`

      - `"execution_time_exceeded"ExecutionTimeExceeded`

    - `JsonElement Type "code_execution_tool_result_error"constant`

  - `class BetaCodeExecutionResultBlockParam:`

    - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

      - `required string FileID`

      - `JsonElement Type "code_execution_output"constant`

    - `required Long ReturnCode`

    - `required string Stderr`

    - `required string Stdout`

    - `JsonElement Type "code_execution_result"constant`

  - `class BetaEncryptedCodeExecutionResultBlockParam:`

    Code execution result with encrypted stdout for PFC + web_search results.

    - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

      - `required string FileID`

      - `JsonElement Type "code_execution_output"constant`

    - `required string EncryptedStdout`

    - `required Long ReturnCode`

    - `required string Stderr`

    - `JsonElement Type "encrypted_code_execution_result"constant`

### Beta Code Execution Tool Result Error

- `class BetaCodeExecutionToolResultError:`

  - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

    - `"invalid_tool_input"InvalidToolInput`

    - `"unavailable"Unavailable`

    - `"too_many_requests"TooManyRequests`

    - `"execution_time_exceeded"ExecutionTimeExceeded`

  - `JsonElement Type "code_execution_tool_result_error"constant`

### Beta Code Execution Tool Result Error Code

- `enum BetaCodeExecutionToolResultErrorCode:`

  - `"invalid_tool_input"InvalidToolInput`

  - `"unavailable"Unavailable`

  - `"too_many_requests"TooManyRequests`

  - `"execution_time_exceeded"ExecutionTimeExceeded`

### Beta Code Execution Tool Result Error Param

- `class BetaCodeExecutionToolResultErrorParam:`

  - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

    - `"invalid_tool_input"InvalidToolInput`

    - `"unavailable"Unavailable`

    - `"too_many_requests"TooManyRequests`

    - `"execution_time_exceeded"ExecutionTimeExceeded`

  - `JsonElement Type "code_execution_tool_result_error"constant`

### Beta Compact 20260112 Edit

- `class BetaCompact20260112Edit:`

  Automatically compact older context when reaching the configured trigger threshold.

  - `JsonElement Type "compact_20260112"constant`

  - `string? Instructions`

    Additional instructions for summarization.

  - `Boolean PauseAfterCompaction`

    Whether to pause after compaction and return the compaction block to the user.

  - `BetaInputTokensTrigger? Trigger`

    When to trigger compaction. Defaults to 150000 input tokens.

    - `JsonElement Type "input_tokens"constant`

    - `required Long Value`

### Beta Compaction Block

- `class BetaCompactionBlock:`

  A compaction block returned when autocompact is triggered.

  When content is None, it indicates the compaction failed to produce a valid
  summary (e.g., malformed output from the model). Clients may round-trip
  compaction blocks with null content; the server treats them as no-ops.

  - `required string? Content`

    Summary of compacted content, or null if compaction failed

  - `required string? EncryptedContent`

    Opaque metadata from prior compaction, to be round-tripped verbatim

  - `JsonElement Type "compaction"constant`

### Beta Compaction Block Param

- `class BetaCompactionBlockParam:`

  A compaction block containing summary of previous context.

  Users should round-trip these blocks from responses to subsequent requests
  to maintain context across compaction boundaries.

  When content is None, the block represents a failed compaction. The server
  treats these as no-ops. Empty string content is not allowed.

  - `JsonElement Type "compaction"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `string? Content`

    Summary of previously compacted content, or null if compaction failed

  - `string? EncryptedContent`

    Opaque metadata from prior compaction, to be round-tripped verbatim

### Beta Compaction Content Block Delta

- `class BetaCompactionContentBlockDelta:`

  - `required string? Content`

  - `required string? EncryptedContent`

    Opaque metadata from prior compaction, to be round-tripped verbatim

  - `JsonElement Type "compaction_delta"constant`

### Beta Compaction Iteration Usage

- `class BetaCompactionIterationUsage:`

  Token usage for a compaction iteration.

  - `required BetaCacheCreation? CacheCreation`

    Breakdown of cached tokens by TTL

    - `required Long Ephemeral1hInputTokens`

      The number of input tokens used to create the 1 hour cache entry.

    - `required Long Ephemeral5mInputTokens`

      The number of input tokens used to create the 5 minute cache entry.

  - `required Long CacheCreationInputTokens`

    The number of input tokens used to create the cache entry.

  - `required Long CacheReadInputTokens`

    The number of input tokens read from the cache.

  - `required Long InputTokens`

    The number of input tokens which were used.

  - `required Long OutputTokens`

    The number of output tokens which were used.

  - `JsonElement Type "compaction"constant`

    Usage for a compaction iteration

### Beta Container

- `class BetaContainer:`

  Information about the container used in the request (for the code execution tool)

  - `required string ID`

    Identifier for the container used in this request

  - `required DateTimeOffset ExpiresAt`

    The time at which the container will expire.

  - `required IReadOnlyList<BetaSkill>? Skills`

    Skills loaded in the container

    - `required string SkillID`

      Skill ID

    - `required Type Type`

      Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

      - `"anthropic"Anthropic`

      - `"custom"Custom`

    - `required string Version`

      Skill version or 'latest' for most recent version

### Beta Container Params

- `class BetaContainerParams:`

  Container parameters with skills to be loaded.

  - `string? ID`

    Container id

  - `IReadOnlyList<BetaSkillParams>? Skills`

    List of skills to load in the container

    - `required string SkillID`

      Skill ID

    - `required Type Type`

      Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

      - `"anthropic"Anthropic`

      - `"custom"Custom`

    - `string Version`

      Skill version or 'latest' for most recent version

### Beta Container Upload Block

- `class BetaContainerUploadBlock:`

  Response model for a file uploaded to the container.

  - `required string FileID`

  - `JsonElement Type "container_upload"constant`

### Beta Container Upload Block Param

- `class BetaContainerUploadBlockParam:`

  A content block that represents a file to be uploaded to the container
  Files uploaded via this block will be available in the container's input directory.

  - `required string FileID`

  - `JsonElement Type "container_upload"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

### Beta Content Block

- `class BetaContentBlock: A class that can be one of several variants.union`

  Response model for a file uploaded to the container.

  - `class BetaTextBlock:`

    - `required IReadOnlyList<BetaTextCitation>? Citations`

      Citations supporting the text block.

      The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

      - `class BetaCitationCharLocation:`

        - `required string CitedText`

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndCharIndex`

        - `required string? FileID`

        - `required Long StartCharIndex`

        - `JsonElement Type "char_location"constant`

      - `class BetaCitationPageLocation:`

        - `required string CitedText`

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndPageNumber`

        - `required string? FileID`

        - `required Long StartPageNumber`

        - `JsonElement Type "page_location"constant`

      - `class BetaCitationContentBlockLocation:`

        - `required string CitedText`

          The full text of the cited block range, concatenated.

          Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndBlockIndex`

          Exclusive 0-based end index of the cited block range in the source's `content` array.

          Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

        - `required string? FileID`

        - `required Long StartBlockIndex`

          0-based index of the first cited block in the source's `content` array.

        - `JsonElement Type "content_block_location"constant`

      - `class BetaCitationsWebSearchResultLocation:`

        - `required string CitedText`

        - `required string EncryptedIndex`

        - `required string? Title`

        - `JsonElement Type "web_search_result_location"constant`

        - `required string Url`

      - `class BetaCitationSearchResultLocation:`

        - `required string CitedText`

          The full text of the cited block range, concatenated.

          Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

        - `required Long EndBlockIndex`

          Exclusive 0-based end index of the cited block range in the source's `content` array.

          Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

        - `required Long SearchResultIndex`

          0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

          Counted separately from `document_index`; server-side web search results are not included in this count.

        - `required string Source`

        - `required Long StartBlockIndex`

          0-based index of the first cited block in the source's `content` array.

        - `required string? Title`

        - `JsonElement Type "search_result_location"constant`

    - `required string Text`

    - `JsonElement Type "text"constant`

  - `class BetaThinkingBlock:`

    - `required string Signature`

    - `required string Thinking`

    - `JsonElement Type "thinking"constant`

  - `class BetaRedactedThinkingBlock:`

    - `required string Data`

    - `JsonElement Type "redacted_thinking"constant`

  - `class BetaToolUseBlock:`

    - `required string ID`

    - `required IReadOnlyDictionary<string, JsonElement> Input`

    - `required string Name`

    - `JsonElement Type "tool_use"constant`

    - `Caller Caller`

      Tool invocation directly from the model.

      - `class BetaDirectCaller:`

        Tool invocation directly from the model.

        - `JsonElement Type "direct"constant`

      - `class BetaServerToolCaller:`

        Tool invocation generated by a server-side tool.

        - `required string ToolID`

        - `JsonElement Type "code_execution_20250825"constant`

      - `class BetaServerToolCaller20260120:`

        - `required string ToolID`

        - `JsonElement Type "code_execution_20260120"constant`

  - `class BetaServerToolUseBlock:`

    - `required string ID`

    - `required IReadOnlyDictionary<string, JsonElement> Input`

    - `required Name Name`

      - `"advisor"Advisor`

      - `"web_search"WebSearch`

      - `"web_fetch"WebFetch`

      - `"code_execution"CodeExecution`

      - `"bash_code_execution"BashCodeExecution`

      - `"text_editor_code_execution"TextEditorCodeExecution`

      - `"tool_search_tool_regex"ToolSearchToolRegex`

      - `"tool_search_tool_bm25"ToolSearchToolBm25`

    - `JsonElement Type "server_tool_use"constant`

    - `Caller Caller`

      Tool invocation directly from the model.

      - `class BetaDirectCaller:`

        Tool invocation directly from the model.

      - `class BetaServerToolCaller:`

        Tool invocation generated by a server-side tool.

      - `class BetaServerToolCaller20260120:`

  - `class BetaWebSearchToolResultBlock:`

    - `required BetaWebSearchToolResultBlockContent Content`

      - `class BetaWebSearchToolResultError:`

        - `required BetaWebSearchToolResultErrorCode ErrorCode`

          - `"invalid_tool_input"InvalidToolInput`

          - `"unavailable"Unavailable`

          - `"max_uses_exceeded"MaxUsesExceeded`

          - `"too_many_requests"TooManyRequests`

          - `"query_too_long"QueryTooLong`

          - `"request_too_large"RequestTooLarge`

        - `JsonElement Type "web_search_tool_result_error"constant`

      - `IReadOnlyList<BetaWebSearchResultBlock>`

        - `required string EncryptedContent`

        - `required string? PageAge`

        - `required string Title`

        - `JsonElement Type "web_search_result"constant`

        - `required string Url`

    - `required string ToolUseID`

    - `JsonElement Type "web_search_tool_result"constant`

    - `Caller Caller`

      Tool invocation directly from the model.

      - `class BetaDirectCaller:`

        Tool invocation directly from the model.

      - `class BetaServerToolCaller:`

        Tool invocation generated by a server-side tool.

      - `class BetaServerToolCaller20260120:`

  - `class BetaWebFetchToolResultBlock:`

    - `required Content Content`

      - `class BetaWebFetchToolResultErrorBlock:`

        - `required BetaWebFetchToolResultErrorCode ErrorCode`

          - `"invalid_tool_input"InvalidToolInput`

          - `"url_too_long"UrlTooLong`

          - `"url_not_allowed"UrlNotAllowed`

          - `"url_not_in_prior_context"UrlNotInPriorContext`

          - `"url_not_accessible"UrlNotAccessible`

          - `"unsupported_content_type"UnsupportedContentType`

          - `"too_many_requests"TooManyRequests`

          - `"max_uses_exceeded"MaxUsesExceeded`

          - `"unavailable"Unavailable`

        - `JsonElement Type "web_fetch_tool_result_error"constant`

      - `class BetaWebFetchBlock:`

        - `required BetaDocumentBlock Content`

          - `required BetaCitationConfig? Citations`

            Citation configuration for the document

            - `required Boolean Enabled`

          - `required Source Source`

            - `class BetaBase64PdfSource:`

              - `required string Data`

              - `JsonElement MediaType "application/pdf"constant`

              - `JsonElement Type "base64"constant`

            - `class BetaPlainTextSource:`

              - `required string Data`

              - `JsonElement MediaType "text/plain"constant`

              - `JsonElement Type "text"constant`

          - `required string? Title`

            The title of the document

          - `JsonElement Type "document"constant`

        - `required string? RetrievedAt`

          ISO 8601 timestamp when the content was retrieved

        - `JsonElement Type "web_fetch_result"constant`

        - `required string Url`

          Fetched content URL

    - `required string ToolUseID`

    - `JsonElement Type "web_fetch_tool_result"constant`

    - `Caller Caller`

      Tool invocation directly from the model.

      - `class BetaDirectCaller:`

        Tool invocation directly from the model.

      - `class BetaServerToolCaller:`

        Tool invocation generated by a server-side tool.

      - `class BetaServerToolCaller20260120:`

  - `class BetaAdvisorToolResultBlock:`

    - `required Content Content`

      - `class BetaAdvisorToolResultError:`

        - `required ErrorCode ErrorCode`

          - `"max_uses_exceeded"MaxUsesExceeded`

          - `"prompt_too_long"PromptTooLong`

          - `"too_many_requests"TooManyRequests`

          - `"overloaded"Overloaded`

          - `"unavailable"Unavailable`

          - `"execution_time_exceeded"ExecutionTimeExceeded`

        - `JsonElement Type "advisor_tool_result_error"constant`

      - `class BetaAdvisorResultBlock:`

        - `required string? StopReason`

          The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the tool's `max_tokens` value or the advisor model's policy cap.

        - `required string Text`

        - `JsonElement Type "advisor_result"constant`

      - `class BetaAdvisorRedactedResultBlock:`

        - `required string EncryptedContent`

          Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.

        - `required string? StopReason`

          The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`).

        - `JsonElement Type "advisor_redacted_result"constant`

    - `required string ToolUseID`

    - `JsonElement Type "advisor_tool_result"constant`

  - `class BetaCodeExecutionToolResultBlock:`

    - `required BetaCodeExecutionToolResultBlockContent Content`

      Code execution result with encrypted stdout for PFC + web_search results.

      - `class BetaCodeExecutionToolResultError:`

        - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

          - `"invalid_tool_input"InvalidToolInput`

          - `"unavailable"Unavailable`

          - `"too_many_requests"TooManyRequests`

          - `"execution_time_exceeded"ExecutionTimeExceeded`

        - `JsonElement Type "code_execution_tool_result_error"constant`

      - `class BetaCodeExecutionResultBlock:`

        - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

          - `required string FileID`

          - `JsonElement Type "code_execution_output"constant`

        - `required Long ReturnCode`

        - `required string Stderr`

        - `required string Stdout`

        - `JsonElement Type "code_execution_result"constant`

      - `class BetaEncryptedCodeExecutionResultBlock:`

        Code execution result with encrypted stdout for PFC + web_search results.

        - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

          - `required string FileID`

          - `JsonElement Type "code_execution_output"constant`

        - `required string EncryptedStdout`

        - `required Long ReturnCode`

        - `required string Stderr`

        - `JsonElement Type "encrypted_code_execution_result"constant`

    - `required string ToolUseID`

    - `JsonElement Type "code_execution_tool_result"constant`

  - `class BetaBashCodeExecutionToolResultBlock:`

    - `required Content Content`

      - `class BetaBashCodeExecutionToolResultError:`

        - `required ErrorCode ErrorCode`

          - `"invalid_tool_input"InvalidToolInput`

          - `"unavailable"Unavailable`

          - `"too_many_requests"TooManyRequests`

          - `"execution_time_exceeded"ExecutionTimeExceeded`

          - `"output_file_too_large"OutputFileTooLarge`

        - `JsonElement Type "bash_code_execution_tool_result_error"constant`

      - `class BetaBashCodeExecutionResultBlock:`

        - `required IReadOnlyList<BetaBashCodeExecutionOutputBlock> Content`

          - `required string FileID`

          - `JsonElement Type "bash_code_execution_output"constant`

        - `required Long ReturnCode`

        - `required string Stderr`

        - `required string Stdout`

        - `JsonElement Type "bash_code_execution_result"constant`

    - `required string ToolUseID`

    - `JsonElement Type "bash_code_execution_tool_result"constant`

  - `class BetaTextEditorCodeExecutionToolResultBlock:`

    - `required Content Content`

      - `class BetaTextEditorCodeExecutionToolResultError:`

        - `required ErrorCode ErrorCode`

          - `"invalid_tool_input"InvalidToolInput`

          - `"unavailable"Unavailable`

          - `"too_many_requests"TooManyRequests`

          - `"execution_time_exceeded"ExecutionTimeExceeded`

          - `"file_not_found"FileNotFound`

        - `required string? ErrorMessage`

        - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

      - `class BetaTextEditorCodeExecutionViewResultBlock:`

        - `required string Content`

        - `required FileType FileType`

          - `"text"Text`

          - `"image"Image`

          - `"pdf"Pdf`

        - `required Long? NumLines`

        - `required Long? StartLine`

        - `required Long? TotalLines`

        - `JsonElement Type "text_editor_code_execution_view_result"constant`

      - `class BetaTextEditorCodeExecutionCreateResultBlock:`

        - `required Boolean IsFileUpdate`

        - `JsonElement Type "text_editor_code_execution_create_result"constant`

      - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:`

        - `required IReadOnlyList<string>? Lines`

        - `required Long? NewLines`

        - `required Long? NewStart`

        - `required Long? OldLines`

        - `required Long? OldStart`

        - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

    - `required string ToolUseID`

    - `JsonElement Type "text_editor_code_execution_tool_result"constant`

  - `class BetaToolSearchToolResultBlock:`

    - `required Content Content`

      - `class BetaToolSearchToolResultError:`

        - `required ErrorCode ErrorCode`

          - `"invalid_tool_input"InvalidToolInput`

          - `"unavailable"Unavailable`

          - `"too_many_requests"TooManyRequests`

          - `"execution_time_exceeded"ExecutionTimeExceeded`

        - `required string? ErrorMessage`

        - `JsonElement Type "tool_search_tool_result_error"constant`

      - `class BetaToolSearchToolSearchResultBlock:`

        - `required IReadOnlyList<BetaToolReferenceBlock> ToolReferences`

          - `required string ToolName`

          - `JsonElement Type "tool_reference"constant`

        - `JsonElement Type "tool_search_tool_search_result"constant`

    - `required string ToolUseID`

    - `JsonElement Type "tool_search_tool_result"constant`

  - `class BetaMcpToolUseBlock:`

    - `required string ID`

    - `required IReadOnlyDictionary<string, JsonElement> Input`

    - `required string Name`

      The name of the MCP tool

    - `required string ServerName`

      The name of the MCP server

    - `JsonElement Type "mcp_tool_use"constant`

  - `class BetaMcpToolResultBlock:`

    - `required Content Content`

      - `string`

      - `IReadOnlyList<BetaTextBlock>`

        - `required IReadOnlyList<BetaTextCitation>? Citations`

          Citations supporting the text block.

          The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

        - `required string Text`

        - `JsonElement Type "text"constant`

    - `required Boolean IsError`

    - `required string ToolUseID`

    - `JsonElement Type "mcp_tool_result"constant`

  - `class BetaContainerUploadBlock:`

    Response model for a file uploaded to the container.

    - `required string FileID`

    - `JsonElement Type "container_upload"constant`

  - `class BetaCompactionBlock:`

    A compaction block returned when autocompact is triggered.

    When content is None, it indicates the compaction failed to produce a valid
    summary (e.g., malformed output from the model). Clients may round-trip
    compaction blocks with null content; the server treats them as no-ops.

    - `required string? Content`

      Summary of compacted content, or null if compaction failed

    - `required string? EncryptedContent`

      Opaque metadata from prior compaction, to be round-tripped verbatim

    - `JsonElement Type "compaction"constant`

### Beta Content Block Param

- `class BetaContentBlockParam: A class that can be one of several variants.union`

  Regular text content.

  - `class BetaTextBlockParam:`

    - `required string Text`

    - `JsonElement Type "text"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

      - `JsonElement Type "ephemeral"constant`

      - `Ttl Ttl`

        The time-to-live for the cache control breakpoint.

        This may be one the following values:

        - `5m`: 5 minutes
        - `1h`: 1 hour

        Defaults to `5m`.

        - `"5m"Ttl5m`

        - `"1h"Ttl1h`

    - `IReadOnlyList<BetaTextCitationParam>? Citations`

      - `class BetaCitationCharLocationParam:`

        - `required string CitedText`

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndCharIndex`

        - `required Long StartCharIndex`

        - `JsonElement Type "char_location"constant`

      - `class BetaCitationPageLocationParam:`

        - `required string CitedText`

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndPageNumber`

        - `required Long StartPageNumber`

        - `JsonElement Type "page_location"constant`

      - `class BetaCitationContentBlockLocationParam:`

        - `required string CitedText`

          The full text of the cited block range, concatenated.

          Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndBlockIndex`

          Exclusive 0-based end index of the cited block range in the source's `content` array.

          Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

        - `required Long StartBlockIndex`

          0-based index of the first cited block in the source's `content` array.

        - `JsonElement Type "content_block_location"constant`

      - `class BetaCitationWebSearchResultLocationParam:`

        - `required string CitedText`

        - `required string EncryptedIndex`

        - `required string? Title`

        - `JsonElement Type "web_search_result_location"constant`

        - `required string Url`

      - `class BetaCitationSearchResultLocationParam:`

        - `required string CitedText`

          The full text of the cited block range, concatenated.

          Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

        - `required Long EndBlockIndex`

          Exclusive 0-based end index of the cited block range in the source's `content` array.

          Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

        - `required Long SearchResultIndex`

          0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

          Counted separately from `document_index`; server-side web search results are not included in this count.

        - `required string Source`

        - `required Long StartBlockIndex`

          0-based index of the first cited block in the source's `content` array.

        - `required string? Title`

        - `JsonElement Type "search_result_location"constant`

  - `class BetaImageBlockParam:`

    - `required Source Source`

      - `class BetaBase64ImageSource:`

        - `required string Data`

        - `required MediaType MediaType`

          - `"image/jpeg"ImageJpeg`

          - `"image/png"ImagePng`

          - `"image/gif"ImageGif`

          - `"image/webp"ImageWebP`

        - `JsonElement Type "base64"constant`

      - `class BetaUrlImageSource:`

        - `JsonElement Type "url"constant`

        - `required string Url`

      - `class BetaFileImageSource:`

        - `required string FileID`

        - `JsonElement Type "file"constant`

    - `JsonElement Type "image"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

  - `class BetaRequestDocumentBlock:`

    - `required Source Source`

      - `class BetaBase64PdfSource:`

        - `required string Data`

        - `JsonElement MediaType "application/pdf"constant`

        - `JsonElement Type "base64"constant`

      - `class BetaPlainTextSource:`

        - `required string Data`

        - `JsonElement MediaType "text/plain"constant`

        - `JsonElement Type "text"constant`

      - `class BetaContentBlockSource:`

        - `required Content Content`

          - `string`

          - `IReadOnlyList<BetaContentBlockSourceContent>`

            - `class BetaTextBlockParam:`

            - `class BetaImageBlockParam:`

        - `JsonElement Type "content"constant`

      - `class BetaUrlPdfSource:`

        - `JsonElement Type "url"constant`

        - `required string Url`

      - `class BetaFileDocumentSource:`

        - `required string FileID`

        - `JsonElement Type "file"constant`

    - `JsonElement Type "document"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `BetaCitationsConfigParam? Citations`

      - `Boolean Enabled`

    - `string? Context`

    - `string? Title`

  - `class BetaSearchResultBlockParam:`

    - `required IReadOnlyList<BetaTextBlockParam> Content`

      - `required string Text`

      - `JsonElement Type "text"constant`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `IReadOnlyList<BetaTextCitationParam>? Citations`

    - `required string Source`

    - `required string Title`

    - `JsonElement Type "search_result"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `BetaCitationsConfigParam Citations`

  - `class BetaThinkingBlockParam:`

    - `required string Signature`

    - `required string Thinking`

    - `JsonElement Type "thinking"constant`

  - `class BetaRedactedThinkingBlockParam:`

    - `required string Data`

    - `JsonElement Type "redacted_thinking"constant`

  - `class BetaToolUseBlockParam:`

    - `required string ID`

    - `required IReadOnlyDictionary<string, JsonElement> Input`

    - `required string Name`

    - `JsonElement Type "tool_use"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Caller Caller`

      Tool invocation directly from the model.

      - `class BetaDirectCaller:`

        Tool invocation directly from the model.

        - `JsonElement Type "direct"constant`

      - `class BetaServerToolCaller:`

        Tool invocation generated by a server-side tool.

        - `required string ToolID`

        - `JsonElement Type "code_execution_20250825"constant`

      - `class BetaServerToolCaller20260120:`

        - `required string ToolID`

        - `JsonElement Type "code_execution_20260120"constant`

  - `class BetaToolResultBlockParam:`

    - `required string ToolUseID`

    - `JsonElement Type "tool_result"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Content Content`

      - `string`

      - `IReadOnlyList<Block>`

        - `class BetaTextBlockParam:`

        - `class BetaImageBlockParam:`

        - `class BetaSearchResultBlockParam:`

        - `class BetaRequestDocumentBlock:`

        - `class BetaToolReferenceBlockParam:`

          Tool reference block that can be included in tool_result content.

          - `required string ToolName`

          - `JsonElement Type "tool_reference"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

    - `Boolean IsError`

  - `class BetaServerToolUseBlockParam:`

    - `required string ID`

    - `required IReadOnlyDictionary<string, JsonElement> Input`

    - `required Name Name`

      - `"advisor"Advisor`

      - `"web_search"WebSearch`

      - `"web_fetch"WebFetch`

      - `"code_execution"CodeExecution`

      - `"bash_code_execution"BashCodeExecution`

      - `"text_editor_code_execution"TextEditorCodeExecution`

      - `"tool_search_tool_regex"ToolSearchToolRegex`

      - `"tool_search_tool_bm25"ToolSearchToolBm25`

    - `JsonElement Type "server_tool_use"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Caller Caller`

      Tool invocation directly from the model.

      - `class BetaDirectCaller:`

        Tool invocation directly from the model.

      - `class BetaServerToolCaller:`

        Tool invocation generated by a server-side tool.

      - `class BetaServerToolCaller20260120:`

  - `class BetaWebSearchToolResultBlockParam:`

    - `required BetaWebSearchToolResultBlockParamContent Content`

      - `IReadOnlyList<BetaWebSearchResultBlockParam>`

        - `required string EncryptedContent`

        - `required string Title`

        - `JsonElement Type "web_search_result"constant`

        - `required string Url`

        - `string? PageAge`

      - `class BetaWebSearchToolRequestError:`

        - `required BetaWebSearchToolResultErrorCode ErrorCode`

          - `"invalid_tool_input"InvalidToolInput`

          - `"unavailable"Unavailable`

          - `"max_uses_exceeded"MaxUsesExceeded`

          - `"too_many_requests"TooManyRequests`

          - `"query_too_long"QueryTooLong`

          - `"request_too_large"RequestTooLarge`

        - `JsonElement Type "web_search_tool_result_error"constant`

    - `required string ToolUseID`

    - `JsonElement Type "web_search_tool_result"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Caller Caller`

      Tool invocation directly from the model.

      - `class BetaDirectCaller:`

        Tool invocation directly from the model.

      - `class BetaServerToolCaller:`

        Tool invocation generated by a server-side tool.

      - `class BetaServerToolCaller20260120:`

  - `class BetaWebFetchToolResultBlockParam:`

    - `required Content Content`

      - `class BetaWebFetchToolResultErrorBlockParam:`

        - `required BetaWebFetchToolResultErrorCode ErrorCode`

          - `"invalid_tool_input"InvalidToolInput`

          - `"url_too_long"UrlTooLong`

          - `"url_not_allowed"UrlNotAllowed`

          - `"url_not_in_prior_context"UrlNotInPriorContext`

          - `"url_not_accessible"UrlNotAccessible`

          - `"unsupported_content_type"UnsupportedContentType`

          - `"too_many_requests"TooManyRequests`

          - `"max_uses_exceeded"MaxUsesExceeded`

          - `"unavailable"Unavailable`

        - `JsonElement Type "web_fetch_tool_result_error"constant`

      - `class BetaWebFetchBlockParam:`

        - `required BetaRequestDocumentBlock Content`

        - `JsonElement Type "web_fetch_result"constant`

        - `required string Url`

          Fetched content URL

        - `string? RetrievedAt`

          ISO 8601 timestamp when the content was retrieved

    - `required string ToolUseID`

    - `JsonElement Type "web_fetch_tool_result"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Caller Caller`

      Tool invocation directly from the model.

      - `class BetaDirectCaller:`

        Tool invocation directly from the model.

      - `class BetaServerToolCaller:`

        Tool invocation generated by a server-side tool.

      - `class BetaServerToolCaller20260120:`

  - `class BetaAdvisorToolResultBlockParam:`

    - `required Content Content`

      - `class BetaAdvisorToolResultErrorParam:`

        - `required ErrorCode ErrorCode`

          - `"max_uses_exceeded"MaxUsesExceeded`

          - `"prompt_too_long"PromptTooLong`

          - `"too_many_requests"TooManyRequests`

          - `"overloaded"Overloaded`

          - `"unavailable"Unavailable`

          - `"execution_time_exceeded"ExecutionTimeExceeded`

        - `JsonElement Type "advisor_tool_result_error"constant`

      - `class BetaAdvisorResultBlockParam:`

        - `required string Text`

        - `JsonElement Type "advisor_result"constant`

        - `string? StopReason`

      - `class BetaAdvisorRedactedResultBlockParam:`

        - `required string EncryptedContent`

          Opaque blob produced by a prior response; must be round-tripped verbatim.

        - `JsonElement Type "advisor_redacted_result"constant`

        - `string? StopReason`

    - `required string ToolUseID`

    - `JsonElement Type "advisor_tool_result"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

  - `class BetaCodeExecutionToolResultBlockParam:`

    - `required BetaCodeExecutionToolResultBlockParamContent Content`

      Code execution result with encrypted stdout for PFC + web_search results.

      - `class BetaCodeExecutionToolResultErrorParam:`

        - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

          - `"invalid_tool_input"InvalidToolInput`

          - `"unavailable"Unavailable`

          - `"too_many_requests"TooManyRequests`

          - `"execution_time_exceeded"ExecutionTimeExceeded`

        - `JsonElement Type "code_execution_tool_result_error"constant`

      - `class BetaCodeExecutionResultBlockParam:`

        - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

          - `required string FileID`

          - `JsonElement Type "code_execution_output"constant`

        - `required Long ReturnCode`

        - `required string Stderr`

        - `required string Stdout`

        - `JsonElement Type "code_execution_result"constant`

      - `class BetaEncryptedCodeExecutionResultBlockParam:`

        Code execution result with encrypted stdout for PFC + web_search results.

        - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

          - `required string FileID`

          - `JsonElement Type "code_execution_output"constant`

        - `required string EncryptedStdout`

        - `required Long ReturnCode`

        - `required string Stderr`

        - `JsonElement Type "encrypted_code_execution_result"constant`

    - `required string ToolUseID`

    - `JsonElement Type "code_execution_tool_result"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

  - `class BetaBashCodeExecutionToolResultBlockParam:`

    - `required Content Content`

      - `class BetaBashCodeExecutionToolResultErrorParam:`

        - `required ErrorCode ErrorCode`

          - `"invalid_tool_input"InvalidToolInput`

          - `"unavailable"Unavailable`

          - `"too_many_requests"TooManyRequests`

          - `"execution_time_exceeded"ExecutionTimeExceeded`

          - `"output_file_too_large"OutputFileTooLarge`

        - `JsonElement Type "bash_code_execution_tool_result_error"constant`

      - `class BetaBashCodeExecutionResultBlockParam:`

        - `required IReadOnlyList<BetaBashCodeExecutionOutputBlockParam> Content`

          - `required string FileID`

          - `JsonElement Type "bash_code_execution_output"constant`

        - `required Long ReturnCode`

        - `required string Stderr`

        - `required string Stdout`

        - `JsonElement Type "bash_code_execution_result"constant`

    - `required string ToolUseID`

    - `JsonElement Type "bash_code_execution_tool_result"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

  - `class BetaTextEditorCodeExecutionToolResultBlockParam:`

    - `required Content Content`

      - `class BetaTextEditorCodeExecutionToolResultErrorParam:`

        - `required ErrorCode ErrorCode`

          - `"invalid_tool_input"InvalidToolInput`

          - `"unavailable"Unavailable`

          - `"too_many_requests"TooManyRequests`

          - `"execution_time_exceeded"ExecutionTimeExceeded`

          - `"file_not_found"FileNotFound`

        - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

        - `string? ErrorMessage`

      - `class BetaTextEditorCodeExecutionViewResultBlockParam:`

        - `required string Content`

        - `required FileType FileType`

          - `"text"Text`

          - `"image"Image`

          - `"pdf"Pdf`

        - `JsonElement Type "text_editor_code_execution_view_result"constant`

        - `Long? NumLines`

        - `Long? StartLine`

        - `Long? TotalLines`

      - `class BetaTextEditorCodeExecutionCreateResultBlockParam:`

        - `required Boolean IsFileUpdate`

        - `JsonElement Type "text_editor_code_execution_create_result"constant`

      - `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:`

        - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

        - `IReadOnlyList<string>? Lines`

        - `Long? NewLines`

        - `Long? NewStart`

        - `Long? OldLines`

        - `Long? OldStart`

    - `required string ToolUseID`

    - `JsonElement Type "text_editor_code_execution_tool_result"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

  - `class BetaToolSearchToolResultBlockParam:`

    - `required Content Content`

      - `class BetaToolSearchToolResultErrorParam:`

        - `required ErrorCode ErrorCode`

          - `"invalid_tool_input"InvalidToolInput`

          - `"unavailable"Unavailable`

          - `"too_many_requests"TooManyRequests`

          - `"execution_time_exceeded"ExecutionTimeExceeded`

        - `JsonElement Type "tool_search_tool_result_error"constant`

      - `class BetaToolSearchToolSearchResultBlockParam:`

        - `required IReadOnlyList<BetaToolReferenceBlockParam> ToolReferences`

          - `required string ToolName`

          - `JsonElement Type "tool_reference"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

        - `JsonElement Type "tool_search_tool_search_result"constant`

    - `required string ToolUseID`

    - `JsonElement Type "tool_search_tool_result"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

  - `class BetaMcpToolUseBlockParam:`

    - `required string ID`

    - `required IReadOnlyDictionary<string, JsonElement> Input`

    - `required string Name`

    - `required string ServerName`

      The name of the MCP server

    - `JsonElement Type "mcp_tool_use"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

  - `class BetaRequestMcpToolResultBlockParam:`

    - `required string ToolUseID`

    - `JsonElement Type "mcp_tool_result"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Content Content`

      - `string`

      - `IReadOnlyList<BetaTextBlockParam>`

        - `required string Text`

        - `JsonElement Type "text"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `IReadOnlyList<BetaTextCitationParam>? Citations`

    - `Boolean IsError`

  - `class BetaContainerUploadBlockParam:`

    A content block that represents a file to be uploaded to the container
    Files uploaded via this block will be available in the container's input directory.

    - `required string FileID`

    - `JsonElement Type "container_upload"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

  - `class BetaCompactionBlockParam:`

    A compaction block containing summary of previous context.

    Users should round-trip these blocks from responses to subsequent requests
    to maintain context across compaction boundaries.

    When content is None, the block represents a failed compaction. The server
    treats these as no-ops. Empty string content is not allowed.

    - `JsonElement Type "compaction"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `string? Content`

      Summary of previously compacted content, or null if compaction failed

    - `string? EncryptedContent`

      Opaque metadata from prior compaction, to be round-tripped verbatim

  - `class BetaMidConversationSystemBlockParam:`

    System instructions that appear mid-conversation.

    Use this block to provide or update system-level instructions at a specific
    point in the conversation, rather than only via the top-level `system` parameter.

    - `required IReadOnlyList<BetaTextBlockParam> Content`

      System instruction text blocks.

      - `required string Text`

      - `JsonElement Type "text"constant`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `IReadOnlyList<BetaTextCitationParam>? Citations`

    - `JsonElement Type "mid_conv_system"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

### Beta Content Block Source

- `class BetaContentBlockSource:`

  - `required Content Content`

    - `string`

    - `IReadOnlyList<BetaContentBlockSourceContent>`

      - `class BetaTextBlockParam:`

        - `required string Text`

        - `JsonElement Type "text"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

          - `JsonElement Type "ephemeral"constant`

          - `Ttl Ttl`

            The time-to-live for the cache control breakpoint.

            This may be one the following values:

            - `5m`: 5 minutes
            - `1h`: 1 hour

            Defaults to `5m`.

            - `"5m"Ttl5m`

            - `"1h"Ttl1h`

        - `IReadOnlyList<BetaTextCitationParam>? Citations`

          - `class BetaCitationCharLocationParam:`

            - `required string CitedText`

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndCharIndex`

            - `required Long StartCharIndex`

            - `JsonElement Type "char_location"constant`

          - `class BetaCitationPageLocationParam:`

            - `required string CitedText`

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndPageNumber`

            - `required Long StartPageNumber`

            - `JsonElement Type "page_location"constant`

          - `class BetaCitationContentBlockLocationParam:`

            - `required string CitedText`

              The full text of the cited block range, concatenated.

              Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndBlockIndex`

              Exclusive 0-based end index of the cited block range in the source's `content` array.

              Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

            - `required Long StartBlockIndex`

              0-based index of the first cited block in the source's `content` array.

            - `JsonElement Type "content_block_location"constant`

          - `class BetaCitationWebSearchResultLocationParam:`

            - `required string CitedText`

            - `required string EncryptedIndex`

            - `required string? Title`

            - `JsonElement Type "web_search_result_location"constant`

            - `required string Url`

          - `class BetaCitationSearchResultLocationParam:`

            - `required string CitedText`

              The full text of the cited block range, concatenated.

              Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

            - `required Long EndBlockIndex`

              Exclusive 0-based end index of the cited block range in the source's `content` array.

              Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

            - `required Long SearchResultIndex`

              0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

              Counted separately from `document_index`; server-side web search results are not included in this count.

            - `required string Source`

            - `required Long StartBlockIndex`

              0-based index of the first cited block in the source's `content` array.

            - `required string? Title`

            - `JsonElement Type "search_result_location"constant`

      - `class BetaImageBlockParam:`

        - `required Source Source`

          - `class BetaBase64ImageSource:`

            - `required string Data`

            - `required MediaType MediaType`

              - `"image/jpeg"ImageJpeg`

              - `"image/png"ImagePng`

              - `"image/gif"ImageGif`

              - `"image/webp"ImageWebP`

            - `JsonElement Type "base64"constant`

          - `class BetaUrlImageSource:`

            - `JsonElement Type "url"constant`

            - `required string Url`

          - `class BetaFileImageSource:`

            - `required string FileID`

            - `JsonElement Type "file"constant`

        - `JsonElement Type "image"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

  - `JsonElement Type "content"constant`

### Beta Content Block Source Content

- `class BetaContentBlockSourceContent: A class that can be one of several variants.union`

  - `class BetaTextBlockParam:`

    - `required string Text`

    - `JsonElement Type "text"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

      - `JsonElement Type "ephemeral"constant`

      - `Ttl Ttl`

        The time-to-live for the cache control breakpoint.

        This may be one the following values:

        - `5m`: 5 minutes
        - `1h`: 1 hour

        Defaults to `5m`.

        - `"5m"Ttl5m`

        - `"1h"Ttl1h`

    - `IReadOnlyList<BetaTextCitationParam>? Citations`

      - `class BetaCitationCharLocationParam:`

        - `required string CitedText`

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndCharIndex`

        - `required Long StartCharIndex`

        - `JsonElement Type "char_location"constant`

      - `class BetaCitationPageLocationParam:`

        - `required string CitedText`

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndPageNumber`

        - `required Long StartPageNumber`

        - `JsonElement Type "page_location"constant`

      - `class BetaCitationContentBlockLocationParam:`

        - `required string CitedText`

          The full text of the cited block range, concatenated.

          Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndBlockIndex`

          Exclusive 0-based end index of the cited block range in the source's `content` array.

          Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

        - `required Long StartBlockIndex`

          0-based index of the first cited block in the source's `content` array.

        - `JsonElement Type "content_block_location"constant`

      - `class BetaCitationWebSearchResultLocationParam:`

        - `required string CitedText`

        - `required string EncryptedIndex`

        - `required string? Title`

        - `JsonElement Type "web_search_result_location"constant`

        - `required string Url`

      - `class BetaCitationSearchResultLocationParam:`

        - `required string CitedText`

          The full text of the cited block range, concatenated.

          Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

        - `required Long EndBlockIndex`

          Exclusive 0-based end index of the cited block range in the source's `content` array.

          Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

        - `required Long SearchResultIndex`

          0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

          Counted separately from `document_index`; server-side web search results are not included in this count.

        - `required string Source`

        - `required Long StartBlockIndex`

          0-based index of the first cited block in the source's `content` array.

        - `required string? Title`

        - `JsonElement Type "search_result_location"constant`

  - `class BetaImageBlockParam:`

    - `required Source Source`

      - `class BetaBase64ImageSource:`

        - `required string Data`

        - `required MediaType MediaType`

          - `"image/jpeg"ImageJpeg`

          - `"image/png"ImagePng`

          - `"image/gif"ImageGif`

          - `"image/webp"ImageWebP`

        - `JsonElement Type "base64"constant`

      - `class BetaUrlImageSource:`

        - `JsonElement Type "url"constant`

        - `required string Url`

      - `class BetaFileImageSource:`

        - `required string FileID`

        - `JsonElement Type "file"constant`

    - `JsonElement Type "image"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

### Beta Context Management Config

- `class BetaContextManagementConfig:`

  - `IReadOnlyList<Edit> Edits`

    List of context management edits to apply

    - `class BetaClearToolUses20250919Edit:`

      - `JsonElement Type "clear_tool_uses_20250919"constant`

      - `BetaInputTokensClearAtLeast? ClearAtLeast`

        Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed.

        - `JsonElement Type "input_tokens"constant`

        - `required Long Value`

      - `ClearToolInputs? ClearToolInputs`

        Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)

        - `Boolean`

        - `IReadOnlyList<string>`

      - `IReadOnlyList<string>? ExcludeTools`

        Tool names whose uses are preserved from clearing

      - `BetaToolUsesKeep Keep`

        Number of tool uses to retain in the conversation

        - `JsonElement Type "tool_uses"constant`

        - `required Long Value`

      - `Trigger Trigger`

        Condition that triggers the context management strategy

        - `class BetaInputTokensTrigger:`

          - `JsonElement Type "input_tokens"constant`

          - `required Long Value`

        - `class BetaToolUsesTrigger:`

          - `JsonElement Type "tool_uses"constant`

          - `required Long Value`

    - `class BetaClearThinking20251015Edit:`

      - `JsonElement Type "clear_thinking_20251015"constant`

      - `Keep Keep`

        Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed.

        - `class BetaThinkingTurns:`

          - `JsonElement Type "thinking_turns"constant`

          - `required Long Value`

        - `class BetaAllThinkingTurns:`

          - `JsonElement Type "all"constant`

        - `class All:`

    - `class BetaCompact20260112Edit:`

      Automatically compact older context when reaching the configured trigger threshold.

      - `JsonElement Type "compact_20260112"constant`

      - `string? Instructions`

        Additional instructions for summarization.

      - `Boolean PauseAfterCompaction`

        Whether to pause after compaction and return the compaction block to the user.

      - `BetaInputTokensTrigger? Trigger`

        When to trigger compaction. Defaults to 150000 input tokens.

### Beta Context Management Response

- `class BetaContextManagementResponse:`

  - `required IReadOnlyList<AppliedEdit> AppliedEdits`

    List of context management edits that were applied.

    - `class BetaClearToolUses20250919EditResponse:`

      - `required Long ClearedInputTokens`

        Number of input tokens cleared by this edit.

      - `required Long ClearedToolUses`

        Number of tool uses that were cleared.

      - `JsonElement Type "clear_tool_uses_20250919"constant`

        The type of context management edit applied.

    - `class BetaClearThinking20251015EditResponse:`

      - `required Long ClearedInputTokens`

        Number of input tokens cleared by this edit.

      - `required Long ClearedThinkingTurns`

        Number of thinking turns that were cleared.

      - `JsonElement Type "clear_thinking_20251015"constant`

        The type of context management edit applied.

### Beta Count Tokens Context Management Response

- `class BetaCountTokensContextManagementResponse:`

  - `required Long OriginalInputTokens`

    The original token count before context management was applied

### Beta Diagnostics

- `class BetaDiagnostics:`

  Response envelope for request-level diagnostics. Present (possibly
  null) whenever the caller supplied `diagnostics` on the request.

  - `required CacheMissReason? CacheMissReason`

    Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.

    - `class BetaCacheMissModelChanged:`

      - `required Long CacheMissedInputTokens`

        Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

      - `JsonElement Type "model_changed"constant`

    - `class BetaCacheMissSystemChanged:`

      - `required Long CacheMissedInputTokens`

        Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

      - `JsonElement Type "system_changed"constant`

    - `class BetaCacheMissToolsChanged:`

      - `required Long CacheMissedInputTokens`

        Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

      - `JsonElement Type "tools_changed"constant`

    - `class BetaCacheMissMessagesChanged:`

      - `required Long CacheMissedInputTokens`

        Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

      - `JsonElement Type "messages_changed"constant`

    - `class BetaCacheMissPreviousMessageNotFound:`

      - `JsonElement Type "previous_message_not_found"constant`

    - `class BetaCacheMissUnavailable:`

      - `JsonElement Type "unavailable"constant`

### Beta Diagnostics Param

- `class BetaDiagnosticsParam:`

  Request-level diagnostics. Currently carries the previous response
  id for prompt-cache divergence reporting.

  - `string? PreviousMessageID`

    The `id` (`msg_...`) from this client's previous /v1/messages response. The server compares that request's prompt fingerprint against this one and returns `diagnostics.cache_miss_reason` when the prompt-cache prefix could not be reused. Pass `null` on the first turn to opt in without a prior message to compare.

### Beta Direct Caller

- `class BetaDirectCaller:`

  Tool invocation directly from the model.

  - `JsonElement Type "direct"constant`

### Beta Document Block

- `class BetaDocumentBlock:`

  - `required BetaCitationConfig? Citations`

    Citation configuration for the document

    - `required Boolean Enabled`

  - `required Source Source`

    - `class BetaBase64PdfSource:`

      - `required string Data`

      - `JsonElement MediaType "application/pdf"constant`

      - `JsonElement Type "base64"constant`

    - `class BetaPlainTextSource:`

      - `required string Data`

      - `JsonElement MediaType "text/plain"constant`

      - `JsonElement Type "text"constant`

  - `required string? Title`

    The title of the document

  - `JsonElement Type "document"constant`

### Beta Encrypted Code Execution Result Block

- `class BetaEncryptedCodeExecutionResultBlock:`

  Code execution result with encrypted stdout for PFC + web_search results.

  - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

    - `required string FileID`

    - `JsonElement Type "code_execution_output"constant`

  - `required string EncryptedStdout`

  - `required Long ReturnCode`

  - `required string Stderr`

  - `JsonElement Type "encrypted_code_execution_result"constant`

### Beta Encrypted Code Execution Result Block Param

- `class BetaEncryptedCodeExecutionResultBlockParam:`

  Code execution result with encrypted stdout for PFC + web_search results.

  - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

    - `required string FileID`

    - `JsonElement Type "code_execution_output"constant`

  - `required string EncryptedStdout`

  - `required Long ReturnCode`

  - `required string Stderr`

  - `JsonElement Type "encrypted_code_execution_result"constant`

### Beta File Document Source

- `class BetaFileDocumentSource:`

  - `required string FileID`

  - `JsonElement Type "file"constant`

### Beta File Image Source

- `class BetaFileImageSource:`

  - `required string FileID`

  - `JsonElement Type "file"constant`

### Beta Image Block Param

- `class BetaImageBlockParam:`

  - `required Source Source`

    - `class BetaBase64ImageSource:`

      - `required string Data`

      - `required MediaType MediaType`

        - `"image/jpeg"ImageJpeg`

        - `"image/png"ImagePng`

        - `"image/gif"ImageGif`

        - `"image/webp"ImageWebP`

      - `JsonElement Type "base64"constant`

    - `class BetaUrlImageSource:`

      - `JsonElement Type "url"constant`

      - `required string Url`

    - `class BetaFileImageSource:`

      - `required string FileID`

      - `JsonElement Type "file"constant`

  - `JsonElement Type "image"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

### Beta Input JSON Delta

- `class BetaInputJsonDelta:`

  - `required string PartialJson`

  - `JsonElement Type "input_json_delta"constant`

### Beta Input Tokens Clear At Least

- `class BetaInputTokensClearAtLeast:`

  - `JsonElement Type "input_tokens"constant`

  - `required Long Value`

### Beta Input Tokens Trigger

- `class BetaInputTokensTrigger:`

  - `JsonElement Type "input_tokens"constant`

  - `required Long Value`

### Beta JSON Output Format

- `class BetaJsonOutputFormat:`

  - `required IReadOnlyDictionary<string, JsonElement> Schema`

    The JSON schema of the format

  - `JsonElement Type "json_schema"constant`

### Beta MCP Tool Config

- `class BetaMcpToolConfig:`

  Configuration for a specific tool in an MCP toolset.

  - `Boolean DeferLoading`

  - `Boolean Enabled`

### Beta MCP Tool Default Config

- `class BetaMcpToolDefaultConfig:`

  Default configuration for tools in an MCP toolset.

  - `Boolean DeferLoading`

  - `Boolean Enabled`

### Beta MCP Tool Result Block

- `class BetaMcpToolResultBlock:`

  - `required Content Content`

    - `string`

    - `IReadOnlyList<BetaTextBlock>`

      - `required IReadOnlyList<BetaTextCitation>? Citations`

        Citations supporting the text block.

        The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

        - `class BetaCitationCharLocation:`

          - `required string CitedText`

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndCharIndex`

          - `required string? FileID`

          - `required Long StartCharIndex`

          - `JsonElement Type "char_location"constant`

        - `class BetaCitationPageLocation:`

          - `required string CitedText`

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndPageNumber`

          - `required string? FileID`

          - `required Long StartPageNumber`

          - `JsonElement Type "page_location"constant`

        - `class BetaCitationContentBlockLocation:`

          - `required string CitedText`

            The full text of the cited block range, concatenated.

            Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndBlockIndex`

            Exclusive 0-based end index of the cited block range in the source's `content` array.

            Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

          - `required string? FileID`

          - `required Long StartBlockIndex`

            0-based index of the first cited block in the source's `content` array.

          - `JsonElement Type "content_block_location"constant`

        - `class BetaCitationsWebSearchResultLocation:`

          - `required string CitedText`

          - `required string EncryptedIndex`

          - `required string? Title`

          - `JsonElement Type "web_search_result_location"constant`

          - `required string Url`

        - `class BetaCitationSearchResultLocation:`

          - `required string CitedText`

            The full text of the cited block range, concatenated.

            Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

          - `required Long EndBlockIndex`

            Exclusive 0-based end index of the cited block range in the source's `content` array.

            Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

          - `required Long SearchResultIndex`

            0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

            Counted separately from `document_index`; server-side web search results are not included in this count.

          - `required string Source`

          - `required Long StartBlockIndex`

            0-based index of the first cited block in the source's `content` array.

          - `required string? Title`

          - `JsonElement Type "search_result_location"constant`

      - `required string Text`

      - `JsonElement Type "text"constant`

  - `required Boolean IsError`

  - `required string ToolUseID`

  - `JsonElement Type "mcp_tool_result"constant`

### Beta MCP Tool Use Block

- `class BetaMcpToolUseBlock:`

  - `required string ID`

  - `required IReadOnlyDictionary<string, JsonElement> Input`

  - `required string Name`

    The name of the MCP tool

  - `required string ServerName`

    The name of the MCP server

  - `JsonElement Type "mcp_tool_use"constant`

### Beta MCP Tool Use Block Param

- `class BetaMcpToolUseBlockParam:`

  - `required string ID`

  - `required IReadOnlyDictionary<string, JsonElement> Input`

  - `required string Name`

  - `required string ServerName`

    The name of the MCP server

  - `JsonElement Type "mcp_tool_use"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

### Beta MCP Toolset

- `class BetaMcpToolset:`

  Configuration for a group of tools from an MCP server.

  Allows configuring enabled status and defer_loading for all tools
  from an MCP server, with optional per-tool overrides.

  - `required string McpServerName`

    Name of the MCP server to configure tools for

  - `JsonElement Type "mcp_toolset"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `IReadOnlyDictionary<string, BetaMcpToolConfig>? Configs`

    Configuration overrides for specific tools, keyed by tool name

    - `Boolean DeferLoading`

    - `Boolean Enabled`

  - `BetaMcpToolDefaultConfig DefaultConfig`

    Default configuration applied to all tools from this server

    - `Boolean DeferLoading`

    - `Boolean Enabled`

### Beta Memory Tool 20250818

- `class BetaMemoryTool20250818:`

  - `JsonElement Name "memory"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "memory_20250818"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Memory Tool 20250818 Command

- `class BetaMemoryTool20250818Command: A class that can be one of several variants.union`

  - `class BetaMemoryTool20250818ViewCommand:`

    - `JsonElement Command "view"constant`

      Command type identifier

    - `required string Path`

      Path to directory or file to view

    - `IReadOnlyList<Long> ViewRange`

      Optional line range for viewing specific lines

  - `class BetaMemoryTool20250818CreateCommand:`

    - `JsonElement Command "create"constant`

      Command type identifier

    - `required string FileText`

      Content to write to the file

    - `required string Path`

      Path where the file should be created

  - `class BetaMemoryTool20250818StrReplaceCommand:`

    - `JsonElement Command "str_replace"constant`

      Command type identifier

    - `required string NewStr`

      Text to replace with

    - `required string OldStr`

      Text to search for and replace

    - `required string Path`

      Path to the file where text should be replaced

  - `class BetaMemoryTool20250818InsertCommand:`

    - `JsonElement Command "insert"constant`

      Command type identifier

    - `required Long InsertLine`

      Line number where text should be inserted

    - `required string InsertText`

      Text to insert at the specified line

    - `required string Path`

      Path to the file where text should be inserted

  - `class BetaMemoryTool20250818DeleteCommand:`

    - `JsonElement Command "delete"constant`

      Command type identifier

    - `required string Path`

      Path to the file or directory to delete

  - `class BetaMemoryTool20250818RenameCommand:`

    - `JsonElement Command "rename"constant`

      Command type identifier

    - `required string NewPath`

      New path for the file or directory

    - `required string OldPath`

      Current path of the file or directory

### Beta Memory Tool 20250818 Create Command

- `class BetaMemoryTool20250818CreateCommand:`

  - `JsonElement Command "create"constant`

    Command type identifier

  - `required string FileText`

    Content to write to the file

  - `required string Path`

    Path where the file should be created

### Beta Memory Tool 20250818 Delete Command

- `class BetaMemoryTool20250818DeleteCommand:`

  - `JsonElement Command "delete"constant`

    Command type identifier

  - `required string Path`

    Path to the file or directory to delete

### Beta Memory Tool 20250818 Insert Command

- `class BetaMemoryTool20250818InsertCommand:`

  - `JsonElement Command "insert"constant`

    Command type identifier

  - `required Long InsertLine`

    Line number where text should be inserted

  - `required string InsertText`

    Text to insert at the specified line

  - `required string Path`

    Path to the file where text should be inserted

### Beta Memory Tool 20250818 Rename Command

- `class BetaMemoryTool20250818RenameCommand:`

  - `JsonElement Command "rename"constant`

    Command type identifier

  - `required string NewPath`

    New path for the file or directory

  - `required string OldPath`

    Current path of the file or directory

### Beta Memory Tool 20250818 Str Replace Command

- `class BetaMemoryTool20250818StrReplaceCommand:`

  - `JsonElement Command "str_replace"constant`

    Command type identifier

  - `required string NewStr`

    Text to replace with

  - `required string OldStr`

    Text to search for and replace

  - `required string Path`

    Path to the file where text should be replaced

### Beta Memory Tool 20250818 View Command

- `class BetaMemoryTool20250818ViewCommand:`

  - `JsonElement Command "view"constant`

    Command type identifier

  - `required string Path`

    Path to directory or file to view

  - `IReadOnlyList<Long> ViewRange`

    Optional line range for viewing specific lines

### Beta Message

- `class BetaMessage:`

  - `required string ID`

    Unique object identifier.

    The format and length of IDs may change over time.

  - `required BetaContainer? Container`

    Information about the container used in the request (for the code execution tool)

    - `required string ID`

      Identifier for the container used in this request

    - `required DateTimeOffset ExpiresAt`

      The time at which the container will expire.

    - `required IReadOnlyList<BetaSkill>? Skills`

      Skills loaded in the container

      - `required string SkillID`

        Skill ID

      - `required Type Type`

        Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

        - `"anthropic"Anthropic`

        - `"custom"Custom`

      - `required string Version`

        Skill version or 'latest' for most recent version

  - `required IReadOnlyList<BetaContentBlock> Content`

    Content generated by the model.

    This is an array of content blocks, each of which has a `type` that determines its shape.

    Example:

    ```json
    [{"type": "text", "text": "Hi, I'm Claude."}]
    ```

    If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.

    For example, if the input `messages` were:

    ```json
    [
      {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
      {"role": "assistant", "content": "The best answer is ("}
    ]
    ```

    Then the response `content` might be:

    ```json
    [{"type": "text", "text": "B)"}]
    ```

    - `class BetaTextBlock:`

      - `required IReadOnlyList<BetaTextCitation>? Citations`

        Citations supporting the text block.

        The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

        - `class BetaCitationCharLocation:`

          - `required string CitedText`

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndCharIndex`

          - `required string? FileID`

          - `required Long StartCharIndex`

          - `JsonElement Type "char_location"constant`

        - `class BetaCitationPageLocation:`

          - `required string CitedText`

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndPageNumber`

          - `required string? FileID`

          - `required Long StartPageNumber`

          - `JsonElement Type "page_location"constant`

        - `class BetaCitationContentBlockLocation:`

          - `required string CitedText`

            The full text of the cited block range, concatenated.

            Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndBlockIndex`

            Exclusive 0-based end index of the cited block range in the source's `content` array.

            Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

          - `required string? FileID`

          - `required Long StartBlockIndex`

            0-based index of the first cited block in the source's `content` array.

          - `JsonElement Type "content_block_location"constant`

        - `class BetaCitationsWebSearchResultLocation:`

          - `required string CitedText`

          - `required string EncryptedIndex`

          - `required string? Title`

          - `JsonElement Type "web_search_result_location"constant`

          - `required string Url`

        - `class BetaCitationSearchResultLocation:`

          - `required string CitedText`

            The full text of the cited block range, concatenated.

            Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

          - `required Long EndBlockIndex`

            Exclusive 0-based end index of the cited block range in the source's `content` array.

            Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

          - `required Long SearchResultIndex`

            0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

            Counted separately from `document_index`; server-side web search results are not included in this count.

          - `required string Source`

          - `required Long StartBlockIndex`

            0-based index of the first cited block in the source's `content` array.

          - `required string? Title`

          - `JsonElement Type "search_result_location"constant`

      - `required string Text`

      - `JsonElement Type "text"constant`

    - `class BetaThinkingBlock:`

      - `required string Signature`

      - `required string Thinking`

      - `JsonElement Type "thinking"constant`

    - `class BetaRedactedThinkingBlock:`

      - `required string Data`

      - `JsonElement Type "redacted_thinking"constant`

    - `class BetaToolUseBlock:`

      - `required string ID`

      - `required IReadOnlyDictionary<string, JsonElement> Input`

      - `required string Name`

      - `JsonElement Type "tool_use"constant`

      - `Caller Caller`

        Tool invocation directly from the model.

        - `class BetaDirectCaller:`

          Tool invocation directly from the model.

          - `JsonElement Type "direct"constant`

        - `class BetaServerToolCaller:`

          Tool invocation generated by a server-side tool.

          - `required string ToolID`

          - `JsonElement Type "code_execution_20250825"constant`

        - `class BetaServerToolCaller20260120:`

          - `required string ToolID`

          - `JsonElement Type "code_execution_20260120"constant`

    - `class BetaServerToolUseBlock:`

      - `required string ID`

      - `required IReadOnlyDictionary<string, JsonElement> Input`

      - `required Name Name`

        - `"advisor"Advisor`

        - `"web_search"WebSearch`

        - `"web_fetch"WebFetch`

        - `"code_execution"CodeExecution`

        - `"bash_code_execution"BashCodeExecution`

        - `"text_editor_code_execution"TextEditorCodeExecution`

        - `"tool_search_tool_regex"ToolSearchToolRegex`

        - `"tool_search_tool_bm25"ToolSearchToolBm25`

      - `JsonElement Type "server_tool_use"constant`

      - `Caller Caller`

        Tool invocation directly from the model.

        - `class BetaDirectCaller:`

          Tool invocation directly from the model.

        - `class BetaServerToolCaller:`

          Tool invocation generated by a server-side tool.

        - `class BetaServerToolCaller20260120:`

    - `class BetaWebSearchToolResultBlock:`

      - `required BetaWebSearchToolResultBlockContent Content`

        - `class BetaWebSearchToolResultError:`

          - `required BetaWebSearchToolResultErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"max_uses_exceeded"MaxUsesExceeded`

            - `"too_many_requests"TooManyRequests`

            - `"query_too_long"QueryTooLong`

            - `"request_too_large"RequestTooLarge`

          - `JsonElement Type "web_search_tool_result_error"constant`

        - `IReadOnlyList<BetaWebSearchResultBlock>`

          - `required string EncryptedContent`

          - `required string? PageAge`

          - `required string Title`

          - `JsonElement Type "web_search_result"constant`

          - `required string Url`

      - `required string ToolUseID`

      - `JsonElement Type "web_search_tool_result"constant`

      - `Caller Caller`

        Tool invocation directly from the model.

        - `class BetaDirectCaller:`

          Tool invocation directly from the model.

        - `class BetaServerToolCaller:`

          Tool invocation generated by a server-side tool.

        - `class BetaServerToolCaller20260120:`

    - `class BetaWebFetchToolResultBlock:`

      - `required Content Content`

        - `class BetaWebFetchToolResultErrorBlock:`

          - `required BetaWebFetchToolResultErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"url_too_long"UrlTooLong`

            - `"url_not_allowed"UrlNotAllowed`

            - `"url_not_in_prior_context"UrlNotInPriorContext`

            - `"url_not_accessible"UrlNotAccessible`

            - `"unsupported_content_type"UnsupportedContentType`

            - `"too_many_requests"TooManyRequests`

            - `"max_uses_exceeded"MaxUsesExceeded`

            - `"unavailable"Unavailable`

          - `JsonElement Type "web_fetch_tool_result_error"constant`

        - `class BetaWebFetchBlock:`

          - `required BetaDocumentBlock Content`

            - `required BetaCitationConfig? Citations`

              Citation configuration for the document

              - `required Boolean Enabled`

            - `required Source Source`

              - `class BetaBase64PdfSource:`

                - `required string Data`

                - `JsonElement MediaType "application/pdf"constant`

                - `JsonElement Type "base64"constant`

              - `class BetaPlainTextSource:`

                - `required string Data`

                - `JsonElement MediaType "text/plain"constant`

                - `JsonElement Type "text"constant`

            - `required string? Title`

              The title of the document

            - `JsonElement Type "document"constant`

          - `required string? RetrievedAt`

            ISO 8601 timestamp when the content was retrieved

          - `JsonElement Type "web_fetch_result"constant`

          - `required string Url`

            Fetched content URL

      - `required string ToolUseID`

      - `JsonElement Type "web_fetch_tool_result"constant`

      - `Caller Caller`

        Tool invocation directly from the model.

        - `class BetaDirectCaller:`

          Tool invocation directly from the model.

        - `class BetaServerToolCaller:`

          Tool invocation generated by a server-side tool.

        - `class BetaServerToolCaller20260120:`

    - `class BetaAdvisorToolResultBlock:`

      - `required Content Content`

        - `class BetaAdvisorToolResultError:`

          - `required ErrorCode ErrorCode`

            - `"max_uses_exceeded"MaxUsesExceeded`

            - `"prompt_too_long"PromptTooLong`

            - `"too_many_requests"TooManyRequests`

            - `"overloaded"Overloaded`

            - `"unavailable"Unavailable`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

          - `JsonElement Type "advisor_tool_result_error"constant`

        - `class BetaAdvisorResultBlock:`

          - `required string? StopReason`

            The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the tool's `max_tokens` value or the advisor model's policy cap.

          - `required string Text`

          - `JsonElement Type "advisor_result"constant`

        - `class BetaAdvisorRedactedResultBlock:`

          - `required string EncryptedContent`

            Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.

          - `required string? StopReason`

            The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`).

          - `JsonElement Type "advisor_redacted_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "advisor_tool_result"constant`

    - `class BetaCodeExecutionToolResultBlock:`

      - `required BetaCodeExecutionToolResultBlockContent Content`

        Code execution result with encrypted stdout for PFC + web_search results.

        - `class BetaCodeExecutionToolResultError:`

          - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"too_many_requests"TooManyRequests`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

          - `JsonElement Type "code_execution_tool_result_error"constant`

        - `class BetaCodeExecutionResultBlock:`

          - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

            - `required string FileID`

            - `JsonElement Type "code_execution_output"constant`

          - `required Long ReturnCode`

          - `required string Stderr`

          - `required string Stdout`

          - `JsonElement Type "code_execution_result"constant`

        - `class BetaEncryptedCodeExecutionResultBlock:`

          Code execution result with encrypted stdout for PFC + web_search results.

          - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

            - `required string FileID`

            - `JsonElement Type "code_execution_output"constant`

          - `required string EncryptedStdout`

          - `required Long ReturnCode`

          - `required string Stderr`

          - `JsonElement Type "encrypted_code_execution_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "code_execution_tool_result"constant`

    - `class BetaBashCodeExecutionToolResultBlock:`

      - `required Content Content`

        - `class BetaBashCodeExecutionToolResultError:`

          - `required ErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"too_many_requests"TooManyRequests`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `"output_file_too_large"OutputFileTooLarge`

          - `JsonElement Type "bash_code_execution_tool_result_error"constant`

        - `class BetaBashCodeExecutionResultBlock:`

          - `required IReadOnlyList<BetaBashCodeExecutionOutputBlock> Content`

            - `required string FileID`

            - `JsonElement Type "bash_code_execution_output"constant`

          - `required Long ReturnCode`

          - `required string Stderr`

          - `required string Stdout`

          - `JsonElement Type "bash_code_execution_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "bash_code_execution_tool_result"constant`

    - `class BetaTextEditorCodeExecutionToolResultBlock:`

      - `required Content Content`

        - `class BetaTextEditorCodeExecutionToolResultError:`

          - `required ErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"too_many_requests"TooManyRequests`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `"file_not_found"FileNotFound`

          - `required string? ErrorMessage`

          - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

        - `class BetaTextEditorCodeExecutionViewResultBlock:`

          - `required string Content`

          - `required FileType FileType`

            - `"text"Text`

            - `"image"Image`

            - `"pdf"Pdf`

          - `required Long? NumLines`

          - `required Long? StartLine`

          - `required Long? TotalLines`

          - `JsonElement Type "text_editor_code_execution_view_result"constant`

        - `class BetaTextEditorCodeExecutionCreateResultBlock:`

          - `required Boolean IsFileUpdate`

          - `JsonElement Type "text_editor_code_execution_create_result"constant`

        - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:`

          - `required IReadOnlyList<string>? Lines`

          - `required Long? NewLines`

          - `required Long? NewStart`

          - `required Long? OldLines`

          - `required Long? OldStart`

          - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "text_editor_code_execution_tool_result"constant`

    - `class BetaToolSearchToolResultBlock:`

      - `required Content Content`

        - `class BetaToolSearchToolResultError:`

          - `required ErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"too_many_requests"TooManyRequests`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

          - `required string? ErrorMessage`

          - `JsonElement Type "tool_search_tool_result_error"constant`

        - `class BetaToolSearchToolSearchResultBlock:`

          - `required IReadOnlyList<BetaToolReferenceBlock> ToolReferences`

            - `required string ToolName`

            - `JsonElement Type "tool_reference"constant`

          - `JsonElement Type "tool_search_tool_search_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "tool_search_tool_result"constant`

    - `class BetaMcpToolUseBlock:`

      - `required string ID`

      - `required IReadOnlyDictionary<string, JsonElement> Input`

      - `required string Name`

        The name of the MCP tool

      - `required string ServerName`

        The name of the MCP server

      - `JsonElement Type "mcp_tool_use"constant`

    - `class BetaMcpToolResultBlock:`

      - `required Content Content`

        - `string`

        - `IReadOnlyList<BetaTextBlock>`

          - `required IReadOnlyList<BetaTextCitation>? Citations`

            Citations supporting the text block.

            The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

          - `required string Text`

          - `JsonElement Type "text"constant`

      - `required Boolean IsError`

      - `required string ToolUseID`

      - `JsonElement Type "mcp_tool_result"constant`

    - `class BetaContainerUploadBlock:`

      Response model for a file uploaded to the container.

      - `required string FileID`

      - `JsonElement Type "container_upload"constant`

    - `class BetaCompactionBlock:`

      A compaction block returned when autocompact is triggered.

      When content is None, it indicates the compaction failed to produce a valid
      summary (e.g., malformed output from the model). Clients may round-trip
      compaction blocks with null content; the server treats them as no-ops.

      - `required string? Content`

        Summary of compacted content, or null if compaction failed

      - `required string? EncryptedContent`

        Opaque metadata from prior compaction, to be round-tripped verbatim

      - `JsonElement Type "compaction"constant`

  - `required BetaContextManagementResponse? ContextManagement`

    Context management response.

    Information about context management strategies applied during the request.

    - `required IReadOnlyList<AppliedEdit> AppliedEdits`

      List of context management edits that were applied.

      - `class BetaClearToolUses20250919EditResponse:`

        - `required Long ClearedInputTokens`

          Number of input tokens cleared by this edit.

        - `required Long ClearedToolUses`

          Number of tool uses that were cleared.

        - `JsonElement Type "clear_tool_uses_20250919"constant`

          The type of context management edit applied.

      - `class BetaClearThinking20251015EditResponse:`

        - `required Long ClearedInputTokens`

          Number of input tokens cleared by this edit.

        - `required Long ClearedThinkingTurns`

          Number of thinking turns that were cleared.

        - `JsonElement Type "clear_thinking_20251015"constant`

          The type of context management edit applied.

  - `required BetaDiagnostics? Diagnostics`

    Response envelope for request-level diagnostics. Present (possibly
    null) whenever the caller supplied `diagnostics` on the request.

    - `required CacheMissReason? CacheMissReason`

      Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.

      - `class BetaCacheMissModelChanged:`

        - `required Long CacheMissedInputTokens`

          Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

        - `JsonElement Type "model_changed"constant`

      - `class BetaCacheMissSystemChanged:`

        - `required Long CacheMissedInputTokens`

          Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

        - `JsonElement Type "system_changed"constant`

      - `class BetaCacheMissToolsChanged:`

        - `required Long CacheMissedInputTokens`

          Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

        - `JsonElement Type "tools_changed"constant`

      - `class BetaCacheMissMessagesChanged:`

        - `required Long CacheMissedInputTokens`

          Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

        - `JsonElement Type "messages_changed"constant`

      - `class BetaCacheMissPreviousMessageNotFound:`

        - `JsonElement Type "previous_message_not_found"constant`

      - `class BetaCacheMissUnavailable:`

        - `JsonElement Type "unavailable"constant`

  - `required Model Model`

    The model that will complete your prompt.

    See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

    - `"claude-opus-4-8"ClaudeOpus4_8`

      Frontier intelligence for long-running agents and coding

    - `"claude-opus-4-7"ClaudeOpus4_7`

      Frontier intelligence for long-running agents and coding

    - `"claude-mythos-preview"ClaudeMythosPreview`

      New class of intelligence, strongest in coding and cybersecurity

    - `"claude-opus-4-6"ClaudeOpus4_6`

      Frontier intelligence for long-running agents and coding

    - `"claude-sonnet-4-6"ClaudeSonnet4_6`

      Best combination of speed and intelligence

    - `"claude-haiku-4-5"ClaudeHaiku4_5`

      Fastest model with near-frontier intelligence

    - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

      Fastest model with near-frontier intelligence

    - `"claude-opus-4-5"ClaudeOpus4_5`

      Premium model combining maximum intelligence with practical performance

    - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

      Premium model combining maximum intelligence with practical performance

    - `"claude-sonnet-4-5"ClaudeSonnet4_5`

      High-performance model for agents and coding

    - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

      High-performance model for agents and coding

    - `"claude-opus-4-1"ClaudeOpus4_1`

      Exceptional model for specialized complex tasks

    - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

      Exceptional model for specialized complex tasks

    - `"claude-opus-4-0"ClaudeOpus4_0`

      Powerful model for complex tasks

    - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

      Powerful model for complex tasks

    - `"claude-sonnet-4-0"ClaudeSonnet4_0`

      High-performance model with extended thinking

    - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

      High-performance model with extended thinking

    - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

      Fast and cost-effective model

  - `JsonElement Role "assistant"constant`

    Conversational role of the generated message.

    This will always be `"assistant"`.

  - `required BetaRefusalStopDetails? StopDetails`

    Structured information about a refusal.

    - `required Category? Category`

      The policy category that triggered the refusal.

      `null` when the refusal doesn't map to a named category.

      - `"cyber"Cyber`

      - `"bio"Bio`

    - `required string? Explanation`

      Human-readable explanation of the refusal.

      This text is not guaranteed to be stable. `null` when no explanation is available for the category.

    - `JsonElement Type "refusal"constant`

  - `required BetaStopReason? StopReason`

    The reason that we stopped.

    This may be one the following values:

    * `"end_turn"`: the model reached a natural stopping point
    * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
    * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
    * `"tool_use"`: the model invoked one or more tools
    * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.
    * `"refusal"`: when streaming classifiers intervene to handle potential policy violations

    In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise.

    - `"end_turn"EndTurn`

    - `"max_tokens"MaxTokens`

    - `"stop_sequence"StopSequence`

    - `"tool_use"ToolUse`

    - `"pause_turn"PauseTurn`

    - `"compaction"Compaction`

    - `"refusal"Refusal`

    - `"model_context_window_exceeded"ModelContextWindowExceeded`

  - `required string? StopSequence`

    Which custom stop sequence was generated, if any.

    This value will be a non-null string if one of your custom stop sequences was generated.

  - `JsonElement Type "message"constant`

    Object type.

    For Messages, this is always `"message"`.

  - `required BetaUsage Usage`

    Billing and rate-limit usage.

    Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

    Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.

    For example, `output_tokens` will be non-zero, even for an empty string response from Claude.

    Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.

    - `required BetaCacheCreation? CacheCreation`

      Breakdown of cached tokens by TTL

      - `required Long Ephemeral1hInputTokens`

        The number of input tokens used to create the 1 hour cache entry.

      - `required Long Ephemeral5mInputTokens`

        The number of input tokens used to create the 5 minute cache entry.

    - `required Long? CacheCreationInputTokens`

      The number of input tokens used to create the cache entry.

    - `required Long? CacheReadInputTokens`

      The number of input tokens read from the cache.

    - `required string? InferenceGeo`

      The geographic region where inference was performed for this request.

    - `required Long InputTokens`

      The number of input tokens which were used.

    - `required IReadOnlyList<BetaIterationsUsageItems>? Iterations`

      Per-iteration token usage breakdown.

      Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:

      - Determine which iterations exceeded long context thresholds (>=200k tokens)
      - Calculate the true context window size from the last iteration
      - Understand token accumulation across server-side tool use loops

      - `class BetaMessageIterationUsage:`

        Token usage for a sampling iteration.

        - `required BetaCacheCreation? CacheCreation`

          Breakdown of cached tokens by TTL

        - `required Long CacheCreationInputTokens`

          The number of input tokens used to create the cache entry.

        - `required Long CacheReadInputTokens`

          The number of input tokens read from the cache.

        - `required Long InputTokens`

          The number of input tokens which were used.

        - `required Long OutputTokens`

          The number of output tokens which were used.

        - `JsonElement Type "message"constant`

          Usage for a sampling iteration

      - `class BetaCompactionIterationUsage:`

        Token usage for a compaction iteration.

        - `required BetaCacheCreation? CacheCreation`

          Breakdown of cached tokens by TTL

        - `required Long CacheCreationInputTokens`

          The number of input tokens used to create the cache entry.

        - `required Long CacheReadInputTokens`

          The number of input tokens read from the cache.

        - `required Long InputTokens`

          The number of input tokens which were used.

        - `required Long OutputTokens`

          The number of output tokens which were used.

        - `JsonElement Type "compaction"constant`

          Usage for a compaction iteration

      - `class BetaAdvisorMessageIterationUsage:`

        Token usage for an advisor sub-inference iteration.

        - `required BetaCacheCreation? CacheCreation`

          Breakdown of cached tokens by TTL

        - `required Long CacheCreationInputTokens`

          The number of input tokens used to create the cache entry.

        - `required Long CacheReadInputTokens`

          The number of input tokens read from the cache.

        - `required Long InputTokens`

          The number of input tokens which were used.

        - `required Model Model`

          The model that will complete your prompt.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `required Long OutputTokens`

          The number of output tokens which were used.

        - `JsonElement Type "advisor_message"constant`

          Usage for an advisor sub-inference iteration

    - `required Long OutputTokens`

      The number of output tokens which were used.

    - `required BetaOutputTokensDetails? OutputTokensDetails`

      Breakdown of output tokens by category.

      `output_tokens` remains the inclusive, authoritative total used for billing.
      This object provides a read-only decomposition for observability — for example,
      how many of the billed output tokens were spent on internal reasoning that may
      have been summarized before being returned to you.

      - `required Long ThinkingTokens`

        Number of output tokens the model generated as internal reasoning, including
        the thinking-block delimiter tokens.

        Reflects the raw reasoning the model produced, not the (possibly shorter)
        summarized thinking text returned in the response body. Computed by
        re-tokenizing the raw reasoning text, so it may differ from the model's exact
        generation count by a small number of tokens. Always ≤ `output_tokens`;
        `output_tokens - thinking_tokens` approximates the non-reasoning output.

    - `required BetaServerToolUsage? ServerToolUse`

      The number of server tool requests.

      - `required Long WebFetchRequests`

        The number of web fetch tool requests.

      - `required Long WebSearchRequests`

        The number of web search tool requests.

    - `required ServiceTier? ServiceTier`

      If the request used the priority, standard, or batch tier.

      - `"standard"Standard`

      - `"priority"Priority`

      - `"batch"Batch`

    - `required Speed? Speed`

      The inference speed mode used for this request.

      - `"standard"Standard`

      - `"fast"Fast`

### Beta Message Delta Usage

- `class BetaMessageDeltaUsage:`

  - `required Long? CacheCreationInputTokens`

    The cumulative number of input tokens used to create the cache entry.

  - `required Long? CacheReadInputTokens`

    The cumulative number of input tokens read from the cache.

  - `required Long? InputTokens`

    The cumulative number of input tokens which were used.

  - `required IReadOnlyList<BetaIterationsUsageItems>? Iterations`

    Per-iteration token usage breakdown.

    Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:

    - Determine which iterations exceeded long context thresholds (>=200k tokens)
    - Calculate the true context window size from the last iteration
    - Understand token accumulation across server-side tool use loops

    - `class BetaMessageIterationUsage:`

      Token usage for a sampling iteration.

      - `required BetaCacheCreation? CacheCreation`

        Breakdown of cached tokens by TTL

        - `required Long Ephemeral1hInputTokens`

          The number of input tokens used to create the 1 hour cache entry.

        - `required Long Ephemeral5mInputTokens`

          The number of input tokens used to create the 5 minute cache entry.

      - `required Long CacheCreationInputTokens`

        The number of input tokens used to create the cache entry.

      - `required Long CacheReadInputTokens`

        The number of input tokens read from the cache.

      - `required Long InputTokens`

        The number of input tokens which were used.

      - `required Long OutputTokens`

        The number of output tokens which were used.

      - `JsonElement Type "message"constant`

        Usage for a sampling iteration

    - `class BetaCompactionIterationUsage:`

      Token usage for a compaction iteration.

      - `required BetaCacheCreation? CacheCreation`

        Breakdown of cached tokens by TTL

      - `required Long CacheCreationInputTokens`

        The number of input tokens used to create the cache entry.

      - `required Long CacheReadInputTokens`

        The number of input tokens read from the cache.

      - `required Long InputTokens`

        The number of input tokens which were used.

      - `required Long OutputTokens`

        The number of output tokens which were used.

      - `JsonElement Type "compaction"constant`

        Usage for a compaction iteration

    - `class BetaAdvisorMessageIterationUsage:`

      Token usage for an advisor sub-inference iteration.

      - `required BetaCacheCreation? CacheCreation`

        Breakdown of cached tokens by TTL

      - `required Long CacheCreationInputTokens`

        The number of input tokens used to create the cache entry.

      - `required Long CacheReadInputTokens`

        The number of input tokens read from the cache.

      - `required Long InputTokens`

        The number of input tokens which were used.

      - `required Model Model`

        The model that will complete your prompt.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-mythos-preview"ClaudeMythosPreview`

          New class of intelligence, strongest in coding and cybersecurity

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Frontier intelligence for long-running agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

        - `"claude-opus-4-1"ClaudeOpus4_1`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-0"ClaudeOpus4_0`

          Powerful model for complex tasks

        - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

          Powerful model for complex tasks

        - `"claude-sonnet-4-0"ClaudeSonnet4_0`

          High-performance model with extended thinking

        - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

          High-performance model with extended thinking

        - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

          Fast and cost-effective model

      - `required Long OutputTokens`

        The number of output tokens which were used.

      - `JsonElement Type "advisor_message"constant`

        Usage for an advisor sub-inference iteration

  - `required Long OutputTokens`

    The cumulative number of output tokens which were used.

  - `required BetaOutputTokensDetails? OutputTokensDetails`

    Breakdown of output tokens by category.

    `output_tokens` remains the inclusive, authoritative total used for billing.
    This object provides a read-only decomposition for observability — for example,
    how many of the billed output tokens were spent on internal reasoning that may
    have been summarized before being returned to you.

    - `required Long ThinkingTokens`

      Number of output tokens the model generated as internal reasoning, including
      the thinking-block delimiter tokens.

      Reflects the raw reasoning the model produced, not the (possibly shorter)
      summarized thinking text returned in the response body. Computed by
      re-tokenizing the raw reasoning text, so it may differ from the model's exact
      generation count by a small number of tokens. Always ≤ `output_tokens`;
      `output_tokens - thinking_tokens` approximates the non-reasoning output.

  - `required BetaServerToolUsage? ServerToolUse`

    The number of server tool requests.

    - `required Long WebFetchRequests`

      The number of web fetch tool requests.

    - `required Long WebSearchRequests`

      The number of web search tool requests.

### Beta Message Iteration Usage

- `class BetaMessageIterationUsage:`

  Token usage for a sampling iteration.

  - `required BetaCacheCreation? CacheCreation`

    Breakdown of cached tokens by TTL

    - `required Long Ephemeral1hInputTokens`

      The number of input tokens used to create the 1 hour cache entry.

    - `required Long Ephemeral5mInputTokens`

      The number of input tokens used to create the 5 minute cache entry.

  - `required Long CacheCreationInputTokens`

    The number of input tokens used to create the cache entry.

  - `required Long CacheReadInputTokens`

    The number of input tokens read from the cache.

  - `required Long InputTokens`

    The number of input tokens which were used.

  - `required Long OutputTokens`

    The number of output tokens which were used.

  - `JsonElement Type "message"constant`

    Usage for a sampling iteration

### Beta Message Param

- `class BetaMessageParam:`

  - `required Content Content`

    - `string`

    - `IReadOnlyList<BetaContentBlockParam>`

      - `class BetaTextBlockParam:`

        - `required string Text`

        - `JsonElement Type "text"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

          - `JsonElement Type "ephemeral"constant`

          - `Ttl Ttl`

            The time-to-live for the cache control breakpoint.

            This may be one the following values:

            - `5m`: 5 minutes
            - `1h`: 1 hour

            Defaults to `5m`.

            - `"5m"Ttl5m`

            - `"1h"Ttl1h`

        - `IReadOnlyList<BetaTextCitationParam>? Citations`

          - `class BetaCitationCharLocationParam:`

            - `required string CitedText`

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndCharIndex`

            - `required Long StartCharIndex`

            - `JsonElement Type "char_location"constant`

          - `class BetaCitationPageLocationParam:`

            - `required string CitedText`

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndPageNumber`

            - `required Long StartPageNumber`

            - `JsonElement Type "page_location"constant`

          - `class BetaCitationContentBlockLocationParam:`

            - `required string CitedText`

              The full text of the cited block range, concatenated.

              Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndBlockIndex`

              Exclusive 0-based end index of the cited block range in the source's `content` array.

              Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

            - `required Long StartBlockIndex`

              0-based index of the first cited block in the source's `content` array.

            - `JsonElement Type "content_block_location"constant`

          - `class BetaCitationWebSearchResultLocationParam:`

            - `required string CitedText`

            - `required string EncryptedIndex`

            - `required string? Title`

            - `JsonElement Type "web_search_result_location"constant`

            - `required string Url`

          - `class BetaCitationSearchResultLocationParam:`

            - `required string CitedText`

              The full text of the cited block range, concatenated.

              Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

            - `required Long EndBlockIndex`

              Exclusive 0-based end index of the cited block range in the source's `content` array.

              Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

            - `required Long SearchResultIndex`

              0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

              Counted separately from `document_index`; server-side web search results are not included in this count.

            - `required string Source`

            - `required Long StartBlockIndex`

              0-based index of the first cited block in the source's `content` array.

            - `required string? Title`

            - `JsonElement Type "search_result_location"constant`

      - `class BetaImageBlockParam:`

        - `required Source Source`

          - `class BetaBase64ImageSource:`

            - `required string Data`

            - `required MediaType MediaType`

              - `"image/jpeg"ImageJpeg`

              - `"image/png"ImagePng`

              - `"image/gif"ImageGif`

              - `"image/webp"ImageWebP`

            - `JsonElement Type "base64"constant`

          - `class BetaUrlImageSource:`

            - `JsonElement Type "url"constant`

            - `required string Url`

          - `class BetaFileImageSource:`

            - `required string FileID`

            - `JsonElement Type "file"constant`

        - `JsonElement Type "image"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

      - `class BetaRequestDocumentBlock:`

        - `required Source Source`

          - `class BetaBase64PdfSource:`

            - `required string Data`

            - `JsonElement MediaType "application/pdf"constant`

            - `JsonElement Type "base64"constant`

          - `class BetaPlainTextSource:`

            - `required string Data`

            - `JsonElement MediaType "text/plain"constant`

            - `JsonElement Type "text"constant`

          - `class BetaContentBlockSource:`

            - `required Content Content`

              - `string`

              - `IReadOnlyList<BetaContentBlockSourceContent>`

                - `class BetaTextBlockParam:`

                - `class BetaImageBlockParam:`

            - `JsonElement Type "content"constant`

          - `class BetaUrlPdfSource:`

            - `JsonElement Type "url"constant`

            - `required string Url`

          - `class BetaFileDocumentSource:`

            - `required string FileID`

            - `JsonElement Type "file"constant`

        - `JsonElement Type "document"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `BetaCitationsConfigParam? Citations`

          - `Boolean Enabled`

        - `string? Context`

        - `string? Title`

      - `class BetaSearchResultBlockParam:`

        - `required IReadOnlyList<BetaTextBlockParam> Content`

          - `required string Text`

          - `JsonElement Type "text"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `IReadOnlyList<BetaTextCitationParam>? Citations`

        - `required string Source`

        - `required string Title`

        - `JsonElement Type "search_result"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `BetaCitationsConfigParam Citations`

      - `class BetaThinkingBlockParam:`

        - `required string Signature`

        - `required string Thinking`

        - `JsonElement Type "thinking"constant`

      - `class BetaRedactedThinkingBlockParam:`

        - `required string Data`

        - `JsonElement Type "redacted_thinking"constant`

      - `class BetaToolUseBlockParam:`

        - `required string ID`

        - `required IReadOnlyDictionary<string, JsonElement> Input`

        - `required string Name`

        - `JsonElement Type "tool_use"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `Caller Caller`

          Tool invocation directly from the model.

          - `class BetaDirectCaller:`

            Tool invocation directly from the model.

            - `JsonElement Type "direct"constant`

          - `class BetaServerToolCaller:`

            Tool invocation generated by a server-side tool.

            - `required string ToolID`

            - `JsonElement Type "code_execution_20250825"constant`

          - `class BetaServerToolCaller20260120:`

            - `required string ToolID`

            - `JsonElement Type "code_execution_20260120"constant`

      - `class BetaToolResultBlockParam:`

        - `required string ToolUseID`

        - `JsonElement Type "tool_result"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `Content Content`

          - `string`

          - `IReadOnlyList<Block>`

            - `class BetaTextBlockParam:`

            - `class BetaImageBlockParam:`

            - `class BetaSearchResultBlockParam:`

            - `class BetaRequestDocumentBlock:`

            - `class BetaToolReferenceBlockParam:`

              Tool reference block that can be included in tool_result content.

              - `required string ToolName`

              - `JsonElement Type "tool_reference"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

        - `Boolean IsError`

      - `class BetaServerToolUseBlockParam:`

        - `required string ID`

        - `required IReadOnlyDictionary<string, JsonElement> Input`

        - `required Name Name`

          - `"advisor"Advisor`

          - `"web_search"WebSearch`

          - `"web_fetch"WebFetch`

          - `"code_execution"CodeExecution`

          - `"bash_code_execution"BashCodeExecution`

          - `"text_editor_code_execution"TextEditorCodeExecution`

          - `"tool_search_tool_regex"ToolSearchToolRegex`

          - `"tool_search_tool_bm25"ToolSearchToolBm25`

        - `JsonElement Type "server_tool_use"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `Caller Caller`

          Tool invocation directly from the model.

          - `class BetaDirectCaller:`

            Tool invocation directly from the model.

          - `class BetaServerToolCaller:`

            Tool invocation generated by a server-side tool.

          - `class BetaServerToolCaller20260120:`

      - `class BetaWebSearchToolResultBlockParam:`

        - `required BetaWebSearchToolResultBlockParamContent Content`

          - `IReadOnlyList<BetaWebSearchResultBlockParam>`

            - `required string EncryptedContent`

            - `required string Title`

            - `JsonElement Type "web_search_result"constant`

            - `required string Url`

            - `string? PageAge`

          - `class BetaWebSearchToolRequestError:`

            - `required BetaWebSearchToolResultErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"max_uses_exceeded"MaxUsesExceeded`

              - `"too_many_requests"TooManyRequests`

              - `"query_too_long"QueryTooLong`

              - `"request_too_large"RequestTooLarge`

            - `JsonElement Type "web_search_tool_result_error"constant`

        - `required string ToolUseID`

        - `JsonElement Type "web_search_tool_result"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `Caller Caller`

          Tool invocation directly from the model.

          - `class BetaDirectCaller:`

            Tool invocation directly from the model.

          - `class BetaServerToolCaller:`

            Tool invocation generated by a server-side tool.

          - `class BetaServerToolCaller20260120:`

      - `class BetaWebFetchToolResultBlockParam:`

        - `required Content Content`

          - `class BetaWebFetchToolResultErrorBlockParam:`

            - `required BetaWebFetchToolResultErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"url_too_long"UrlTooLong`

              - `"url_not_allowed"UrlNotAllowed`

              - `"url_not_in_prior_context"UrlNotInPriorContext`

              - `"url_not_accessible"UrlNotAccessible`

              - `"unsupported_content_type"UnsupportedContentType`

              - `"too_many_requests"TooManyRequests`

              - `"max_uses_exceeded"MaxUsesExceeded`

              - `"unavailable"Unavailable`

            - `JsonElement Type "web_fetch_tool_result_error"constant`

          - `class BetaWebFetchBlockParam:`

            - `required BetaRequestDocumentBlock Content`

            - `JsonElement Type "web_fetch_result"constant`

            - `required string Url`

              Fetched content URL

            - `string? RetrievedAt`

              ISO 8601 timestamp when the content was retrieved

        - `required string ToolUseID`

        - `JsonElement Type "web_fetch_tool_result"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `Caller Caller`

          Tool invocation directly from the model.

          - `class BetaDirectCaller:`

            Tool invocation directly from the model.

          - `class BetaServerToolCaller:`

            Tool invocation generated by a server-side tool.

          - `class BetaServerToolCaller20260120:`

      - `class BetaAdvisorToolResultBlockParam:`

        - `required Content Content`

          - `class BetaAdvisorToolResultErrorParam:`

            - `required ErrorCode ErrorCode`

              - `"max_uses_exceeded"MaxUsesExceeded`

              - `"prompt_too_long"PromptTooLong`

              - `"too_many_requests"TooManyRequests`

              - `"overloaded"Overloaded`

              - `"unavailable"Unavailable`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `JsonElement Type "advisor_tool_result_error"constant`

          - `class BetaAdvisorResultBlockParam:`

            - `required string Text`

            - `JsonElement Type "advisor_result"constant`

            - `string? StopReason`

          - `class BetaAdvisorRedactedResultBlockParam:`

            - `required string EncryptedContent`

              Opaque blob produced by a prior response; must be round-tripped verbatim.

            - `JsonElement Type "advisor_redacted_result"constant`

            - `string? StopReason`

        - `required string ToolUseID`

        - `JsonElement Type "advisor_tool_result"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

      - `class BetaCodeExecutionToolResultBlockParam:`

        - `required BetaCodeExecutionToolResultBlockParamContent Content`

          Code execution result with encrypted stdout for PFC + web_search results.

          - `class BetaCodeExecutionToolResultErrorParam:`

            - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"too_many_requests"TooManyRequests`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `JsonElement Type "code_execution_tool_result_error"constant`

          - `class BetaCodeExecutionResultBlockParam:`

            - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

              - `required string FileID`

              - `JsonElement Type "code_execution_output"constant`

            - `required Long ReturnCode`

            - `required string Stderr`

            - `required string Stdout`

            - `JsonElement Type "code_execution_result"constant`

          - `class BetaEncryptedCodeExecutionResultBlockParam:`

            Code execution result with encrypted stdout for PFC + web_search results.

            - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

              - `required string FileID`

              - `JsonElement Type "code_execution_output"constant`

            - `required string EncryptedStdout`

            - `required Long ReturnCode`

            - `required string Stderr`

            - `JsonElement Type "encrypted_code_execution_result"constant`

        - `required string ToolUseID`

        - `JsonElement Type "code_execution_tool_result"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

      - `class BetaBashCodeExecutionToolResultBlockParam:`

        - `required Content Content`

          - `class BetaBashCodeExecutionToolResultErrorParam:`

            - `required ErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"too_many_requests"TooManyRequests`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `"output_file_too_large"OutputFileTooLarge`

            - `JsonElement Type "bash_code_execution_tool_result_error"constant`

          - `class BetaBashCodeExecutionResultBlockParam:`

            - `required IReadOnlyList<BetaBashCodeExecutionOutputBlockParam> Content`

              - `required string FileID`

              - `JsonElement Type "bash_code_execution_output"constant`

            - `required Long ReturnCode`

            - `required string Stderr`

            - `required string Stdout`

            - `JsonElement Type "bash_code_execution_result"constant`

        - `required string ToolUseID`

        - `JsonElement Type "bash_code_execution_tool_result"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

      - `class BetaTextEditorCodeExecutionToolResultBlockParam:`

        - `required Content Content`

          - `class BetaTextEditorCodeExecutionToolResultErrorParam:`

            - `required ErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"too_many_requests"TooManyRequests`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `"file_not_found"FileNotFound`

            - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

            - `string? ErrorMessage`

          - `class BetaTextEditorCodeExecutionViewResultBlockParam:`

            - `required string Content`

            - `required FileType FileType`

              - `"text"Text`

              - `"image"Image`

              - `"pdf"Pdf`

            - `JsonElement Type "text_editor_code_execution_view_result"constant`

            - `Long? NumLines`

            - `Long? StartLine`

            - `Long? TotalLines`

          - `class BetaTextEditorCodeExecutionCreateResultBlockParam:`

            - `required Boolean IsFileUpdate`

            - `JsonElement Type "text_editor_code_execution_create_result"constant`

          - `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:`

            - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

            - `IReadOnlyList<string>? Lines`

            - `Long? NewLines`

            - `Long? NewStart`

            - `Long? OldLines`

            - `Long? OldStart`

        - `required string ToolUseID`

        - `JsonElement Type "text_editor_code_execution_tool_result"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

      - `class BetaToolSearchToolResultBlockParam:`

        - `required Content Content`

          - `class BetaToolSearchToolResultErrorParam:`

            - `required ErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"too_many_requests"TooManyRequests`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `JsonElement Type "tool_search_tool_result_error"constant`

          - `class BetaToolSearchToolSearchResultBlockParam:`

            - `required IReadOnlyList<BetaToolReferenceBlockParam> ToolReferences`

              - `required string ToolName`

              - `JsonElement Type "tool_reference"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

            - `JsonElement Type "tool_search_tool_search_result"constant`

        - `required string ToolUseID`

        - `JsonElement Type "tool_search_tool_result"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

      - `class BetaMcpToolUseBlockParam:`

        - `required string ID`

        - `required IReadOnlyDictionary<string, JsonElement> Input`

        - `required string Name`

        - `required string ServerName`

          The name of the MCP server

        - `JsonElement Type "mcp_tool_use"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

      - `class BetaRequestMcpToolResultBlockParam:`

        - `required string ToolUseID`

        - `JsonElement Type "mcp_tool_result"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `Content Content`

          - `string`

          - `IReadOnlyList<BetaTextBlockParam>`

            - `required string Text`

            - `JsonElement Type "text"constant`

            - `BetaCacheControlEphemeral? CacheControl`

              Create a cache control breakpoint at this content block.

            - `IReadOnlyList<BetaTextCitationParam>? Citations`

        - `Boolean IsError`

      - `class BetaContainerUploadBlockParam:`

        A content block that represents a file to be uploaded to the container
        Files uploaded via this block will be available in the container's input directory.

        - `required string FileID`

        - `JsonElement Type "container_upload"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

      - `class BetaCompactionBlockParam:`

        A compaction block containing summary of previous context.

        Users should round-trip these blocks from responses to subsequent requests
        to maintain context across compaction boundaries.

        When content is None, the block represents a failed compaction. The server
        treats these as no-ops. Empty string content is not allowed.

        - `JsonElement Type "compaction"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `string? Content`

          Summary of previously compacted content, or null if compaction failed

        - `string? EncryptedContent`

          Opaque metadata from prior compaction, to be round-tripped verbatim

      - `class BetaMidConversationSystemBlockParam:`

        System instructions that appear mid-conversation.

        Use this block to provide or update system-level instructions at a specific
        point in the conversation, rather than only via the top-level `system` parameter.

        - `required IReadOnlyList<BetaTextBlockParam> Content`

          System instruction text blocks.

          - `required string Text`

          - `JsonElement Type "text"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `IReadOnlyList<BetaTextCitationParam>? Citations`

        - `JsonElement Type "mid_conv_system"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

  - `required Role Role`

    - `"user"User`

    - `"assistant"Assistant`

    - `"system"System`

### Beta Message Tokens Count

- `class BetaMessageTokensCount:`

  - `required BetaCountTokensContextManagementResponse? ContextManagement`

    Information about context management applied to the message.

    - `required Long OriginalInputTokens`

      The original token count before context management was applied

  - `required Long InputTokens`

    The total number of tokens across the provided list of messages, system prompt, and tools.

### Beta Metadata

- `class BetaMetadata:`

  - `string? UserID`

    An external identifier for the user who is associated with the request.

    This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.

### Beta Mid Conversation System Block Param

- `class BetaMidConversationSystemBlockParam:`

  System instructions that appear mid-conversation.

  Use this block to provide or update system-level instructions at a specific
  point in the conversation, rather than only via the top-level `system` parameter.

  - `required IReadOnlyList<BetaTextBlockParam> Content`

    System instruction text blocks.

    - `required string Text`

    - `JsonElement Type "text"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

      - `JsonElement Type "ephemeral"constant`

      - `Ttl Ttl`

        The time-to-live for the cache control breakpoint.

        This may be one the following values:

        - `5m`: 5 minutes
        - `1h`: 1 hour

        Defaults to `5m`.

        - `"5m"Ttl5m`

        - `"1h"Ttl1h`

    - `IReadOnlyList<BetaTextCitationParam>? Citations`

      - `class BetaCitationCharLocationParam:`

        - `required string CitedText`

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndCharIndex`

        - `required Long StartCharIndex`

        - `JsonElement Type "char_location"constant`

      - `class BetaCitationPageLocationParam:`

        - `required string CitedText`

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndPageNumber`

        - `required Long StartPageNumber`

        - `JsonElement Type "page_location"constant`

      - `class BetaCitationContentBlockLocationParam:`

        - `required string CitedText`

          The full text of the cited block range, concatenated.

          Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndBlockIndex`

          Exclusive 0-based end index of the cited block range in the source's `content` array.

          Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

        - `required Long StartBlockIndex`

          0-based index of the first cited block in the source's `content` array.

        - `JsonElement Type "content_block_location"constant`

      - `class BetaCitationWebSearchResultLocationParam:`

        - `required string CitedText`

        - `required string EncryptedIndex`

        - `required string? Title`

        - `JsonElement Type "web_search_result_location"constant`

        - `required string Url`

      - `class BetaCitationSearchResultLocationParam:`

        - `required string CitedText`

          The full text of the cited block range, concatenated.

          Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

        - `required Long EndBlockIndex`

          Exclusive 0-based end index of the cited block range in the source's `content` array.

          Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

        - `required Long SearchResultIndex`

          0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

          Counted separately from `document_index`; server-side web search results are not included in this count.

        - `required string Source`

        - `required Long StartBlockIndex`

          0-based index of the first cited block in the source's `content` array.

        - `required string? Title`

        - `JsonElement Type "search_result_location"constant`

  - `JsonElement Type "mid_conv_system"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

### Beta Output Config

- `class BetaOutputConfig:`

  - `Effort? Effort`

    All possible effort levels.

    - `"low"Low`

    - `"medium"Medium`

    - `"high"High`

    - `"xhigh"Xhigh`

    - `"max"Max`

  - `BetaJsonOutputFormat? Format`

    A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)

    - `required IReadOnlyDictionary<string, JsonElement> Schema`

      The JSON schema of the format

    - `JsonElement Type "json_schema"constant`

  - `BetaTokenTaskBudget? TaskBudget`

    User-configurable total token budget across contexts.

    - `required Long Total`

      Total token budget across all contexts in the session.

    - `JsonElement Type "tokens"constant`

      The budget type. Currently only 'tokens' is supported.

    - `Long? Remaining`

      Remaining tokens in the budget. Use this to track usage across contexts when implementing compaction client-side. Defaults to total if not provided.

### Beta Output Tokens Details

- `class BetaOutputTokensDetails:`

  - `required Long ThinkingTokens`

    Number of output tokens the model generated as internal reasoning, including
    the thinking-block delimiter tokens.

    Reflects the raw reasoning the model produced, not the (possibly shorter)
    summarized thinking text returned in the response body. Computed by
    re-tokenizing the raw reasoning text, so it may differ from the model's exact
    generation count by a small number of tokens. Always ≤ `output_tokens`;
    `output_tokens - thinking_tokens` approximates the non-reasoning output.

### Beta Plain Text Source

- `class BetaPlainTextSource:`

  - `required string Data`

  - `JsonElement MediaType "text/plain"constant`

  - `JsonElement Type "text"constant`

### Beta Raw Content Block Delta

- `class BetaRawContentBlockDelta: A class that can be one of several variants.union`

  - `class BetaTextDelta:`

    - `required string Text`

    - `JsonElement Type "text_delta"constant`

  - `class BetaInputJsonDelta:`

    - `required string PartialJson`

    - `JsonElement Type "input_json_delta"constant`

  - `class BetaCitationsDelta:`

    - `required Citation Citation`

      - `class BetaCitationCharLocation:`

        - `required string CitedText`

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndCharIndex`

        - `required string? FileID`

        - `required Long StartCharIndex`

        - `JsonElement Type "char_location"constant`

      - `class BetaCitationPageLocation:`

        - `required string CitedText`

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndPageNumber`

        - `required string? FileID`

        - `required Long StartPageNumber`

        - `JsonElement Type "page_location"constant`

      - `class BetaCitationContentBlockLocation:`

        - `required string CitedText`

          The full text of the cited block range, concatenated.

          Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndBlockIndex`

          Exclusive 0-based end index of the cited block range in the source's `content` array.

          Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

        - `required string? FileID`

        - `required Long StartBlockIndex`

          0-based index of the first cited block in the source's `content` array.

        - `JsonElement Type "content_block_location"constant`

      - `class BetaCitationsWebSearchResultLocation:`

        - `required string CitedText`

        - `required string EncryptedIndex`

        - `required string? Title`

        - `JsonElement Type "web_search_result_location"constant`

        - `required string Url`

      - `class BetaCitationSearchResultLocation:`

        - `required string CitedText`

          The full text of the cited block range, concatenated.

          Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

        - `required Long EndBlockIndex`

          Exclusive 0-based end index of the cited block range in the source's `content` array.

          Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

        - `required Long SearchResultIndex`

          0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

          Counted separately from `document_index`; server-side web search results are not included in this count.

        - `required string Source`

        - `required Long StartBlockIndex`

          0-based index of the first cited block in the source's `content` array.

        - `required string? Title`

        - `JsonElement Type "search_result_location"constant`

    - `JsonElement Type "citations_delta"constant`

  - `class BetaThinkingDelta:`

    - `required Long? EstimatedTokens`

      Per-frame increment of a coarse, running estimate of the tokens this thinking block has produced so far. Present whenever the `thinking-token-count-2026-05-13` beta is set; `null` unless `thinking.display` resolves to `"omitted"` and a count is due this frame. Sum the increments across `thinking_delta` frames on this block for a progress indicator. Each increment is a non-negative multiple of a fixed quantum and the cadence is rate-limited, so this is a deliberately lossy display hint, not a billable count; `usage.output_tokens` remains authoritative.

    - `required string Thinking`

    - `JsonElement Type "thinking_delta"constant`

  - `class BetaSignatureDelta:`

    - `required string Signature`

    - `JsonElement Type "signature_delta"constant`

  - `class BetaCompactionContentBlockDelta:`

    - `required string? Content`

    - `required string? EncryptedContent`

      Opaque metadata from prior compaction, to be round-tripped verbatim

    - `JsonElement Type "compaction_delta"constant`

### Beta Raw Content Block Delta Event

- `class BetaRawContentBlockDeltaEvent:`

  - `required BetaRawContentBlockDelta Delta`

    - `class BetaTextDelta:`

      - `required string Text`

      - `JsonElement Type "text_delta"constant`

    - `class BetaInputJsonDelta:`

      - `required string PartialJson`

      - `JsonElement Type "input_json_delta"constant`

    - `class BetaCitationsDelta:`

      - `required Citation Citation`

        - `class BetaCitationCharLocation:`

          - `required string CitedText`

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndCharIndex`

          - `required string? FileID`

          - `required Long StartCharIndex`

          - `JsonElement Type "char_location"constant`

        - `class BetaCitationPageLocation:`

          - `required string CitedText`

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndPageNumber`

          - `required string? FileID`

          - `required Long StartPageNumber`

          - `JsonElement Type "page_location"constant`

        - `class BetaCitationContentBlockLocation:`

          - `required string CitedText`

            The full text of the cited block range, concatenated.

            Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndBlockIndex`

            Exclusive 0-based end index of the cited block range in the source's `content` array.

            Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

          - `required string? FileID`

          - `required Long StartBlockIndex`

            0-based index of the first cited block in the source's `content` array.

          - `JsonElement Type "content_block_location"constant`

        - `class BetaCitationsWebSearchResultLocation:`

          - `required string CitedText`

          - `required string EncryptedIndex`

          - `required string? Title`

          - `JsonElement Type "web_search_result_location"constant`

          - `required string Url`

        - `class BetaCitationSearchResultLocation:`

          - `required string CitedText`

            The full text of the cited block range, concatenated.

            Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

          - `required Long EndBlockIndex`

            Exclusive 0-based end index of the cited block range in the source's `content` array.

            Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

          - `required Long SearchResultIndex`

            0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

            Counted separately from `document_index`; server-side web search results are not included in this count.

          - `required string Source`

          - `required Long StartBlockIndex`

            0-based index of the first cited block in the source's `content` array.

          - `required string? Title`

          - `JsonElement Type "search_result_location"constant`

      - `JsonElement Type "citations_delta"constant`

    - `class BetaThinkingDelta:`

      - `required Long? EstimatedTokens`

        Per-frame increment of a coarse, running estimate of the tokens this thinking block has produced so far. Present whenever the `thinking-token-count-2026-05-13` beta is set; `null` unless `thinking.display` resolves to `"omitted"` and a count is due this frame. Sum the increments across `thinking_delta` frames on this block for a progress indicator. Each increment is a non-negative multiple of a fixed quantum and the cadence is rate-limited, so this is a deliberately lossy display hint, not a billable count; `usage.output_tokens` remains authoritative.

      - `required string Thinking`

      - `JsonElement Type "thinking_delta"constant`

    - `class BetaSignatureDelta:`

      - `required string Signature`

      - `JsonElement Type "signature_delta"constant`

    - `class BetaCompactionContentBlockDelta:`

      - `required string? Content`

      - `required string? EncryptedContent`

        Opaque metadata from prior compaction, to be round-tripped verbatim

      - `JsonElement Type "compaction_delta"constant`

  - `required Long Index`

  - `JsonElement Type "content_block_delta"constant`

### Beta Raw Content Block Start Event

- `class BetaRawContentBlockStartEvent:`

  - `required ContentBlock ContentBlock`

    Response model for a file uploaded to the container.

    - `class BetaTextBlock:`

      - `required IReadOnlyList<BetaTextCitation>? Citations`

        Citations supporting the text block.

        The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

        - `class BetaCitationCharLocation:`

          - `required string CitedText`

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndCharIndex`

          - `required string? FileID`

          - `required Long StartCharIndex`

          - `JsonElement Type "char_location"constant`

        - `class BetaCitationPageLocation:`

          - `required string CitedText`

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndPageNumber`

          - `required string? FileID`

          - `required Long StartPageNumber`

          - `JsonElement Type "page_location"constant`

        - `class BetaCitationContentBlockLocation:`

          - `required string CitedText`

            The full text of the cited block range, concatenated.

            Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndBlockIndex`

            Exclusive 0-based end index of the cited block range in the source's `content` array.

            Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

          - `required string? FileID`

          - `required Long StartBlockIndex`

            0-based index of the first cited block in the source's `content` array.

          - `JsonElement Type "content_block_location"constant`

        - `class BetaCitationsWebSearchResultLocation:`

          - `required string CitedText`

          - `required string EncryptedIndex`

          - `required string? Title`

          - `JsonElement Type "web_search_result_location"constant`

          - `required string Url`

        - `class BetaCitationSearchResultLocation:`

          - `required string CitedText`

            The full text of the cited block range, concatenated.

            Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

          - `required Long EndBlockIndex`

            Exclusive 0-based end index of the cited block range in the source's `content` array.

            Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

          - `required Long SearchResultIndex`

            0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

            Counted separately from `document_index`; server-side web search results are not included in this count.

          - `required string Source`

          - `required Long StartBlockIndex`

            0-based index of the first cited block in the source's `content` array.

          - `required string? Title`

          - `JsonElement Type "search_result_location"constant`

      - `required string Text`

      - `JsonElement Type "text"constant`

    - `class BetaThinkingBlock:`

      - `required string Signature`

      - `required string Thinking`

      - `JsonElement Type "thinking"constant`

    - `class BetaRedactedThinkingBlock:`

      - `required string Data`

      - `JsonElement Type "redacted_thinking"constant`

    - `class BetaToolUseBlock:`

      - `required string ID`

      - `required IReadOnlyDictionary<string, JsonElement> Input`

      - `required string Name`

      - `JsonElement Type "tool_use"constant`

      - `Caller Caller`

        Tool invocation directly from the model.

        - `class BetaDirectCaller:`

          Tool invocation directly from the model.

          - `JsonElement Type "direct"constant`

        - `class BetaServerToolCaller:`

          Tool invocation generated by a server-side tool.

          - `required string ToolID`

          - `JsonElement Type "code_execution_20250825"constant`

        - `class BetaServerToolCaller20260120:`

          - `required string ToolID`

          - `JsonElement Type "code_execution_20260120"constant`

    - `class BetaServerToolUseBlock:`

      - `required string ID`

      - `required IReadOnlyDictionary<string, JsonElement> Input`

      - `required Name Name`

        - `"advisor"Advisor`

        - `"web_search"WebSearch`

        - `"web_fetch"WebFetch`

        - `"code_execution"CodeExecution`

        - `"bash_code_execution"BashCodeExecution`

        - `"text_editor_code_execution"TextEditorCodeExecution`

        - `"tool_search_tool_regex"ToolSearchToolRegex`

        - `"tool_search_tool_bm25"ToolSearchToolBm25`

      - `JsonElement Type "server_tool_use"constant`

      - `Caller Caller`

        Tool invocation directly from the model.

        - `class BetaDirectCaller:`

          Tool invocation directly from the model.

        - `class BetaServerToolCaller:`

          Tool invocation generated by a server-side tool.

        - `class BetaServerToolCaller20260120:`

    - `class BetaWebSearchToolResultBlock:`

      - `required BetaWebSearchToolResultBlockContent Content`

        - `class BetaWebSearchToolResultError:`

          - `required BetaWebSearchToolResultErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"max_uses_exceeded"MaxUsesExceeded`

            - `"too_many_requests"TooManyRequests`

            - `"query_too_long"QueryTooLong`

            - `"request_too_large"RequestTooLarge`

          - `JsonElement Type "web_search_tool_result_error"constant`

        - `IReadOnlyList<BetaWebSearchResultBlock>`

          - `required string EncryptedContent`

          - `required string? PageAge`

          - `required string Title`

          - `JsonElement Type "web_search_result"constant`

          - `required string Url`

      - `required string ToolUseID`

      - `JsonElement Type "web_search_tool_result"constant`

      - `Caller Caller`

        Tool invocation directly from the model.

        - `class BetaDirectCaller:`

          Tool invocation directly from the model.

        - `class BetaServerToolCaller:`

          Tool invocation generated by a server-side tool.

        - `class BetaServerToolCaller20260120:`

    - `class BetaWebFetchToolResultBlock:`

      - `required Content Content`

        - `class BetaWebFetchToolResultErrorBlock:`

          - `required BetaWebFetchToolResultErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"url_too_long"UrlTooLong`

            - `"url_not_allowed"UrlNotAllowed`

            - `"url_not_in_prior_context"UrlNotInPriorContext`

            - `"url_not_accessible"UrlNotAccessible`

            - `"unsupported_content_type"UnsupportedContentType`

            - `"too_many_requests"TooManyRequests`

            - `"max_uses_exceeded"MaxUsesExceeded`

            - `"unavailable"Unavailable`

          - `JsonElement Type "web_fetch_tool_result_error"constant`

        - `class BetaWebFetchBlock:`

          - `required BetaDocumentBlock Content`

            - `required BetaCitationConfig? Citations`

              Citation configuration for the document

              - `required Boolean Enabled`

            - `required Source Source`

              - `class BetaBase64PdfSource:`

                - `required string Data`

                - `JsonElement MediaType "application/pdf"constant`

                - `JsonElement Type "base64"constant`

              - `class BetaPlainTextSource:`

                - `required string Data`

                - `JsonElement MediaType "text/plain"constant`

                - `JsonElement Type "text"constant`

            - `required string? Title`

              The title of the document

            - `JsonElement Type "document"constant`

          - `required string? RetrievedAt`

            ISO 8601 timestamp when the content was retrieved

          - `JsonElement Type "web_fetch_result"constant`

          - `required string Url`

            Fetched content URL

      - `required string ToolUseID`

      - `JsonElement Type "web_fetch_tool_result"constant`

      - `Caller Caller`

        Tool invocation directly from the model.

        - `class BetaDirectCaller:`

          Tool invocation directly from the model.

        - `class BetaServerToolCaller:`

          Tool invocation generated by a server-side tool.

        - `class BetaServerToolCaller20260120:`

    - `class BetaAdvisorToolResultBlock:`

      - `required Content Content`

        - `class BetaAdvisorToolResultError:`

          - `required ErrorCode ErrorCode`

            - `"max_uses_exceeded"MaxUsesExceeded`

            - `"prompt_too_long"PromptTooLong`

            - `"too_many_requests"TooManyRequests`

            - `"overloaded"Overloaded`

            - `"unavailable"Unavailable`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

          - `JsonElement Type "advisor_tool_result_error"constant`

        - `class BetaAdvisorResultBlock:`

          - `required string? StopReason`

            The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the tool's `max_tokens` value or the advisor model's policy cap.

          - `required string Text`

          - `JsonElement Type "advisor_result"constant`

        - `class BetaAdvisorRedactedResultBlock:`

          - `required string EncryptedContent`

            Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.

          - `required string? StopReason`

            The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`).

          - `JsonElement Type "advisor_redacted_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "advisor_tool_result"constant`

    - `class BetaCodeExecutionToolResultBlock:`

      - `required BetaCodeExecutionToolResultBlockContent Content`

        Code execution result with encrypted stdout for PFC + web_search results.

        - `class BetaCodeExecutionToolResultError:`

          - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"too_many_requests"TooManyRequests`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

          - `JsonElement Type "code_execution_tool_result_error"constant`

        - `class BetaCodeExecutionResultBlock:`

          - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

            - `required string FileID`

            - `JsonElement Type "code_execution_output"constant`

          - `required Long ReturnCode`

          - `required string Stderr`

          - `required string Stdout`

          - `JsonElement Type "code_execution_result"constant`

        - `class BetaEncryptedCodeExecutionResultBlock:`

          Code execution result with encrypted stdout for PFC + web_search results.

          - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

            - `required string FileID`

            - `JsonElement Type "code_execution_output"constant`

          - `required string EncryptedStdout`

          - `required Long ReturnCode`

          - `required string Stderr`

          - `JsonElement Type "encrypted_code_execution_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "code_execution_tool_result"constant`

    - `class BetaBashCodeExecutionToolResultBlock:`

      - `required Content Content`

        - `class BetaBashCodeExecutionToolResultError:`

          - `required ErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"too_many_requests"TooManyRequests`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `"output_file_too_large"OutputFileTooLarge`

          - `JsonElement Type "bash_code_execution_tool_result_error"constant`

        - `class BetaBashCodeExecutionResultBlock:`

          - `required IReadOnlyList<BetaBashCodeExecutionOutputBlock> Content`

            - `required string FileID`

            - `JsonElement Type "bash_code_execution_output"constant`

          - `required Long ReturnCode`

          - `required string Stderr`

          - `required string Stdout`

          - `JsonElement Type "bash_code_execution_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "bash_code_execution_tool_result"constant`

    - `class BetaTextEditorCodeExecutionToolResultBlock:`

      - `required Content Content`

        - `class BetaTextEditorCodeExecutionToolResultError:`

          - `required ErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"too_many_requests"TooManyRequests`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `"file_not_found"FileNotFound`

          - `required string? ErrorMessage`

          - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

        - `class BetaTextEditorCodeExecutionViewResultBlock:`

          - `required string Content`

          - `required FileType FileType`

            - `"text"Text`

            - `"image"Image`

            - `"pdf"Pdf`

          - `required Long? NumLines`

          - `required Long? StartLine`

          - `required Long? TotalLines`

          - `JsonElement Type "text_editor_code_execution_view_result"constant`

        - `class BetaTextEditorCodeExecutionCreateResultBlock:`

          - `required Boolean IsFileUpdate`

          - `JsonElement Type "text_editor_code_execution_create_result"constant`

        - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:`

          - `required IReadOnlyList<string>? Lines`

          - `required Long? NewLines`

          - `required Long? NewStart`

          - `required Long? OldLines`

          - `required Long? OldStart`

          - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "text_editor_code_execution_tool_result"constant`

    - `class BetaToolSearchToolResultBlock:`

      - `required Content Content`

        - `class BetaToolSearchToolResultError:`

          - `required ErrorCode ErrorCode`

            - `"invalid_tool_input"InvalidToolInput`

            - `"unavailable"Unavailable`

            - `"too_many_requests"TooManyRequests`

            - `"execution_time_exceeded"ExecutionTimeExceeded`

          - `required string? ErrorMessage`

          - `JsonElement Type "tool_search_tool_result_error"constant`

        - `class BetaToolSearchToolSearchResultBlock:`

          - `required IReadOnlyList<BetaToolReferenceBlock> ToolReferences`

            - `required string ToolName`

            - `JsonElement Type "tool_reference"constant`

          - `JsonElement Type "tool_search_tool_search_result"constant`

      - `required string ToolUseID`

      - `JsonElement Type "tool_search_tool_result"constant`

    - `class BetaMcpToolUseBlock:`

      - `required string ID`

      - `required IReadOnlyDictionary<string, JsonElement> Input`

      - `required string Name`

        The name of the MCP tool

      - `required string ServerName`

        The name of the MCP server

      - `JsonElement Type "mcp_tool_use"constant`

    - `class BetaMcpToolResultBlock:`

      - `required Content Content`

        - `string`

        - `IReadOnlyList<BetaTextBlock>`

          - `required IReadOnlyList<BetaTextCitation>? Citations`

            Citations supporting the text block.

            The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

          - `required string Text`

          - `JsonElement Type "text"constant`

      - `required Boolean IsError`

      - `required string ToolUseID`

      - `JsonElement Type "mcp_tool_result"constant`

    - `class BetaContainerUploadBlock:`

      Response model for a file uploaded to the container.

      - `required string FileID`

      - `JsonElement Type "container_upload"constant`

    - `class BetaCompactionBlock:`

      A compaction block returned when autocompact is triggered.

      When content is None, it indicates the compaction failed to produce a valid
      summary (e.g., malformed output from the model). Clients may round-trip
      compaction blocks with null content; the server treats them as no-ops.

      - `required string? Content`

        Summary of compacted content, or null if compaction failed

      - `required string? EncryptedContent`

        Opaque metadata from prior compaction, to be round-tripped verbatim

      - `JsonElement Type "compaction"constant`

  - `required Long Index`

  - `JsonElement Type "content_block_start"constant`

### Beta Raw Content Block Stop Event

- `class BetaRawContentBlockStopEvent:`

  - `required Long Index`

  - `JsonElement Type "content_block_stop"constant`

### Beta Raw Message Delta Event

- `class BetaRawMessageDeltaEvent:`

  - `required BetaContextManagementResponse? ContextManagement`

    Information about context management strategies applied during the request

    - `required IReadOnlyList<AppliedEdit> AppliedEdits`

      List of context management edits that were applied.

      - `class BetaClearToolUses20250919EditResponse:`

        - `required Long ClearedInputTokens`

          Number of input tokens cleared by this edit.

        - `required Long ClearedToolUses`

          Number of tool uses that were cleared.

        - `JsonElement Type "clear_tool_uses_20250919"constant`

          The type of context management edit applied.

      - `class BetaClearThinking20251015EditResponse:`

        - `required Long ClearedInputTokens`

          Number of input tokens cleared by this edit.

        - `required Long ClearedThinkingTurns`

          Number of thinking turns that were cleared.

        - `JsonElement Type "clear_thinking_20251015"constant`

          The type of context management edit applied.

  - `required Delta Delta`

    - `required BetaContainer? Container`

      Information about the container used in the request (for the code execution tool)

      - `required string ID`

        Identifier for the container used in this request

      - `required DateTimeOffset ExpiresAt`

        The time at which the container will expire.

      - `required IReadOnlyList<BetaSkill>? Skills`

        Skills loaded in the container

        - `required string SkillID`

          Skill ID

        - `required Type Type`

          Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

          - `"anthropic"Anthropic`

          - `"custom"Custom`

        - `required string Version`

          Skill version or 'latest' for most recent version

    - `required BetaRefusalStopDetails? StopDetails`

      Structured information about a refusal.

      - `required Category? Category`

        The policy category that triggered the refusal.

        `null` when the refusal doesn't map to a named category.

        - `"cyber"Cyber`

        - `"bio"Bio`

      - `required string? Explanation`

        Human-readable explanation of the refusal.

        This text is not guaranteed to be stable. `null` when no explanation is available for the category.

      - `JsonElement Type "refusal"constant`

    - `required BetaStopReason? StopReason`

      - `"end_turn"EndTurn`

      - `"max_tokens"MaxTokens`

      - `"stop_sequence"StopSequence`

      - `"tool_use"ToolUse`

      - `"pause_turn"PauseTurn`

      - `"compaction"Compaction`

      - `"refusal"Refusal`

      - `"model_context_window_exceeded"ModelContextWindowExceeded`

    - `required string? StopSequence`

  - `JsonElement Type "message_delta"constant`

  - `required BetaMessageDeltaUsage Usage`

    Billing and rate-limit usage.

    Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

    Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.

    For example, `output_tokens` will be non-zero, even for an empty string response from Claude.

    Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.

    - `required Long? CacheCreationInputTokens`

      The cumulative number of input tokens used to create the cache entry.

    - `required Long? CacheReadInputTokens`

      The cumulative number of input tokens read from the cache.

    - `required Long? InputTokens`

      The cumulative number of input tokens which were used.

    - `required IReadOnlyList<BetaIterationsUsageItems>? Iterations`

      Per-iteration token usage breakdown.

      Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:

      - Determine which iterations exceeded long context thresholds (>=200k tokens)
      - Calculate the true context window size from the last iteration
      - Understand token accumulation across server-side tool use loops

      - `class BetaMessageIterationUsage:`

        Token usage for a sampling iteration.

        - `required BetaCacheCreation? CacheCreation`

          Breakdown of cached tokens by TTL

          - `required Long Ephemeral1hInputTokens`

            The number of input tokens used to create the 1 hour cache entry.

          - `required Long Ephemeral5mInputTokens`

            The number of input tokens used to create the 5 minute cache entry.

        - `required Long CacheCreationInputTokens`

          The number of input tokens used to create the cache entry.

        - `required Long CacheReadInputTokens`

          The number of input tokens read from the cache.

        - `required Long InputTokens`

          The number of input tokens which were used.

        - `required Long OutputTokens`

          The number of output tokens which were used.

        - `JsonElement Type "message"constant`

          Usage for a sampling iteration

      - `class BetaCompactionIterationUsage:`

        Token usage for a compaction iteration.

        - `required BetaCacheCreation? CacheCreation`

          Breakdown of cached tokens by TTL

        - `required Long CacheCreationInputTokens`

          The number of input tokens used to create the cache entry.

        - `required Long CacheReadInputTokens`

          The number of input tokens read from the cache.

        - `required Long InputTokens`

          The number of input tokens which were used.

        - `required Long OutputTokens`

          The number of output tokens which were used.

        - `JsonElement Type "compaction"constant`

          Usage for a compaction iteration

      - `class BetaAdvisorMessageIterationUsage:`

        Token usage for an advisor sub-inference iteration.

        - `required BetaCacheCreation? CacheCreation`

          Breakdown of cached tokens by TTL

        - `required Long CacheCreationInputTokens`

          The number of input tokens used to create the cache entry.

        - `required Long CacheReadInputTokens`

          The number of input tokens read from the cache.

        - `required Long InputTokens`

          The number of input tokens which were used.

        - `required Model Model`

          The model that will complete your prompt.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `"claude-opus-4-8"ClaudeOpus4_8`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-7"ClaudeOpus4_7`

            Frontier intelligence for long-running agents and coding

          - `"claude-mythos-preview"ClaudeMythosPreview`

            New class of intelligence, strongest in coding and cybersecurity

          - `"claude-opus-4-6"ClaudeOpus4_6`

            Frontier intelligence for long-running agents and coding

          - `"claude-sonnet-4-6"ClaudeSonnet4_6`

            Best combination of speed and intelligence

          - `"claude-haiku-4-5"ClaudeHaiku4_5`

            Fastest model with near-frontier intelligence

          - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

            Fastest model with near-frontier intelligence

          - `"claude-opus-4-5"ClaudeOpus4_5`

            Premium model combining maximum intelligence with practical performance

          - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

            Premium model combining maximum intelligence with practical performance

          - `"claude-sonnet-4-5"ClaudeSonnet4_5`

            High-performance model for agents and coding

          - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

            High-performance model for agents and coding

          - `"claude-opus-4-1"ClaudeOpus4_1`

            Exceptional model for specialized complex tasks

          - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

            Exceptional model for specialized complex tasks

          - `"claude-opus-4-0"ClaudeOpus4_0`

            Powerful model for complex tasks

          - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

            Powerful model for complex tasks

          - `"claude-sonnet-4-0"ClaudeSonnet4_0`

            High-performance model with extended thinking

          - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

            High-performance model with extended thinking

          - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

            Fast and cost-effective model

        - `required Long OutputTokens`

          The number of output tokens which were used.

        - `JsonElement Type "advisor_message"constant`

          Usage for an advisor sub-inference iteration

    - `required Long OutputTokens`

      The cumulative number of output tokens which were used.

    - `required BetaOutputTokensDetails? OutputTokensDetails`

      Breakdown of output tokens by category.

      `output_tokens` remains the inclusive, authoritative total used for billing.
      This object provides a read-only decomposition for observability — for example,
      how many of the billed output tokens were spent on internal reasoning that may
      have been summarized before being returned to you.

      - `required Long ThinkingTokens`

        Number of output tokens the model generated as internal reasoning, including
        the thinking-block delimiter tokens.

        Reflects the raw reasoning the model produced, not the (possibly shorter)
        summarized thinking text returned in the response body. Computed by
        re-tokenizing the raw reasoning text, so it may differ from the model's exact
        generation count by a small number of tokens. Always ≤ `output_tokens`;
        `output_tokens - thinking_tokens` approximates the non-reasoning output.

    - `required BetaServerToolUsage? ServerToolUse`

      The number of server tool requests.

      - `required Long WebFetchRequests`

        The number of web fetch tool requests.

      - `required Long WebSearchRequests`

        The number of web search tool requests.

### Beta Raw Message Start Event

- `class BetaRawMessageStartEvent:`

  - `required BetaMessage Message`

    - `required string ID`

      Unique object identifier.

      The format and length of IDs may change over time.

    - `required BetaContainer? Container`

      Information about the container used in the request (for the code execution tool)

      - `required string ID`

        Identifier for the container used in this request

      - `required DateTimeOffset ExpiresAt`

        The time at which the container will expire.

      - `required IReadOnlyList<BetaSkill>? Skills`

        Skills loaded in the container

        - `required string SkillID`

          Skill ID

        - `required Type Type`

          Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

          - `"anthropic"Anthropic`

          - `"custom"Custom`

        - `required string Version`

          Skill version or 'latest' for most recent version

    - `required IReadOnlyList<BetaContentBlock> Content`

      Content generated by the model.

      This is an array of content blocks, each of which has a `type` that determines its shape.

      Example:

      ```json
      [{"type": "text", "text": "Hi, I'm Claude."}]
      ```

      If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.

      For example, if the input `messages` were:

      ```json
      [
        {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
        {"role": "assistant", "content": "The best answer is ("}
      ]
      ```

      Then the response `content` might be:

      ```json
      [{"type": "text", "text": "B)"}]
      ```

      - `class BetaTextBlock:`

        - `required IReadOnlyList<BetaTextCitation>? Citations`

          Citations supporting the text block.

          The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

          - `class BetaCitationCharLocation:`

            - `required string CitedText`

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndCharIndex`

            - `required string? FileID`

            - `required Long StartCharIndex`

            - `JsonElement Type "char_location"constant`

          - `class BetaCitationPageLocation:`

            - `required string CitedText`

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndPageNumber`

            - `required string? FileID`

            - `required Long StartPageNumber`

            - `JsonElement Type "page_location"constant`

          - `class BetaCitationContentBlockLocation:`

            - `required string CitedText`

              The full text of the cited block range, concatenated.

              Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndBlockIndex`

              Exclusive 0-based end index of the cited block range in the source's `content` array.

              Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

            - `required string? FileID`

            - `required Long StartBlockIndex`

              0-based index of the first cited block in the source's `content` array.

            - `JsonElement Type "content_block_location"constant`

          - `class BetaCitationsWebSearchResultLocation:`

            - `required string CitedText`

            - `required string EncryptedIndex`

            - `required string? Title`

            - `JsonElement Type "web_search_result_location"constant`

            - `required string Url`

          - `class BetaCitationSearchResultLocation:`

            - `required string CitedText`

              The full text of the cited block range, concatenated.

              Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

            - `required Long EndBlockIndex`

              Exclusive 0-based end index of the cited block range in the source's `content` array.

              Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

            - `required Long SearchResultIndex`

              0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

              Counted separately from `document_index`; server-side web search results are not included in this count.

            - `required string Source`

            - `required Long StartBlockIndex`

              0-based index of the first cited block in the source's `content` array.

            - `required string? Title`

            - `JsonElement Type "search_result_location"constant`

        - `required string Text`

        - `JsonElement Type "text"constant`

      - `class BetaThinkingBlock:`

        - `required string Signature`

        - `required string Thinking`

        - `JsonElement Type "thinking"constant`

      - `class BetaRedactedThinkingBlock:`

        - `required string Data`

        - `JsonElement Type "redacted_thinking"constant`

      - `class BetaToolUseBlock:`

        - `required string ID`

        - `required IReadOnlyDictionary<string, JsonElement> Input`

        - `required string Name`

        - `JsonElement Type "tool_use"constant`

        - `Caller Caller`

          Tool invocation directly from the model.

          - `class BetaDirectCaller:`

            Tool invocation directly from the model.

            - `JsonElement Type "direct"constant`

          - `class BetaServerToolCaller:`

            Tool invocation generated by a server-side tool.

            - `required string ToolID`

            - `JsonElement Type "code_execution_20250825"constant`

          - `class BetaServerToolCaller20260120:`

            - `required string ToolID`

            - `JsonElement Type "code_execution_20260120"constant`

      - `class BetaServerToolUseBlock:`

        - `required string ID`

        - `required IReadOnlyDictionary<string, JsonElement> Input`

        - `required Name Name`

          - `"advisor"Advisor`

          - `"web_search"WebSearch`

          - `"web_fetch"WebFetch`

          - `"code_execution"CodeExecution`

          - `"bash_code_execution"BashCodeExecution`

          - `"text_editor_code_execution"TextEditorCodeExecution`

          - `"tool_search_tool_regex"ToolSearchToolRegex`

          - `"tool_search_tool_bm25"ToolSearchToolBm25`

        - `JsonElement Type "server_tool_use"constant`

        - `Caller Caller`

          Tool invocation directly from the model.

          - `class BetaDirectCaller:`

            Tool invocation directly from the model.

          - `class BetaServerToolCaller:`

            Tool invocation generated by a server-side tool.

          - `class BetaServerToolCaller20260120:`

      - `class BetaWebSearchToolResultBlock:`

        - `required BetaWebSearchToolResultBlockContent Content`

          - `class BetaWebSearchToolResultError:`

            - `required BetaWebSearchToolResultErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"max_uses_exceeded"MaxUsesExceeded`

              - `"too_many_requests"TooManyRequests`

              - `"query_too_long"QueryTooLong`

              - `"request_too_large"RequestTooLarge`

            - `JsonElement Type "web_search_tool_result_error"constant`

          - `IReadOnlyList<BetaWebSearchResultBlock>`

            - `required string EncryptedContent`

            - `required string? PageAge`

            - `required string Title`

            - `JsonElement Type "web_search_result"constant`

            - `required string Url`

        - `required string ToolUseID`

        - `JsonElement Type "web_search_tool_result"constant`

        - `Caller Caller`

          Tool invocation directly from the model.

          - `class BetaDirectCaller:`

            Tool invocation directly from the model.

          - `class BetaServerToolCaller:`

            Tool invocation generated by a server-side tool.

          - `class BetaServerToolCaller20260120:`

      - `class BetaWebFetchToolResultBlock:`

        - `required Content Content`

          - `class BetaWebFetchToolResultErrorBlock:`

            - `required BetaWebFetchToolResultErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"url_too_long"UrlTooLong`

              - `"url_not_allowed"UrlNotAllowed`

              - `"url_not_in_prior_context"UrlNotInPriorContext`

              - `"url_not_accessible"UrlNotAccessible`

              - `"unsupported_content_type"UnsupportedContentType`

              - `"too_many_requests"TooManyRequests`

              - `"max_uses_exceeded"MaxUsesExceeded`

              - `"unavailable"Unavailable`

            - `JsonElement Type "web_fetch_tool_result_error"constant`

          - `class BetaWebFetchBlock:`

            - `required BetaDocumentBlock Content`

              - `required BetaCitationConfig? Citations`

                Citation configuration for the document

                - `required Boolean Enabled`

              - `required Source Source`

                - `class BetaBase64PdfSource:`

                  - `required string Data`

                  - `JsonElement MediaType "application/pdf"constant`

                  - `JsonElement Type "base64"constant`

                - `class BetaPlainTextSource:`

                  - `required string Data`

                  - `JsonElement MediaType "text/plain"constant`

                  - `JsonElement Type "text"constant`

              - `required string? Title`

                The title of the document

              - `JsonElement Type "document"constant`

            - `required string? RetrievedAt`

              ISO 8601 timestamp when the content was retrieved

            - `JsonElement Type "web_fetch_result"constant`

            - `required string Url`

              Fetched content URL

        - `required string ToolUseID`

        - `JsonElement Type "web_fetch_tool_result"constant`

        - `Caller Caller`

          Tool invocation directly from the model.

          - `class BetaDirectCaller:`

            Tool invocation directly from the model.

          - `class BetaServerToolCaller:`

            Tool invocation generated by a server-side tool.

          - `class BetaServerToolCaller20260120:`

      - `class BetaAdvisorToolResultBlock:`

        - `required Content Content`

          - `class BetaAdvisorToolResultError:`

            - `required ErrorCode ErrorCode`

              - `"max_uses_exceeded"MaxUsesExceeded`

              - `"prompt_too_long"PromptTooLong`

              - `"too_many_requests"TooManyRequests`

              - `"overloaded"Overloaded`

              - `"unavailable"Unavailable`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `JsonElement Type "advisor_tool_result_error"constant`

          - `class BetaAdvisorResultBlock:`

            - `required string? StopReason`

              The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the tool's `max_tokens` value or the advisor model's policy cap.

            - `required string Text`

            - `JsonElement Type "advisor_result"constant`

          - `class BetaAdvisorRedactedResultBlock:`

            - `required string EncryptedContent`

              Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.

            - `required string? StopReason`

              The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`).

            - `JsonElement Type "advisor_redacted_result"constant`

        - `required string ToolUseID`

        - `JsonElement Type "advisor_tool_result"constant`

      - `class BetaCodeExecutionToolResultBlock:`

        - `required BetaCodeExecutionToolResultBlockContent Content`

          Code execution result with encrypted stdout for PFC + web_search results.

          - `class BetaCodeExecutionToolResultError:`

            - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"too_many_requests"TooManyRequests`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `JsonElement Type "code_execution_tool_result_error"constant`

          - `class BetaCodeExecutionResultBlock:`

            - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

              - `required string FileID`

              - `JsonElement Type "code_execution_output"constant`

            - `required Long ReturnCode`

            - `required string Stderr`

            - `required string Stdout`

            - `JsonElement Type "code_execution_result"constant`

          - `class BetaEncryptedCodeExecutionResultBlock:`

            Code execution result with encrypted stdout for PFC + web_search results.

            - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

              - `required string FileID`

              - `JsonElement Type "code_execution_output"constant`

            - `required string EncryptedStdout`

            - `required Long ReturnCode`

            - `required string Stderr`

            - `JsonElement Type "encrypted_code_execution_result"constant`

        - `required string ToolUseID`

        - `JsonElement Type "code_execution_tool_result"constant`

      - `class BetaBashCodeExecutionToolResultBlock:`

        - `required Content Content`

          - `class BetaBashCodeExecutionToolResultError:`

            - `required ErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"too_many_requests"TooManyRequests`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `"output_file_too_large"OutputFileTooLarge`

            - `JsonElement Type "bash_code_execution_tool_result_error"constant`

          - `class BetaBashCodeExecutionResultBlock:`

            - `required IReadOnlyList<BetaBashCodeExecutionOutputBlock> Content`

              - `required string FileID`

              - `JsonElement Type "bash_code_execution_output"constant`

            - `required Long ReturnCode`

            - `required string Stderr`

            - `required string Stdout`

            - `JsonElement Type "bash_code_execution_result"constant`

        - `required string ToolUseID`

        - `JsonElement Type "bash_code_execution_tool_result"constant`

      - `class BetaTextEditorCodeExecutionToolResultBlock:`

        - `required Content Content`

          - `class BetaTextEditorCodeExecutionToolResultError:`

            - `required ErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"too_many_requests"TooManyRequests`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `"file_not_found"FileNotFound`

            - `required string? ErrorMessage`

            - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

          - `class BetaTextEditorCodeExecutionViewResultBlock:`

            - `required string Content`

            - `required FileType FileType`

              - `"text"Text`

              - `"image"Image`

              - `"pdf"Pdf`

            - `required Long? NumLines`

            - `required Long? StartLine`

            - `required Long? TotalLines`

            - `JsonElement Type "text_editor_code_execution_view_result"constant`

          - `class BetaTextEditorCodeExecutionCreateResultBlock:`

            - `required Boolean IsFileUpdate`

            - `JsonElement Type "text_editor_code_execution_create_result"constant`

          - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:`

            - `required IReadOnlyList<string>? Lines`

            - `required Long? NewLines`

            - `required Long? NewStart`

            - `required Long? OldLines`

            - `required Long? OldStart`

            - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

        - `required string ToolUseID`

        - `JsonElement Type "text_editor_code_execution_tool_result"constant`

      - `class BetaToolSearchToolResultBlock:`

        - `required Content Content`

          - `class BetaToolSearchToolResultError:`

            - `required ErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"too_many_requests"TooManyRequests`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `required string? ErrorMessage`

            - `JsonElement Type "tool_search_tool_result_error"constant`

          - `class BetaToolSearchToolSearchResultBlock:`

            - `required IReadOnlyList<BetaToolReferenceBlock> ToolReferences`

              - `required string ToolName`

              - `JsonElement Type "tool_reference"constant`

            - `JsonElement Type "tool_search_tool_search_result"constant`

        - `required string ToolUseID`

        - `JsonElement Type "tool_search_tool_result"constant`

      - `class BetaMcpToolUseBlock:`

        - `required string ID`

        - `required IReadOnlyDictionary<string, JsonElement> Input`

        - `required string Name`

          The name of the MCP tool

        - `required string ServerName`

          The name of the MCP server

        - `JsonElement Type "mcp_tool_use"constant`

      - `class BetaMcpToolResultBlock:`

        - `required Content Content`

          - `string`

          - `IReadOnlyList<BetaTextBlock>`

            - `required IReadOnlyList<BetaTextCitation>? Citations`

              Citations supporting the text block.

              The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

            - `required string Text`

            - `JsonElement Type "text"constant`

        - `required Boolean IsError`

        - `required string ToolUseID`

        - `JsonElement Type "mcp_tool_result"constant`

      - `class BetaContainerUploadBlock:`

        Response model for a file uploaded to the container.

        - `required string FileID`

        - `JsonElement Type "container_upload"constant`

      - `class BetaCompactionBlock:`

        A compaction block returned when autocompact is triggered.

        When content is None, it indicates the compaction failed to produce a valid
        summary (e.g., malformed output from the model). Clients may round-trip
        compaction blocks with null content; the server treats them as no-ops.

        - `required string? Content`

          Summary of compacted content, or null if compaction failed

        - `required string? EncryptedContent`

          Opaque metadata from prior compaction, to be round-tripped verbatim

        - `JsonElement Type "compaction"constant`

    - `required BetaContextManagementResponse? ContextManagement`

      Context management response.

      Information about context management strategies applied during the request.

      - `required IReadOnlyList<AppliedEdit> AppliedEdits`

        List of context management edits that were applied.

        - `class BetaClearToolUses20250919EditResponse:`

          - `required Long ClearedInputTokens`

            Number of input tokens cleared by this edit.

          - `required Long ClearedToolUses`

            Number of tool uses that were cleared.

          - `JsonElement Type "clear_tool_uses_20250919"constant`

            The type of context management edit applied.

        - `class BetaClearThinking20251015EditResponse:`

          - `required Long ClearedInputTokens`

            Number of input tokens cleared by this edit.

          - `required Long ClearedThinkingTurns`

            Number of thinking turns that were cleared.

          - `JsonElement Type "clear_thinking_20251015"constant`

            The type of context management edit applied.

    - `required BetaDiagnostics? Diagnostics`

      Response envelope for request-level diagnostics. Present (possibly
      null) whenever the caller supplied `diagnostics` on the request.

      - `required CacheMissReason? CacheMissReason`

        Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.

        - `class BetaCacheMissModelChanged:`

          - `required Long CacheMissedInputTokens`

            Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

          - `JsonElement Type "model_changed"constant`

        - `class BetaCacheMissSystemChanged:`

          - `required Long CacheMissedInputTokens`

            Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

          - `JsonElement Type "system_changed"constant`

        - `class BetaCacheMissToolsChanged:`

          - `required Long CacheMissedInputTokens`

            Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

          - `JsonElement Type "tools_changed"constant`

        - `class BetaCacheMissMessagesChanged:`

          - `required Long CacheMissedInputTokens`

            Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

          - `JsonElement Type "messages_changed"constant`

        - `class BetaCacheMissPreviousMessageNotFound:`

          - `JsonElement Type "previous_message_not_found"constant`

        - `class BetaCacheMissUnavailable:`

          - `JsonElement Type "unavailable"constant`

    - `required Model Model`

      The model that will complete your prompt.

      See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

      - `"claude-opus-4-8"ClaudeOpus4_8`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-7"ClaudeOpus4_7`

        Frontier intelligence for long-running agents and coding

      - `"claude-mythos-preview"ClaudeMythosPreview`

        New class of intelligence, strongest in coding and cybersecurity

      - `"claude-opus-4-6"ClaudeOpus4_6`

        Frontier intelligence for long-running agents and coding

      - `"claude-sonnet-4-6"ClaudeSonnet4_6`

        Best combination of speed and intelligence

      - `"claude-haiku-4-5"ClaudeHaiku4_5`

        Fastest model with near-frontier intelligence

      - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

        Fastest model with near-frontier intelligence

      - `"claude-opus-4-5"ClaudeOpus4_5`

        Premium model combining maximum intelligence with practical performance

      - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

        Premium model combining maximum intelligence with practical performance

      - `"claude-sonnet-4-5"ClaudeSonnet4_5`

        High-performance model for agents and coding

      - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

        High-performance model for agents and coding

      - `"claude-opus-4-1"ClaudeOpus4_1`

        Exceptional model for specialized complex tasks

      - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

        Exceptional model for specialized complex tasks

      - `"claude-opus-4-0"ClaudeOpus4_0`

        Powerful model for complex tasks

      - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

        Powerful model for complex tasks

      - `"claude-sonnet-4-0"ClaudeSonnet4_0`

        High-performance model with extended thinking

      - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

        High-performance model with extended thinking

      - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

        Fast and cost-effective model

    - `JsonElement Role "assistant"constant`

      Conversational role of the generated message.

      This will always be `"assistant"`.

    - `required BetaRefusalStopDetails? StopDetails`

      Structured information about a refusal.

      - `required Category? Category`

        The policy category that triggered the refusal.

        `null` when the refusal doesn't map to a named category.

        - `"cyber"Cyber`

        - `"bio"Bio`

      - `required string? Explanation`

        Human-readable explanation of the refusal.

        This text is not guaranteed to be stable. `null` when no explanation is available for the category.

      - `JsonElement Type "refusal"constant`

    - `required BetaStopReason? StopReason`

      The reason that we stopped.

      This may be one the following values:

      * `"end_turn"`: the model reached a natural stopping point
      * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
      * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
      * `"tool_use"`: the model invoked one or more tools
      * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.
      * `"refusal"`: when streaming classifiers intervene to handle potential policy violations

      In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise.

      - `"end_turn"EndTurn`

      - `"max_tokens"MaxTokens`

      - `"stop_sequence"StopSequence`

      - `"tool_use"ToolUse`

      - `"pause_turn"PauseTurn`

      - `"compaction"Compaction`

      - `"refusal"Refusal`

      - `"model_context_window_exceeded"ModelContextWindowExceeded`

    - `required string? StopSequence`

      Which custom stop sequence was generated, if any.

      This value will be a non-null string if one of your custom stop sequences was generated.

    - `JsonElement Type "message"constant`

      Object type.

      For Messages, this is always `"message"`.

    - `required BetaUsage Usage`

      Billing and rate-limit usage.

      Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

      Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.

      For example, `output_tokens` will be non-zero, even for an empty string response from Claude.

      Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.

      - `required BetaCacheCreation? CacheCreation`

        Breakdown of cached tokens by TTL

        - `required Long Ephemeral1hInputTokens`

          The number of input tokens used to create the 1 hour cache entry.

        - `required Long Ephemeral5mInputTokens`

          The number of input tokens used to create the 5 minute cache entry.

      - `required Long? CacheCreationInputTokens`

        The number of input tokens used to create the cache entry.

      - `required Long? CacheReadInputTokens`

        The number of input tokens read from the cache.

      - `required string? InferenceGeo`

        The geographic region where inference was performed for this request.

      - `required Long InputTokens`

        The number of input tokens which were used.

      - `required IReadOnlyList<BetaIterationsUsageItems>? Iterations`

        Per-iteration token usage breakdown.

        Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:

        - Determine which iterations exceeded long context thresholds (>=200k tokens)
        - Calculate the true context window size from the last iteration
        - Understand token accumulation across server-side tool use loops

        - `class BetaMessageIterationUsage:`

          Token usage for a sampling iteration.

          - `required BetaCacheCreation? CacheCreation`

            Breakdown of cached tokens by TTL

          - `required Long CacheCreationInputTokens`

            The number of input tokens used to create the cache entry.

          - `required Long CacheReadInputTokens`

            The number of input tokens read from the cache.

          - `required Long InputTokens`

            The number of input tokens which were used.

          - `required Long OutputTokens`

            The number of output tokens which were used.

          - `JsonElement Type "message"constant`

            Usage for a sampling iteration

        - `class BetaCompactionIterationUsage:`

          Token usage for a compaction iteration.

          - `required BetaCacheCreation? CacheCreation`

            Breakdown of cached tokens by TTL

          - `required Long CacheCreationInputTokens`

            The number of input tokens used to create the cache entry.

          - `required Long CacheReadInputTokens`

            The number of input tokens read from the cache.

          - `required Long InputTokens`

            The number of input tokens which were used.

          - `required Long OutputTokens`

            The number of output tokens which were used.

          - `JsonElement Type "compaction"constant`

            Usage for a compaction iteration

        - `class BetaAdvisorMessageIterationUsage:`

          Token usage for an advisor sub-inference iteration.

          - `required BetaCacheCreation? CacheCreation`

            Breakdown of cached tokens by TTL

          - `required Long CacheCreationInputTokens`

            The number of input tokens used to create the cache entry.

          - `required Long CacheReadInputTokens`

            The number of input tokens read from the cache.

          - `required Long InputTokens`

            The number of input tokens which were used.

          - `required Model Model`

            The model that will complete your prompt.

            See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `required Long OutputTokens`

            The number of output tokens which were used.

          - `JsonElement Type "advisor_message"constant`

            Usage for an advisor sub-inference iteration

      - `required Long OutputTokens`

        The number of output tokens which were used.

      - `required BetaOutputTokensDetails? OutputTokensDetails`

        Breakdown of output tokens by category.

        `output_tokens` remains the inclusive, authoritative total used for billing.
        This object provides a read-only decomposition for observability — for example,
        how many of the billed output tokens were spent on internal reasoning that may
        have been summarized before being returned to you.

        - `required Long ThinkingTokens`

          Number of output tokens the model generated as internal reasoning, including
          the thinking-block delimiter tokens.

          Reflects the raw reasoning the model produced, not the (possibly shorter)
          summarized thinking text returned in the response body. Computed by
          re-tokenizing the raw reasoning text, so it may differ from the model's exact
          generation count by a small number of tokens. Always ≤ `output_tokens`;
          `output_tokens - thinking_tokens` approximates the non-reasoning output.

      - `required BetaServerToolUsage? ServerToolUse`

        The number of server tool requests.

        - `required Long WebFetchRequests`

          The number of web fetch tool requests.

        - `required Long WebSearchRequests`

          The number of web search tool requests.

      - `required ServiceTier? ServiceTier`

        If the request used the priority, standard, or batch tier.

        - `"standard"Standard`

        - `"priority"Priority`

        - `"batch"Batch`

      - `required Speed? Speed`

        The inference speed mode used for this request.

        - `"standard"Standard`

        - `"fast"Fast`

  - `JsonElement Type "message_start"constant`

### Beta Raw Message Stop Event

- `class BetaRawMessageStopEvent:`

  - `JsonElement Type "message_stop"constant`

### Beta Raw Message Stream Event

- `class BetaRawMessageStreamEvent: A class that can be one of several variants.union`

  - `class BetaRawMessageStartEvent:`

    - `required BetaMessage Message`

      - `required string ID`

        Unique object identifier.

        The format and length of IDs may change over time.

      - `required BetaContainer? Container`

        Information about the container used in the request (for the code execution tool)

        - `required string ID`

          Identifier for the container used in this request

        - `required DateTimeOffset ExpiresAt`

          The time at which the container will expire.

        - `required IReadOnlyList<BetaSkill>? Skills`

          Skills loaded in the container

          - `required string SkillID`

            Skill ID

          - `required Type Type`

            Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

            - `"anthropic"Anthropic`

            - `"custom"Custom`

          - `required string Version`

            Skill version or 'latest' for most recent version

      - `required IReadOnlyList<BetaContentBlock> Content`

        Content generated by the model.

        This is an array of content blocks, each of which has a `type` that determines its shape.

        Example:

        ```json
        [{"type": "text", "text": "Hi, I'm Claude."}]
        ```

        If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.

        For example, if the input `messages` were:

        ```json
        [
          {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
          {"role": "assistant", "content": "The best answer is ("}
        ]
        ```

        Then the response `content` might be:

        ```json
        [{"type": "text", "text": "B)"}]
        ```

        - `class BetaTextBlock:`

          - `required IReadOnlyList<BetaTextCitation>? Citations`

            Citations supporting the text block.

            The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

            - `class BetaCitationCharLocation:`

              - `required string CitedText`

              - `required Long DocumentIndex`

              - `required string? DocumentTitle`

              - `required Long EndCharIndex`

              - `required string? FileID`

              - `required Long StartCharIndex`

              - `JsonElement Type "char_location"constant`

            - `class BetaCitationPageLocation:`

              - `required string CitedText`

              - `required Long DocumentIndex`

              - `required string? DocumentTitle`

              - `required Long EndPageNumber`

              - `required string? FileID`

              - `required Long StartPageNumber`

              - `JsonElement Type "page_location"constant`

            - `class BetaCitationContentBlockLocation:`

              - `required string CitedText`

                The full text of the cited block range, concatenated.

                Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

              - `required Long DocumentIndex`

              - `required string? DocumentTitle`

              - `required Long EndBlockIndex`

                Exclusive 0-based end index of the cited block range in the source's `content` array.

                Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

              - `required string? FileID`

              - `required Long StartBlockIndex`

                0-based index of the first cited block in the source's `content` array.

              - `JsonElement Type "content_block_location"constant`

            - `class BetaCitationsWebSearchResultLocation:`

              - `required string CitedText`

              - `required string EncryptedIndex`

              - `required string? Title`

              - `JsonElement Type "web_search_result_location"constant`

              - `required string Url`

            - `class BetaCitationSearchResultLocation:`

              - `required string CitedText`

                The full text of the cited block range, concatenated.

                Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

              - `required Long EndBlockIndex`

                Exclusive 0-based end index of the cited block range in the source's `content` array.

                Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

              - `required Long SearchResultIndex`

                0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

                Counted separately from `document_index`; server-side web search results are not included in this count.

              - `required string Source`

              - `required Long StartBlockIndex`

                0-based index of the first cited block in the source's `content` array.

              - `required string? Title`

              - `JsonElement Type "search_result_location"constant`

          - `required string Text`

          - `JsonElement Type "text"constant`

        - `class BetaThinkingBlock:`

          - `required string Signature`

          - `required string Thinking`

          - `JsonElement Type "thinking"constant`

        - `class BetaRedactedThinkingBlock:`

          - `required string Data`

          - `JsonElement Type "redacted_thinking"constant`

        - `class BetaToolUseBlock:`

          - `required string ID`

          - `required IReadOnlyDictionary<string, JsonElement> Input`

          - `required string Name`

          - `JsonElement Type "tool_use"constant`

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

              - `JsonElement Type "direct"constant`

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

              - `required string ToolID`

              - `JsonElement Type "code_execution_20250825"constant`

            - `class BetaServerToolCaller20260120:`

              - `required string ToolID`

              - `JsonElement Type "code_execution_20260120"constant`

        - `class BetaServerToolUseBlock:`

          - `required string ID`

          - `required IReadOnlyDictionary<string, JsonElement> Input`

          - `required Name Name`

            - `"advisor"Advisor`

            - `"web_search"WebSearch`

            - `"web_fetch"WebFetch`

            - `"code_execution"CodeExecution`

            - `"bash_code_execution"BashCodeExecution`

            - `"text_editor_code_execution"TextEditorCodeExecution`

            - `"tool_search_tool_regex"ToolSearchToolRegex`

            - `"tool_search_tool_bm25"ToolSearchToolBm25`

          - `JsonElement Type "server_tool_use"constant`

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

            - `class BetaServerToolCaller20260120:`

        - `class BetaWebSearchToolResultBlock:`

          - `required BetaWebSearchToolResultBlockContent Content`

            - `class BetaWebSearchToolResultError:`

              - `required BetaWebSearchToolResultErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"max_uses_exceeded"MaxUsesExceeded`

                - `"too_many_requests"TooManyRequests`

                - `"query_too_long"QueryTooLong`

                - `"request_too_large"RequestTooLarge`

              - `JsonElement Type "web_search_tool_result_error"constant`

            - `IReadOnlyList<BetaWebSearchResultBlock>`

              - `required string EncryptedContent`

              - `required string? PageAge`

              - `required string Title`

              - `JsonElement Type "web_search_result"constant`

              - `required string Url`

          - `required string ToolUseID`

          - `JsonElement Type "web_search_tool_result"constant`

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

            - `class BetaServerToolCaller20260120:`

        - `class BetaWebFetchToolResultBlock:`

          - `required Content Content`

            - `class BetaWebFetchToolResultErrorBlock:`

              - `required BetaWebFetchToolResultErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"url_too_long"UrlTooLong`

                - `"url_not_allowed"UrlNotAllowed`

                - `"url_not_in_prior_context"UrlNotInPriorContext`

                - `"url_not_accessible"UrlNotAccessible`

                - `"unsupported_content_type"UnsupportedContentType`

                - `"too_many_requests"TooManyRequests`

                - `"max_uses_exceeded"MaxUsesExceeded`

                - `"unavailable"Unavailable`

              - `JsonElement Type "web_fetch_tool_result_error"constant`

            - `class BetaWebFetchBlock:`

              - `required BetaDocumentBlock Content`

                - `required BetaCitationConfig? Citations`

                  Citation configuration for the document

                  - `required Boolean Enabled`

                - `required Source Source`

                  - `class BetaBase64PdfSource:`

                    - `required string Data`

                    - `JsonElement MediaType "application/pdf"constant`

                    - `JsonElement Type "base64"constant`

                  - `class BetaPlainTextSource:`

                    - `required string Data`

                    - `JsonElement MediaType "text/plain"constant`

                    - `JsonElement Type "text"constant`

                - `required string? Title`

                  The title of the document

                - `JsonElement Type "document"constant`

              - `required string? RetrievedAt`

                ISO 8601 timestamp when the content was retrieved

              - `JsonElement Type "web_fetch_result"constant`

              - `required string Url`

                Fetched content URL

          - `required string ToolUseID`

          - `JsonElement Type "web_fetch_tool_result"constant`

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

            - `class BetaServerToolCaller20260120:`

        - `class BetaAdvisorToolResultBlock:`

          - `required Content Content`

            - `class BetaAdvisorToolResultError:`

              - `required ErrorCode ErrorCode`

                - `"max_uses_exceeded"MaxUsesExceeded`

                - `"prompt_too_long"PromptTooLong`

                - `"too_many_requests"TooManyRequests`

                - `"overloaded"Overloaded`

                - `"unavailable"Unavailable`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `JsonElement Type "advisor_tool_result_error"constant`

            - `class BetaAdvisorResultBlock:`

              - `required string? StopReason`

                The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the tool's `max_tokens` value or the advisor model's policy cap.

              - `required string Text`

              - `JsonElement Type "advisor_result"constant`

            - `class BetaAdvisorRedactedResultBlock:`

              - `required string EncryptedContent`

                Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.

              - `required string? StopReason`

                The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`).

              - `JsonElement Type "advisor_redacted_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "advisor_tool_result"constant`

        - `class BetaCodeExecutionToolResultBlock:`

          - `required BetaCodeExecutionToolResultBlockContent Content`

            Code execution result with encrypted stdout for PFC + web_search results.

            - `class BetaCodeExecutionToolResultError:`

              - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `JsonElement Type "code_execution_tool_result_error"constant`

            - `class BetaCodeExecutionResultBlock:`

              - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

                - `required string FileID`

                - `JsonElement Type "code_execution_output"constant`

              - `required Long ReturnCode`

              - `required string Stderr`

              - `required string Stdout`

              - `JsonElement Type "code_execution_result"constant`

            - `class BetaEncryptedCodeExecutionResultBlock:`

              Code execution result with encrypted stdout for PFC + web_search results.

              - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

                - `required string FileID`

                - `JsonElement Type "code_execution_output"constant`

              - `required string EncryptedStdout`

              - `required Long ReturnCode`

              - `required string Stderr`

              - `JsonElement Type "encrypted_code_execution_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "code_execution_tool_result"constant`

        - `class BetaBashCodeExecutionToolResultBlock:`

          - `required Content Content`

            - `class BetaBashCodeExecutionToolResultError:`

              - `required ErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `"output_file_too_large"OutputFileTooLarge`

              - `JsonElement Type "bash_code_execution_tool_result_error"constant`

            - `class BetaBashCodeExecutionResultBlock:`

              - `required IReadOnlyList<BetaBashCodeExecutionOutputBlock> Content`

                - `required string FileID`

                - `JsonElement Type "bash_code_execution_output"constant`

              - `required Long ReturnCode`

              - `required string Stderr`

              - `required string Stdout`

              - `JsonElement Type "bash_code_execution_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "bash_code_execution_tool_result"constant`

        - `class BetaTextEditorCodeExecutionToolResultBlock:`

          - `required Content Content`

            - `class BetaTextEditorCodeExecutionToolResultError:`

              - `required ErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `"file_not_found"FileNotFound`

              - `required string? ErrorMessage`

              - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

            - `class BetaTextEditorCodeExecutionViewResultBlock:`

              - `required string Content`

              - `required FileType FileType`

                - `"text"Text`

                - `"image"Image`

                - `"pdf"Pdf`

              - `required Long? NumLines`

              - `required Long? StartLine`

              - `required Long? TotalLines`

              - `JsonElement Type "text_editor_code_execution_view_result"constant`

            - `class BetaTextEditorCodeExecutionCreateResultBlock:`

              - `required Boolean IsFileUpdate`

              - `JsonElement Type "text_editor_code_execution_create_result"constant`

            - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:`

              - `required IReadOnlyList<string>? Lines`

              - `required Long? NewLines`

              - `required Long? NewStart`

              - `required Long? OldLines`

              - `required Long? OldStart`

              - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "text_editor_code_execution_tool_result"constant`

        - `class BetaToolSearchToolResultBlock:`

          - `required Content Content`

            - `class BetaToolSearchToolResultError:`

              - `required ErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `required string? ErrorMessage`

              - `JsonElement Type "tool_search_tool_result_error"constant`

            - `class BetaToolSearchToolSearchResultBlock:`

              - `required IReadOnlyList<BetaToolReferenceBlock> ToolReferences`

                - `required string ToolName`

                - `JsonElement Type "tool_reference"constant`

              - `JsonElement Type "tool_search_tool_search_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "tool_search_tool_result"constant`

        - `class BetaMcpToolUseBlock:`

          - `required string ID`

          - `required IReadOnlyDictionary<string, JsonElement> Input`

          - `required string Name`

            The name of the MCP tool

          - `required string ServerName`

            The name of the MCP server

          - `JsonElement Type "mcp_tool_use"constant`

        - `class BetaMcpToolResultBlock:`

          - `required Content Content`

            - `string`

            - `IReadOnlyList<BetaTextBlock>`

              - `required IReadOnlyList<BetaTextCitation>? Citations`

                Citations supporting the text block.

                The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

              - `required string Text`

              - `JsonElement Type "text"constant`

          - `required Boolean IsError`

          - `required string ToolUseID`

          - `JsonElement Type "mcp_tool_result"constant`

        - `class BetaContainerUploadBlock:`

          Response model for a file uploaded to the container.

          - `required string FileID`

          - `JsonElement Type "container_upload"constant`

        - `class BetaCompactionBlock:`

          A compaction block returned when autocompact is triggered.

          When content is None, it indicates the compaction failed to produce a valid
          summary (e.g., malformed output from the model). Clients may round-trip
          compaction blocks with null content; the server treats them as no-ops.

          - `required string? Content`

            Summary of compacted content, or null if compaction failed

          - `required string? EncryptedContent`

            Opaque metadata from prior compaction, to be round-tripped verbatim

          - `JsonElement Type "compaction"constant`

      - `required BetaContextManagementResponse? ContextManagement`

        Context management response.

        Information about context management strategies applied during the request.

        - `required IReadOnlyList<AppliedEdit> AppliedEdits`

          List of context management edits that were applied.

          - `class BetaClearToolUses20250919EditResponse:`

            - `required Long ClearedInputTokens`

              Number of input tokens cleared by this edit.

            - `required Long ClearedToolUses`

              Number of tool uses that were cleared.

            - `JsonElement Type "clear_tool_uses_20250919"constant`

              The type of context management edit applied.

          - `class BetaClearThinking20251015EditResponse:`

            - `required Long ClearedInputTokens`

              Number of input tokens cleared by this edit.

            - `required Long ClearedThinkingTurns`

              Number of thinking turns that were cleared.

            - `JsonElement Type "clear_thinking_20251015"constant`

              The type of context management edit applied.

      - `required BetaDiagnostics? Diagnostics`

        Response envelope for request-level diagnostics. Present (possibly
        null) whenever the caller supplied `diagnostics` on the request.

        - `required CacheMissReason? CacheMissReason`

          Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.

          - `class BetaCacheMissModelChanged:`

            - `required Long CacheMissedInputTokens`

              Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

            - `JsonElement Type "model_changed"constant`

          - `class BetaCacheMissSystemChanged:`

            - `required Long CacheMissedInputTokens`

              Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

            - `JsonElement Type "system_changed"constant`

          - `class BetaCacheMissToolsChanged:`

            - `required Long CacheMissedInputTokens`

              Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

            - `JsonElement Type "tools_changed"constant`

          - `class BetaCacheMissMessagesChanged:`

            - `required Long CacheMissedInputTokens`

              Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

            - `JsonElement Type "messages_changed"constant`

          - `class BetaCacheMissPreviousMessageNotFound:`

            - `JsonElement Type "previous_message_not_found"constant`

          - `class BetaCacheMissUnavailable:`

            - `JsonElement Type "unavailable"constant`

      - `required Model Model`

        The model that will complete your prompt.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-mythos-preview"ClaudeMythosPreview`

          New class of intelligence, strongest in coding and cybersecurity

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Frontier intelligence for long-running agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

        - `"claude-opus-4-1"ClaudeOpus4_1`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-0"ClaudeOpus4_0`

          Powerful model for complex tasks

        - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

          Powerful model for complex tasks

        - `"claude-sonnet-4-0"ClaudeSonnet4_0`

          High-performance model with extended thinking

        - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

          High-performance model with extended thinking

        - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

          Fast and cost-effective model

      - `JsonElement Role "assistant"constant`

        Conversational role of the generated message.

        This will always be `"assistant"`.

      - `required BetaRefusalStopDetails? StopDetails`

        Structured information about a refusal.

        - `required Category? Category`

          The policy category that triggered the refusal.

          `null` when the refusal doesn't map to a named category.

          - `"cyber"Cyber`

          - `"bio"Bio`

        - `required string? Explanation`

          Human-readable explanation of the refusal.

          This text is not guaranteed to be stable. `null` when no explanation is available for the category.

        - `JsonElement Type "refusal"constant`

      - `required BetaStopReason? StopReason`

        The reason that we stopped.

        This may be one the following values:

        * `"end_turn"`: the model reached a natural stopping point
        * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
        * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
        * `"tool_use"`: the model invoked one or more tools
        * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.
        * `"refusal"`: when streaming classifiers intervene to handle potential policy violations

        In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise.

        - `"end_turn"EndTurn`

        - `"max_tokens"MaxTokens`

        - `"stop_sequence"StopSequence`

        - `"tool_use"ToolUse`

        - `"pause_turn"PauseTurn`

        - `"compaction"Compaction`

        - `"refusal"Refusal`

        - `"model_context_window_exceeded"ModelContextWindowExceeded`

      - `required string? StopSequence`

        Which custom stop sequence was generated, if any.

        This value will be a non-null string if one of your custom stop sequences was generated.

      - `JsonElement Type "message"constant`

        Object type.

        For Messages, this is always `"message"`.

      - `required BetaUsage Usage`

        Billing and rate-limit usage.

        Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

        Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.

        For example, `output_tokens` will be non-zero, even for an empty string response from Claude.

        Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.

        - `required BetaCacheCreation? CacheCreation`

          Breakdown of cached tokens by TTL

          - `required Long Ephemeral1hInputTokens`

            The number of input tokens used to create the 1 hour cache entry.

          - `required Long Ephemeral5mInputTokens`

            The number of input tokens used to create the 5 minute cache entry.

        - `required Long? CacheCreationInputTokens`

          The number of input tokens used to create the cache entry.

        - `required Long? CacheReadInputTokens`

          The number of input tokens read from the cache.

        - `required string? InferenceGeo`

          The geographic region where inference was performed for this request.

        - `required Long InputTokens`

          The number of input tokens which were used.

        - `required IReadOnlyList<BetaIterationsUsageItems>? Iterations`

          Per-iteration token usage breakdown.

          Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:

          - Determine which iterations exceeded long context thresholds (>=200k tokens)
          - Calculate the true context window size from the last iteration
          - Understand token accumulation across server-side tool use loops

          - `class BetaMessageIterationUsage:`

            Token usage for a sampling iteration.

            - `required BetaCacheCreation? CacheCreation`

              Breakdown of cached tokens by TTL

            - `required Long CacheCreationInputTokens`

              The number of input tokens used to create the cache entry.

            - `required Long CacheReadInputTokens`

              The number of input tokens read from the cache.

            - `required Long InputTokens`

              The number of input tokens which were used.

            - `required Long OutputTokens`

              The number of output tokens which were used.

            - `JsonElement Type "message"constant`

              Usage for a sampling iteration

          - `class BetaCompactionIterationUsage:`

            Token usage for a compaction iteration.

            - `required BetaCacheCreation? CacheCreation`

              Breakdown of cached tokens by TTL

            - `required Long CacheCreationInputTokens`

              The number of input tokens used to create the cache entry.

            - `required Long CacheReadInputTokens`

              The number of input tokens read from the cache.

            - `required Long InputTokens`

              The number of input tokens which were used.

            - `required Long OutputTokens`

              The number of output tokens which were used.

            - `JsonElement Type "compaction"constant`

              Usage for a compaction iteration

          - `class BetaAdvisorMessageIterationUsage:`

            Token usage for an advisor sub-inference iteration.

            - `required BetaCacheCreation? CacheCreation`

              Breakdown of cached tokens by TTL

            - `required Long CacheCreationInputTokens`

              The number of input tokens used to create the cache entry.

            - `required Long CacheReadInputTokens`

              The number of input tokens read from the cache.

            - `required Long InputTokens`

              The number of input tokens which were used.

            - `required Model Model`

              The model that will complete your prompt.

              See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

            - `required Long OutputTokens`

              The number of output tokens which were used.

            - `JsonElement Type "advisor_message"constant`

              Usage for an advisor sub-inference iteration

        - `required Long OutputTokens`

          The number of output tokens which were used.

        - `required BetaOutputTokensDetails? OutputTokensDetails`

          Breakdown of output tokens by category.

          `output_tokens` remains the inclusive, authoritative total used for billing.
          This object provides a read-only decomposition for observability — for example,
          how many of the billed output tokens were spent on internal reasoning that may
          have been summarized before being returned to you.

          - `required Long ThinkingTokens`

            Number of output tokens the model generated as internal reasoning, including
            the thinking-block delimiter tokens.

            Reflects the raw reasoning the model produced, not the (possibly shorter)
            summarized thinking text returned in the response body. Computed by
            re-tokenizing the raw reasoning text, so it may differ from the model's exact
            generation count by a small number of tokens. Always ≤ `output_tokens`;
            `output_tokens - thinking_tokens` approximates the non-reasoning output.

        - `required BetaServerToolUsage? ServerToolUse`

          The number of server tool requests.

          - `required Long WebFetchRequests`

            The number of web fetch tool requests.

          - `required Long WebSearchRequests`

            The number of web search tool requests.

        - `required ServiceTier? ServiceTier`

          If the request used the priority, standard, or batch tier.

          - `"standard"Standard`

          - `"priority"Priority`

          - `"batch"Batch`

        - `required Speed? Speed`

          The inference speed mode used for this request.

          - `"standard"Standard`

          - `"fast"Fast`

    - `JsonElement Type "message_start"constant`

  - `class BetaRawMessageDeltaEvent:`

    - `required BetaContextManagementResponse? ContextManagement`

      Information about context management strategies applied during the request

    - `required Delta Delta`

      - `required BetaContainer? Container`

        Information about the container used in the request (for the code execution tool)

      - `required BetaRefusalStopDetails? StopDetails`

        Structured information about a refusal.

      - `required BetaStopReason? StopReason`

      - `required string? StopSequence`

    - `JsonElement Type "message_delta"constant`

    - `required BetaMessageDeltaUsage Usage`

      Billing and rate-limit usage.

      Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

      Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.

      For example, `output_tokens` will be non-zero, even for an empty string response from Claude.

      Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.

      - `required Long? CacheCreationInputTokens`

        The cumulative number of input tokens used to create the cache entry.

      - `required Long? CacheReadInputTokens`

        The cumulative number of input tokens read from the cache.

      - `required Long? InputTokens`

        The cumulative number of input tokens which were used.

      - `required IReadOnlyList<BetaIterationsUsageItems>? Iterations`

        Per-iteration token usage breakdown.

        Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:

        - Determine which iterations exceeded long context thresholds (>=200k tokens)
        - Calculate the true context window size from the last iteration
        - Understand token accumulation across server-side tool use loops

      - `required Long OutputTokens`

        The cumulative number of output tokens which were used.

      - `required BetaOutputTokensDetails? OutputTokensDetails`

        Breakdown of output tokens by category.

        `output_tokens` remains the inclusive, authoritative total used for billing.
        This object provides a read-only decomposition for observability — for example,
        how many of the billed output tokens were spent on internal reasoning that may
        have been summarized before being returned to you.

      - `required BetaServerToolUsage? ServerToolUse`

        The number of server tool requests.

  - `class BetaRawMessageStopEvent:`

    - `JsonElement Type "message_stop"constant`

  - `class BetaRawContentBlockStartEvent:`

    - `required ContentBlock ContentBlock`

      Response model for a file uploaded to the container.

      - `class BetaTextBlock:`

      - `class BetaThinkingBlock:`

      - `class BetaRedactedThinkingBlock:`

      - `class BetaToolUseBlock:`

      - `class BetaServerToolUseBlock:`

      - `class BetaWebSearchToolResultBlock:`

      - `class BetaWebFetchToolResultBlock:`

      - `class BetaAdvisorToolResultBlock:`

      - `class BetaCodeExecutionToolResultBlock:`

      - `class BetaBashCodeExecutionToolResultBlock:`

      - `class BetaTextEditorCodeExecutionToolResultBlock:`

      - `class BetaToolSearchToolResultBlock:`

      - `class BetaMcpToolUseBlock:`

      - `class BetaMcpToolResultBlock:`

      - `class BetaContainerUploadBlock:`

        Response model for a file uploaded to the container.

      - `class BetaCompactionBlock:`

        A compaction block returned when autocompact is triggered.

        When content is None, it indicates the compaction failed to produce a valid
        summary (e.g., malformed output from the model). Clients may round-trip
        compaction blocks with null content; the server treats them as no-ops.

    - `required Long Index`

    - `JsonElement Type "content_block_start"constant`

  - `class BetaRawContentBlockDeltaEvent:`

    - `required BetaRawContentBlockDelta Delta`

      - `class BetaTextDelta:`

        - `required string Text`

        - `JsonElement Type "text_delta"constant`

      - `class BetaInputJsonDelta:`

        - `required string PartialJson`

        - `JsonElement Type "input_json_delta"constant`

      - `class BetaCitationsDelta:`

        - `required Citation Citation`

          - `class BetaCitationCharLocation:`

          - `class BetaCitationPageLocation:`

          - `class BetaCitationContentBlockLocation:`

          - `class BetaCitationsWebSearchResultLocation:`

          - `class BetaCitationSearchResultLocation:`

        - `JsonElement Type "citations_delta"constant`

      - `class BetaThinkingDelta:`

        - `required Long? EstimatedTokens`

          Per-frame increment of a coarse, running estimate of the tokens this thinking block has produced so far. Present whenever the `thinking-token-count-2026-05-13` beta is set; `null` unless `thinking.display` resolves to `"omitted"` and a count is due this frame. Sum the increments across `thinking_delta` frames on this block for a progress indicator. Each increment is a non-negative multiple of a fixed quantum and the cadence is rate-limited, so this is a deliberately lossy display hint, not a billable count; `usage.output_tokens` remains authoritative.

        - `required string Thinking`

        - `JsonElement Type "thinking_delta"constant`

      - `class BetaSignatureDelta:`

        - `required string Signature`

        - `JsonElement Type "signature_delta"constant`

      - `class BetaCompactionContentBlockDelta:`

        - `required string? Content`

        - `required string? EncryptedContent`

          Opaque metadata from prior compaction, to be round-tripped verbatim

        - `JsonElement Type "compaction_delta"constant`

    - `required Long Index`

    - `JsonElement Type "content_block_delta"constant`

  - `class BetaRawContentBlockStopEvent:`

    - `required Long Index`

    - `JsonElement Type "content_block_stop"constant`

### Beta Redacted Thinking Block

- `class BetaRedactedThinkingBlock:`

  - `required string Data`

  - `JsonElement Type "redacted_thinking"constant`

### Beta Redacted Thinking Block Param

- `class BetaRedactedThinkingBlockParam:`

  - `required string Data`

  - `JsonElement Type "redacted_thinking"constant`

### Beta Refusal Stop Details

- `class BetaRefusalStopDetails:`

  Structured information about a refusal.

  - `required Category? Category`

    The policy category that triggered the refusal.

    `null` when the refusal doesn't map to a named category.

    - `"cyber"Cyber`

    - `"bio"Bio`

  - `required string? Explanation`

    Human-readable explanation of the refusal.

    This text is not guaranteed to be stable. `null` when no explanation is available for the category.

  - `JsonElement Type "refusal"constant`

### Beta Request Document Block

- `class BetaRequestDocumentBlock:`

  - `required Source Source`

    - `class BetaBase64PdfSource:`

      - `required string Data`

      - `JsonElement MediaType "application/pdf"constant`

      - `JsonElement Type "base64"constant`

    - `class BetaPlainTextSource:`

      - `required string Data`

      - `JsonElement MediaType "text/plain"constant`

      - `JsonElement Type "text"constant`

    - `class BetaContentBlockSource:`

      - `required Content Content`

        - `string`

        - `IReadOnlyList<BetaContentBlockSourceContent>`

          - `class BetaTextBlockParam:`

            - `required string Text`

            - `JsonElement Type "text"constant`

            - `BetaCacheControlEphemeral? CacheControl`

              Create a cache control breakpoint at this content block.

              - `JsonElement Type "ephemeral"constant`

              - `Ttl Ttl`

                The time-to-live for the cache control breakpoint.

                This may be one the following values:

                - `5m`: 5 minutes
                - `1h`: 1 hour

                Defaults to `5m`.

                - `"5m"Ttl5m`

                - `"1h"Ttl1h`

            - `IReadOnlyList<BetaTextCitationParam>? Citations`

              - `class BetaCitationCharLocationParam:`

                - `required string CitedText`

                - `required Long DocumentIndex`

                - `required string? DocumentTitle`

                - `required Long EndCharIndex`

                - `required Long StartCharIndex`

                - `JsonElement Type "char_location"constant`

              - `class BetaCitationPageLocationParam:`

                - `required string CitedText`

                - `required Long DocumentIndex`

                - `required string? DocumentTitle`

                - `required Long EndPageNumber`

                - `required Long StartPageNumber`

                - `JsonElement Type "page_location"constant`

              - `class BetaCitationContentBlockLocationParam:`

                - `required string CitedText`

                  The full text of the cited block range, concatenated.

                  Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                - `required Long DocumentIndex`

                - `required string? DocumentTitle`

                - `required Long EndBlockIndex`

                  Exclusive 0-based end index of the cited block range in the source's `content` array.

                  Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                - `required Long StartBlockIndex`

                  0-based index of the first cited block in the source's `content` array.

                - `JsonElement Type "content_block_location"constant`

              - `class BetaCitationWebSearchResultLocationParam:`

                - `required string CitedText`

                - `required string EncryptedIndex`

                - `required string? Title`

                - `JsonElement Type "web_search_result_location"constant`

                - `required string Url`

              - `class BetaCitationSearchResultLocationParam:`

                - `required string CitedText`

                  The full text of the cited block range, concatenated.

                  Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                - `required Long EndBlockIndex`

                  Exclusive 0-based end index of the cited block range in the source's `content` array.

                  Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                - `required Long SearchResultIndex`

                  0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

                  Counted separately from `document_index`; server-side web search results are not included in this count.

                - `required string Source`

                - `required Long StartBlockIndex`

                  0-based index of the first cited block in the source's `content` array.

                - `required string? Title`

                - `JsonElement Type "search_result_location"constant`

          - `class BetaImageBlockParam:`

            - `required Source Source`

              - `class BetaBase64ImageSource:`

                - `required string Data`

                - `required MediaType MediaType`

                  - `"image/jpeg"ImageJpeg`

                  - `"image/png"ImagePng`

                  - `"image/gif"ImageGif`

                  - `"image/webp"ImageWebP`

                - `JsonElement Type "base64"constant`

              - `class BetaUrlImageSource:`

                - `JsonElement Type "url"constant`

                - `required string Url`

              - `class BetaFileImageSource:`

                - `required string FileID`

                - `JsonElement Type "file"constant`

            - `JsonElement Type "image"constant`

            - `BetaCacheControlEphemeral? CacheControl`

              Create a cache control breakpoint at this content block.

      - `JsonElement Type "content"constant`

    - `class BetaUrlPdfSource:`

      - `JsonElement Type "url"constant`

      - `required string Url`

    - `class BetaFileDocumentSource:`

      - `required string FileID`

      - `JsonElement Type "file"constant`

  - `JsonElement Type "document"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

  - `BetaCitationsConfigParam? Citations`

    - `Boolean Enabled`

  - `string? Context`

  - `string? Title`

### Beta Request MCP Server Tool Configuration

- `class BetaRequestMcpServerToolConfiguration:`

  - `IReadOnlyList<string>? AllowedTools`

  - `Boolean? Enabled`

### Beta Request MCP Server URL Definition

- `class BetaRequestMcpServerUrlDefinition:`

  - `required string Name`

  - `JsonElement Type "url"constant`

  - `required string Url`

  - `string? AuthorizationToken`

  - `BetaRequestMcpServerToolConfiguration? ToolConfiguration`

    - `IReadOnlyList<string>? AllowedTools`

    - `Boolean? Enabled`

### Beta Request MCP Tool Result Block Param

- `class BetaRequestMcpToolResultBlockParam:`

  - `required string ToolUseID`

  - `JsonElement Type "mcp_tool_result"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Content Content`

    - `string`

    - `IReadOnlyList<BetaTextBlockParam>`

      - `required string Text`

      - `JsonElement Type "text"constant`

      - `BetaCacheControlEphemeral? CacheControl`

        Create a cache control breakpoint at this content block.

      - `IReadOnlyList<BetaTextCitationParam>? Citations`

        - `class BetaCitationCharLocationParam:`

          - `required string CitedText`

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndCharIndex`

          - `required Long StartCharIndex`

          - `JsonElement Type "char_location"constant`

        - `class BetaCitationPageLocationParam:`

          - `required string CitedText`

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndPageNumber`

          - `required Long StartPageNumber`

          - `JsonElement Type "page_location"constant`

        - `class BetaCitationContentBlockLocationParam:`

          - `required string CitedText`

            The full text of the cited block range, concatenated.

            Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

          - `required Long DocumentIndex`

          - `required string? DocumentTitle`

          - `required Long EndBlockIndex`

            Exclusive 0-based end index of the cited block range in the source's `content` array.

            Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

          - `required Long StartBlockIndex`

            0-based index of the first cited block in the source's `content` array.

          - `JsonElement Type "content_block_location"constant`

        - `class BetaCitationWebSearchResultLocationParam:`

          - `required string CitedText`

          - `required string EncryptedIndex`

          - `required string? Title`

          - `JsonElement Type "web_search_result_location"constant`

          - `required string Url`

        - `class BetaCitationSearchResultLocationParam:`

          - `required string CitedText`

            The full text of the cited block range, concatenated.

            Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

          - `required Long EndBlockIndex`

            Exclusive 0-based end index of the cited block range in the source's `content` array.

            Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

          - `required Long SearchResultIndex`

            0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

            Counted separately from `document_index`; server-side web search results are not included in this count.

          - `required string Source`

          - `required Long StartBlockIndex`

            0-based index of the first cited block in the source's `content` array.

          - `required string? Title`

          - `JsonElement Type "search_result_location"constant`

  - `Boolean IsError`

### Beta Search Result Block Param

- `class BetaSearchResultBlockParam:`

  - `required IReadOnlyList<BetaTextBlockParam> Content`

    - `required string Text`

    - `JsonElement Type "text"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

      - `JsonElement Type "ephemeral"constant`

      - `Ttl Ttl`

        The time-to-live for the cache control breakpoint.

        This may be one the following values:

        - `5m`: 5 minutes
        - `1h`: 1 hour

        Defaults to `5m`.

        - `"5m"Ttl5m`

        - `"1h"Ttl1h`

    - `IReadOnlyList<BetaTextCitationParam>? Citations`

      - `class BetaCitationCharLocationParam:`

        - `required string CitedText`

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndCharIndex`

        - `required Long StartCharIndex`

        - `JsonElement Type "char_location"constant`

      - `class BetaCitationPageLocationParam:`

        - `required string CitedText`

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndPageNumber`

        - `required Long StartPageNumber`

        - `JsonElement Type "page_location"constant`

      - `class BetaCitationContentBlockLocationParam:`

        - `required string CitedText`

          The full text of the cited block range, concatenated.

          Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

        - `required Long DocumentIndex`

        - `required string? DocumentTitle`

        - `required Long EndBlockIndex`

          Exclusive 0-based end index of the cited block range in the source's `content` array.

          Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

        - `required Long StartBlockIndex`

          0-based index of the first cited block in the source's `content` array.

        - `JsonElement Type "content_block_location"constant`

      - `class BetaCitationWebSearchResultLocationParam:`

        - `required string CitedText`

        - `required string EncryptedIndex`

        - `required string? Title`

        - `JsonElement Type "web_search_result_location"constant`

        - `required string Url`

      - `class BetaCitationSearchResultLocationParam:`

        - `required string CitedText`

          The full text of the cited block range, concatenated.

          Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

        - `required Long EndBlockIndex`

          Exclusive 0-based end index of the cited block range in the source's `content` array.

          Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

        - `required Long SearchResultIndex`

          0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

          Counted separately from `document_index`; server-side web search results are not included in this count.

        - `required string Source`

        - `required Long StartBlockIndex`

          0-based index of the first cited block in the source's `content` array.

        - `required string? Title`

        - `JsonElement Type "search_result_location"constant`

  - `required string Source`

  - `required string Title`

  - `JsonElement Type "search_result"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

  - `BetaCitationsConfigParam Citations`

    - `Boolean Enabled`

### Beta Server Tool Caller

- `class BetaServerToolCaller:`

  Tool invocation generated by a server-side tool.

  - `required string ToolID`

  - `JsonElement Type "code_execution_20250825"constant`

### Beta Server Tool Caller 20260120

- `class BetaServerToolCaller20260120:`

  - `required string ToolID`

  - `JsonElement Type "code_execution_20260120"constant`

### Beta Server Tool Usage

- `class BetaServerToolUsage:`

  - `required Long WebFetchRequests`

    The number of web fetch tool requests.

  - `required Long WebSearchRequests`

    The number of web search tool requests.

### Beta Server Tool Use Block

- `class BetaServerToolUseBlock:`

  - `required string ID`

  - `required IReadOnlyDictionary<string, JsonElement> Input`

  - `required Name Name`

    - `"advisor"Advisor`

    - `"web_search"WebSearch`

    - `"web_fetch"WebFetch`

    - `"code_execution"CodeExecution`

    - `"bash_code_execution"BashCodeExecution`

    - `"text_editor_code_execution"TextEditorCodeExecution`

    - `"tool_search_tool_regex"ToolSearchToolRegex`

    - `"tool_search_tool_bm25"ToolSearchToolBm25`

  - `JsonElement Type "server_tool_use"constant`

  - `Caller Caller`

    Tool invocation directly from the model.

    - `class BetaDirectCaller:`

      Tool invocation directly from the model.

      - `JsonElement Type "direct"constant`

    - `class BetaServerToolCaller:`

      Tool invocation generated by a server-side tool.

      - `required string ToolID`

      - `JsonElement Type "code_execution_20250825"constant`

    - `class BetaServerToolCaller20260120:`

      - `required string ToolID`

      - `JsonElement Type "code_execution_20260120"constant`

### Beta Server Tool Use Block Param

- `class BetaServerToolUseBlockParam:`

  - `required string ID`

  - `required IReadOnlyDictionary<string, JsonElement> Input`

  - `required Name Name`

    - `"advisor"Advisor`

    - `"web_search"WebSearch`

    - `"web_fetch"WebFetch`

    - `"code_execution"CodeExecution`

    - `"bash_code_execution"BashCodeExecution`

    - `"text_editor_code_execution"TextEditorCodeExecution`

    - `"tool_search_tool_regex"ToolSearchToolRegex`

    - `"tool_search_tool_bm25"ToolSearchToolBm25`

  - `JsonElement Type "server_tool_use"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Caller Caller`

    Tool invocation directly from the model.

    - `class BetaDirectCaller:`

      Tool invocation directly from the model.

      - `JsonElement Type "direct"constant`

    - `class BetaServerToolCaller:`

      Tool invocation generated by a server-side tool.

      - `required string ToolID`

      - `JsonElement Type "code_execution_20250825"constant`

    - `class BetaServerToolCaller20260120:`

      - `required string ToolID`

      - `JsonElement Type "code_execution_20260120"constant`

### Beta Signature Delta

- `class BetaSignatureDelta:`

  - `required string Signature`

  - `JsonElement Type "signature_delta"constant`

### Beta Skill

- `class BetaSkill:`

  A skill that was loaded in a container (response model).

  - `required string SkillID`

    Skill ID

  - `required Type Type`

    Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

    - `"anthropic"Anthropic`

    - `"custom"Custom`

  - `required string Version`

    Skill version or 'latest' for most recent version

### Beta Skill Params

- `class BetaSkillParams:`

  Specification for a skill to be loaded in a container (request model).

  - `required string SkillID`

    Skill ID

  - `required Type Type`

    Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

    - `"anthropic"Anthropic`

    - `"custom"Custom`

  - `string Version`

    Skill version or 'latest' for most recent version

### Beta Stop Reason

- `enum BetaStopReason:`

  - `"end_turn"EndTurn`

  - `"max_tokens"MaxTokens`

  - `"stop_sequence"StopSequence`

  - `"tool_use"ToolUse`

  - `"pause_turn"PauseTurn`

  - `"compaction"Compaction`

  - `"refusal"Refusal`

  - `"model_context_window_exceeded"ModelContextWindowExceeded`

### Beta Text Block

- `class BetaTextBlock:`

  - `required IReadOnlyList<BetaTextCitation>? Citations`

    Citations supporting the text block.

    The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

    - `class BetaCitationCharLocation:`

      - `required string CitedText`

      - `required Long DocumentIndex`

      - `required string? DocumentTitle`

      - `required Long EndCharIndex`

      - `required string? FileID`

      - `required Long StartCharIndex`

      - `JsonElement Type "char_location"constant`

    - `class BetaCitationPageLocation:`

      - `required string CitedText`

      - `required Long DocumentIndex`

      - `required string? DocumentTitle`

      - `required Long EndPageNumber`

      - `required string? FileID`

      - `required Long StartPageNumber`

      - `JsonElement Type "page_location"constant`

    - `class BetaCitationContentBlockLocation:`

      - `required string CitedText`

        The full text of the cited block range, concatenated.

        Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

      - `required Long DocumentIndex`

      - `required string? DocumentTitle`

      - `required Long EndBlockIndex`

        Exclusive 0-based end index of the cited block range in the source's `content` array.

        Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

      - `required string? FileID`

      - `required Long StartBlockIndex`

        0-based index of the first cited block in the source's `content` array.

      - `JsonElement Type "content_block_location"constant`

    - `class BetaCitationsWebSearchResultLocation:`

      - `required string CitedText`

      - `required string EncryptedIndex`

      - `required string? Title`

      - `JsonElement Type "web_search_result_location"constant`

      - `required string Url`

    - `class BetaCitationSearchResultLocation:`

      - `required string CitedText`

        The full text of the cited block range, concatenated.

        Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

      - `required Long EndBlockIndex`

        Exclusive 0-based end index of the cited block range in the source's `content` array.

        Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

      - `required Long SearchResultIndex`

        0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

        Counted separately from `document_index`; server-side web search results are not included in this count.

      - `required string Source`

      - `required Long StartBlockIndex`

        0-based index of the first cited block in the source's `content` array.

      - `required string? Title`

      - `JsonElement Type "search_result_location"constant`

  - `required string Text`

  - `JsonElement Type "text"constant`

### Beta Text Block Param

- `class BetaTextBlockParam:`

  - `required string Text`

  - `JsonElement Type "text"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `IReadOnlyList<BetaTextCitationParam>? Citations`

    - `class BetaCitationCharLocationParam:`

      - `required string CitedText`

      - `required Long DocumentIndex`

      - `required string? DocumentTitle`

      - `required Long EndCharIndex`

      - `required Long StartCharIndex`

      - `JsonElement Type "char_location"constant`

    - `class BetaCitationPageLocationParam:`

      - `required string CitedText`

      - `required Long DocumentIndex`

      - `required string? DocumentTitle`

      - `required Long EndPageNumber`

      - `required Long StartPageNumber`

      - `JsonElement Type "page_location"constant`

    - `class BetaCitationContentBlockLocationParam:`

      - `required string CitedText`

        The full text of the cited block range, concatenated.

        Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

      - `required Long DocumentIndex`

      - `required string? DocumentTitle`

      - `required Long EndBlockIndex`

        Exclusive 0-based end index of the cited block range in the source's `content` array.

        Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

      - `required Long StartBlockIndex`

        0-based index of the first cited block in the source's `content` array.

      - `JsonElement Type "content_block_location"constant`

    - `class BetaCitationWebSearchResultLocationParam:`

      - `required string CitedText`

      - `required string EncryptedIndex`

      - `required string? Title`

      - `JsonElement Type "web_search_result_location"constant`

      - `required string Url`

    - `class BetaCitationSearchResultLocationParam:`

      - `required string CitedText`

        The full text of the cited block range, concatenated.

        Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

      - `required Long EndBlockIndex`

        Exclusive 0-based end index of the cited block range in the source's `content` array.

        Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

      - `required Long SearchResultIndex`

        0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

        Counted separately from `document_index`; server-side web search results are not included in this count.

      - `required string Source`

      - `required Long StartBlockIndex`

        0-based index of the first cited block in the source's `content` array.

      - `required string? Title`

      - `JsonElement Type "search_result_location"constant`

### Beta Text Citation

- `class BetaTextCitation: A class that can be one of several variants.union`

  - `class BetaCitationCharLocation:`

    - `required string CitedText`

    - `required Long DocumentIndex`

    - `required string? DocumentTitle`

    - `required Long EndCharIndex`

    - `required string? FileID`

    - `required Long StartCharIndex`

    - `JsonElement Type "char_location"constant`

  - `class BetaCitationPageLocation:`

    - `required string CitedText`

    - `required Long DocumentIndex`

    - `required string? DocumentTitle`

    - `required Long EndPageNumber`

    - `required string? FileID`

    - `required Long StartPageNumber`

    - `JsonElement Type "page_location"constant`

  - `class BetaCitationContentBlockLocation:`

    - `required string CitedText`

      The full text of the cited block range, concatenated.

      Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

    - `required Long DocumentIndex`

    - `required string? DocumentTitle`

    - `required Long EndBlockIndex`

      Exclusive 0-based end index of the cited block range in the source's `content` array.

      Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

    - `required string? FileID`

    - `required Long StartBlockIndex`

      0-based index of the first cited block in the source's `content` array.

    - `JsonElement Type "content_block_location"constant`

  - `class BetaCitationsWebSearchResultLocation:`

    - `required string CitedText`

    - `required string EncryptedIndex`

    - `required string? Title`

    - `JsonElement Type "web_search_result_location"constant`

    - `required string Url`

  - `class BetaCitationSearchResultLocation:`

    - `required string CitedText`

      The full text of the cited block range, concatenated.

      Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

    - `required Long EndBlockIndex`

      Exclusive 0-based end index of the cited block range in the source's `content` array.

      Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

    - `required Long SearchResultIndex`

      0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

      Counted separately from `document_index`; server-side web search results are not included in this count.

    - `required string Source`

    - `required Long StartBlockIndex`

      0-based index of the first cited block in the source's `content` array.

    - `required string? Title`

    - `JsonElement Type "search_result_location"constant`

### Beta Text Citation Param

- `class BetaTextCitationParam: A class that can be one of several variants.union`

  - `class BetaCitationCharLocationParam:`

    - `required string CitedText`

    - `required Long DocumentIndex`

    - `required string? DocumentTitle`

    - `required Long EndCharIndex`

    - `required Long StartCharIndex`

    - `JsonElement Type "char_location"constant`

  - `class BetaCitationPageLocationParam:`

    - `required string CitedText`

    - `required Long DocumentIndex`

    - `required string? DocumentTitle`

    - `required Long EndPageNumber`

    - `required Long StartPageNumber`

    - `JsonElement Type "page_location"constant`

  - `class BetaCitationContentBlockLocationParam:`

    - `required string CitedText`

      The full text of the cited block range, concatenated.

      Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

    - `required Long DocumentIndex`

    - `required string? DocumentTitle`

    - `required Long EndBlockIndex`

      Exclusive 0-based end index of the cited block range in the source's `content` array.

      Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

    - `required Long StartBlockIndex`

      0-based index of the first cited block in the source's `content` array.

    - `JsonElement Type "content_block_location"constant`

  - `class BetaCitationWebSearchResultLocationParam:`

    - `required string CitedText`

    - `required string EncryptedIndex`

    - `required string? Title`

    - `JsonElement Type "web_search_result_location"constant`

    - `required string Url`

  - `class BetaCitationSearchResultLocationParam:`

    - `required string CitedText`

      The full text of the cited block range, concatenated.

      Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

    - `required Long EndBlockIndex`

      Exclusive 0-based end index of the cited block range in the source's `content` array.

      Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

    - `required Long SearchResultIndex`

      0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

      Counted separately from `document_index`; server-side web search results are not included in this count.

    - `required string Source`

    - `required Long StartBlockIndex`

      0-based index of the first cited block in the source's `content` array.

    - `required string? Title`

    - `JsonElement Type "search_result_location"constant`

### Beta Text Delta

- `class BetaTextDelta:`

  - `required string Text`

  - `JsonElement Type "text_delta"constant`

### Beta Text Editor Code Execution Create Result Block

- `class BetaTextEditorCodeExecutionCreateResultBlock:`

  - `required Boolean IsFileUpdate`

  - `JsonElement Type "text_editor_code_execution_create_result"constant`

### Beta Text Editor Code Execution Create Result Block Param

- `class BetaTextEditorCodeExecutionCreateResultBlockParam:`

  - `required Boolean IsFileUpdate`

  - `JsonElement Type "text_editor_code_execution_create_result"constant`

### Beta Text Editor Code Execution Str Replace Result Block

- `class BetaTextEditorCodeExecutionStrReplaceResultBlock:`

  - `required IReadOnlyList<string>? Lines`

  - `required Long? NewLines`

  - `required Long? NewStart`

  - `required Long? OldLines`

  - `required Long? OldStart`

  - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

### Beta Text Editor Code Execution Str Replace Result Block Param

- `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:`

  - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

  - `IReadOnlyList<string>? Lines`

  - `Long? NewLines`

  - `Long? NewStart`

  - `Long? OldLines`

  - `Long? OldStart`

### Beta Text Editor Code Execution Tool Result Block

- `class BetaTextEditorCodeExecutionToolResultBlock:`

  - `required Content Content`

    - `class BetaTextEditorCodeExecutionToolResultError:`

      - `required ErrorCode ErrorCode`

        - `"invalid_tool_input"InvalidToolInput`

        - `"unavailable"Unavailable`

        - `"too_many_requests"TooManyRequests`

        - `"execution_time_exceeded"ExecutionTimeExceeded`

        - `"file_not_found"FileNotFound`

      - `required string? ErrorMessage`

      - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

    - `class BetaTextEditorCodeExecutionViewResultBlock:`

      - `required string Content`

      - `required FileType FileType`

        - `"text"Text`

        - `"image"Image`

        - `"pdf"Pdf`

      - `required Long? NumLines`

      - `required Long? StartLine`

      - `required Long? TotalLines`

      - `JsonElement Type "text_editor_code_execution_view_result"constant`

    - `class BetaTextEditorCodeExecutionCreateResultBlock:`

      - `required Boolean IsFileUpdate`

      - `JsonElement Type "text_editor_code_execution_create_result"constant`

    - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:`

      - `required IReadOnlyList<string>? Lines`

      - `required Long? NewLines`

      - `required Long? NewStart`

      - `required Long? OldLines`

      - `required Long? OldStart`

      - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

  - `required string ToolUseID`

  - `JsonElement Type "text_editor_code_execution_tool_result"constant`

### Beta Text Editor Code Execution Tool Result Block Param

- `class BetaTextEditorCodeExecutionToolResultBlockParam:`

  - `required Content Content`

    - `class BetaTextEditorCodeExecutionToolResultErrorParam:`

      - `required ErrorCode ErrorCode`

        - `"invalid_tool_input"InvalidToolInput`

        - `"unavailable"Unavailable`

        - `"too_many_requests"TooManyRequests`

        - `"execution_time_exceeded"ExecutionTimeExceeded`

        - `"file_not_found"FileNotFound`

      - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

      - `string? ErrorMessage`

    - `class BetaTextEditorCodeExecutionViewResultBlockParam:`

      - `required string Content`

      - `required FileType FileType`

        - `"text"Text`

        - `"image"Image`

        - `"pdf"Pdf`

      - `JsonElement Type "text_editor_code_execution_view_result"constant`

      - `Long? NumLines`

      - `Long? StartLine`

      - `Long? TotalLines`

    - `class BetaTextEditorCodeExecutionCreateResultBlockParam:`

      - `required Boolean IsFileUpdate`

      - `JsonElement Type "text_editor_code_execution_create_result"constant`

    - `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:`

      - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

      - `IReadOnlyList<string>? Lines`

      - `Long? NewLines`

      - `Long? NewStart`

      - `Long? OldLines`

      - `Long? OldStart`

  - `required string ToolUseID`

  - `JsonElement Type "text_editor_code_execution_tool_result"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

### Beta Text Editor Code Execution Tool Result Error

- `class BetaTextEditorCodeExecutionToolResultError:`

  - `required ErrorCode ErrorCode`

    - `"invalid_tool_input"InvalidToolInput`

    - `"unavailable"Unavailable`

    - `"too_many_requests"TooManyRequests`

    - `"execution_time_exceeded"ExecutionTimeExceeded`

    - `"file_not_found"FileNotFound`

  - `required string? ErrorMessage`

  - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

### Beta Text Editor Code Execution Tool Result Error Param

- `class BetaTextEditorCodeExecutionToolResultErrorParam:`

  - `required ErrorCode ErrorCode`

    - `"invalid_tool_input"InvalidToolInput`

    - `"unavailable"Unavailable`

    - `"too_many_requests"TooManyRequests`

    - `"execution_time_exceeded"ExecutionTimeExceeded`

    - `"file_not_found"FileNotFound`

  - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

  - `string? ErrorMessage`

### Beta Text Editor Code Execution View Result Block

- `class BetaTextEditorCodeExecutionViewResultBlock:`

  - `required string Content`

  - `required FileType FileType`

    - `"text"Text`

    - `"image"Image`

    - `"pdf"Pdf`

  - `required Long? NumLines`

  - `required Long? StartLine`

  - `required Long? TotalLines`

  - `JsonElement Type "text_editor_code_execution_view_result"constant`

### Beta Text Editor Code Execution View Result Block Param

- `class BetaTextEditorCodeExecutionViewResultBlockParam:`

  - `required string Content`

  - `required FileType FileType`

    - `"text"Text`

    - `"image"Image`

    - `"pdf"Pdf`

  - `JsonElement Type "text_editor_code_execution_view_result"constant`

  - `Long? NumLines`

  - `Long? StartLine`

  - `Long? TotalLines`

### Beta Thinking Block

- `class BetaThinkingBlock:`

  - `required string Signature`

  - `required string Thinking`

  - `JsonElement Type "thinking"constant`

### Beta Thinking Block Param

- `class BetaThinkingBlockParam:`

  - `required string Signature`

  - `required string Thinking`

  - `JsonElement Type "thinking"constant`

### Beta Thinking Config Adaptive

- `class BetaThinkingConfigAdaptive:`

  - `JsonElement Type "adaptive"constant`

  - `Display? Display`

    Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.

    - `"summarized"Summarized`

    - `"omitted"Omitted`

### Beta Thinking Config Disabled

- `class BetaThinkingConfigDisabled:`

  - `JsonElement Type "disabled"constant`

### Beta Thinking Config Enabled

- `class BetaThinkingConfigEnabled:`

  - `required Long BudgetTokens`

    Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.

    Must be ≥1024 and less than `max_tokens`.

    See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details.

  - `JsonElement Type "enabled"constant`

  - `Display? Display`

    Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.

    - `"summarized"Summarized`

    - `"omitted"Omitted`

### Beta Thinking Config Param

- `class BetaThinkingConfigParam: A class that can be one of several variants.union`

  Configuration for enabling Claude's extended thinking.

  When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.

  See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details.

  - `class BetaThinkingConfigEnabled:`

    - `required Long BudgetTokens`

      Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.

      Must be ≥1024 and less than `max_tokens`.

      See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details.

    - `JsonElement Type "enabled"constant`

    - `Display? Display`

      Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.

      - `"summarized"Summarized`

      - `"omitted"Omitted`

  - `class BetaThinkingConfigDisabled:`

    - `JsonElement Type "disabled"constant`

  - `class BetaThinkingConfigAdaptive:`

    - `JsonElement Type "adaptive"constant`

    - `Display? Display`

      Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.

      - `"summarized"Summarized`

      - `"omitted"Omitted`

### Beta Thinking Delta

- `class BetaThinkingDelta:`

  - `required Long? EstimatedTokens`

    Per-frame increment of a coarse, running estimate of the tokens this thinking block has produced so far. Present whenever the `thinking-token-count-2026-05-13` beta is set; `null` unless `thinking.display` resolves to `"omitted"` and a count is due this frame. Sum the increments across `thinking_delta` frames on this block for a progress indicator. Each increment is a non-negative multiple of a fixed quantum and the cadence is rate-limited, so this is a deliberately lossy display hint, not a billable count; `usage.output_tokens` remains authoritative.

  - `required string Thinking`

  - `JsonElement Type "thinking_delta"constant`

### Beta Thinking Turns

- `class BetaThinkingTurns:`

  - `JsonElement Type "thinking_turns"constant`

  - `required Long Value`

### Beta Token Task Budget

- `class BetaTokenTaskBudget:`

  User-configurable total token budget across contexts.

  - `required Long Total`

    Total token budget across all contexts in the session.

  - `JsonElement Type "tokens"constant`

    The budget type. Currently only 'tokens' is supported.

  - `Long? Remaining`

    Remaining tokens in the budget. Use this to track usage across contexts when implementing compaction client-side. Defaults to total if not provided.

### Beta Tool

- `class BetaTool:`

  - `required InputSchema InputSchema`

    [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.

    This defines the shape of the `input` that your tool accepts and that the model will produce.

    - `JsonElement Type "object"constant`

    - `IReadOnlyDictionary<string, JsonElement>? Properties`

    - `IReadOnlyList<string>? Required`

  - `required string Name`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `string Description`

    Description of what this tool does.

    Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.

  - `Boolean? EagerInputStreaming`

    Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers.

  - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

  - `Type? Type`

    - `"custom"Custom`

### Beta Tool Bash 20241022

- `class BetaToolBash20241022:`

  - `JsonElement Name "bash"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "bash_20241022"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Tool Bash 20250124

- `class BetaToolBash20250124:`

  - `JsonElement Name "bash"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "bash_20250124"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Tool Choice

- `class BetaToolChoice: A class that can be one of several variants.union`

  How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.

  - `class BetaToolChoiceAuto:`

    The model will automatically decide whether to use tools.

    - `JsonElement Type "auto"constant`

    - `Boolean DisableParallelToolUse`

      Whether to disable parallel tool use.

      Defaults to `false`. If set to `true`, the model will output at most one tool use.

  - `class BetaToolChoiceAny:`

    The model will use any available tools.

    - `JsonElement Type "any"constant`

    - `Boolean DisableParallelToolUse`

      Whether to disable parallel tool use.

      Defaults to `false`. If set to `true`, the model will output exactly one tool use.

  - `class BetaToolChoiceTool:`

    The model will use the specified tool with `tool_choice.name`.

    - `required string Name`

      The name of the tool to use.

    - `JsonElement Type "tool"constant`

    - `Boolean DisableParallelToolUse`

      Whether to disable parallel tool use.

      Defaults to `false`. If set to `true`, the model will output exactly one tool use.

  - `class BetaToolChoiceNone:`

    The model will not be allowed to use tools.

    - `JsonElement Type "none"constant`

### Beta Tool Choice Any

- `class BetaToolChoiceAny:`

  The model will use any available tools.

  - `JsonElement Type "any"constant`

  - `Boolean DisableParallelToolUse`

    Whether to disable parallel tool use.

    Defaults to `false`. If set to `true`, the model will output exactly one tool use.

### Beta Tool Choice Auto

- `class BetaToolChoiceAuto:`

  The model will automatically decide whether to use tools.

  - `JsonElement Type "auto"constant`

  - `Boolean DisableParallelToolUse`

    Whether to disable parallel tool use.

    Defaults to `false`. If set to `true`, the model will output at most one tool use.

### Beta Tool Choice None

- `class BetaToolChoiceNone:`

  The model will not be allowed to use tools.

  - `JsonElement Type "none"constant`

### Beta Tool Choice Tool

- `class BetaToolChoiceTool:`

  The model will use the specified tool with `tool_choice.name`.

  - `required string Name`

    The name of the tool to use.

  - `JsonElement Type "tool"constant`

  - `Boolean DisableParallelToolUse`

    Whether to disable parallel tool use.

    Defaults to `false`. If set to `true`, the model will output exactly one tool use.

### Beta Tool Computer Use 20241022

- `class BetaToolComputerUse20241022:`

  - `required Long DisplayHeightPx`

    The height of the display in pixels.

  - `required Long DisplayWidthPx`

    The width of the display in pixels.

  - `JsonElement Name "computer"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "computer_20241022"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Long? DisplayNumber`

    The X11 display number (e.g. 0, 1) for the display.

  - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Tool Computer Use 20250124

- `class BetaToolComputerUse20250124:`

  - `required Long DisplayHeightPx`

    The height of the display in pixels.

  - `required Long DisplayWidthPx`

    The width of the display in pixels.

  - `JsonElement Name "computer"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "computer_20250124"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Long? DisplayNumber`

    The X11 display number (e.g. 0, 1) for the display.

  - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Tool Computer Use 20251124

- `class BetaToolComputerUse20251124:`

  - `required Long DisplayHeightPx`

    The height of the display in pixels.

  - `required Long DisplayWidthPx`

    The width of the display in pixels.

  - `JsonElement Name "computer"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "computer_20251124"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Long? DisplayNumber`

    The X11 display number (e.g. 0, 1) for the display.

  - `Boolean EnableZoom`

    Whether to enable an action to take a zoomed-in screenshot of the screen.

  - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Tool Reference Block

- `class BetaToolReferenceBlock:`

  - `required string ToolName`

  - `JsonElement Type "tool_reference"constant`

### Beta Tool Reference Block Param

- `class BetaToolReferenceBlockParam:`

  Tool reference block that can be included in tool_result content.

  - `required string ToolName`

  - `JsonElement Type "tool_reference"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

### Beta Tool Result Block Param

- `class BetaToolResultBlockParam:`

  - `required string ToolUseID`

  - `JsonElement Type "tool_result"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Content Content`

    - `string`

    - `IReadOnlyList<Block>`

      - `class BetaTextBlockParam:`

        - `required string Text`

        - `JsonElement Type "text"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `IReadOnlyList<BetaTextCitationParam>? Citations`

          - `class BetaCitationCharLocationParam:`

            - `required string CitedText`

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndCharIndex`

            - `required Long StartCharIndex`

            - `JsonElement Type "char_location"constant`

          - `class BetaCitationPageLocationParam:`

            - `required string CitedText`

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndPageNumber`

            - `required Long StartPageNumber`

            - `JsonElement Type "page_location"constant`

          - `class BetaCitationContentBlockLocationParam:`

            - `required string CitedText`

              The full text of the cited block range, concatenated.

              Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndBlockIndex`

              Exclusive 0-based end index of the cited block range in the source's `content` array.

              Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

            - `required Long StartBlockIndex`

              0-based index of the first cited block in the source's `content` array.

            - `JsonElement Type "content_block_location"constant`

          - `class BetaCitationWebSearchResultLocationParam:`

            - `required string CitedText`

            - `required string EncryptedIndex`

            - `required string? Title`

            - `JsonElement Type "web_search_result_location"constant`

            - `required string Url`

          - `class BetaCitationSearchResultLocationParam:`

            - `required string CitedText`

              The full text of the cited block range, concatenated.

              Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

            - `required Long EndBlockIndex`

              Exclusive 0-based end index of the cited block range in the source's `content` array.

              Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

            - `required Long SearchResultIndex`

              0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

              Counted separately from `document_index`; server-side web search results are not included in this count.

            - `required string Source`

            - `required Long StartBlockIndex`

              0-based index of the first cited block in the source's `content` array.

            - `required string? Title`

            - `JsonElement Type "search_result_location"constant`

      - `class BetaImageBlockParam:`

        - `required Source Source`

          - `class BetaBase64ImageSource:`

            - `required string Data`

            - `required MediaType MediaType`

              - `"image/jpeg"ImageJpeg`

              - `"image/png"ImagePng`

              - `"image/gif"ImageGif`

              - `"image/webp"ImageWebP`

            - `JsonElement Type "base64"constant`

          - `class BetaUrlImageSource:`

            - `JsonElement Type "url"constant`

            - `required string Url`

          - `class BetaFileImageSource:`

            - `required string FileID`

            - `JsonElement Type "file"constant`

        - `JsonElement Type "image"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

      - `class BetaSearchResultBlockParam:`

        - `required IReadOnlyList<BetaTextBlockParam> Content`

          - `required string Text`

          - `JsonElement Type "text"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `IReadOnlyList<BetaTextCitationParam>? Citations`

        - `required string Source`

        - `required string Title`

        - `JsonElement Type "search_result"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `BetaCitationsConfigParam Citations`

          - `Boolean Enabled`

      - `class BetaRequestDocumentBlock:`

        - `required Source Source`

          - `class BetaBase64PdfSource:`

            - `required string Data`

            - `JsonElement MediaType "application/pdf"constant`

            - `JsonElement Type "base64"constant`

          - `class BetaPlainTextSource:`

            - `required string Data`

            - `JsonElement MediaType "text/plain"constant`

            - `JsonElement Type "text"constant`

          - `class BetaContentBlockSource:`

            - `required Content Content`

              - `string`

              - `IReadOnlyList<BetaContentBlockSourceContent>`

                - `class BetaTextBlockParam:`

                - `class BetaImageBlockParam:`

            - `JsonElement Type "content"constant`

          - `class BetaUrlPdfSource:`

            - `JsonElement Type "url"constant`

            - `required string Url`

          - `class BetaFileDocumentSource:`

            - `required string FileID`

            - `JsonElement Type "file"constant`

        - `JsonElement Type "document"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `BetaCitationsConfigParam? Citations`

        - `string? Context`

        - `string? Title`

      - `class BetaToolReferenceBlockParam:`

        Tool reference block that can be included in tool_result content.

        - `required string ToolName`

        - `JsonElement Type "tool_reference"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

  - `Boolean IsError`

### Beta Tool Search Tool Bm25 20251119

- `class BetaToolSearchToolBm25_20251119:`

  - `JsonElement Name "tool_search_tool_bm25"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `required Type Type`

    - `"tool_search_tool_bm25_20251119"ToolSearchToolBm25_20251119`

    - `"tool_search_tool_bm25"ToolSearchToolBm25`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Tool Search Tool Regex 20251119

- `class BetaToolSearchToolRegex20251119:`

  - `JsonElement Name "tool_search_tool_regex"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `required Type Type`

    - `"tool_search_tool_regex_20251119"ToolSearchToolRegex20251119`

    - `"tool_search_tool_regex"ToolSearchToolRegex`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Tool Search Tool Result Block

- `class BetaToolSearchToolResultBlock:`

  - `required Content Content`

    - `class BetaToolSearchToolResultError:`

      - `required ErrorCode ErrorCode`

        - `"invalid_tool_input"InvalidToolInput`

        - `"unavailable"Unavailable`

        - `"too_many_requests"TooManyRequests`

        - `"execution_time_exceeded"ExecutionTimeExceeded`

      - `required string? ErrorMessage`

      - `JsonElement Type "tool_search_tool_result_error"constant`

    - `class BetaToolSearchToolSearchResultBlock:`

      - `required IReadOnlyList<BetaToolReferenceBlock> ToolReferences`

        - `required string ToolName`

        - `JsonElement Type "tool_reference"constant`

      - `JsonElement Type "tool_search_tool_search_result"constant`

  - `required string ToolUseID`

  - `JsonElement Type "tool_search_tool_result"constant`

### Beta Tool Search Tool Result Block Param

- `class BetaToolSearchToolResultBlockParam:`

  - `required Content Content`

    - `class BetaToolSearchToolResultErrorParam:`

      - `required ErrorCode ErrorCode`

        - `"invalid_tool_input"InvalidToolInput`

        - `"unavailable"Unavailable`

        - `"too_many_requests"TooManyRequests`

        - `"execution_time_exceeded"ExecutionTimeExceeded`

      - `JsonElement Type "tool_search_tool_result_error"constant`

    - `class BetaToolSearchToolSearchResultBlockParam:`

      - `required IReadOnlyList<BetaToolReferenceBlockParam> ToolReferences`

        - `required string ToolName`

        - `JsonElement Type "tool_reference"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

          - `JsonElement Type "ephemeral"constant`

          - `Ttl Ttl`

            The time-to-live for the cache control breakpoint.

            This may be one the following values:

            - `5m`: 5 minutes
            - `1h`: 1 hour

            Defaults to `5m`.

            - `"5m"Ttl5m`

            - `"1h"Ttl1h`

      - `JsonElement Type "tool_search_tool_search_result"constant`

  - `required string ToolUseID`

  - `JsonElement Type "tool_search_tool_result"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

### Beta Tool Search Tool Result Error

- `class BetaToolSearchToolResultError:`

  - `required ErrorCode ErrorCode`

    - `"invalid_tool_input"InvalidToolInput`

    - `"unavailable"Unavailable`

    - `"too_many_requests"TooManyRequests`

    - `"execution_time_exceeded"ExecutionTimeExceeded`

  - `required string? ErrorMessage`

  - `JsonElement Type "tool_search_tool_result_error"constant`

### Beta Tool Search Tool Result Error Param

- `class BetaToolSearchToolResultErrorParam:`

  - `required ErrorCode ErrorCode`

    - `"invalid_tool_input"InvalidToolInput`

    - `"unavailable"Unavailable`

    - `"too_many_requests"TooManyRequests`

    - `"execution_time_exceeded"ExecutionTimeExceeded`

  - `JsonElement Type "tool_search_tool_result_error"constant`

### Beta Tool Search Tool Search Result Block

- `class BetaToolSearchToolSearchResultBlock:`

  - `required IReadOnlyList<BetaToolReferenceBlock> ToolReferences`

    - `required string ToolName`

    - `JsonElement Type "tool_reference"constant`

  - `JsonElement Type "tool_search_tool_search_result"constant`

### Beta Tool Search Tool Search Result Block Param

- `class BetaToolSearchToolSearchResultBlockParam:`

  - `required IReadOnlyList<BetaToolReferenceBlockParam> ToolReferences`

    - `required string ToolName`

    - `JsonElement Type "tool_reference"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

      - `JsonElement Type "ephemeral"constant`

      - `Ttl Ttl`

        The time-to-live for the cache control breakpoint.

        This may be one the following values:

        - `5m`: 5 minutes
        - `1h`: 1 hour

        Defaults to `5m`.

        - `"5m"Ttl5m`

        - `"1h"Ttl1h`

  - `JsonElement Type "tool_search_tool_search_result"constant`

### Beta Tool Text Editor 20241022

- `class BetaToolTextEditor20241022:`

  - `JsonElement Name "str_replace_editor"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "text_editor_20241022"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Tool Text Editor 20250124

- `class BetaToolTextEditor20250124:`

  - `JsonElement Name "str_replace_editor"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "text_editor_20250124"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Tool Text Editor 20250429

- `class BetaToolTextEditor20250429:`

  - `JsonElement Name "str_replace_based_edit_tool"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "text_editor_20250429"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Tool Text Editor 20250728

- `class BetaToolTextEditor20250728:`

  - `JsonElement Name "str_replace_based_edit_tool"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "text_editor_20250728"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

  - `Long? MaxCharacters`

    Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Tool Union

- `class BetaToolUnion: A class that can be one of several variants.union`

  Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).

  - `class BetaTool:`

    - `required InputSchema InputSchema`

      [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.

      This defines the shape of the `input` that your tool accepts and that the model will produce.

      - `JsonElement Type "object"constant`

      - `IReadOnlyDictionary<string, JsonElement>? Properties`

      - `IReadOnlyList<string>? Required`

    - `required string Name`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

      - `JsonElement Type "ephemeral"constant`

      - `Ttl Ttl`

        The time-to-live for the cache control breakpoint.

        This may be one the following values:

        - `5m`: 5 minutes
        - `1h`: 1 hour

        Defaults to `5m`.

        - `"5m"Ttl5m`

        - `"1h"Ttl1h`

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `string Description`

      Description of what this tool does.

      Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.

    - `Boolean? EagerInputStreaming`

      Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers.

    - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

    - `Type? Type`

      - `"custom"Custom`

  - `class BetaToolBash20241022:`

    - `JsonElement Name "bash"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "bash_20241022"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaToolBash20250124:`

    - `JsonElement Name "bash"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "bash_20250124"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaCodeExecutionTool20250522:`

    - `JsonElement Name "code_execution"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "code_execution_20250522"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaCodeExecutionTool20250825:`

    - `JsonElement Name "code_execution"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "code_execution_20250825"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaCodeExecutionTool20260120:`

    Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).

    - `JsonElement Name "code_execution"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "code_execution_20260120"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaToolComputerUse20241022:`

    - `required Long DisplayHeightPx`

      The height of the display in pixels.

    - `required Long DisplayWidthPx`

      The width of the display in pixels.

    - `JsonElement Name "computer"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "computer_20241022"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Long? DisplayNumber`

      The X11 display number (e.g. 0, 1) for the display.

    - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaMemoryTool20250818:`

    - `JsonElement Name "memory"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "memory_20250818"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaToolComputerUse20250124:`

    - `required Long DisplayHeightPx`

      The height of the display in pixels.

    - `required Long DisplayWidthPx`

      The width of the display in pixels.

    - `JsonElement Name "computer"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "computer_20250124"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Long? DisplayNumber`

      The X11 display number (e.g. 0, 1) for the display.

    - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaToolTextEditor20241022:`

    - `JsonElement Name "str_replace_editor"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "text_editor_20241022"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaToolComputerUse20251124:`

    - `required Long DisplayHeightPx`

      The height of the display in pixels.

    - `required Long DisplayWidthPx`

      The width of the display in pixels.

    - `JsonElement Name "computer"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "computer_20251124"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Long? DisplayNumber`

      The X11 display number (e.g. 0, 1) for the display.

    - `Boolean EnableZoom`

      Whether to enable an action to take a zoomed-in screenshot of the screen.

    - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaToolTextEditor20250124:`

    - `JsonElement Name "str_replace_editor"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "text_editor_20250124"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaToolTextEditor20250429:`

    - `JsonElement Name "str_replace_based_edit_tool"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "text_editor_20250429"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaToolTextEditor20250728:`

    - `JsonElement Name "str_replace_based_edit_tool"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "text_editor_20250728"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

    - `Long? MaxCharacters`

      Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaWebSearchTool20250305:`

    - `JsonElement Name "web_search"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "web_search_20250305"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `IReadOnlyList<string>? AllowedDomains`

      If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.

    - `IReadOnlyList<string>? BlockedDomains`

      If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Long? MaxUses`

      Maximum number of times the tool can be used in the API request.

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

    - `BetaUserLocation? UserLocation`

      Parameters for the user's location. Used to provide more relevant search results.

      - `JsonElement Type "approximate"constant`

      - `string? City`

        The city of the user.

      - `string? Country`

        The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.

      - `string? Region`

        The region of the user.

      - `string? Timezone`

        The [IANA timezone](https://nodatime.org/TimeZones) of the user.

  - `class BetaWebFetchTool20250910:`

    - `JsonElement Name "web_fetch"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "web_fetch_20250910"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `IReadOnlyList<string>? AllowedDomains`

      List of domains to allow fetching from

    - `IReadOnlyList<string>? BlockedDomains`

      List of domains to block fetching from

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `BetaCitationsConfigParam? Citations`

      Citations configuration for fetched documents. Citations are disabled by default.

      - `Boolean Enabled`

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Long? MaxContentTokens`

      Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

    - `Long? MaxUses`

      Maximum number of times the tool can be used in the API request.

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaWebSearchTool20260209:`

    - `JsonElement Name "web_search"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "web_search_20260209"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `IReadOnlyList<string>? AllowedDomains`

      If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.

    - `IReadOnlyList<string>? BlockedDomains`

      If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Long? MaxUses`

      Maximum number of times the tool can be used in the API request.

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

    - `BetaUserLocation? UserLocation`

      Parameters for the user's location. Used to provide more relevant search results.

  - `class BetaWebFetchTool20260209:`

    - `JsonElement Name "web_fetch"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "web_fetch_20260209"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `IReadOnlyList<string>? AllowedDomains`

      List of domains to allow fetching from

    - `IReadOnlyList<string>? BlockedDomains`

      List of domains to block fetching from

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `BetaCitationsConfigParam? Citations`

      Citations configuration for fetched documents. Citations are disabled by default.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Long? MaxContentTokens`

      Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

    - `Long? MaxUses`

      Maximum number of times the tool can be used in the API request.

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaWebFetchTool20260309:`

    Web fetch tool with use_cache parameter for bypassing cached content.

    - `JsonElement Name "web_fetch"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "web_fetch_20260309"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `IReadOnlyList<string>? AllowedDomains`

      List of domains to allow fetching from

    - `IReadOnlyList<string>? BlockedDomains`

      List of domains to block fetching from

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `BetaCitationsConfigParam? Citations`

      Citations configuration for fetched documents. Citations are disabled by default.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Long? MaxContentTokens`

      Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

    - `Long? MaxUses`

      Maximum number of times the tool can be used in the API request.

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

    - `Boolean UseCache`

      Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.

  - `class BetaAdvisorTool20260301:`

    - `required Model Model`

      The model that will complete your prompt.

      See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

      - `"claude-opus-4-8"ClaudeOpus4_8`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-7"ClaudeOpus4_7`

        Frontier intelligence for long-running agents and coding

      - `"claude-mythos-preview"ClaudeMythosPreview`

        New class of intelligence, strongest in coding and cybersecurity

      - `"claude-opus-4-6"ClaudeOpus4_6`

        Frontier intelligence for long-running agents and coding

      - `"claude-sonnet-4-6"ClaudeSonnet4_6`

        Best combination of speed and intelligence

      - `"claude-haiku-4-5"ClaudeHaiku4_5`

        Fastest model with near-frontier intelligence

      - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

        Fastest model with near-frontier intelligence

      - `"claude-opus-4-5"ClaudeOpus4_5`

        Premium model combining maximum intelligence with practical performance

      - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

        Premium model combining maximum intelligence with practical performance

      - `"claude-sonnet-4-5"ClaudeSonnet4_5`

        High-performance model for agents and coding

      - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

        High-performance model for agents and coding

      - `"claude-opus-4-1"ClaudeOpus4_1`

        Exceptional model for specialized complex tasks

      - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

        Exceptional model for specialized complex tasks

      - `"claude-opus-4-0"ClaudeOpus4_0`

        Powerful model for complex tasks

      - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

        Powerful model for complex tasks

      - `"claude-sonnet-4-0"ClaudeSonnet4_0`

        High-performance model with extended thinking

      - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

        High-performance model with extended thinking

      - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

        Fast and cost-effective model

    - `JsonElement Name "advisor"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `JsonElement Type "advisor_20260301"constant`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `BetaCacheControlEphemeral? Caching`

      Caching for the advisor's own prompt. When set, each advisor call writes a cache entry at the given TTL so subsequent calls in the same conversation read the stable prefix. When omitted, the advisor prompt is not cached.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Long? MaxUses`

      Maximum number of times the tool can be used in the API request.

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaToolSearchToolBm25_20251119:`

    - `JsonElement Name "tool_search_tool_bm25"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `required Type Type`

      - `"tool_search_tool_bm25_20251119"ToolSearchToolBm25_20251119`

      - `"tool_search_tool_bm25"ToolSearchToolBm25`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaToolSearchToolRegex20251119:`

    - `JsonElement Name "tool_search_tool_regex"constant`

      Name of the tool.

      This is how the tool will be called by the model and in `tool_use` blocks.

    - `required Type Type`

      - `"tool_search_tool_regex_20251119"ToolSearchToolRegex20251119`

      - `"tool_search_tool_regex"ToolSearchToolRegex`

    - `IReadOnlyList<AllowedCaller> AllowedCallers`

      - `"direct"Direct`

      - `"code_execution_20250825"CodeExecution20250825`

      - `"code_execution_20260120"CodeExecution20260120`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `Boolean DeferLoading`

      If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    - `Boolean Strict`

      When true, guarantees schema validation on tool names and inputs

  - `class BetaMcpToolset:`

    Configuration for a group of tools from an MCP server.

    Allows configuring enabled status and defer_loading for all tools
    from an MCP server, with optional per-tool overrides.

    - `required string McpServerName`

      Name of the MCP server to configure tools for

    - `JsonElement Type "mcp_toolset"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `IReadOnlyDictionary<string, BetaMcpToolConfig>? Configs`

      Configuration overrides for specific tools, keyed by tool name

      - `Boolean DeferLoading`

      - `Boolean Enabled`

    - `BetaMcpToolDefaultConfig DefaultConfig`

      Default configuration applied to all tools from this server

      - `Boolean DeferLoading`

      - `Boolean Enabled`

### Beta Tool Use Block

- `class BetaToolUseBlock:`

  - `required string ID`

  - `required IReadOnlyDictionary<string, JsonElement> Input`

  - `required string Name`

  - `JsonElement Type "tool_use"constant`

  - `Caller Caller`

    Tool invocation directly from the model.

    - `class BetaDirectCaller:`

      Tool invocation directly from the model.

      - `JsonElement Type "direct"constant`

    - `class BetaServerToolCaller:`

      Tool invocation generated by a server-side tool.

      - `required string ToolID`

      - `JsonElement Type "code_execution_20250825"constant`

    - `class BetaServerToolCaller20260120:`

      - `required string ToolID`

      - `JsonElement Type "code_execution_20260120"constant`

### Beta Tool Use Block Param

- `class BetaToolUseBlockParam:`

  - `required string ID`

  - `required IReadOnlyDictionary<string, JsonElement> Input`

  - `required string Name`

  - `JsonElement Type "tool_use"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Caller Caller`

    Tool invocation directly from the model.

    - `class BetaDirectCaller:`

      Tool invocation directly from the model.

      - `JsonElement Type "direct"constant`

    - `class BetaServerToolCaller:`

      Tool invocation generated by a server-side tool.

      - `required string ToolID`

      - `JsonElement Type "code_execution_20250825"constant`

    - `class BetaServerToolCaller20260120:`

      - `required string ToolID`

      - `JsonElement Type "code_execution_20260120"constant`

### Beta Tool Uses Keep

- `class BetaToolUsesKeep:`

  - `JsonElement Type "tool_uses"constant`

  - `required Long Value`

### Beta Tool Uses Trigger

- `class BetaToolUsesTrigger:`

  - `JsonElement Type "tool_uses"constant`

  - `required Long Value`

### Beta URL Image Source

- `class BetaUrlImageSource:`

  - `JsonElement Type "url"constant`

  - `required string Url`

### Beta URL PDF Source

- `class BetaUrlPdfSource:`

  - `JsonElement Type "url"constant`

  - `required string Url`

### Beta Usage

- `class BetaUsage:`

  - `required BetaCacheCreation? CacheCreation`

    Breakdown of cached tokens by TTL

    - `required Long Ephemeral1hInputTokens`

      The number of input tokens used to create the 1 hour cache entry.

    - `required Long Ephemeral5mInputTokens`

      The number of input tokens used to create the 5 minute cache entry.

  - `required Long? CacheCreationInputTokens`

    The number of input tokens used to create the cache entry.

  - `required Long? CacheReadInputTokens`

    The number of input tokens read from the cache.

  - `required string? InferenceGeo`

    The geographic region where inference was performed for this request.

  - `required Long InputTokens`

    The number of input tokens which were used.

  - `required IReadOnlyList<BetaIterationsUsageItems>? Iterations`

    Per-iteration token usage breakdown.

    Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:

    - Determine which iterations exceeded long context thresholds (>=200k tokens)
    - Calculate the true context window size from the last iteration
    - Understand token accumulation across server-side tool use loops

    - `class BetaMessageIterationUsage:`

      Token usage for a sampling iteration.

      - `required BetaCacheCreation? CacheCreation`

        Breakdown of cached tokens by TTL

      - `required Long CacheCreationInputTokens`

        The number of input tokens used to create the cache entry.

      - `required Long CacheReadInputTokens`

        The number of input tokens read from the cache.

      - `required Long InputTokens`

        The number of input tokens which were used.

      - `required Long OutputTokens`

        The number of output tokens which were used.

      - `JsonElement Type "message"constant`

        Usage for a sampling iteration

    - `class BetaCompactionIterationUsage:`

      Token usage for a compaction iteration.

      - `required BetaCacheCreation? CacheCreation`

        Breakdown of cached tokens by TTL

      - `required Long CacheCreationInputTokens`

        The number of input tokens used to create the cache entry.

      - `required Long CacheReadInputTokens`

        The number of input tokens read from the cache.

      - `required Long InputTokens`

        The number of input tokens which were used.

      - `required Long OutputTokens`

        The number of output tokens which were used.

      - `JsonElement Type "compaction"constant`

        Usage for a compaction iteration

    - `class BetaAdvisorMessageIterationUsage:`

      Token usage for an advisor sub-inference iteration.

      - `required BetaCacheCreation? CacheCreation`

        Breakdown of cached tokens by TTL

      - `required Long CacheCreationInputTokens`

        The number of input tokens used to create the cache entry.

      - `required Long CacheReadInputTokens`

        The number of input tokens read from the cache.

      - `required Long InputTokens`

        The number of input tokens which were used.

      - `required Model Model`

        The model that will complete your prompt.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-mythos-preview"ClaudeMythosPreview`

          New class of intelligence, strongest in coding and cybersecurity

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Frontier intelligence for long-running agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

        - `"claude-opus-4-1"ClaudeOpus4_1`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-0"ClaudeOpus4_0`

          Powerful model for complex tasks

        - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

          Powerful model for complex tasks

        - `"claude-sonnet-4-0"ClaudeSonnet4_0`

          High-performance model with extended thinking

        - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

          High-performance model with extended thinking

        - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

          Fast and cost-effective model

      - `required Long OutputTokens`

        The number of output tokens which were used.

      - `JsonElement Type "advisor_message"constant`

        Usage for an advisor sub-inference iteration

  - `required Long OutputTokens`

    The number of output tokens which were used.

  - `required BetaOutputTokensDetails? OutputTokensDetails`

    Breakdown of output tokens by category.

    `output_tokens` remains the inclusive, authoritative total used for billing.
    This object provides a read-only decomposition for observability — for example,
    how many of the billed output tokens were spent on internal reasoning that may
    have been summarized before being returned to you.

    - `required Long ThinkingTokens`

      Number of output tokens the model generated as internal reasoning, including
      the thinking-block delimiter tokens.

      Reflects the raw reasoning the model produced, not the (possibly shorter)
      summarized thinking text returned in the response body. Computed by
      re-tokenizing the raw reasoning text, so it may differ from the model's exact
      generation count by a small number of tokens. Always ≤ `output_tokens`;
      `output_tokens - thinking_tokens` approximates the non-reasoning output.

  - `required BetaServerToolUsage? ServerToolUse`

    The number of server tool requests.

    - `required Long WebFetchRequests`

      The number of web fetch tool requests.

    - `required Long WebSearchRequests`

      The number of web search tool requests.

  - `required ServiceTier? ServiceTier`

    If the request used the priority, standard, or batch tier.

    - `"standard"Standard`

    - `"priority"Priority`

    - `"batch"Batch`

  - `required Speed? Speed`

    The inference speed mode used for this request.

    - `"standard"Standard`

    - `"fast"Fast`

### Beta User Location

- `class BetaUserLocation:`

  - `JsonElement Type "approximate"constant`

  - `string? City`

    The city of the user.

  - `string? Country`

    The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.

  - `string? Region`

    The region of the user.

  - `string? Timezone`

    The [IANA timezone](https://nodatime.org/TimeZones) of the user.

### Beta Web Fetch Block

- `class BetaWebFetchBlock:`

  - `required BetaDocumentBlock Content`

    - `required BetaCitationConfig? Citations`

      Citation configuration for the document

      - `required Boolean Enabled`

    - `required Source Source`

      - `class BetaBase64PdfSource:`

        - `required string Data`

        - `JsonElement MediaType "application/pdf"constant`

        - `JsonElement Type "base64"constant`

      - `class BetaPlainTextSource:`

        - `required string Data`

        - `JsonElement MediaType "text/plain"constant`

        - `JsonElement Type "text"constant`

    - `required string? Title`

      The title of the document

    - `JsonElement Type "document"constant`

  - `required string? RetrievedAt`

    ISO 8601 timestamp when the content was retrieved

  - `JsonElement Type "web_fetch_result"constant`

  - `required string Url`

    Fetched content URL

### Beta Web Fetch Block Param

- `class BetaWebFetchBlockParam:`

  - `required BetaRequestDocumentBlock Content`

    - `required Source Source`

      - `class BetaBase64PdfSource:`

        - `required string Data`

        - `JsonElement MediaType "application/pdf"constant`

        - `JsonElement Type "base64"constant`

      - `class BetaPlainTextSource:`

        - `required string Data`

        - `JsonElement MediaType "text/plain"constant`

        - `JsonElement Type "text"constant`

      - `class BetaContentBlockSource:`

        - `required Content Content`

          - `string`

          - `IReadOnlyList<BetaContentBlockSourceContent>`

            - `class BetaTextBlockParam:`

              - `required string Text`

              - `JsonElement Type "text"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

                - `JsonElement Type "ephemeral"constant`

                - `Ttl Ttl`

                  The time-to-live for the cache control breakpoint.

                  This may be one the following values:

                  - `5m`: 5 minutes
                  - `1h`: 1 hour

                  Defaults to `5m`.

                  - `"5m"Ttl5m`

                  - `"1h"Ttl1h`

              - `IReadOnlyList<BetaTextCitationParam>? Citations`

                - `class BetaCitationCharLocationParam:`

                  - `required string CitedText`

                  - `required Long DocumentIndex`

                  - `required string? DocumentTitle`

                  - `required Long EndCharIndex`

                  - `required Long StartCharIndex`

                  - `JsonElement Type "char_location"constant`

                - `class BetaCitationPageLocationParam:`

                  - `required string CitedText`

                  - `required Long DocumentIndex`

                  - `required string? DocumentTitle`

                  - `required Long EndPageNumber`

                  - `required Long StartPageNumber`

                  - `JsonElement Type "page_location"constant`

                - `class BetaCitationContentBlockLocationParam:`

                  - `required string CitedText`

                    The full text of the cited block range, concatenated.

                    Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                  - `required Long DocumentIndex`

                  - `required string? DocumentTitle`

                  - `required Long EndBlockIndex`

                    Exclusive 0-based end index of the cited block range in the source's `content` array.

                    Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                  - `required Long StartBlockIndex`

                    0-based index of the first cited block in the source's `content` array.

                  - `JsonElement Type "content_block_location"constant`

                - `class BetaCitationWebSearchResultLocationParam:`

                  - `required string CitedText`

                  - `required string EncryptedIndex`

                  - `required string? Title`

                  - `JsonElement Type "web_search_result_location"constant`

                  - `required string Url`

                - `class BetaCitationSearchResultLocationParam:`

                  - `required string CitedText`

                    The full text of the cited block range, concatenated.

                    Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                  - `required Long EndBlockIndex`

                    Exclusive 0-based end index of the cited block range in the source's `content` array.

                    Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                  - `required Long SearchResultIndex`

                    0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

                    Counted separately from `document_index`; server-side web search results are not included in this count.

                  - `required string Source`

                  - `required Long StartBlockIndex`

                    0-based index of the first cited block in the source's `content` array.

                  - `required string? Title`

                  - `JsonElement Type "search_result_location"constant`

            - `class BetaImageBlockParam:`

              - `required Source Source`

                - `class BetaBase64ImageSource:`

                  - `required string Data`

                  - `required MediaType MediaType`

                    - `"image/jpeg"ImageJpeg`

                    - `"image/png"ImagePng`

                    - `"image/gif"ImageGif`

                    - `"image/webp"ImageWebP`

                  - `JsonElement Type "base64"constant`

                - `class BetaUrlImageSource:`

                  - `JsonElement Type "url"constant`

                  - `required string Url`

                - `class BetaFileImageSource:`

                  - `required string FileID`

                  - `JsonElement Type "file"constant`

              - `JsonElement Type "image"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

        - `JsonElement Type "content"constant`

      - `class BetaUrlPdfSource:`

        - `JsonElement Type "url"constant`

        - `required string Url`

      - `class BetaFileDocumentSource:`

        - `required string FileID`

        - `JsonElement Type "file"constant`

    - `JsonElement Type "document"constant`

    - `BetaCacheControlEphemeral? CacheControl`

      Create a cache control breakpoint at this content block.

    - `BetaCitationsConfigParam? Citations`

      - `Boolean Enabled`

    - `string? Context`

    - `string? Title`

  - `JsonElement Type "web_fetch_result"constant`

  - `required string Url`

    Fetched content URL

  - `string? RetrievedAt`

    ISO 8601 timestamp when the content was retrieved

### Beta Web Fetch Tool 20250910

- `class BetaWebFetchTool20250910:`

  - `JsonElement Name "web_fetch"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "web_fetch_20250910"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `IReadOnlyList<string>? AllowedDomains`

    List of domains to allow fetching from

  - `IReadOnlyList<string>? BlockedDomains`

    List of domains to block fetching from

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `BetaCitationsConfigParam? Citations`

    Citations configuration for fetched documents. Citations are disabled by default.

    - `Boolean Enabled`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Long? MaxContentTokens`

    Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

  - `Long? MaxUses`

    Maximum number of times the tool can be used in the API request.

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Web Fetch Tool 20260209

- `class BetaWebFetchTool20260209:`

  - `JsonElement Name "web_fetch"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "web_fetch_20260209"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `IReadOnlyList<string>? AllowedDomains`

    List of domains to allow fetching from

  - `IReadOnlyList<string>? BlockedDomains`

    List of domains to block fetching from

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `BetaCitationsConfigParam? Citations`

    Citations configuration for fetched documents. Citations are disabled by default.

    - `Boolean Enabled`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Long? MaxContentTokens`

    Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

  - `Long? MaxUses`

    Maximum number of times the tool can be used in the API request.

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

### Beta Web Fetch Tool 20260309

- `class BetaWebFetchTool20260309:`

  Web fetch tool with use_cache parameter for bypassing cached content.

  - `JsonElement Name "web_fetch"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "web_fetch_20260309"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `IReadOnlyList<string>? AllowedDomains`

    List of domains to allow fetching from

  - `IReadOnlyList<string>? BlockedDomains`

    List of domains to block fetching from

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `BetaCitationsConfigParam? Citations`

    Citations configuration for fetched documents. Citations are disabled by default.

    - `Boolean Enabled`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Long? MaxContentTokens`

    Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

  - `Long? MaxUses`

    Maximum number of times the tool can be used in the API request.

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

  - `Boolean UseCache`

    Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.

### Beta Web Fetch Tool Result Block

- `class BetaWebFetchToolResultBlock:`

  - `required Content Content`

    - `class BetaWebFetchToolResultErrorBlock:`

      - `required BetaWebFetchToolResultErrorCode ErrorCode`

        - `"invalid_tool_input"InvalidToolInput`

        - `"url_too_long"UrlTooLong`

        - `"url_not_allowed"UrlNotAllowed`

        - `"url_not_in_prior_context"UrlNotInPriorContext`

        - `"url_not_accessible"UrlNotAccessible`

        - `"unsupported_content_type"UnsupportedContentType`

        - `"too_many_requests"TooManyRequests`

        - `"max_uses_exceeded"MaxUsesExceeded`

        - `"unavailable"Unavailable`

      - `JsonElement Type "web_fetch_tool_result_error"constant`

    - `class BetaWebFetchBlock:`

      - `required BetaDocumentBlock Content`

        - `required BetaCitationConfig? Citations`

          Citation configuration for the document

          - `required Boolean Enabled`

        - `required Source Source`

          - `class BetaBase64PdfSource:`

            - `required string Data`

            - `JsonElement MediaType "application/pdf"constant`

            - `JsonElement Type "base64"constant`

          - `class BetaPlainTextSource:`

            - `required string Data`

            - `JsonElement MediaType "text/plain"constant`

            - `JsonElement Type "text"constant`

        - `required string? Title`

          The title of the document

        - `JsonElement Type "document"constant`

      - `required string? RetrievedAt`

        ISO 8601 timestamp when the content was retrieved

      - `JsonElement Type "web_fetch_result"constant`

      - `required string Url`

        Fetched content URL

  - `required string ToolUseID`

  - `JsonElement Type "web_fetch_tool_result"constant`

  - `Caller Caller`

    Tool invocation directly from the model.

    - `class BetaDirectCaller:`

      Tool invocation directly from the model.

      - `JsonElement Type "direct"constant`

    - `class BetaServerToolCaller:`

      Tool invocation generated by a server-side tool.

      - `required string ToolID`

      - `JsonElement Type "code_execution_20250825"constant`

    - `class BetaServerToolCaller20260120:`

      - `required string ToolID`

      - `JsonElement Type "code_execution_20260120"constant`

### Beta Web Fetch Tool Result Block Param

- `class BetaWebFetchToolResultBlockParam:`

  - `required Content Content`

    - `class BetaWebFetchToolResultErrorBlockParam:`

      - `required BetaWebFetchToolResultErrorCode ErrorCode`

        - `"invalid_tool_input"InvalidToolInput`

        - `"url_too_long"UrlTooLong`

        - `"url_not_allowed"UrlNotAllowed`

        - `"url_not_in_prior_context"UrlNotInPriorContext`

        - `"url_not_accessible"UrlNotAccessible`

        - `"unsupported_content_type"UnsupportedContentType`

        - `"too_many_requests"TooManyRequests`

        - `"max_uses_exceeded"MaxUsesExceeded`

        - `"unavailable"Unavailable`

      - `JsonElement Type "web_fetch_tool_result_error"constant`

    - `class BetaWebFetchBlockParam:`

      - `required BetaRequestDocumentBlock Content`

        - `required Source Source`

          - `class BetaBase64PdfSource:`

            - `required string Data`

            - `JsonElement MediaType "application/pdf"constant`

            - `JsonElement Type "base64"constant`

          - `class BetaPlainTextSource:`

            - `required string Data`

            - `JsonElement MediaType "text/plain"constant`

            - `JsonElement Type "text"constant`

          - `class BetaContentBlockSource:`

            - `required Content Content`

              - `string`

              - `IReadOnlyList<BetaContentBlockSourceContent>`

                - `class BetaTextBlockParam:`

                  - `required string Text`

                  - `JsonElement Type "text"constant`

                  - `BetaCacheControlEphemeral? CacheControl`

                    Create a cache control breakpoint at this content block.

                    - `JsonElement Type "ephemeral"constant`

                    - `Ttl Ttl`

                      The time-to-live for the cache control breakpoint.

                      This may be one the following values:

                      - `5m`: 5 minutes
                      - `1h`: 1 hour

                      Defaults to `5m`.

                      - `"5m"Ttl5m`

                      - `"1h"Ttl1h`

                  - `IReadOnlyList<BetaTextCitationParam>? Citations`

                    - `class BetaCitationCharLocationParam:`

                      - `required string CitedText`

                      - `required Long DocumentIndex`

                      - `required string? DocumentTitle`

                      - `required Long EndCharIndex`

                      - `required Long StartCharIndex`

                      - `JsonElement Type "char_location"constant`

                    - `class BetaCitationPageLocationParam:`

                      - `required string CitedText`

                      - `required Long DocumentIndex`

                      - `required string? DocumentTitle`

                      - `required Long EndPageNumber`

                      - `required Long StartPageNumber`

                      - `JsonElement Type "page_location"constant`

                    - `class BetaCitationContentBlockLocationParam:`

                      - `required string CitedText`

                        The full text of the cited block range, concatenated.

                        Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                      - `required Long DocumentIndex`

                      - `required string? DocumentTitle`

                      - `required Long EndBlockIndex`

                        Exclusive 0-based end index of the cited block range in the source's `content` array.

                        Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                      - `required Long StartBlockIndex`

                        0-based index of the first cited block in the source's `content` array.

                      - `JsonElement Type "content_block_location"constant`

                    - `class BetaCitationWebSearchResultLocationParam:`

                      - `required string CitedText`

                      - `required string EncryptedIndex`

                      - `required string? Title`

                      - `JsonElement Type "web_search_result_location"constant`

                      - `required string Url`

                    - `class BetaCitationSearchResultLocationParam:`

                      - `required string CitedText`

                        The full text of the cited block range, concatenated.

                        Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                      - `required Long EndBlockIndex`

                        Exclusive 0-based end index of the cited block range in the source's `content` array.

                        Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                      - `required Long SearchResultIndex`

                        0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

                        Counted separately from `document_index`; server-side web search results are not included in this count.

                      - `required string Source`

                      - `required Long StartBlockIndex`

                        0-based index of the first cited block in the source's `content` array.

                      - `required string? Title`

                      - `JsonElement Type "search_result_location"constant`

                - `class BetaImageBlockParam:`

                  - `required Source Source`

                    - `class BetaBase64ImageSource:`

                      - `required string Data`

                      - `required MediaType MediaType`

                        - `"image/jpeg"ImageJpeg`

                        - `"image/png"ImagePng`

                        - `"image/gif"ImageGif`

                        - `"image/webp"ImageWebP`

                      - `JsonElement Type "base64"constant`

                    - `class BetaUrlImageSource:`

                      - `JsonElement Type "url"constant`

                      - `required string Url`

                    - `class BetaFileImageSource:`

                      - `required string FileID`

                      - `JsonElement Type "file"constant`

                  - `JsonElement Type "image"constant`

                  - `BetaCacheControlEphemeral? CacheControl`

                    Create a cache control breakpoint at this content block.

            - `JsonElement Type "content"constant`

          - `class BetaUrlPdfSource:`

            - `JsonElement Type "url"constant`

            - `required string Url`

          - `class BetaFileDocumentSource:`

            - `required string FileID`

            - `JsonElement Type "file"constant`

        - `JsonElement Type "document"constant`

        - `BetaCacheControlEphemeral? CacheControl`

          Create a cache control breakpoint at this content block.

        - `BetaCitationsConfigParam? Citations`

          - `Boolean Enabled`

        - `string? Context`

        - `string? Title`

      - `JsonElement Type "web_fetch_result"constant`

      - `required string Url`

        Fetched content URL

      - `string? RetrievedAt`

        ISO 8601 timestamp when the content was retrieved

  - `required string ToolUseID`

  - `JsonElement Type "web_fetch_tool_result"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

  - `Caller Caller`

    Tool invocation directly from the model.

    - `class BetaDirectCaller:`

      Tool invocation directly from the model.

      - `JsonElement Type "direct"constant`

    - `class BetaServerToolCaller:`

      Tool invocation generated by a server-side tool.

      - `required string ToolID`

      - `JsonElement Type "code_execution_20250825"constant`

    - `class BetaServerToolCaller20260120:`

      - `required string ToolID`

      - `JsonElement Type "code_execution_20260120"constant`

### Beta Web Fetch Tool Result Error Block

- `class BetaWebFetchToolResultErrorBlock:`

  - `required BetaWebFetchToolResultErrorCode ErrorCode`

    - `"invalid_tool_input"InvalidToolInput`

    - `"url_too_long"UrlTooLong`

    - `"url_not_allowed"UrlNotAllowed`

    - `"url_not_in_prior_context"UrlNotInPriorContext`

    - `"url_not_accessible"UrlNotAccessible`

    - `"unsupported_content_type"UnsupportedContentType`

    - `"too_many_requests"TooManyRequests`

    - `"max_uses_exceeded"MaxUsesExceeded`

    - `"unavailable"Unavailable`

  - `JsonElement Type "web_fetch_tool_result_error"constant`

### Beta Web Fetch Tool Result Error Block Param

- `class BetaWebFetchToolResultErrorBlockParam:`

  - `required BetaWebFetchToolResultErrorCode ErrorCode`

    - `"invalid_tool_input"InvalidToolInput`

    - `"url_too_long"UrlTooLong`

    - `"url_not_allowed"UrlNotAllowed`

    - `"url_not_in_prior_context"UrlNotInPriorContext`

    - `"url_not_accessible"UrlNotAccessible`

    - `"unsupported_content_type"UnsupportedContentType`

    - `"too_many_requests"TooManyRequests`

    - `"max_uses_exceeded"MaxUsesExceeded`

    - `"unavailable"Unavailable`

  - `JsonElement Type "web_fetch_tool_result_error"constant`

### Beta Web Fetch Tool Result Error Code

- `enum BetaWebFetchToolResultErrorCode:`

  - `"invalid_tool_input"InvalidToolInput`

  - `"url_too_long"UrlTooLong`

  - `"url_not_allowed"UrlNotAllowed`

  - `"url_not_in_prior_context"UrlNotInPriorContext`

  - `"url_not_accessible"UrlNotAccessible`

  - `"unsupported_content_type"UnsupportedContentType`

  - `"too_many_requests"TooManyRequests`

  - `"max_uses_exceeded"MaxUsesExceeded`

  - `"unavailable"Unavailable`

### Beta Web Search Result Block

- `class BetaWebSearchResultBlock:`

  - `required string EncryptedContent`

  - `required string? PageAge`

  - `required string Title`

  - `JsonElement Type "web_search_result"constant`

  - `required string Url`

### Beta Web Search Result Block Param

- `class BetaWebSearchResultBlockParam:`

  - `required string EncryptedContent`

  - `required string Title`

  - `JsonElement Type "web_search_result"constant`

  - `required string Url`

  - `string? PageAge`

### Beta Web Search Tool 20250305

- `class BetaWebSearchTool20250305:`

  - `JsonElement Name "web_search"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "web_search_20250305"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `IReadOnlyList<string>? AllowedDomains`

    If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.

  - `IReadOnlyList<string>? BlockedDomains`

    If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Long? MaxUses`

    Maximum number of times the tool can be used in the API request.

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

  - `BetaUserLocation? UserLocation`

    Parameters for the user's location. Used to provide more relevant search results.

    - `JsonElement Type "approximate"constant`

    - `string? City`

      The city of the user.

    - `string? Country`

      The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.

    - `string? Region`

      The region of the user.

    - `string? Timezone`

      The [IANA timezone](https://nodatime.org/TimeZones) of the user.

### Beta Web Search Tool 20260209

- `class BetaWebSearchTool20260209:`

  - `JsonElement Name "web_search"constant`

    Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.

  - `JsonElement Type "web_search_20260209"constant`

  - `IReadOnlyList<AllowedCaller> AllowedCallers`

    - `"direct"Direct`

    - `"code_execution_20250825"CodeExecution20250825`

    - `"code_execution_20260120"CodeExecution20260120`

  - `IReadOnlyList<string>? AllowedDomains`

    If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.

  - `IReadOnlyList<string>? BlockedDomains`

    If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Boolean DeferLoading`

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

  - `Long? MaxUses`

    Maximum number of times the tool can be used in the API request.

  - `Boolean Strict`

    When true, guarantees schema validation on tool names and inputs

  - `BetaUserLocation? UserLocation`

    Parameters for the user's location. Used to provide more relevant search results.

    - `JsonElement Type "approximate"constant`

    - `string? City`

      The city of the user.

    - `string? Country`

      The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.

    - `string? Region`

      The region of the user.

    - `string? Timezone`

      The [IANA timezone](https://nodatime.org/TimeZones) of the user.

### Beta Web Search Tool Request Error

- `class BetaWebSearchToolRequestError:`

  - `required BetaWebSearchToolResultErrorCode ErrorCode`

    - `"invalid_tool_input"InvalidToolInput`

    - `"unavailable"Unavailable`

    - `"max_uses_exceeded"MaxUsesExceeded`

    - `"too_many_requests"TooManyRequests`

    - `"query_too_long"QueryTooLong`

    - `"request_too_large"RequestTooLarge`

  - `JsonElement Type "web_search_tool_result_error"constant`

### Beta Web Search Tool Result Block

- `class BetaWebSearchToolResultBlock:`

  - `required BetaWebSearchToolResultBlockContent Content`

    - `class BetaWebSearchToolResultError:`

      - `required BetaWebSearchToolResultErrorCode ErrorCode`

        - `"invalid_tool_input"InvalidToolInput`

        - `"unavailable"Unavailable`

        - `"max_uses_exceeded"MaxUsesExceeded`

        - `"too_many_requests"TooManyRequests`

        - `"query_too_long"QueryTooLong`

        - `"request_too_large"RequestTooLarge`

      - `JsonElement Type "web_search_tool_result_error"constant`

    - `IReadOnlyList<BetaWebSearchResultBlock>`

      - `required string EncryptedContent`

      - `required string? PageAge`

      - `required string Title`

      - `JsonElement Type "web_search_result"constant`

      - `required string Url`

  - `required string ToolUseID`

  - `JsonElement Type "web_search_tool_result"constant`

  - `Caller Caller`

    Tool invocation directly from the model.

    - `class BetaDirectCaller:`

      Tool invocation directly from the model.

      - `JsonElement Type "direct"constant`

    - `class BetaServerToolCaller:`

      Tool invocation generated by a server-side tool.

      - `required string ToolID`

      - `JsonElement Type "code_execution_20250825"constant`

    - `class BetaServerToolCaller20260120:`

      - `required string ToolID`

      - `JsonElement Type "code_execution_20260120"constant`

### Beta Web Search Tool Result Block Content

- `class BetaWebSearchToolResultBlockContent: A class that can be one of several variants.union`

  - `class BetaWebSearchToolResultError:`

    - `required BetaWebSearchToolResultErrorCode ErrorCode`

      - `"invalid_tool_input"InvalidToolInput`

      - `"unavailable"Unavailable`

      - `"max_uses_exceeded"MaxUsesExceeded`

      - `"too_many_requests"TooManyRequests`

      - `"query_too_long"QueryTooLong`

      - `"request_too_large"RequestTooLarge`

    - `JsonElement Type "web_search_tool_result_error"constant`

  - `IReadOnlyList<BetaWebSearchResultBlock>`

    - `required string EncryptedContent`

    - `required string? PageAge`

    - `required string Title`

    - `JsonElement Type "web_search_result"constant`

    - `required string Url`

### Beta Web Search Tool Result Block Param

- `class BetaWebSearchToolResultBlockParam:`

  - `required BetaWebSearchToolResultBlockParamContent Content`

    - `IReadOnlyList<BetaWebSearchResultBlockParam>`

      - `required string EncryptedContent`

      - `required string Title`

      - `JsonElement Type "web_search_result"constant`

      - `required string Url`

      - `string? PageAge`

    - `class BetaWebSearchToolRequestError:`

      - `required BetaWebSearchToolResultErrorCode ErrorCode`

        - `"invalid_tool_input"InvalidToolInput`

        - `"unavailable"Unavailable`

        - `"max_uses_exceeded"MaxUsesExceeded`

        - `"too_many_requests"TooManyRequests`

        - `"query_too_long"QueryTooLong`

        - `"request_too_large"RequestTooLarge`

      - `JsonElement Type "web_search_tool_result_error"constant`

  - `required string ToolUseID`

  - `JsonElement Type "web_search_tool_result"constant`

  - `BetaCacheControlEphemeral? CacheControl`

    Create a cache control breakpoint at this content block.

    - `JsonElement Type "ephemeral"constant`

    - `Ttl Ttl`

      The time-to-live for the cache control breakpoint.

      This may be one the following values:

      - `5m`: 5 minutes
      - `1h`: 1 hour

      Defaults to `5m`.

      - `"5m"Ttl5m`

      - `"1h"Ttl1h`

  - `Caller Caller`

    Tool invocation directly from the model.

    - `class BetaDirectCaller:`

      Tool invocation directly from the model.

      - `JsonElement Type "direct"constant`

    - `class BetaServerToolCaller:`

      Tool invocation generated by a server-side tool.

      - `required string ToolID`

      - `JsonElement Type "code_execution_20250825"constant`

    - `class BetaServerToolCaller20260120:`

      - `required string ToolID`

      - `JsonElement Type "code_execution_20260120"constant`

### Beta Web Search Tool Result Block Param Content

- `class BetaWebSearchToolResultBlockParamContent: A class that can be one of several variants.union`

  - `IReadOnlyList<BetaWebSearchResultBlockParam>`

    - `required string EncryptedContent`

    - `required string Title`

    - `JsonElement Type "web_search_result"constant`

    - `required string Url`

    - `string? PageAge`

  - `class BetaWebSearchToolRequestError:`

    - `required BetaWebSearchToolResultErrorCode ErrorCode`

      - `"invalid_tool_input"InvalidToolInput`

      - `"unavailable"Unavailable`

      - `"max_uses_exceeded"MaxUsesExceeded`

      - `"too_many_requests"TooManyRequests`

      - `"query_too_long"QueryTooLong`

      - `"request_too_large"RequestTooLarge`

    - `JsonElement Type "web_search_tool_result_error"constant`

### Beta Web Search Tool Result Error

- `class BetaWebSearchToolResultError:`

  - `required BetaWebSearchToolResultErrorCode ErrorCode`

    - `"invalid_tool_input"InvalidToolInput`

    - `"unavailable"Unavailable`

    - `"max_uses_exceeded"MaxUsesExceeded`

    - `"too_many_requests"TooManyRequests`

    - `"query_too_long"QueryTooLong`

    - `"request_too_large"RequestTooLarge`

  - `JsonElement Type "web_search_tool_result_error"constant`

### Beta Web Search Tool Result Error Code

- `enum BetaWebSearchToolResultErrorCode:`

  - `"invalid_tool_input"InvalidToolInput`

  - `"unavailable"Unavailable`

  - `"max_uses_exceeded"MaxUsesExceeded`

  - `"too_many_requests"TooManyRequests`

  - `"query_too_long"QueryTooLong`

  - `"request_too_large"RequestTooLarge`

# Batches

## Create a Message Batch

`BetaMessageBatch Beta.Messages.Batches.Create(BatchCreateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/messages/batches`

Send a batch of Message creation requests.

The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete.

Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

### Parameters

- `BatchCreateParams parameters`

  - `required IReadOnlyList<Request> requests`

    Body param: List of requests for prompt completion. Each is an individual request to create a Message.

    - `required string CustomID`

      Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.

      Must be unique for each request within the Message Batch.

    - `required Params Params`

      Messages API creation parameters for the individual request.

      See the [Messages API reference](https://docs.claude.com/en/api/messages) for full documentation on available parameters.

      - `required Long MaxTokens`

        The maximum number of tokens to generate before stopping.

        Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.

        Set to `0` to populate the [prompt cache](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#pre-warming-the-cache) without generating a response.

        Different models have different maximum values for this parameter.  See [models](https://docs.claude.com/en/docs/models-overview) for details.

      - `required IReadOnlyList<BetaMessageParam> Messages`

        Input messages.

        Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.

        Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.

        If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.

        Example with a single `user` message:

        ```json
        [{"role": "user", "content": "Hello, Claude"}]
        ```

        Example with multiple conversational turns:

        ```json
        [
          {"role": "user", "content": "Hello there."},
          {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
          {"role": "user", "content": "Can you explain LLMs in plain English?"},
        ]
        ```

        Example with a partially-filled response from Claude:

        ```json
        [
          {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
          {"role": "assistant", "content": "The best answer is ("},
        ]
        ```

        Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:

        ```json
        {"role": "user", "content": "Hello, Claude"}
        ```

        ```json
        {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
        ```

        See [input examples](https://docs.claude.com/en/api/messages-examples).

        Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API.

        There is a limit of 100,000 messages in a single request.

        - `required Content Content`

          - `string`

          - `IReadOnlyList<BetaContentBlockParam>`

            - `class BetaTextBlockParam:`

              - `required string Text`

              - `JsonElement Type "text"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

                - `JsonElement Type "ephemeral"constant`

                - `Ttl Ttl`

                  The time-to-live for the cache control breakpoint.

                  This may be one the following values:

                  - `5m`: 5 minutes
                  - `1h`: 1 hour

                  Defaults to `5m`.

                  - `"5m"Ttl5m`

                  - `"1h"Ttl1h`

              - `IReadOnlyList<BetaTextCitationParam>? Citations`

                - `class BetaCitationCharLocationParam:`

                  - `required string CitedText`

                  - `required Long DocumentIndex`

                  - `required string? DocumentTitle`

                  - `required Long EndCharIndex`

                  - `required Long StartCharIndex`

                  - `JsonElement Type "char_location"constant`

                - `class BetaCitationPageLocationParam:`

                  - `required string CitedText`

                  - `required Long DocumentIndex`

                  - `required string? DocumentTitle`

                  - `required Long EndPageNumber`

                  - `required Long StartPageNumber`

                  - `JsonElement Type "page_location"constant`

                - `class BetaCitationContentBlockLocationParam:`

                  - `required string CitedText`

                    The full text of the cited block range, concatenated.

                    Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                  - `required Long DocumentIndex`

                  - `required string? DocumentTitle`

                  - `required Long EndBlockIndex`

                    Exclusive 0-based end index of the cited block range in the source's `content` array.

                    Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                  - `required Long StartBlockIndex`

                    0-based index of the first cited block in the source's `content` array.

                  - `JsonElement Type "content_block_location"constant`

                - `class BetaCitationWebSearchResultLocationParam:`

                  - `required string CitedText`

                  - `required string EncryptedIndex`

                  - `required string? Title`

                  - `JsonElement Type "web_search_result_location"constant`

                  - `required string Url`

                - `class BetaCitationSearchResultLocationParam:`

                  - `required string CitedText`

                    The full text of the cited block range, concatenated.

                    Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                  - `required Long EndBlockIndex`

                    Exclusive 0-based end index of the cited block range in the source's `content` array.

                    Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                  - `required Long SearchResultIndex`

                    0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

                    Counted separately from `document_index`; server-side web search results are not included in this count.

                  - `required string Source`

                  - `required Long StartBlockIndex`

                    0-based index of the first cited block in the source's `content` array.

                  - `required string? Title`

                  - `JsonElement Type "search_result_location"constant`

            - `class BetaImageBlockParam:`

              - `required Source Source`

                - `class BetaBase64ImageSource:`

                  - `required string Data`

                  - `required MediaType MediaType`

                    - `"image/jpeg"ImageJpeg`

                    - `"image/png"ImagePng`

                    - `"image/gif"ImageGif`

                    - `"image/webp"ImageWebP`

                  - `JsonElement Type "base64"constant`

                - `class BetaUrlImageSource:`

                  - `JsonElement Type "url"constant`

                  - `required string Url`

                - `class BetaFileImageSource:`

                  - `required string FileID`

                  - `JsonElement Type "file"constant`

              - `JsonElement Type "image"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

            - `class BetaRequestDocumentBlock:`

              - `required Source Source`

                - `class BetaBase64PdfSource:`

                  - `required string Data`

                  - `JsonElement MediaType "application/pdf"constant`

                  - `JsonElement Type "base64"constant`

                - `class BetaPlainTextSource:`

                  - `required string Data`

                  - `JsonElement MediaType "text/plain"constant`

                  - `JsonElement Type "text"constant`

                - `class BetaContentBlockSource:`

                  - `required Content Content`

                    - `string`

                    - `IReadOnlyList<BetaContentBlockSourceContent>`

                      - `class BetaTextBlockParam:`

                      - `class BetaImageBlockParam:`

                  - `JsonElement Type "content"constant`

                - `class BetaUrlPdfSource:`

                  - `JsonElement Type "url"constant`

                  - `required string Url`

                - `class BetaFileDocumentSource:`

                  - `required string FileID`

                  - `JsonElement Type "file"constant`

              - `JsonElement Type "document"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

              - `BetaCitationsConfigParam? Citations`

                - `Boolean Enabled`

              - `string? Context`

              - `string? Title`

            - `class BetaSearchResultBlockParam:`

              - `required IReadOnlyList<BetaTextBlockParam> Content`

                - `required string Text`

                - `JsonElement Type "text"constant`

                - `BetaCacheControlEphemeral? CacheControl`

                  Create a cache control breakpoint at this content block.

                - `IReadOnlyList<BetaTextCitationParam>? Citations`

              - `required string Source`

              - `required string Title`

              - `JsonElement Type "search_result"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

              - `BetaCitationsConfigParam Citations`

            - `class BetaThinkingBlockParam:`

              - `required string Signature`

              - `required string Thinking`

              - `JsonElement Type "thinking"constant`

            - `class BetaRedactedThinkingBlockParam:`

              - `required string Data`

              - `JsonElement Type "redacted_thinking"constant`

            - `class BetaToolUseBlockParam:`

              - `required string ID`

              - `required IReadOnlyDictionary<string, JsonElement> Input`

              - `required string Name`

              - `JsonElement Type "tool_use"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

              - `Caller Caller`

                Tool invocation directly from the model.

                - `class BetaDirectCaller:`

                  Tool invocation directly from the model.

                  - `JsonElement Type "direct"constant`

                - `class BetaServerToolCaller:`

                  Tool invocation generated by a server-side tool.

                  - `required string ToolID`

                  - `JsonElement Type "code_execution_20250825"constant`

                - `class BetaServerToolCaller20260120:`

                  - `required string ToolID`

                  - `JsonElement Type "code_execution_20260120"constant`

            - `class BetaToolResultBlockParam:`

              - `required string ToolUseID`

              - `JsonElement Type "tool_result"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

              - `Content Content`

                - `string`

                - `IReadOnlyList<Block>`

                  - `class BetaTextBlockParam:`

                  - `class BetaImageBlockParam:`

                  - `class BetaSearchResultBlockParam:`

                  - `class BetaRequestDocumentBlock:`

                  - `class BetaToolReferenceBlockParam:`

                    Tool reference block that can be included in tool_result content.

                    - `required string ToolName`

                    - `JsonElement Type "tool_reference"constant`

                    - `BetaCacheControlEphemeral? CacheControl`

                      Create a cache control breakpoint at this content block.

              - `Boolean IsError`

            - `class BetaServerToolUseBlockParam:`

              - `required string ID`

              - `required IReadOnlyDictionary<string, JsonElement> Input`

              - `required Name Name`

                - `"advisor"Advisor`

                - `"web_search"WebSearch`

                - `"web_fetch"WebFetch`

                - `"code_execution"CodeExecution`

                - `"bash_code_execution"BashCodeExecution`

                - `"text_editor_code_execution"TextEditorCodeExecution`

                - `"tool_search_tool_regex"ToolSearchToolRegex`

                - `"tool_search_tool_bm25"ToolSearchToolBm25`

              - `JsonElement Type "server_tool_use"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

              - `Caller Caller`

                Tool invocation directly from the model.

                - `class BetaDirectCaller:`

                  Tool invocation directly from the model.

                - `class BetaServerToolCaller:`

                  Tool invocation generated by a server-side tool.

                - `class BetaServerToolCaller20260120:`

            - `class BetaWebSearchToolResultBlockParam:`

              - `required BetaWebSearchToolResultBlockParamContent Content`

                - `IReadOnlyList<BetaWebSearchResultBlockParam>`

                  - `required string EncryptedContent`

                  - `required string Title`

                  - `JsonElement Type "web_search_result"constant`

                  - `required string Url`

                  - `string? PageAge`

                - `class BetaWebSearchToolRequestError:`

                  - `required BetaWebSearchToolResultErrorCode ErrorCode`

                    - `"invalid_tool_input"InvalidToolInput`

                    - `"unavailable"Unavailable`

                    - `"max_uses_exceeded"MaxUsesExceeded`

                    - `"too_many_requests"TooManyRequests`

                    - `"query_too_long"QueryTooLong`

                    - `"request_too_large"RequestTooLarge`

                  - `JsonElement Type "web_search_tool_result_error"constant`

              - `required string ToolUseID`

              - `JsonElement Type "web_search_tool_result"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

              - `Caller Caller`

                Tool invocation directly from the model.

                - `class BetaDirectCaller:`

                  Tool invocation directly from the model.

                - `class BetaServerToolCaller:`

                  Tool invocation generated by a server-side tool.

                - `class BetaServerToolCaller20260120:`

            - `class BetaWebFetchToolResultBlockParam:`

              - `required Content Content`

                - `class BetaWebFetchToolResultErrorBlockParam:`

                  - `required BetaWebFetchToolResultErrorCode ErrorCode`

                    - `"invalid_tool_input"InvalidToolInput`

                    - `"url_too_long"UrlTooLong`

                    - `"url_not_allowed"UrlNotAllowed`

                    - `"url_not_in_prior_context"UrlNotInPriorContext`

                    - `"url_not_accessible"UrlNotAccessible`

                    - `"unsupported_content_type"UnsupportedContentType`

                    - `"too_many_requests"TooManyRequests`

                    - `"max_uses_exceeded"MaxUsesExceeded`

                    - `"unavailable"Unavailable`

                  - `JsonElement Type "web_fetch_tool_result_error"constant`

                - `class BetaWebFetchBlockParam:`

                  - `required BetaRequestDocumentBlock Content`

                  - `JsonElement Type "web_fetch_result"constant`

                  - `required string Url`

                    Fetched content URL

                  - `string? RetrievedAt`

                    ISO 8601 timestamp when the content was retrieved

              - `required string ToolUseID`

              - `JsonElement Type "web_fetch_tool_result"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

              - `Caller Caller`

                Tool invocation directly from the model.

                - `class BetaDirectCaller:`

                  Tool invocation directly from the model.

                - `class BetaServerToolCaller:`

                  Tool invocation generated by a server-side tool.

                - `class BetaServerToolCaller20260120:`

            - `class BetaAdvisorToolResultBlockParam:`

              - `required Content Content`

                - `class BetaAdvisorToolResultErrorParam:`

                  - `required ErrorCode ErrorCode`

                    - `"max_uses_exceeded"MaxUsesExceeded`

                    - `"prompt_too_long"PromptTooLong`

                    - `"too_many_requests"TooManyRequests`

                    - `"overloaded"Overloaded`

                    - `"unavailable"Unavailable`

                    - `"execution_time_exceeded"ExecutionTimeExceeded`

                  - `JsonElement Type "advisor_tool_result_error"constant`

                - `class BetaAdvisorResultBlockParam:`

                  - `required string Text`

                  - `JsonElement Type "advisor_result"constant`

                  - `string? StopReason`

                - `class BetaAdvisorRedactedResultBlockParam:`

                  - `required string EncryptedContent`

                    Opaque blob produced by a prior response; must be round-tripped verbatim.

                  - `JsonElement Type "advisor_redacted_result"constant`

                  - `string? StopReason`

              - `required string ToolUseID`

              - `JsonElement Type "advisor_tool_result"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

            - `class BetaCodeExecutionToolResultBlockParam:`

              - `required BetaCodeExecutionToolResultBlockParamContent Content`

                Code execution result with encrypted stdout for PFC + web_search results.

                - `class BetaCodeExecutionToolResultErrorParam:`

                  - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

                    - `"invalid_tool_input"InvalidToolInput`

                    - `"unavailable"Unavailable`

                    - `"too_many_requests"TooManyRequests`

                    - `"execution_time_exceeded"ExecutionTimeExceeded`

                  - `JsonElement Type "code_execution_tool_result_error"constant`

                - `class BetaCodeExecutionResultBlockParam:`

                  - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

                    - `required string FileID`

                    - `JsonElement Type "code_execution_output"constant`

                  - `required Long ReturnCode`

                  - `required string Stderr`

                  - `required string Stdout`

                  - `JsonElement Type "code_execution_result"constant`

                - `class BetaEncryptedCodeExecutionResultBlockParam:`

                  Code execution result with encrypted stdout for PFC + web_search results.

                  - `required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content`

                    - `required string FileID`

                    - `JsonElement Type "code_execution_output"constant`

                  - `required string EncryptedStdout`

                  - `required Long ReturnCode`

                  - `required string Stderr`

                  - `JsonElement Type "encrypted_code_execution_result"constant`

              - `required string ToolUseID`

              - `JsonElement Type "code_execution_tool_result"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

            - `class BetaBashCodeExecutionToolResultBlockParam:`

              - `required Content Content`

                - `class BetaBashCodeExecutionToolResultErrorParam:`

                  - `required ErrorCode ErrorCode`

                    - `"invalid_tool_input"InvalidToolInput`

                    - `"unavailable"Unavailable`

                    - `"too_many_requests"TooManyRequests`

                    - `"execution_time_exceeded"ExecutionTimeExceeded`

                    - `"output_file_too_large"OutputFileTooLarge`

                  - `JsonElement Type "bash_code_execution_tool_result_error"constant`

                - `class BetaBashCodeExecutionResultBlockParam:`

                  - `required IReadOnlyList<BetaBashCodeExecutionOutputBlockParam> Content`

                    - `required string FileID`

                    - `JsonElement Type "bash_code_execution_output"constant`

                  - `required Long ReturnCode`

                  - `required string Stderr`

                  - `required string Stdout`

                  - `JsonElement Type "bash_code_execution_result"constant`

              - `required string ToolUseID`

              - `JsonElement Type "bash_code_execution_tool_result"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

            - `class BetaTextEditorCodeExecutionToolResultBlockParam:`

              - `required Content Content`

                - `class BetaTextEditorCodeExecutionToolResultErrorParam:`

                  - `required ErrorCode ErrorCode`

                    - `"invalid_tool_input"InvalidToolInput`

                    - `"unavailable"Unavailable`

                    - `"too_many_requests"TooManyRequests`

                    - `"execution_time_exceeded"ExecutionTimeExceeded`

                    - `"file_not_found"FileNotFound`

                  - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

                  - `string? ErrorMessage`

                - `class BetaTextEditorCodeExecutionViewResultBlockParam:`

                  - `required string Content`

                  - `required FileType FileType`

                    - `"text"Text`

                    - `"image"Image`

                    - `"pdf"Pdf`

                  - `JsonElement Type "text_editor_code_execution_view_result"constant`

                  - `Long? NumLines`

                  - `Long? StartLine`

                  - `Long? TotalLines`

                - `class BetaTextEditorCodeExecutionCreateResultBlockParam:`

                  - `required Boolean IsFileUpdate`

                  - `JsonElement Type "text_editor_code_execution_create_result"constant`

                - `class BetaTextEditorCodeExecutionStrReplaceResultBlockParam:`

                  - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

                  - `IReadOnlyList<string>? Lines`

                  - `Long? NewLines`

                  - `Long? NewStart`

                  - `Long? OldLines`

                  - `Long? OldStart`

              - `required string ToolUseID`

              - `JsonElement Type "text_editor_code_execution_tool_result"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

            - `class BetaToolSearchToolResultBlockParam:`

              - `required Content Content`

                - `class BetaToolSearchToolResultErrorParam:`

                  - `required ErrorCode ErrorCode`

                    - `"invalid_tool_input"InvalidToolInput`

                    - `"unavailable"Unavailable`

                    - `"too_many_requests"TooManyRequests`

                    - `"execution_time_exceeded"ExecutionTimeExceeded`

                  - `JsonElement Type "tool_search_tool_result_error"constant`

                - `class BetaToolSearchToolSearchResultBlockParam:`

                  - `required IReadOnlyList<BetaToolReferenceBlockParam> ToolReferences`

                    - `required string ToolName`

                    - `JsonElement Type "tool_reference"constant`

                    - `BetaCacheControlEphemeral? CacheControl`

                      Create a cache control breakpoint at this content block.

                  - `JsonElement Type "tool_search_tool_search_result"constant`

              - `required string ToolUseID`

              - `JsonElement Type "tool_search_tool_result"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

            - `class BetaMcpToolUseBlockParam:`

              - `required string ID`

              - `required IReadOnlyDictionary<string, JsonElement> Input`

              - `required string Name`

              - `required string ServerName`

                The name of the MCP server

              - `JsonElement Type "mcp_tool_use"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

            - `class BetaRequestMcpToolResultBlockParam:`

              - `required string ToolUseID`

              - `JsonElement Type "mcp_tool_result"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

              - `Content Content`

                - `string`

                - `IReadOnlyList<BetaTextBlockParam>`

                  - `required string Text`

                  - `JsonElement Type "text"constant`

                  - `BetaCacheControlEphemeral? CacheControl`

                    Create a cache control breakpoint at this content block.

                  - `IReadOnlyList<BetaTextCitationParam>? Citations`

              - `Boolean IsError`

            - `class BetaContainerUploadBlockParam:`

              A content block that represents a file to be uploaded to the container
              Files uploaded via this block will be available in the container's input directory.

              - `required string FileID`

              - `JsonElement Type "container_upload"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

            - `class BetaCompactionBlockParam:`

              A compaction block containing summary of previous context.

              Users should round-trip these blocks from responses to subsequent requests
              to maintain context across compaction boundaries.

              When content is None, the block represents a failed compaction. The server
              treats these as no-ops. Empty string content is not allowed.

              - `JsonElement Type "compaction"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

              - `string? Content`

                Summary of previously compacted content, or null if compaction failed

              - `string? EncryptedContent`

                Opaque metadata from prior compaction, to be round-tripped verbatim

            - `class BetaMidConversationSystemBlockParam:`

              System instructions that appear mid-conversation.

              Use this block to provide or update system-level instructions at a specific
              point in the conversation, rather than only via the top-level `system` parameter.

              - `required IReadOnlyList<BetaTextBlockParam> Content`

                System instruction text blocks.

                - `required string Text`

                - `JsonElement Type "text"constant`

                - `BetaCacheControlEphemeral? CacheControl`

                  Create a cache control breakpoint at this content block.

                - `IReadOnlyList<BetaTextCitationParam>? Citations`

              - `JsonElement Type "mid_conv_system"constant`

              - `BetaCacheControlEphemeral? CacheControl`

                Create a cache control breakpoint at this content block.

        - `required Role Role`

          - `"user"User`

          - `"assistant"Assistant`

          - `"system"System`

      - `required Model Model`

        The model that will complete your prompt.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-mythos-preview"ClaudeMythosPreview`

          New class of intelligence, strongest in coding and cybersecurity

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Frontier intelligence for long-running agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

        - `"claude-opus-4-1"ClaudeOpus4_1`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-0"ClaudeOpus4_0`

          Powerful model for complex tasks

        - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

          Powerful model for complex tasks

        - `"claude-sonnet-4-0"ClaudeSonnet4_0`

          High-performance model with extended thinking

        - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

          High-performance model with extended thinking

        - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

          Fast and cost-effective model

      - `BetaCacheControlEphemeral? CacheControl`

        Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.

      - `Container? Container`

        Container identifier for reuse across requests.

        - `class BetaContainerParams:`

          Container parameters with skills to be loaded.

          - `string? ID`

            Container id

          - `IReadOnlyList<BetaSkillParams>? Skills`

            List of skills to load in the container

            - `required string SkillID`

              Skill ID

            - `required Type Type`

              Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

              - `"anthropic"Anthropic`

              - `"custom"Custom`

            - `string Version`

              Skill version or 'latest' for most recent version

        - `string`

      - `BetaContextManagementConfig? ContextManagement`

        Context management configuration.

        This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not.

        - `IReadOnlyList<Edit> Edits`

          List of context management edits to apply

          - `class BetaClearToolUses20250919Edit:`

            - `JsonElement Type "clear_tool_uses_20250919"constant`

            - `BetaInputTokensClearAtLeast? ClearAtLeast`

              Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed.

              - `JsonElement Type "input_tokens"constant`

              - `required Long Value`

            - `ClearToolInputs? ClearToolInputs`

              Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)

              - `Boolean`

              - `IReadOnlyList<string>`

            - `IReadOnlyList<string>? ExcludeTools`

              Tool names whose uses are preserved from clearing

            - `BetaToolUsesKeep Keep`

              Number of tool uses to retain in the conversation

              - `JsonElement Type "tool_uses"constant`

              - `required Long Value`

            - `Trigger Trigger`

              Condition that triggers the context management strategy

              - `class BetaInputTokensTrigger:`

                - `JsonElement Type "input_tokens"constant`

                - `required Long Value`

              - `class BetaToolUsesTrigger:`

                - `JsonElement Type "tool_uses"constant`

                - `required Long Value`

          - `class BetaClearThinking20251015Edit:`

            - `JsonElement Type "clear_thinking_20251015"constant`

            - `Keep Keep`

              Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed.

              - `class BetaThinkingTurns:`

                - `JsonElement Type "thinking_turns"constant`

                - `required Long Value`

              - `class BetaAllThinkingTurns:`

                - `JsonElement Type "all"constant`

              - `class All:`

          - `class BetaCompact20260112Edit:`

            Automatically compact older context when reaching the configured trigger threshold.

            - `JsonElement Type "compact_20260112"constant`

            - `string? Instructions`

              Additional instructions for summarization.

            - `Boolean PauseAfterCompaction`

              Whether to pause after compaction and return the compaction block to the user.

            - `BetaInputTokensTrigger? Trigger`

              When to trigger compaction. Defaults to 150000 input tokens.

      - `BetaDiagnosticsParam? Diagnostics`

        Request-level diagnostics. Currently carries the previous response
        id for prompt-cache divergence reporting.

        - `string? PreviousMessageID`

          The `id` (`msg_...`) from this client's previous /v1/messages response. The server compares that request's prompt fingerprint against this one and returns `diagnostics.cache_miss_reason` when the prompt-cache prefix could not be reused. Pass `null` on the first turn to opt in without a prior message to compare.

      - `string? InferenceGeo`

        Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used.

      - `IReadOnlyList<BetaRequestMcpServerUrlDefinition> McpServers`

        MCP servers to be utilized in this request

        - `required string Name`

        - `JsonElement Type "url"constant`

        - `required string Url`

        - `string? AuthorizationToken`

        - `BetaRequestMcpServerToolConfiguration? ToolConfiguration`

          - `IReadOnlyList<string>? AllowedTools`

          - `Boolean? Enabled`

      - `BetaMetadata Metadata`

        An object describing metadata about the request.

        - `string? UserID`

          An external identifier for the user who is associated with the request.

          This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.

      - `BetaOutputConfig OutputConfig`

        Configuration options for the model's output, such as the output format.

        - `Effort? Effort`

          All possible effort levels.

          - `"low"Low`

          - `"medium"Medium`

          - `"high"High`

          - `"xhigh"Xhigh`

          - `"max"Max`

        - `BetaJsonOutputFormat? Format`

          A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)

          - `required IReadOnlyDictionary<string, JsonElement> Schema`

            The JSON schema of the format

          - `JsonElement Type "json_schema"constant`

        - `BetaTokenTaskBudget? TaskBudget`

          User-configurable total token budget across contexts.

          - `required Long Total`

            Total token budget across all contexts in the session.

          - `JsonElement Type "tokens"constant`

            The budget type. Currently only 'tokens' is supported.

          - `Long? Remaining`

            Remaining tokens in the budget. Use this to track usage across contexts when implementing compaction client-side. Defaults to total if not provided.

      - `BetaJsonOutputFormat? OutputFormat`

        Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)

        A schema to specify Claude's output format in responses. This parameter will be removed in a future release.

      - `ServiceTier ServiceTier`

        Determines whether to use priority capacity (if available) or standard capacity for this request.

        Anthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.

        - `"auto"Auto`

        - `"standard_only"StandardOnly`

      - `Speed? Speed`

        The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference.

        - `"standard"Standard`

        - `"fast"Fast`

      - `IReadOnlyList<string> StopSequences`

        Custom text sequences that will cause the model to stop generating.

        Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.

        If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence.

      - `Boolean Stream`

        Whether to incrementally stream the response using server-sent events.

        See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.

      - `System System`

        System prompt.

        A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).

        - `string`

        - `IReadOnlyList<BetaTextBlockParam>`

          - `required string Text`

          - `JsonElement Type "text"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `IReadOnlyList<BetaTextCitationParam>? Citations`

      - `Double Temperature`

        Amount of randomness injected into the response.

        Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.

        Note that even with `temperature` of `0.0`, the results will not be fully deterministic.

      - `BetaThinkingConfigParam Thinking`

        Configuration for enabling Claude's extended thinking.

        When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.

        See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details.

        - `class BetaThinkingConfigEnabled:`

          - `required Long BudgetTokens`

            Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.

            Must be ≥1024 and less than `max_tokens`.

            See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details.

          - `JsonElement Type "enabled"constant`

          - `Display? Display`

            Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.

            - `"summarized"Summarized`

            - `"omitted"Omitted`

        - `class BetaThinkingConfigDisabled:`

          - `JsonElement Type "disabled"constant`

        - `class BetaThinkingConfigAdaptive:`

          - `JsonElement Type "adaptive"constant`

          - `Display? Display`

            Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.

            - `"summarized"Summarized`

            - `"omitted"Omitted`

      - `BetaToolChoice ToolChoice`

        How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.

        - `class BetaToolChoiceAuto:`

          The model will automatically decide whether to use tools.

          - `JsonElement Type "auto"constant`

          - `Boolean DisableParallelToolUse`

            Whether to disable parallel tool use.

            Defaults to `false`. If set to `true`, the model will output at most one tool use.

        - `class BetaToolChoiceAny:`

          The model will use any available tools.

          - `JsonElement Type "any"constant`

          - `Boolean DisableParallelToolUse`

            Whether to disable parallel tool use.

            Defaults to `false`. If set to `true`, the model will output exactly one tool use.

        - `class BetaToolChoiceTool:`

          The model will use the specified tool with `tool_choice.name`.

          - `required string Name`

            The name of the tool to use.

          - `JsonElement Type "tool"constant`

          - `Boolean DisableParallelToolUse`

            Whether to disable parallel tool use.

            Defaults to `false`. If set to `true`, the model will output exactly one tool use.

        - `class BetaToolChoiceNone:`

          The model will not be allowed to use tools.

          - `JsonElement Type "none"constant`

      - `IReadOnlyList<BetaToolUnion> Tools`

        Definitions of tools that the model may use.

        If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.

        There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).

        Each tool definition includes:

        * `name`: Name of the tool.
        * `description`: Optional, but strongly-recommended description of the tool.
        * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.

        For example, if you defined `tools` as:

        ```json
        [
          {
            "name": "get_stock_price",
            "description": "Get the current stock price for a given ticker symbol.",
            "input_schema": {
              "type": "object",
              "properties": {
                "ticker": {
                  "type": "string",
                  "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
                }
              },
              "required": ["ticker"]
            }
          }
        ]
        ```

        And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:

        ```json
        [
          {
            "type": "tool_use",
            "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
            "name": "get_stock_price",
            "input": { "ticker": "^GSPC" }
          }
        ]
        ```

        You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:

        ```json
        [
          {
            "type": "tool_result",
            "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
            "content": "259.75 USD"
          }
        ]
        ```

        Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.

        See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.

        - `class BetaTool:`

          - `required InputSchema InputSchema`

            [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.

            This defines the shape of the `input` that your tool accepts and that the model will produce.

            - `JsonElement Type "object"constant`

            - `IReadOnlyDictionary<string, JsonElement>? Properties`

            - `IReadOnlyList<string>? Required`

          - `required string Name`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `string Description`

            Description of what this tool does.

            Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.

          - `Boolean? EagerInputStreaming`

            Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers.

          - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

          - `Type? Type`

            - `"custom"Custom`

        - `class BetaToolBash20241022:`

          - `JsonElement Name "bash"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "bash_20241022"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaToolBash20250124:`

          - `JsonElement Name "bash"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "bash_20250124"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaCodeExecutionTool20250522:`

          - `JsonElement Name "code_execution"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "code_execution_20250522"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaCodeExecutionTool20250825:`

          - `JsonElement Name "code_execution"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "code_execution_20250825"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaCodeExecutionTool20260120:`

          Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).

          - `JsonElement Name "code_execution"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "code_execution_20260120"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaToolComputerUse20241022:`

          - `required Long DisplayHeightPx`

            The height of the display in pixels.

          - `required Long DisplayWidthPx`

            The width of the display in pixels.

          - `JsonElement Name "computer"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "computer_20241022"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Long? DisplayNumber`

            The X11 display number (e.g. 0, 1) for the display.

          - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaMemoryTool20250818:`

          - `JsonElement Name "memory"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "memory_20250818"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaToolComputerUse20250124:`

          - `required Long DisplayHeightPx`

            The height of the display in pixels.

          - `required Long DisplayWidthPx`

            The width of the display in pixels.

          - `JsonElement Name "computer"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "computer_20250124"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Long? DisplayNumber`

            The X11 display number (e.g. 0, 1) for the display.

          - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaToolTextEditor20241022:`

          - `JsonElement Name "str_replace_editor"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "text_editor_20241022"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaToolComputerUse20251124:`

          - `required Long DisplayHeightPx`

            The height of the display in pixels.

          - `required Long DisplayWidthPx`

            The width of the display in pixels.

          - `JsonElement Name "computer"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "computer_20251124"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Long? DisplayNumber`

            The X11 display number (e.g. 0, 1) for the display.

          - `Boolean EnableZoom`

            Whether to enable an action to take a zoomed-in screenshot of the screen.

          - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaToolTextEditor20250124:`

          - `JsonElement Name "str_replace_editor"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "text_editor_20250124"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaToolTextEditor20250429:`

          - `JsonElement Name "str_replace_based_edit_tool"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "text_editor_20250429"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaToolTextEditor20250728:`

          - `JsonElement Name "str_replace_based_edit_tool"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "text_editor_20250728"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> InputExamples`

          - `Long? MaxCharacters`

            Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaWebSearchTool20250305:`

          - `JsonElement Name "web_search"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "web_search_20250305"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `IReadOnlyList<string>? AllowedDomains`

            If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.

          - `IReadOnlyList<string>? BlockedDomains`

            If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Long? MaxUses`

            Maximum number of times the tool can be used in the API request.

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

          - `BetaUserLocation? UserLocation`

            Parameters for the user's location. Used to provide more relevant search results.

            - `JsonElement Type "approximate"constant`

            - `string? City`

              The city of the user.

            - `string? Country`

              The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.

            - `string? Region`

              The region of the user.

            - `string? Timezone`

              The [IANA timezone](https://nodatime.org/TimeZones) of the user.

        - `class BetaWebFetchTool20250910:`

          - `JsonElement Name "web_fetch"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "web_fetch_20250910"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `IReadOnlyList<string>? AllowedDomains`

            List of domains to allow fetching from

          - `IReadOnlyList<string>? BlockedDomains`

            List of domains to block fetching from

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `BetaCitationsConfigParam? Citations`

            Citations configuration for fetched documents. Citations are disabled by default.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Long? MaxContentTokens`

            Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

          - `Long? MaxUses`

            Maximum number of times the tool can be used in the API request.

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaWebSearchTool20260209:`

          - `JsonElement Name "web_search"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "web_search_20260209"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `IReadOnlyList<string>? AllowedDomains`

            If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.

          - `IReadOnlyList<string>? BlockedDomains`

            If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Long? MaxUses`

            Maximum number of times the tool can be used in the API request.

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

          - `BetaUserLocation? UserLocation`

            Parameters for the user's location. Used to provide more relevant search results.

        - `class BetaWebFetchTool20260209:`

          - `JsonElement Name "web_fetch"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "web_fetch_20260209"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `IReadOnlyList<string>? AllowedDomains`

            List of domains to allow fetching from

          - `IReadOnlyList<string>? BlockedDomains`

            List of domains to block fetching from

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `BetaCitationsConfigParam? Citations`

            Citations configuration for fetched documents. Citations are disabled by default.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Long? MaxContentTokens`

            Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

          - `Long? MaxUses`

            Maximum number of times the tool can be used in the API request.

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaWebFetchTool20260309:`

          Web fetch tool with use_cache parameter for bypassing cached content.

          - `JsonElement Name "web_fetch"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "web_fetch_20260309"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `IReadOnlyList<string>? AllowedDomains`

            List of domains to allow fetching from

          - `IReadOnlyList<string>? BlockedDomains`

            List of domains to block fetching from

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `BetaCitationsConfigParam? Citations`

            Citations configuration for fetched documents. Citations are disabled by default.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Long? MaxContentTokens`

            Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.

          - `Long? MaxUses`

            Maximum number of times the tool can be used in the API request.

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

          - `Boolean UseCache`

            Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.

        - `class BetaAdvisorTool20260301:`

          - `required Model Model`

            The model that will complete your prompt.

            See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `JsonElement Name "advisor"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `JsonElement Type "advisor_20260301"constant`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `BetaCacheControlEphemeral? Caching`

            Caching for the advisor's own prompt. When set, each advisor call writes a cache entry at the given TTL so subsequent calls in the same conversation read the stable prefix. When omitted, the advisor prompt is not cached.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Long? MaxUses`

            Maximum number of times the tool can be used in the API request.

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaToolSearchToolBm25_20251119:`

          - `JsonElement Name "tool_search_tool_bm25"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `required Type Type`

            - `"tool_search_tool_bm25_20251119"ToolSearchToolBm25_20251119`

            - `"tool_search_tool_bm25"ToolSearchToolBm25`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaToolSearchToolRegex20251119:`

          - `JsonElement Name "tool_search_tool_regex"constant`

            Name of the tool.

            This is how the tool will be called by the model and in `tool_use` blocks.

          - `required Type Type`

            - `"tool_search_tool_regex_20251119"ToolSearchToolRegex20251119`

            - `"tool_search_tool_regex"ToolSearchToolRegex`

          - `IReadOnlyList<AllowedCaller> AllowedCallers`

            - `"direct"Direct`

            - `"code_execution_20250825"CodeExecution20250825`

            - `"code_execution_20260120"CodeExecution20260120`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `Boolean DeferLoading`

            If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

          - `Boolean Strict`

            When true, guarantees schema validation on tool names and inputs

        - `class BetaMcpToolset:`

          Configuration for a group of tools from an MCP server.

          Allows configuring enabled status and defer_loading for all tools
          from an MCP server, with optional per-tool overrides.

          - `required string McpServerName`

            Name of the MCP server to configure tools for

          - `JsonElement Type "mcp_toolset"constant`

          - `BetaCacheControlEphemeral? CacheControl`

            Create a cache control breakpoint at this content block.

          - `IReadOnlyDictionary<string, BetaMcpToolConfig>? Configs`

            Configuration overrides for specific tools, keyed by tool name

            - `Boolean DeferLoading`

            - `Boolean Enabled`

          - `BetaMcpToolDefaultConfig DefaultConfig`

            Default configuration applied to all tools from this server

            - `Boolean DeferLoading`

            - `Boolean Enabled`

      - `Long TopK`

        Only sample from the top K options for each subsequent token.

        Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).

        Recommended for advanced use cases only.

      - `Double TopP`

        Use nucleus sampling.

        In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`.

        Recommended for advanced use cases only.

      - `string? UserProfileID`

        The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaMessageBatch:`

  - `required string ID`

    Unique object identifier.

    The format and length of IDs may change over time.

  - `required DateTimeOffset? ArchivedAt`

    RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.

  - `required DateTimeOffset? CancelInitiatedAt`

    RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.

  - `required DateTimeOffset CreatedAt`

    RFC 3339 datetime string representing the time at which the Message Batch was created.

  - `required DateTimeOffset? EndedAt`

    RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.

    Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.

  - `required DateTimeOffset ExpiresAt`

    RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.

  - `required ProcessingStatus ProcessingStatus`

    Processing status of the Message Batch.

    - `"in_progress"InProgress`

    - `"canceling"Canceling`

    - `"ended"Ended`

  - `required BetaMessageBatchRequestCounts RequestCounts`

    Tallies requests within the Message Batch, categorized by their status.

    Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch.

    - `required Long Canceled`

      Number of requests in the Message Batch that have been canceled.

      This is zero until processing of the entire Message Batch has ended.

    - `required Long Errored`

      Number of requests in the Message Batch that encountered an error.

      This is zero until processing of the entire Message Batch has ended.

    - `required Long Expired`

      Number of requests in the Message Batch that have expired.

      This is zero until processing of the entire Message Batch has ended.

    - `required Long Processing`

      Number of requests in the Message Batch that are processing.

    - `required Long Succeeded`

      Number of requests in the Message Batch that have completed successfully.

      This is zero until processing of the entire Message Batch has ended.

  - `required string? ResultsUrl`

    URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.

    Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.

  - `JsonElement Type "message_batch"constant`

    Object type.

    For Message Batches, this is always `"message_batch"`.

### Example

```csharp
BatchCreateParams parameters = new()
{
    Requests =
    [
        new()
        {
            CustomID = "my-custom-id-1",
            Params = new()
            {
                MaxTokens = 1024,
                Messages =
                [
                    new()
                    {
                        Content = "Hello, world",
                        Role = Role.User,
                    },
                ],
                Model = Model.ClaudeOpus4_6,
                CacheControl = new() { Ttl = Ttl.Ttl5m },
                Container = new BetaContainerParams()
                {
                    ID = "id",
                    Skills =
                    [
                        new()
                        {
                            SkillID = "pdf",
                            Type = Type.Anthropic,
                            Version = "latest",
                        },
                    ],
                },
                ContextManagement = new()
                {
                    Edits =
                    [
                        new BetaClearToolUses20250919Edit()
                        {
                            ClearAtLeast = new(0),
                            ClearToolInputs = true,
                            ExcludeTools =
                            [
                                "string"
                            ],
                            Keep = new(0),
                            Trigger = new BetaInputTokensTrigger(1),
                        },
                    ],
                },
                Diagnostics = new()
                {
                    PreviousMessageID = "previous_message_id"
                },
                InferenceGeo = "inference_geo",
                McpServers =
                [
                    new()
                    {
                        Name = "name",
                        Url = "url",
                        AuthorizationToken = "authorization_token",
                        ToolConfiguration = new()
                        {
                            AllowedTools =
                            [
                                "string"
                            ],
                            Enabled = true,
                        },
                    },
                ],
                Metadata = new()
                {
                    UserID = "13803d75-b4b5-4c3e-b2a2-6f21399b021b"
                },
                OutputConfig = new()
                {
                    Effort = Effort.Low,
                    Format = new()
                    {
                        Schema = new Dictionary<string, JsonElement>()
                        {
                            { "foo", JsonSerializer.SerializeToElement("bar") }
                        },
                    },
                    TaskBudget = new()
                    {
                        Total = 1024,
                        Remaining = 0,
                    },
                },
                OutputFormat = new()
                {
                    Schema = new Dictionary<string, JsonElement>()
                    {
                        { "foo", JsonSerializer.SerializeToElement("bar") }
                    },
                },
                ServiceTier = ServiceTier.Auto,
                Speed = Speed.Standard,
                StopSequences =
                [
                    "string"
                ],
                Stream = true,
                System = new(

                    [
                        new BetaTextBlockParam()
                        {
                            Text = "Today's date is 2024-06-01.",
                            CacheControl = new() { Ttl = Ttl.Ttl5m },
                            Citations =
                            [
                                new BetaCitationCharLocationParam()
                                {
                                    CitedText = "cited_text",
                                    DocumentIndex = 0,
                                    DocumentTitle = "x",
                                    EndCharIndex = 0,
                                    StartCharIndex = 0,
                                },
                            ],
                        },
                    ]
                ),
                Temperature = 1,
                Thinking = new BetaThinkingConfigAdaptive()
                {
                    Display = Display.Summarized
                },
                ToolChoice = new BetaToolChoiceAuto()
                {
                    DisableParallelToolUse = true
                },
                Tools =
                [
                    new BetaTool()
                    {
                        InputSchema = new()
                        {
                            Properties = new Dictionary<string, JsonElement>()
                            {
                                { "location", JsonSerializer.SerializeToElement("bar") },
                                { "unit", JsonSerializer.SerializeToElement("bar") },
                            },
                            Required =
                            [
                                "location"
                            ],
                        },
                        Name = "name",
                        AllowedCallers =
                        [
                            AllowedCaller.Direct
                        ],
                        CacheControl = new() { Ttl = Ttl.Ttl5m },
                        DeferLoading = true,
                        Description = "Get the current weather in a given location",
                        EagerInputStreaming = true,
                        InputExamples =
                        [
                            new Dictionary<string, JsonElement>()
                            {
                                { "foo", JsonSerializer.SerializeToElement("bar") },
                            },
                        ],
                        Strict = true,
                        Type = Type.Custom,
                    },
                ],
                TopK = 5,
                TopP = 0.7,
                UserProfileID = "user_profile_id",
            },
        },
    ],
};

var betaMessageBatch = await client.Beta.Messages.Batches.Create(parameters);

Console.WriteLine(betaMessageBatch);
```

#### Response

```json
{
  "id": "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF",
  "archived_at": "2024-08-20T18:37:24.100435Z",
  "cancel_initiated_at": "2024-08-20T18:37:24.100435Z",
  "created_at": "2024-08-20T18:37:24.100435Z",
  "ended_at": "2024-08-20T18:37:24.100435Z",
  "expires_at": "2024-08-20T18:37:24.100435Z",
  "processing_status": "in_progress",
  "request_counts": {
    "canceled": 10,
    "errored": 30,
    "expired": 10,
    "processing": 100,
    "succeeded": 50
  },
  "results_url": "https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results",
  "type": "message_batch"
}
```

## Retrieve a Message Batch

`BetaMessageBatch Beta.Messages.Batches.Retrieve(BatchRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/messages/batches/{message_batch_id}`

This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response.

Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

### Parameters

- `BatchRetrieveParams parameters`

  - `required string messageBatchID`

    ID of the Message Batch.

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaMessageBatch:`

  - `required string ID`

    Unique object identifier.

    The format and length of IDs may change over time.

  - `required DateTimeOffset? ArchivedAt`

    RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.

  - `required DateTimeOffset? CancelInitiatedAt`

    RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.

  - `required DateTimeOffset CreatedAt`

    RFC 3339 datetime string representing the time at which the Message Batch was created.

  - `required DateTimeOffset? EndedAt`

    RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.

    Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.

  - `required DateTimeOffset ExpiresAt`

    RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.

  - `required ProcessingStatus ProcessingStatus`

    Processing status of the Message Batch.

    - `"in_progress"InProgress`

    - `"canceling"Canceling`

    - `"ended"Ended`

  - `required BetaMessageBatchRequestCounts RequestCounts`

    Tallies requests within the Message Batch, categorized by their status.

    Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch.

    - `required Long Canceled`

      Number of requests in the Message Batch that have been canceled.

      This is zero until processing of the entire Message Batch has ended.

    - `required Long Errored`

      Number of requests in the Message Batch that encountered an error.

      This is zero until processing of the entire Message Batch has ended.

    - `required Long Expired`

      Number of requests in the Message Batch that have expired.

      This is zero until processing of the entire Message Batch has ended.

    - `required Long Processing`

      Number of requests in the Message Batch that are processing.

    - `required Long Succeeded`

      Number of requests in the Message Batch that have completed successfully.

      This is zero until processing of the entire Message Batch has ended.

  - `required string? ResultsUrl`

    URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.

    Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.

  - `JsonElement Type "message_batch"constant`

    Object type.

    For Message Batches, this is always `"message_batch"`.

### Example

```csharp
BatchRetrieveParams parameters = new() { MessageBatchID = "message_batch_id" };

var betaMessageBatch = await client.Beta.Messages.Batches.Retrieve(parameters);

Console.WriteLine(betaMessageBatch);
```

#### Response

```json
{
  "id": "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF",
  "archived_at": "2024-08-20T18:37:24.100435Z",
  "cancel_initiated_at": "2024-08-20T18:37:24.100435Z",
  "created_at": "2024-08-20T18:37:24.100435Z",
  "ended_at": "2024-08-20T18:37:24.100435Z",
  "expires_at": "2024-08-20T18:37:24.100435Z",
  "processing_status": "in_progress",
  "request_counts": {
    "canceled": 10,
    "errored": 30,
    "expired": 10,
    "processing": 100,
    "succeeded": 50
  },
  "results_url": "https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results",
  "type": "message_batch"
}
```

## List Message Batches

`BatchListPageResponse Beta.Messages.Batches.List(BatchListParams?parameters, CancellationTokencancellationToken = default)`

**get** `/v1/messages/batches`

List all Message Batches within a Workspace. Most recently created batches are returned first.

Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

### Parameters

- `BatchListParams parameters`

  - `string afterID`

    Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.

  - `string beforeID`

    Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.

  - `Long limit`

    Query param: Number of items to return per page.

    Defaults to `20`. Ranges from `1` to `1000`.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BatchListPageResponse:`

  - `required IReadOnlyList<BetaMessageBatch> Data`

    - `required string ID`

      Unique object identifier.

      The format and length of IDs may change over time.

    - `required DateTimeOffset? ArchivedAt`

      RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.

    - `required DateTimeOffset? CancelInitiatedAt`

      RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.

    - `required DateTimeOffset CreatedAt`

      RFC 3339 datetime string representing the time at which the Message Batch was created.

    - `required DateTimeOffset? EndedAt`

      RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.

      Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.

    - `required DateTimeOffset ExpiresAt`

      RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.

    - `required ProcessingStatus ProcessingStatus`

      Processing status of the Message Batch.

      - `"in_progress"InProgress`

      - `"canceling"Canceling`

      - `"ended"Ended`

    - `required BetaMessageBatchRequestCounts RequestCounts`

      Tallies requests within the Message Batch, categorized by their status.

      Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch.

      - `required Long Canceled`

        Number of requests in the Message Batch that have been canceled.

        This is zero until processing of the entire Message Batch has ended.

      - `required Long Errored`

        Number of requests in the Message Batch that encountered an error.

        This is zero until processing of the entire Message Batch has ended.

      - `required Long Expired`

        Number of requests in the Message Batch that have expired.

        This is zero until processing of the entire Message Batch has ended.

      - `required Long Processing`

        Number of requests in the Message Batch that are processing.

      - `required Long Succeeded`

        Number of requests in the Message Batch that have completed successfully.

        This is zero until processing of the entire Message Batch has ended.

    - `required string? ResultsUrl`

      URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.

      Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.

    - `JsonElement Type "message_batch"constant`

      Object type.

      For Message Batches, this is always `"message_batch"`.

  - `required string? FirstID`

    First ID in the `data` list. Can be used as the `before_id` for the previous page.

  - `required Boolean HasMore`

    Indicates if there are more results in the requested page direction.

  - `required string? LastID`

    Last ID in the `data` list. Can be used as the `after_id` for the next page.

### Example

```csharp
BatchListParams parameters = new();

var page = await client.Beta.Messages.Batches.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF",
      "archived_at": "2024-08-20T18:37:24.100435Z",
      "cancel_initiated_at": "2024-08-20T18:37:24.100435Z",
      "created_at": "2024-08-20T18:37:24.100435Z",
      "ended_at": "2024-08-20T18:37:24.100435Z",
      "expires_at": "2024-08-20T18:37:24.100435Z",
      "processing_status": "in_progress",
      "request_counts": {
        "canceled": 10,
        "errored": 30,
        "expired": 10,
        "processing": 100,
        "succeeded": 50
      },
      "results_url": "https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results",
      "type": "message_batch"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id"
}
```

## Cancel a Message Batch

`BetaMessageBatch Beta.Messages.Batches.Cancel(BatchCancelParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/messages/batches/{message_batch_id}/cancel`

Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.

The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible.

Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

### Parameters

- `BatchCancelParams parameters`

  - `required string messageBatchID`

    ID of the Message Batch.

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaMessageBatch:`

  - `required string ID`

    Unique object identifier.

    The format and length of IDs may change over time.

  - `required DateTimeOffset? ArchivedAt`

    RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.

  - `required DateTimeOffset? CancelInitiatedAt`

    RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.

  - `required DateTimeOffset CreatedAt`

    RFC 3339 datetime string representing the time at which the Message Batch was created.

  - `required DateTimeOffset? EndedAt`

    RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.

    Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.

  - `required DateTimeOffset ExpiresAt`

    RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.

  - `required ProcessingStatus ProcessingStatus`

    Processing status of the Message Batch.

    - `"in_progress"InProgress`

    - `"canceling"Canceling`

    - `"ended"Ended`

  - `required BetaMessageBatchRequestCounts RequestCounts`

    Tallies requests within the Message Batch, categorized by their status.

    Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch.

    - `required Long Canceled`

      Number of requests in the Message Batch that have been canceled.

      This is zero until processing of the entire Message Batch has ended.

    - `required Long Errored`

      Number of requests in the Message Batch that encountered an error.

      This is zero until processing of the entire Message Batch has ended.

    - `required Long Expired`

      Number of requests in the Message Batch that have expired.

      This is zero until processing of the entire Message Batch has ended.

    - `required Long Processing`

      Number of requests in the Message Batch that are processing.

    - `required Long Succeeded`

      Number of requests in the Message Batch that have completed successfully.

      This is zero until processing of the entire Message Batch has ended.

  - `required string? ResultsUrl`

    URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.

    Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.

  - `JsonElement Type "message_batch"constant`

    Object type.

    For Message Batches, this is always `"message_batch"`.

### Example

```csharp
BatchCancelParams parameters = new() { MessageBatchID = "message_batch_id" };

var betaMessageBatch = await client.Beta.Messages.Batches.Cancel(parameters);

Console.WriteLine(betaMessageBatch);
```

#### Response

```json
{
  "id": "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF",
  "archived_at": "2024-08-20T18:37:24.100435Z",
  "cancel_initiated_at": "2024-08-20T18:37:24.100435Z",
  "created_at": "2024-08-20T18:37:24.100435Z",
  "ended_at": "2024-08-20T18:37:24.100435Z",
  "expires_at": "2024-08-20T18:37:24.100435Z",
  "processing_status": "in_progress",
  "request_counts": {
    "canceled": 10,
    "errored": 30,
    "expired": 10,
    "processing": 100,
    "succeeded": 50
  },
  "results_url": "https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results",
  "type": "message_batch"
}
```

## Delete a Message Batch

`BetaDeletedMessageBatch Beta.Messages.Batches.Delete(BatchDeleteParamsparameters, CancellationTokencancellationToken = default)`

**delete** `/v1/messages/batches/{message_batch_id}`

Delete a Message Batch.

Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it.

Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

### Parameters

- `BatchDeleteParams parameters`

  - `required string messageBatchID`

    ID of the Message Batch.

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaDeletedMessageBatch:`

  - `required string ID`

    ID of the Message Batch.

  - `JsonElement Type "message_batch_deleted"constant`

    Deleted object type.

    For Message Batches, this is always `"message_batch_deleted"`.

### Example

```csharp
BatchDeleteParams parameters = new() { MessageBatchID = "message_batch_id" };

var betaDeletedMessageBatch = await client.Beta.Messages.Batches.Delete(parameters);

Console.WriteLine(betaDeletedMessageBatch);
```

#### Response

```json
{
  "id": "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF",
  "type": "message_batch_deleted"
}
```

## Retrieve Message Batch results

`BetaMessageBatchIndividualResponse Beta.Messages.Batches.ResultsStreaming(BatchResultsParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/messages/batches/{message_batch_id}/results`

Streams the results of a Message Batch as a `.jsonl` file.

Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.

Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

### Parameters

- `BatchResultsParams parameters`

  - `required string messageBatchID`

    ID of the Message Batch.

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaMessageBatchIndividualResponse:`

  This is a single line in the response `.jsonl` file and does not represent the response as a whole.

  - `required string CustomID`

    Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.

    Must be unique for each request within the Message Batch.

  - `required BetaMessageBatchResult Result`

    Processing result for this request.

    Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.

    - `class BetaMessageBatchSucceededResult:`

      - `required BetaMessage Message`

        - `required string ID`

          Unique object identifier.

          The format and length of IDs may change over time.

        - `required BetaContainer? Container`

          Information about the container used in the request (for the code execution tool)

          - `required string ID`

            Identifier for the container used in this request

          - `required DateTimeOffset ExpiresAt`

            The time at which the container will expire.

          - `required IReadOnlyList<BetaSkill>? Skills`

            Skills loaded in the container

            - `required string SkillID`

              Skill ID

            - `required Type Type`

              Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

              - `"anthropic"Anthropic`

              - `"custom"Custom`

            - `required string Version`

              Skill version or 'latest' for most recent version

        - `required IReadOnlyList<BetaContentBlock> Content`

          Content generated by the model.

          This is an array of content blocks, each of which has a `type` that determines its shape.

          Example:

          ```json
          [{"type": "text", "text": "Hi, I'm Claude."}]
          ```

          If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.

          For example, if the input `messages` were:

          ```json
          [
            {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
            {"role": "assistant", "content": "The best answer is ("}
          ]
          ```

          Then the response `content` might be:

          ```json
          [{"type": "text", "text": "B)"}]
          ```

          - `class BetaTextBlock:`

            - `required IReadOnlyList<BetaTextCitation>? Citations`

              Citations supporting the text block.

              The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

              - `class BetaCitationCharLocation:`

                - `required string CitedText`

                - `required Long DocumentIndex`

                - `required string? DocumentTitle`

                - `required Long EndCharIndex`

                - `required string? FileID`

                - `required Long StartCharIndex`

                - `JsonElement Type "char_location"constant`

              - `class BetaCitationPageLocation:`

                - `required string CitedText`

                - `required Long DocumentIndex`

                - `required string? DocumentTitle`

                - `required Long EndPageNumber`

                - `required string? FileID`

                - `required Long StartPageNumber`

                - `JsonElement Type "page_location"constant`

              - `class BetaCitationContentBlockLocation:`

                - `required string CitedText`

                  The full text of the cited block range, concatenated.

                  Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                - `required Long DocumentIndex`

                - `required string? DocumentTitle`

                - `required Long EndBlockIndex`

                  Exclusive 0-based end index of the cited block range in the source's `content` array.

                  Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                - `required string? FileID`

                - `required Long StartBlockIndex`

                  0-based index of the first cited block in the source's `content` array.

                - `JsonElement Type "content_block_location"constant`

              - `class BetaCitationsWebSearchResultLocation:`

                - `required string CitedText`

                - `required string EncryptedIndex`

                - `required string? Title`

                - `JsonElement Type "web_search_result_location"constant`

                - `required string Url`

              - `class BetaCitationSearchResultLocation:`

                - `required string CitedText`

                  The full text of the cited block range, concatenated.

                  Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                - `required Long EndBlockIndex`

                  Exclusive 0-based end index of the cited block range in the source's `content` array.

                  Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                - `required Long SearchResultIndex`

                  0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

                  Counted separately from `document_index`; server-side web search results are not included in this count.

                - `required string Source`

                - `required Long StartBlockIndex`

                  0-based index of the first cited block in the source's `content` array.

                - `required string? Title`

                - `JsonElement Type "search_result_location"constant`

            - `required string Text`

            - `JsonElement Type "text"constant`

          - `class BetaThinkingBlock:`

            - `required string Signature`

            - `required string Thinking`

            - `JsonElement Type "thinking"constant`

          - `class BetaRedactedThinkingBlock:`

            - `required string Data`

            - `JsonElement Type "redacted_thinking"constant`

          - `class BetaToolUseBlock:`

            - `required string ID`

            - `required IReadOnlyDictionary<string, JsonElement> Input`

            - `required string Name`

            - `JsonElement Type "tool_use"constant`

            - `Caller Caller`

              Tool invocation directly from the model.

              - `class BetaDirectCaller:`

                Tool invocation directly from the model.

                - `JsonElement Type "direct"constant`

              - `class BetaServerToolCaller:`

                Tool invocation generated by a server-side tool.

                - `required string ToolID`

                - `JsonElement Type "code_execution_20250825"constant`

              - `class BetaServerToolCaller20260120:`

                - `required string ToolID`

                - `JsonElement Type "code_execution_20260120"constant`

          - `class BetaServerToolUseBlock:`

            - `required string ID`

            - `required IReadOnlyDictionary<string, JsonElement> Input`

            - `required Name Name`

              - `"advisor"Advisor`

              - `"web_search"WebSearch`

              - `"web_fetch"WebFetch`

              - `"code_execution"CodeExecution`

              - `"bash_code_execution"BashCodeExecution`

              - `"text_editor_code_execution"TextEditorCodeExecution`

              - `"tool_search_tool_regex"ToolSearchToolRegex`

              - `"tool_search_tool_bm25"ToolSearchToolBm25`

            - `JsonElement Type "server_tool_use"constant`

            - `Caller Caller`

              Tool invocation directly from the model.

              - `class BetaDirectCaller:`

                Tool invocation directly from the model.

              - `class BetaServerToolCaller:`

                Tool invocation generated by a server-side tool.

              - `class BetaServerToolCaller20260120:`

          - `class BetaWebSearchToolResultBlock:`

            - `required BetaWebSearchToolResultBlockContent Content`

              - `class BetaWebSearchToolResultError:`

                - `required BetaWebSearchToolResultErrorCode ErrorCode`

                  - `"invalid_tool_input"InvalidToolInput`

                  - `"unavailable"Unavailable`

                  - `"max_uses_exceeded"MaxUsesExceeded`

                  - `"too_many_requests"TooManyRequests`

                  - `"query_too_long"QueryTooLong`

                  - `"request_too_large"RequestTooLarge`

                - `JsonElement Type "web_search_tool_result_error"constant`

              - `IReadOnlyList<BetaWebSearchResultBlock>`

                - `required string EncryptedContent`

                - `required string? PageAge`

                - `required string Title`

                - `JsonElement Type "web_search_result"constant`

                - `required string Url`

            - `required string ToolUseID`

            - `JsonElement Type "web_search_tool_result"constant`

            - `Caller Caller`

              Tool invocation directly from the model.

              - `class BetaDirectCaller:`

                Tool invocation directly from the model.

              - `class BetaServerToolCaller:`

                Tool invocation generated by a server-side tool.

              - `class BetaServerToolCaller20260120:`

          - `class BetaWebFetchToolResultBlock:`

            - `required Content Content`

              - `class BetaWebFetchToolResultErrorBlock:`

                - `required BetaWebFetchToolResultErrorCode ErrorCode`

                  - `"invalid_tool_input"InvalidToolInput`

                  - `"url_too_long"UrlTooLong`

                  - `"url_not_allowed"UrlNotAllowed`

                  - `"url_not_in_prior_context"UrlNotInPriorContext`

                  - `"url_not_accessible"UrlNotAccessible`

                  - `"unsupported_content_type"UnsupportedContentType`

                  - `"too_many_requests"TooManyRequests`

                  - `"max_uses_exceeded"MaxUsesExceeded`

                  - `"unavailable"Unavailable`

                - `JsonElement Type "web_fetch_tool_result_error"constant`

              - `class BetaWebFetchBlock:`

                - `required BetaDocumentBlock Content`

                  - `required BetaCitationConfig? Citations`

                    Citation configuration for the document

                    - `required Boolean Enabled`

                  - `required Source Source`

                    - `class BetaBase64PdfSource:`

                      - `required string Data`

                      - `JsonElement MediaType "application/pdf"constant`

                      - `JsonElement Type "base64"constant`

                    - `class BetaPlainTextSource:`

                      - `required string Data`

                      - `JsonElement MediaType "text/plain"constant`

                      - `JsonElement Type "text"constant`

                  - `required string? Title`

                    The title of the document

                  - `JsonElement Type "document"constant`

                - `required string? RetrievedAt`

                  ISO 8601 timestamp when the content was retrieved

                - `JsonElement Type "web_fetch_result"constant`

                - `required string Url`

                  Fetched content URL

            - `required string ToolUseID`

            - `JsonElement Type "web_fetch_tool_result"constant`

            - `Caller Caller`

              Tool invocation directly from the model.

              - `class BetaDirectCaller:`

                Tool invocation directly from the model.

              - `class BetaServerToolCaller:`

                Tool invocation generated by a server-side tool.

              - `class BetaServerToolCaller20260120:`

          - `class BetaAdvisorToolResultBlock:`

            - `required Content Content`

              - `class BetaAdvisorToolResultError:`

                - `required ErrorCode ErrorCode`

                  - `"max_uses_exceeded"MaxUsesExceeded`

                  - `"prompt_too_long"PromptTooLong`

                  - `"too_many_requests"TooManyRequests`

                  - `"overloaded"Overloaded`

                  - `"unavailable"Unavailable`

                  - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `JsonElement Type "advisor_tool_result_error"constant`

              - `class BetaAdvisorResultBlock:`

                - `required string? StopReason`

                  The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the tool's `max_tokens` value or the advisor model's policy cap.

                - `required string Text`

                - `JsonElement Type "advisor_result"constant`

              - `class BetaAdvisorRedactedResultBlock:`

                - `required string EncryptedContent`

                  Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.

                - `required string? StopReason`

                  The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`).

                - `JsonElement Type "advisor_redacted_result"constant`

            - `required string ToolUseID`

            - `JsonElement Type "advisor_tool_result"constant`

          - `class BetaCodeExecutionToolResultBlock:`

            - `required BetaCodeExecutionToolResultBlockContent Content`

              Code execution result with encrypted stdout for PFC + web_search results.

              - `class BetaCodeExecutionToolResultError:`

                - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

                  - `"invalid_tool_input"InvalidToolInput`

                  - `"unavailable"Unavailable`

                  - `"too_many_requests"TooManyRequests`

                  - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `JsonElement Type "code_execution_tool_result_error"constant`

              - `class BetaCodeExecutionResultBlock:`

                - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

                  - `required string FileID`

                  - `JsonElement Type "code_execution_output"constant`

                - `required Long ReturnCode`

                - `required string Stderr`

                - `required string Stdout`

                - `JsonElement Type "code_execution_result"constant`

              - `class BetaEncryptedCodeExecutionResultBlock:`

                Code execution result with encrypted stdout for PFC + web_search results.

                - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

                  - `required string FileID`

                  - `JsonElement Type "code_execution_output"constant`

                - `required string EncryptedStdout`

                - `required Long ReturnCode`

                - `required string Stderr`

                - `JsonElement Type "encrypted_code_execution_result"constant`

            - `required string ToolUseID`

            - `JsonElement Type "code_execution_tool_result"constant`

          - `class BetaBashCodeExecutionToolResultBlock:`

            - `required Content Content`

              - `class BetaBashCodeExecutionToolResultError:`

                - `required ErrorCode ErrorCode`

                  - `"invalid_tool_input"InvalidToolInput`

                  - `"unavailable"Unavailable`

                  - `"too_many_requests"TooManyRequests`

                  - `"execution_time_exceeded"ExecutionTimeExceeded`

                  - `"output_file_too_large"OutputFileTooLarge`

                - `JsonElement Type "bash_code_execution_tool_result_error"constant`

              - `class BetaBashCodeExecutionResultBlock:`

                - `required IReadOnlyList<BetaBashCodeExecutionOutputBlock> Content`

                  - `required string FileID`

                  - `JsonElement Type "bash_code_execution_output"constant`

                - `required Long ReturnCode`

                - `required string Stderr`

                - `required string Stdout`

                - `JsonElement Type "bash_code_execution_result"constant`

            - `required string ToolUseID`

            - `JsonElement Type "bash_code_execution_tool_result"constant`

          - `class BetaTextEditorCodeExecutionToolResultBlock:`

            - `required Content Content`

              - `class BetaTextEditorCodeExecutionToolResultError:`

                - `required ErrorCode ErrorCode`

                  - `"invalid_tool_input"InvalidToolInput`

                  - `"unavailable"Unavailable`

                  - `"too_many_requests"TooManyRequests`

                  - `"execution_time_exceeded"ExecutionTimeExceeded`

                  - `"file_not_found"FileNotFound`

                - `required string? ErrorMessage`

                - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

              - `class BetaTextEditorCodeExecutionViewResultBlock:`

                - `required string Content`

                - `required FileType FileType`

                  - `"text"Text`

                  - `"image"Image`

                  - `"pdf"Pdf`

                - `required Long? NumLines`

                - `required Long? StartLine`

                - `required Long? TotalLines`

                - `JsonElement Type "text_editor_code_execution_view_result"constant`

              - `class BetaTextEditorCodeExecutionCreateResultBlock:`

                - `required Boolean IsFileUpdate`

                - `JsonElement Type "text_editor_code_execution_create_result"constant`

              - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:`

                - `required IReadOnlyList<string>? Lines`

                - `required Long? NewLines`

                - `required Long? NewStart`

                - `required Long? OldLines`

                - `required Long? OldStart`

                - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

            - `required string ToolUseID`

            - `JsonElement Type "text_editor_code_execution_tool_result"constant`

          - `class BetaToolSearchToolResultBlock:`

            - `required Content Content`

              - `class BetaToolSearchToolResultError:`

                - `required ErrorCode ErrorCode`

                  - `"invalid_tool_input"InvalidToolInput`

                  - `"unavailable"Unavailable`

                  - `"too_many_requests"TooManyRequests`

                  - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `required string? ErrorMessage`

                - `JsonElement Type "tool_search_tool_result_error"constant`

              - `class BetaToolSearchToolSearchResultBlock:`

                - `required IReadOnlyList<BetaToolReferenceBlock> ToolReferences`

                  - `required string ToolName`

                  - `JsonElement Type "tool_reference"constant`

                - `JsonElement Type "tool_search_tool_search_result"constant`

            - `required string ToolUseID`

            - `JsonElement Type "tool_search_tool_result"constant`

          - `class BetaMcpToolUseBlock:`

            - `required string ID`

            - `required IReadOnlyDictionary<string, JsonElement> Input`

            - `required string Name`

              The name of the MCP tool

            - `required string ServerName`

              The name of the MCP server

            - `JsonElement Type "mcp_tool_use"constant`

          - `class BetaMcpToolResultBlock:`

            - `required Content Content`

              - `string`

              - `IReadOnlyList<BetaTextBlock>`

                - `required IReadOnlyList<BetaTextCitation>? Citations`

                  Citations supporting the text block.

                  The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

                - `required string Text`

                - `JsonElement Type "text"constant`

            - `required Boolean IsError`

            - `required string ToolUseID`

            - `JsonElement Type "mcp_tool_result"constant`

          - `class BetaContainerUploadBlock:`

            Response model for a file uploaded to the container.

            - `required string FileID`

            - `JsonElement Type "container_upload"constant`

          - `class BetaCompactionBlock:`

            A compaction block returned when autocompact is triggered.

            When content is None, it indicates the compaction failed to produce a valid
            summary (e.g., malformed output from the model). Clients may round-trip
            compaction blocks with null content; the server treats them as no-ops.

            - `required string? Content`

              Summary of compacted content, or null if compaction failed

            - `required string? EncryptedContent`

              Opaque metadata from prior compaction, to be round-tripped verbatim

            - `JsonElement Type "compaction"constant`

        - `required BetaContextManagementResponse? ContextManagement`

          Context management response.

          Information about context management strategies applied during the request.

          - `required IReadOnlyList<AppliedEdit> AppliedEdits`

            List of context management edits that were applied.

            - `class BetaClearToolUses20250919EditResponse:`

              - `required Long ClearedInputTokens`

                Number of input tokens cleared by this edit.

              - `required Long ClearedToolUses`

                Number of tool uses that were cleared.

              - `JsonElement Type "clear_tool_uses_20250919"constant`

                The type of context management edit applied.

            - `class BetaClearThinking20251015EditResponse:`

              - `required Long ClearedInputTokens`

                Number of input tokens cleared by this edit.

              - `required Long ClearedThinkingTurns`

                Number of thinking turns that were cleared.

              - `JsonElement Type "clear_thinking_20251015"constant`

                The type of context management edit applied.

        - `required BetaDiagnostics? Diagnostics`

          Response envelope for request-level diagnostics. Present (possibly
          null) whenever the caller supplied `diagnostics` on the request.

          - `required CacheMissReason? CacheMissReason`

            Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.

            - `class BetaCacheMissModelChanged:`

              - `required Long CacheMissedInputTokens`

                Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

              - `JsonElement Type "model_changed"constant`

            - `class BetaCacheMissSystemChanged:`

              - `required Long CacheMissedInputTokens`

                Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

              - `JsonElement Type "system_changed"constant`

            - `class BetaCacheMissToolsChanged:`

              - `required Long CacheMissedInputTokens`

                Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

              - `JsonElement Type "tools_changed"constant`

            - `class BetaCacheMissMessagesChanged:`

              - `required Long CacheMissedInputTokens`

                Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

              - `JsonElement Type "messages_changed"constant`

            - `class BetaCacheMissPreviousMessageNotFound:`

              - `JsonElement Type "previous_message_not_found"constant`

            - `class BetaCacheMissUnavailable:`

              - `JsonElement Type "unavailable"constant`

        - `required Model Model`

          The model that will complete your prompt.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `"claude-opus-4-8"ClaudeOpus4_8`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-7"ClaudeOpus4_7`

            Frontier intelligence for long-running agents and coding

          - `"claude-mythos-preview"ClaudeMythosPreview`

            New class of intelligence, strongest in coding and cybersecurity

          - `"claude-opus-4-6"ClaudeOpus4_6`

            Frontier intelligence for long-running agents and coding

          - `"claude-sonnet-4-6"ClaudeSonnet4_6`

            Best combination of speed and intelligence

          - `"claude-haiku-4-5"ClaudeHaiku4_5`

            Fastest model with near-frontier intelligence

          - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

            Fastest model with near-frontier intelligence

          - `"claude-opus-4-5"ClaudeOpus4_5`

            Premium model combining maximum intelligence with practical performance

          - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

            Premium model combining maximum intelligence with practical performance

          - `"claude-sonnet-4-5"ClaudeSonnet4_5`

            High-performance model for agents and coding

          - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

            High-performance model for agents and coding

          - `"claude-opus-4-1"ClaudeOpus4_1`

            Exceptional model for specialized complex tasks

          - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

            Exceptional model for specialized complex tasks

          - `"claude-opus-4-0"ClaudeOpus4_0`

            Powerful model for complex tasks

          - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

            Powerful model for complex tasks

          - `"claude-sonnet-4-0"ClaudeSonnet4_0`

            High-performance model with extended thinking

          - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

            High-performance model with extended thinking

          - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

            Fast and cost-effective model

        - `JsonElement Role "assistant"constant`

          Conversational role of the generated message.

          This will always be `"assistant"`.

        - `required BetaRefusalStopDetails? StopDetails`

          Structured information about a refusal.

          - `required Category? Category`

            The policy category that triggered the refusal.

            `null` when the refusal doesn't map to a named category.

            - `"cyber"Cyber`

            - `"bio"Bio`

          - `required string? Explanation`

            Human-readable explanation of the refusal.

            This text is not guaranteed to be stable. `null` when no explanation is available for the category.

          - `JsonElement Type "refusal"constant`

        - `required BetaStopReason? StopReason`

          The reason that we stopped.

          This may be one the following values:

          * `"end_turn"`: the model reached a natural stopping point
          * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
          * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
          * `"tool_use"`: the model invoked one or more tools
          * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.
          * `"refusal"`: when streaming classifiers intervene to handle potential policy violations

          In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise.

          - `"end_turn"EndTurn`

          - `"max_tokens"MaxTokens`

          - `"stop_sequence"StopSequence`

          - `"tool_use"ToolUse`

          - `"pause_turn"PauseTurn`

          - `"compaction"Compaction`

          - `"refusal"Refusal`

          - `"model_context_window_exceeded"ModelContextWindowExceeded`

        - `required string? StopSequence`

          Which custom stop sequence was generated, if any.

          This value will be a non-null string if one of your custom stop sequences was generated.

        - `JsonElement Type "message"constant`

          Object type.

          For Messages, this is always `"message"`.

        - `required BetaUsage Usage`

          Billing and rate-limit usage.

          Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

          Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.

          For example, `output_tokens` will be non-zero, even for an empty string response from Claude.

          Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.

          - `required BetaCacheCreation? CacheCreation`

            Breakdown of cached tokens by TTL

            - `required Long Ephemeral1hInputTokens`

              The number of input tokens used to create the 1 hour cache entry.

            - `required Long Ephemeral5mInputTokens`

              The number of input tokens used to create the 5 minute cache entry.

          - `required Long? CacheCreationInputTokens`

            The number of input tokens used to create the cache entry.

          - `required Long? CacheReadInputTokens`

            The number of input tokens read from the cache.

          - `required string? InferenceGeo`

            The geographic region where inference was performed for this request.

          - `required Long InputTokens`

            The number of input tokens which were used.

          - `required IReadOnlyList<BetaIterationsUsageItems>? Iterations`

            Per-iteration token usage breakdown.

            Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:

            - Determine which iterations exceeded long context thresholds (>=200k tokens)
            - Calculate the true context window size from the last iteration
            - Understand token accumulation across server-side tool use loops

            - `class BetaMessageIterationUsage:`

              Token usage for a sampling iteration.

              - `required BetaCacheCreation? CacheCreation`

                Breakdown of cached tokens by TTL

              - `required Long CacheCreationInputTokens`

                The number of input tokens used to create the cache entry.

              - `required Long CacheReadInputTokens`

                The number of input tokens read from the cache.

              - `required Long InputTokens`

                The number of input tokens which were used.

              - `required Long OutputTokens`

                The number of output tokens which were used.

              - `JsonElement Type "message"constant`

                Usage for a sampling iteration

            - `class BetaCompactionIterationUsage:`

              Token usage for a compaction iteration.

              - `required BetaCacheCreation? CacheCreation`

                Breakdown of cached tokens by TTL

              - `required Long CacheCreationInputTokens`

                The number of input tokens used to create the cache entry.

              - `required Long CacheReadInputTokens`

                The number of input tokens read from the cache.

              - `required Long InputTokens`

                The number of input tokens which were used.

              - `required Long OutputTokens`

                The number of output tokens which were used.

              - `JsonElement Type "compaction"constant`

                Usage for a compaction iteration

            - `class BetaAdvisorMessageIterationUsage:`

              Token usage for an advisor sub-inference iteration.

              - `required BetaCacheCreation? CacheCreation`

                Breakdown of cached tokens by TTL

              - `required Long CacheCreationInputTokens`

                The number of input tokens used to create the cache entry.

              - `required Long CacheReadInputTokens`

                The number of input tokens read from the cache.

              - `required Long InputTokens`

                The number of input tokens which were used.

              - `required Model Model`

                The model that will complete your prompt.

                See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

              - `required Long OutputTokens`

                The number of output tokens which were used.

              - `JsonElement Type "advisor_message"constant`

                Usage for an advisor sub-inference iteration

          - `required Long OutputTokens`

            The number of output tokens which were used.

          - `required BetaOutputTokensDetails? OutputTokensDetails`

            Breakdown of output tokens by category.

            `output_tokens` remains the inclusive, authoritative total used for billing.
            This object provides a read-only decomposition for observability — for example,
            how many of the billed output tokens were spent on internal reasoning that may
            have been summarized before being returned to you.

            - `required Long ThinkingTokens`

              Number of output tokens the model generated as internal reasoning, including
              the thinking-block delimiter tokens.

              Reflects the raw reasoning the model produced, not the (possibly shorter)
              summarized thinking text returned in the response body. Computed by
              re-tokenizing the raw reasoning text, so it may differ from the model's exact
              generation count by a small number of tokens. Always ≤ `output_tokens`;
              `output_tokens - thinking_tokens` approximates the non-reasoning output.

          - `required BetaServerToolUsage? ServerToolUse`

            The number of server tool requests.

            - `required Long WebFetchRequests`

              The number of web fetch tool requests.

            - `required Long WebSearchRequests`

              The number of web search tool requests.

          - `required ServiceTier? ServiceTier`

            If the request used the priority, standard, or batch tier.

            - `"standard"Standard`

            - `"priority"Priority`

            - `"batch"Batch`

          - `required Speed? Speed`

            The inference speed mode used for this request.

            - `"standard"Standard`

            - `"fast"Fast`

      - `JsonElement Type "succeeded"constant`

    - `class BetaMessageBatchErroredResult:`

      - `required BetaErrorResponse Error`

        - `required BetaError Error`

          - `class BetaInvalidRequestError:`

            - `required string Message`

            - `JsonElement Type "invalid_request_error"constant`

          - `class BetaAuthenticationError:`

            - `required string Message`

            - `JsonElement Type "authentication_error"constant`

          - `class BetaBillingError:`

            - `required string Message`

            - `JsonElement Type "billing_error"constant`

          - `class BetaPermissionError:`

            - `required string Message`

            - `JsonElement Type "permission_error"constant`

          - `class BetaNotFoundError:`

            - `required string Message`

            - `JsonElement Type "not_found_error"constant`

          - `class BetaRateLimitError:`

            - `required string Message`

            - `JsonElement Type "rate_limit_error"constant`

          - `class BetaGatewayTimeoutError:`

            - `required string Message`

            - `JsonElement Type "timeout_error"constant`

          - `class BetaApiError:`

            - `required string Message`

            - `JsonElement Type "api_error"constant`

          - `class BetaOverloadedError:`

            - `required string Message`

            - `JsonElement Type "overloaded_error"constant`

        - `required string? RequestID`

        - `JsonElement Type "error"constant`

      - `JsonElement Type "errored"constant`

    - `class BetaMessageBatchCanceledResult:`

      - `JsonElement Type "canceled"constant`

    - `class BetaMessageBatchExpiredResult:`

      - `JsonElement Type "expired"constant`

### Example

```csharp
BatchResultsParams parameters = new() { MessageBatchID = "message_batch_id" };

await foreach (var betaMessageBatchIndividualResponse in client.Beta.Messages.Batches.ResultsStreaming(parameters))
{
    Console.WriteLine(betaMessageBatchIndividualResponse);
}
```

## Domain Types

### Beta Deleted Message Batch

- `class BetaDeletedMessageBatch:`

  - `required string ID`

    ID of the Message Batch.

  - `JsonElement Type "message_batch_deleted"constant`

    Deleted object type.

    For Message Batches, this is always `"message_batch_deleted"`.

### Beta Message Batch

- `class BetaMessageBatch:`

  - `required string ID`

    Unique object identifier.

    The format and length of IDs may change over time.

  - `required DateTimeOffset? ArchivedAt`

    RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.

  - `required DateTimeOffset? CancelInitiatedAt`

    RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.

  - `required DateTimeOffset CreatedAt`

    RFC 3339 datetime string representing the time at which the Message Batch was created.

  - `required DateTimeOffset? EndedAt`

    RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.

    Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.

  - `required DateTimeOffset ExpiresAt`

    RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.

  - `required ProcessingStatus ProcessingStatus`

    Processing status of the Message Batch.

    - `"in_progress"InProgress`

    - `"canceling"Canceling`

    - `"ended"Ended`

  - `required BetaMessageBatchRequestCounts RequestCounts`

    Tallies requests within the Message Batch, categorized by their status.

    Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch.

    - `required Long Canceled`

      Number of requests in the Message Batch that have been canceled.

      This is zero until processing of the entire Message Batch has ended.

    - `required Long Errored`

      Number of requests in the Message Batch that encountered an error.

      This is zero until processing of the entire Message Batch has ended.

    - `required Long Expired`

      Number of requests in the Message Batch that have expired.

      This is zero until processing of the entire Message Batch has ended.

    - `required Long Processing`

      Number of requests in the Message Batch that are processing.

    - `required Long Succeeded`

      Number of requests in the Message Batch that have completed successfully.

      This is zero until processing of the entire Message Batch has ended.

  - `required string? ResultsUrl`

    URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.

    Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.

  - `JsonElement Type "message_batch"constant`

    Object type.

    For Message Batches, this is always `"message_batch"`.

### Beta Message Batch Canceled Result

- `class BetaMessageBatchCanceledResult:`

  - `JsonElement Type "canceled"constant`

### Beta Message Batch Errored Result

- `class BetaMessageBatchErroredResult:`

  - `required BetaErrorResponse Error`

    - `required BetaError Error`

      - `class BetaInvalidRequestError:`

        - `required string Message`

        - `JsonElement Type "invalid_request_error"constant`

      - `class BetaAuthenticationError:`

        - `required string Message`

        - `JsonElement Type "authentication_error"constant`

      - `class BetaBillingError:`

        - `required string Message`

        - `JsonElement Type "billing_error"constant`

      - `class BetaPermissionError:`

        - `required string Message`

        - `JsonElement Type "permission_error"constant`

      - `class BetaNotFoundError:`

        - `required string Message`

        - `JsonElement Type "not_found_error"constant`

      - `class BetaRateLimitError:`

        - `required string Message`

        - `JsonElement Type "rate_limit_error"constant`

      - `class BetaGatewayTimeoutError:`

        - `required string Message`

        - `JsonElement Type "timeout_error"constant`

      - `class BetaApiError:`

        - `required string Message`

        - `JsonElement Type "api_error"constant`

      - `class BetaOverloadedError:`

        - `required string Message`

        - `JsonElement Type "overloaded_error"constant`

    - `required string? RequestID`

    - `JsonElement Type "error"constant`

  - `JsonElement Type "errored"constant`

### Beta Message Batch Expired Result

- `class BetaMessageBatchExpiredResult:`

  - `JsonElement Type "expired"constant`

### Beta Message Batch Individual Response

- `class BetaMessageBatchIndividualResponse:`

  This is a single line in the response `.jsonl` file and does not represent the response as a whole.

  - `required string CustomID`

    Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.

    Must be unique for each request within the Message Batch.

  - `required BetaMessageBatchResult Result`

    Processing result for this request.

    Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.

    - `class BetaMessageBatchSucceededResult:`

      - `required BetaMessage Message`

        - `required string ID`

          Unique object identifier.

          The format and length of IDs may change over time.

        - `required BetaContainer? Container`

          Information about the container used in the request (for the code execution tool)

          - `required string ID`

            Identifier for the container used in this request

          - `required DateTimeOffset ExpiresAt`

            The time at which the container will expire.

          - `required IReadOnlyList<BetaSkill>? Skills`

            Skills loaded in the container

            - `required string SkillID`

              Skill ID

            - `required Type Type`

              Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

              - `"anthropic"Anthropic`

              - `"custom"Custom`

            - `required string Version`

              Skill version or 'latest' for most recent version

        - `required IReadOnlyList<BetaContentBlock> Content`

          Content generated by the model.

          This is an array of content blocks, each of which has a `type` that determines its shape.

          Example:

          ```json
          [{"type": "text", "text": "Hi, I'm Claude."}]
          ```

          If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.

          For example, if the input `messages` were:

          ```json
          [
            {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
            {"role": "assistant", "content": "The best answer is ("}
          ]
          ```

          Then the response `content` might be:

          ```json
          [{"type": "text", "text": "B)"}]
          ```

          - `class BetaTextBlock:`

            - `required IReadOnlyList<BetaTextCitation>? Citations`

              Citations supporting the text block.

              The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

              - `class BetaCitationCharLocation:`

                - `required string CitedText`

                - `required Long DocumentIndex`

                - `required string? DocumentTitle`

                - `required Long EndCharIndex`

                - `required string? FileID`

                - `required Long StartCharIndex`

                - `JsonElement Type "char_location"constant`

              - `class BetaCitationPageLocation:`

                - `required string CitedText`

                - `required Long DocumentIndex`

                - `required string? DocumentTitle`

                - `required Long EndPageNumber`

                - `required string? FileID`

                - `required Long StartPageNumber`

                - `JsonElement Type "page_location"constant`

              - `class BetaCitationContentBlockLocation:`

                - `required string CitedText`

                  The full text of the cited block range, concatenated.

                  Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                - `required Long DocumentIndex`

                - `required string? DocumentTitle`

                - `required Long EndBlockIndex`

                  Exclusive 0-based end index of the cited block range in the source's `content` array.

                  Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                - `required string? FileID`

                - `required Long StartBlockIndex`

                  0-based index of the first cited block in the source's `content` array.

                - `JsonElement Type "content_block_location"constant`

              - `class BetaCitationsWebSearchResultLocation:`

                - `required string CitedText`

                - `required string EncryptedIndex`

                - `required string? Title`

                - `JsonElement Type "web_search_result_location"constant`

                - `required string Url`

              - `class BetaCitationSearchResultLocation:`

                - `required string CitedText`

                  The full text of the cited block range, concatenated.

                  Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                - `required Long EndBlockIndex`

                  Exclusive 0-based end index of the cited block range in the source's `content` array.

                  Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                - `required Long SearchResultIndex`

                  0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

                  Counted separately from `document_index`; server-side web search results are not included in this count.

                - `required string Source`

                - `required Long StartBlockIndex`

                  0-based index of the first cited block in the source's `content` array.

                - `required string? Title`

                - `JsonElement Type "search_result_location"constant`

            - `required string Text`

            - `JsonElement Type "text"constant`

          - `class BetaThinkingBlock:`

            - `required string Signature`

            - `required string Thinking`

            - `JsonElement Type "thinking"constant`

          - `class BetaRedactedThinkingBlock:`

            - `required string Data`

            - `JsonElement Type "redacted_thinking"constant`

          - `class BetaToolUseBlock:`

            - `required string ID`

            - `required IReadOnlyDictionary<string, JsonElement> Input`

            - `required string Name`

            - `JsonElement Type "tool_use"constant`

            - `Caller Caller`

              Tool invocation directly from the model.

              - `class BetaDirectCaller:`

                Tool invocation directly from the model.

                - `JsonElement Type "direct"constant`

              - `class BetaServerToolCaller:`

                Tool invocation generated by a server-side tool.

                - `required string ToolID`

                - `JsonElement Type "code_execution_20250825"constant`

              - `class BetaServerToolCaller20260120:`

                - `required string ToolID`

                - `JsonElement Type "code_execution_20260120"constant`

          - `class BetaServerToolUseBlock:`

            - `required string ID`

            - `required IReadOnlyDictionary<string, JsonElement> Input`

            - `required Name Name`

              - `"advisor"Advisor`

              - `"web_search"WebSearch`

              - `"web_fetch"WebFetch`

              - `"code_execution"CodeExecution`

              - `"bash_code_execution"BashCodeExecution`

              - `"text_editor_code_execution"TextEditorCodeExecution`

              - `"tool_search_tool_regex"ToolSearchToolRegex`

              - `"tool_search_tool_bm25"ToolSearchToolBm25`

            - `JsonElement Type "server_tool_use"constant`

            - `Caller Caller`

              Tool invocation directly from the model.

              - `class BetaDirectCaller:`

                Tool invocation directly from the model.

              - `class BetaServerToolCaller:`

                Tool invocation generated by a server-side tool.

              - `class BetaServerToolCaller20260120:`

          - `class BetaWebSearchToolResultBlock:`

            - `required BetaWebSearchToolResultBlockContent Content`

              - `class BetaWebSearchToolResultError:`

                - `required BetaWebSearchToolResultErrorCode ErrorCode`

                  - `"invalid_tool_input"InvalidToolInput`

                  - `"unavailable"Unavailable`

                  - `"max_uses_exceeded"MaxUsesExceeded`

                  - `"too_many_requests"TooManyRequests`

                  - `"query_too_long"QueryTooLong`

                  - `"request_too_large"RequestTooLarge`

                - `JsonElement Type "web_search_tool_result_error"constant`

              - `IReadOnlyList<BetaWebSearchResultBlock>`

                - `required string EncryptedContent`

                - `required string? PageAge`

                - `required string Title`

                - `JsonElement Type "web_search_result"constant`

                - `required string Url`

            - `required string ToolUseID`

            - `JsonElement Type "web_search_tool_result"constant`

            - `Caller Caller`

              Tool invocation directly from the model.

              - `class BetaDirectCaller:`

                Tool invocation directly from the model.

              - `class BetaServerToolCaller:`

                Tool invocation generated by a server-side tool.

              - `class BetaServerToolCaller20260120:`

          - `class BetaWebFetchToolResultBlock:`

            - `required Content Content`

              - `class BetaWebFetchToolResultErrorBlock:`

                - `required BetaWebFetchToolResultErrorCode ErrorCode`

                  - `"invalid_tool_input"InvalidToolInput`

                  - `"url_too_long"UrlTooLong`

                  - `"url_not_allowed"UrlNotAllowed`

                  - `"url_not_in_prior_context"UrlNotInPriorContext`

                  - `"url_not_accessible"UrlNotAccessible`

                  - `"unsupported_content_type"UnsupportedContentType`

                  - `"too_many_requests"TooManyRequests`

                  - `"max_uses_exceeded"MaxUsesExceeded`

                  - `"unavailable"Unavailable`

                - `JsonElement Type "web_fetch_tool_result_error"constant`

              - `class BetaWebFetchBlock:`

                - `required BetaDocumentBlock Content`

                  - `required BetaCitationConfig? Citations`

                    Citation configuration for the document

                    - `required Boolean Enabled`

                  - `required Source Source`

                    - `class BetaBase64PdfSource:`

                      - `required string Data`

                      - `JsonElement MediaType "application/pdf"constant`

                      - `JsonElement Type "base64"constant`

                    - `class BetaPlainTextSource:`

                      - `required string Data`

                      - `JsonElement MediaType "text/plain"constant`

                      - `JsonElement Type "text"constant`

                  - `required string? Title`

                    The title of the document

                  - `JsonElement Type "document"constant`

                - `required string? RetrievedAt`

                  ISO 8601 timestamp when the content was retrieved

                - `JsonElement Type "web_fetch_result"constant`

                - `required string Url`

                  Fetched content URL

            - `required string ToolUseID`

            - `JsonElement Type "web_fetch_tool_result"constant`

            - `Caller Caller`

              Tool invocation directly from the model.

              - `class BetaDirectCaller:`

                Tool invocation directly from the model.

              - `class BetaServerToolCaller:`

                Tool invocation generated by a server-side tool.

              - `class BetaServerToolCaller20260120:`

          - `class BetaAdvisorToolResultBlock:`

            - `required Content Content`

              - `class BetaAdvisorToolResultError:`

                - `required ErrorCode ErrorCode`

                  - `"max_uses_exceeded"MaxUsesExceeded`

                  - `"prompt_too_long"PromptTooLong`

                  - `"too_many_requests"TooManyRequests`

                  - `"overloaded"Overloaded`

                  - `"unavailable"Unavailable`

                  - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `JsonElement Type "advisor_tool_result_error"constant`

              - `class BetaAdvisorResultBlock:`

                - `required string? StopReason`

                  The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the tool's `max_tokens` value or the advisor model's policy cap.

                - `required string Text`

                - `JsonElement Type "advisor_result"constant`

              - `class BetaAdvisorRedactedResultBlock:`

                - `required string EncryptedContent`

                  Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.

                - `required string? StopReason`

                  The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`).

                - `JsonElement Type "advisor_redacted_result"constant`

            - `required string ToolUseID`

            - `JsonElement Type "advisor_tool_result"constant`

          - `class BetaCodeExecutionToolResultBlock:`

            - `required BetaCodeExecutionToolResultBlockContent Content`

              Code execution result with encrypted stdout for PFC + web_search results.

              - `class BetaCodeExecutionToolResultError:`

                - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

                  - `"invalid_tool_input"InvalidToolInput`

                  - `"unavailable"Unavailable`

                  - `"too_many_requests"TooManyRequests`

                  - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `JsonElement Type "code_execution_tool_result_error"constant`

              - `class BetaCodeExecutionResultBlock:`

                - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

                  - `required string FileID`

                  - `JsonElement Type "code_execution_output"constant`

                - `required Long ReturnCode`

                - `required string Stderr`

                - `required string Stdout`

                - `JsonElement Type "code_execution_result"constant`

              - `class BetaEncryptedCodeExecutionResultBlock:`

                Code execution result with encrypted stdout for PFC + web_search results.

                - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

                  - `required string FileID`

                  - `JsonElement Type "code_execution_output"constant`

                - `required string EncryptedStdout`

                - `required Long ReturnCode`

                - `required string Stderr`

                - `JsonElement Type "encrypted_code_execution_result"constant`

            - `required string ToolUseID`

            - `JsonElement Type "code_execution_tool_result"constant`

          - `class BetaBashCodeExecutionToolResultBlock:`

            - `required Content Content`

              - `class BetaBashCodeExecutionToolResultError:`

                - `required ErrorCode ErrorCode`

                  - `"invalid_tool_input"InvalidToolInput`

                  - `"unavailable"Unavailable`

                  - `"too_many_requests"TooManyRequests`

                  - `"execution_time_exceeded"ExecutionTimeExceeded`

                  - `"output_file_too_large"OutputFileTooLarge`

                - `JsonElement Type "bash_code_execution_tool_result_error"constant`

              - `class BetaBashCodeExecutionResultBlock:`

                - `required IReadOnlyList<BetaBashCodeExecutionOutputBlock> Content`

                  - `required string FileID`

                  - `JsonElement Type "bash_code_execution_output"constant`

                - `required Long ReturnCode`

                - `required string Stderr`

                - `required string Stdout`

                - `JsonElement Type "bash_code_execution_result"constant`

            - `required string ToolUseID`

            - `JsonElement Type "bash_code_execution_tool_result"constant`

          - `class BetaTextEditorCodeExecutionToolResultBlock:`

            - `required Content Content`

              - `class BetaTextEditorCodeExecutionToolResultError:`

                - `required ErrorCode ErrorCode`

                  - `"invalid_tool_input"InvalidToolInput`

                  - `"unavailable"Unavailable`

                  - `"too_many_requests"TooManyRequests`

                  - `"execution_time_exceeded"ExecutionTimeExceeded`

                  - `"file_not_found"FileNotFound`

                - `required string? ErrorMessage`

                - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

              - `class BetaTextEditorCodeExecutionViewResultBlock:`

                - `required string Content`

                - `required FileType FileType`

                  - `"text"Text`

                  - `"image"Image`

                  - `"pdf"Pdf`

                - `required Long? NumLines`

                - `required Long? StartLine`

                - `required Long? TotalLines`

                - `JsonElement Type "text_editor_code_execution_view_result"constant`

              - `class BetaTextEditorCodeExecutionCreateResultBlock:`

                - `required Boolean IsFileUpdate`

                - `JsonElement Type "text_editor_code_execution_create_result"constant`

              - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:`

                - `required IReadOnlyList<string>? Lines`

                - `required Long? NewLines`

                - `required Long? NewStart`

                - `required Long? OldLines`

                - `required Long? OldStart`

                - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

            - `required string ToolUseID`

            - `JsonElement Type "text_editor_code_execution_tool_result"constant`

          - `class BetaToolSearchToolResultBlock:`

            - `required Content Content`

              - `class BetaToolSearchToolResultError:`

                - `required ErrorCode ErrorCode`

                  - `"invalid_tool_input"InvalidToolInput`

                  - `"unavailable"Unavailable`

                  - `"too_many_requests"TooManyRequests`

                  - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `required string? ErrorMessage`

                - `JsonElement Type "tool_search_tool_result_error"constant`

              - `class BetaToolSearchToolSearchResultBlock:`

                - `required IReadOnlyList<BetaToolReferenceBlock> ToolReferences`

                  - `required string ToolName`

                  - `JsonElement Type "tool_reference"constant`

                - `JsonElement Type "tool_search_tool_search_result"constant`

            - `required string ToolUseID`

            - `JsonElement Type "tool_search_tool_result"constant`

          - `class BetaMcpToolUseBlock:`

            - `required string ID`

            - `required IReadOnlyDictionary<string, JsonElement> Input`

            - `required string Name`

              The name of the MCP tool

            - `required string ServerName`

              The name of the MCP server

            - `JsonElement Type "mcp_tool_use"constant`

          - `class BetaMcpToolResultBlock:`

            - `required Content Content`

              - `string`

              - `IReadOnlyList<BetaTextBlock>`

                - `required IReadOnlyList<BetaTextCitation>? Citations`

                  Citations supporting the text block.

                  The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

                - `required string Text`

                - `JsonElement Type "text"constant`

            - `required Boolean IsError`

            - `required string ToolUseID`

            - `JsonElement Type "mcp_tool_result"constant`

          - `class BetaContainerUploadBlock:`

            Response model for a file uploaded to the container.

            - `required string FileID`

            - `JsonElement Type "container_upload"constant`

          - `class BetaCompactionBlock:`

            A compaction block returned when autocompact is triggered.

            When content is None, it indicates the compaction failed to produce a valid
            summary (e.g., malformed output from the model). Clients may round-trip
            compaction blocks with null content; the server treats them as no-ops.

            - `required string? Content`

              Summary of compacted content, or null if compaction failed

            - `required string? EncryptedContent`

              Opaque metadata from prior compaction, to be round-tripped verbatim

            - `JsonElement Type "compaction"constant`

        - `required BetaContextManagementResponse? ContextManagement`

          Context management response.

          Information about context management strategies applied during the request.

          - `required IReadOnlyList<AppliedEdit> AppliedEdits`

            List of context management edits that were applied.

            - `class BetaClearToolUses20250919EditResponse:`

              - `required Long ClearedInputTokens`

                Number of input tokens cleared by this edit.

              - `required Long ClearedToolUses`

                Number of tool uses that were cleared.

              - `JsonElement Type "clear_tool_uses_20250919"constant`

                The type of context management edit applied.

            - `class BetaClearThinking20251015EditResponse:`

              - `required Long ClearedInputTokens`

                Number of input tokens cleared by this edit.

              - `required Long ClearedThinkingTurns`

                Number of thinking turns that were cleared.

              - `JsonElement Type "clear_thinking_20251015"constant`

                The type of context management edit applied.

        - `required BetaDiagnostics? Diagnostics`

          Response envelope for request-level diagnostics. Present (possibly
          null) whenever the caller supplied `diagnostics` on the request.

          - `required CacheMissReason? CacheMissReason`

            Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.

            - `class BetaCacheMissModelChanged:`

              - `required Long CacheMissedInputTokens`

                Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

              - `JsonElement Type "model_changed"constant`

            - `class BetaCacheMissSystemChanged:`

              - `required Long CacheMissedInputTokens`

                Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

              - `JsonElement Type "system_changed"constant`

            - `class BetaCacheMissToolsChanged:`

              - `required Long CacheMissedInputTokens`

                Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

              - `JsonElement Type "tools_changed"constant`

            - `class BetaCacheMissMessagesChanged:`

              - `required Long CacheMissedInputTokens`

                Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

              - `JsonElement Type "messages_changed"constant`

            - `class BetaCacheMissPreviousMessageNotFound:`

              - `JsonElement Type "previous_message_not_found"constant`

            - `class BetaCacheMissUnavailable:`

              - `JsonElement Type "unavailable"constant`

        - `required Model Model`

          The model that will complete your prompt.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `"claude-opus-4-8"ClaudeOpus4_8`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-7"ClaudeOpus4_7`

            Frontier intelligence for long-running agents and coding

          - `"claude-mythos-preview"ClaudeMythosPreview`

            New class of intelligence, strongest in coding and cybersecurity

          - `"claude-opus-4-6"ClaudeOpus4_6`

            Frontier intelligence for long-running agents and coding

          - `"claude-sonnet-4-6"ClaudeSonnet4_6`

            Best combination of speed and intelligence

          - `"claude-haiku-4-5"ClaudeHaiku4_5`

            Fastest model with near-frontier intelligence

          - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

            Fastest model with near-frontier intelligence

          - `"claude-opus-4-5"ClaudeOpus4_5`

            Premium model combining maximum intelligence with practical performance

          - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

            Premium model combining maximum intelligence with practical performance

          - `"claude-sonnet-4-5"ClaudeSonnet4_5`

            High-performance model for agents and coding

          - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

            High-performance model for agents and coding

          - `"claude-opus-4-1"ClaudeOpus4_1`

            Exceptional model for specialized complex tasks

          - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

            Exceptional model for specialized complex tasks

          - `"claude-opus-4-0"ClaudeOpus4_0`

            Powerful model for complex tasks

          - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

            Powerful model for complex tasks

          - `"claude-sonnet-4-0"ClaudeSonnet4_0`

            High-performance model with extended thinking

          - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

            High-performance model with extended thinking

          - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

            Fast and cost-effective model

        - `JsonElement Role "assistant"constant`

          Conversational role of the generated message.

          This will always be `"assistant"`.

        - `required BetaRefusalStopDetails? StopDetails`

          Structured information about a refusal.

          - `required Category? Category`

            The policy category that triggered the refusal.

            `null` when the refusal doesn't map to a named category.

            - `"cyber"Cyber`

            - `"bio"Bio`

          - `required string? Explanation`

            Human-readable explanation of the refusal.

            This text is not guaranteed to be stable. `null` when no explanation is available for the category.

          - `JsonElement Type "refusal"constant`

        - `required BetaStopReason? StopReason`

          The reason that we stopped.

          This may be one the following values:

          * `"end_turn"`: the model reached a natural stopping point
          * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
          * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
          * `"tool_use"`: the model invoked one or more tools
          * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.
          * `"refusal"`: when streaming classifiers intervene to handle potential policy violations

          In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise.

          - `"end_turn"EndTurn`

          - `"max_tokens"MaxTokens`

          - `"stop_sequence"StopSequence`

          - `"tool_use"ToolUse`

          - `"pause_turn"PauseTurn`

          - `"compaction"Compaction`

          - `"refusal"Refusal`

          - `"model_context_window_exceeded"ModelContextWindowExceeded`

        - `required string? StopSequence`

          Which custom stop sequence was generated, if any.

          This value will be a non-null string if one of your custom stop sequences was generated.

        - `JsonElement Type "message"constant`

          Object type.

          For Messages, this is always `"message"`.

        - `required BetaUsage Usage`

          Billing and rate-limit usage.

          Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

          Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.

          For example, `output_tokens` will be non-zero, even for an empty string response from Claude.

          Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.

          - `required BetaCacheCreation? CacheCreation`

            Breakdown of cached tokens by TTL

            - `required Long Ephemeral1hInputTokens`

              The number of input tokens used to create the 1 hour cache entry.

            - `required Long Ephemeral5mInputTokens`

              The number of input tokens used to create the 5 minute cache entry.

          - `required Long? CacheCreationInputTokens`

            The number of input tokens used to create the cache entry.

          - `required Long? CacheReadInputTokens`

            The number of input tokens read from the cache.

          - `required string? InferenceGeo`

            The geographic region where inference was performed for this request.

          - `required Long InputTokens`

            The number of input tokens which were used.

          - `required IReadOnlyList<BetaIterationsUsageItems>? Iterations`

            Per-iteration token usage breakdown.

            Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:

            - Determine which iterations exceeded long context thresholds (>=200k tokens)
            - Calculate the true context window size from the last iteration
            - Understand token accumulation across server-side tool use loops

            - `class BetaMessageIterationUsage:`

              Token usage for a sampling iteration.

              - `required BetaCacheCreation? CacheCreation`

                Breakdown of cached tokens by TTL

              - `required Long CacheCreationInputTokens`

                The number of input tokens used to create the cache entry.

              - `required Long CacheReadInputTokens`

                The number of input tokens read from the cache.

              - `required Long InputTokens`

                The number of input tokens which were used.

              - `required Long OutputTokens`

                The number of output tokens which were used.

              - `JsonElement Type "message"constant`

                Usage for a sampling iteration

            - `class BetaCompactionIterationUsage:`

              Token usage for a compaction iteration.

              - `required BetaCacheCreation? CacheCreation`

                Breakdown of cached tokens by TTL

              - `required Long CacheCreationInputTokens`

                The number of input tokens used to create the cache entry.

              - `required Long CacheReadInputTokens`

                The number of input tokens read from the cache.

              - `required Long InputTokens`

                The number of input tokens which were used.

              - `required Long OutputTokens`

                The number of output tokens which were used.

              - `JsonElement Type "compaction"constant`

                Usage for a compaction iteration

            - `class BetaAdvisorMessageIterationUsage:`

              Token usage for an advisor sub-inference iteration.

              - `required BetaCacheCreation? CacheCreation`

                Breakdown of cached tokens by TTL

              - `required Long CacheCreationInputTokens`

                The number of input tokens used to create the cache entry.

              - `required Long CacheReadInputTokens`

                The number of input tokens read from the cache.

              - `required Long InputTokens`

                The number of input tokens which were used.

              - `required Model Model`

                The model that will complete your prompt.

                See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

              - `required Long OutputTokens`

                The number of output tokens which were used.

              - `JsonElement Type "advisor_message"constant`

                Usage for an advisor sub-inference iteration

          - `required Long OutputTokens`

            The number of output tokens which were used.

          - `required BetaOutputTokensDetails? OutputTokensDetails`

            Breakdown of output tokens by category.

            `output_tokens` remains the inclusive, authoritative total used for billing.
            This object provides a read-only decomposition for observability — for example,
            how many of the billed output tokens were spent on internal reasoning that may
            have been summarized before being returned to you.

            - `required Long ThinkingTokens`

              Number of output tokens the model generated as internal reasoning, including
              the thinking-block delimiter tokens.

              Reflects the raw reasoning the model produced, not the (possibly shorter)
              summarized thinking text returned in the response body. Computed by
              re-tokenizing the raw reasoning text, so it may differ from the model's exact
              generation count by a small number of tokens. Always ≤ `output_tokens`;
              `output_tokens - thinking_tokens` approximates the non-reasoning output.

          - `required BetaServerToolUsage? ServerToolUse`

            The number of server tool requests.

            - `required Long WebFetchRequests`

              The number of web fetch tool requests.

            - `required Long WebSearchRequests`

              The number of web search tool requests.

          - `required ServiceTier? ServiceTier`

            If the request used the priority, standard, or batch tier.

            - `"standard"Standard`

            - `"priority"Priority`

            - `"batch"Batch`

          - `required Speed? Speed`

            The inference speed mode used for this request.

            - `"standard"Standard`

            - `"fast"Fast`

      - `JsonElement Type "succeeded"constant`

    - `class BetaMessageBatchErroredResult:`

      - `required BetaErrorResponse Error`

        - `required BetaError Error`

          - `class BetaInvalidRequestError:`

            - `required string Message`

            - `JsonElement Type "invalid_request_error"constant`

          - `class BetaAuthenticationError:`

            - `required string Message`

            - `JsonElement Type "authentication_error"constant`

          - `class BetaBillingError:`

            - `required string Message`

            - `JsonElement Type "billing_error"constant`

          - `class BetaPermissionError:`

            - `required string Message`

            - `JsonElement Type "permission_error"constant`

          - `class BetaNotFoundError:`

            - `required string Message`

            - `JsonElement Type "not_found_error"constant`

          - `class BetaRateLimitError:`

            - `required string Message`

            - `JsonElement Type "rate_limit_error"constant`

          - `class BetaGatewayTimeoutError:`

            - `required string Message`

            - `JsonElement Type "timeout_error"constant`

          - `class BetaApiError:`

            - `required string Message`

            - `JsonElement Type "api_error"constant`

          - `class BetaOverloadedError:`

            - `required string Message`

            - `JsonElement Type "overloaded_error"constant`

        - `required string? RequestID`

        - `JsonElement Type "error"constant`

      - `JsonElement Type "errored"constant`

    - `class BetaMessageBatchCanceledResult:`

      - `JsonElement Type "canceled"constant`

    - `class BetaMessageBatchExpiredResult:`

      - `JsonElement Type "expired"constant`

### Beta Message Batch Request Counts

- `class BetaMessageBatchRequestCounts:`

  - `required Long Canceled`

    Number of requests in the Message Batch that have been canceled.

    This is zero until processing of the entire Message Batch has ended.

  - `required Long Errored`

    Number of requests in the Message Batch that encountered an error.

    This is zero until processing of the entire Message Batch has ended.

  - `required Long Expired`

    Number of requests in the Message Batch that have expired.

    This is zero until processing of the entire Message Batch has ended.

  - `required Long Processing`

    Number of requests in the Message Batch that are processing.

  - `required Long Succeeded`

    Number of requests in the Message Batch that have completed successfully.

    This is zero until processing of the entire Message Batch has ended.

### Beta Message Batch Result

- `class BetaMessageBatchResult: A class that can be one of several variants.union`

  Processing result for this request.

  Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.

  - `class BetaMessageBatchSucceededResult:`

    - `required BetaMessage Message`

      - `required string ID`

        Unique object identifier.

        The format and length of IDs may change over time.

      - `required BetaContainer? Container`

        Information about the container used in the request (for the code execution tool)

        - `required string ID`

          Identifier for the container used in this request

        - `required DateTimeOffset ExpiresAt`

          The time at which the container will expire.

        - `required IReadOnlyList<BetaSkill>? Skills`

          Skills loaded in the container

          - `required string SkillID`

            Skill ID

          - `required Type Type`

            Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

            - `"anthropic"Anthropic`

            - `"custom"Custom`

          - `required string Version`

            Skill version or 'latest' for most recent version

      - `required IReadOnlyList<BetaContentBlock> Content`

        Content generated by the model.

        This is an array of content blocks, each of which has a `type` that determines its shape.

        Example:

        ```json
        [{"type": "text", "text": "Hi, I'm Claude."}]
        ```

        If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.

        For example, if the input `messages` were:

        ```json
        [
          {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
          {"role": "assistant", "content": "The best answer is ("}
        ]
        ```

        Then the response `content` might be:

        ```json
        [{"type": "text", "text": "B)"}]
        ```

        - `class BetaTextBlock:`

          - `required IReadOnlyList<BetaTextCitation>? Citations`

            Citations supporting the text block.

            The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

            - `class BetaCitationCharLocation:`

              - `required string CitedText`

              - `required Long DocumentIndex`

              - `required string? DocumentTitle`

              - `required Long EndCharIndex`

              - `required string? FileID`

              - `required Long StartCharIndex`

              - `JsonElement Type "char_location"constant`

            - `class BetaCitationPageLocation:`

              - `required string CitedText`

              - `required Long DocumentIndex`

              - `required string? DocumentTitle`

              - `required Long EndPageNumber`

              - `required string? FileID`

              - `required Long StartPageNumber`

              - `JsonElement Type "page_location"constant`

            - `class BetaCitationContentBlockLocation:`

              - `required string CitedText`

                The full text of the cited block range, concatenated.

                Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

              - `required Long DocumentIndex`

              - `required string? DocumentTitle`

              - `required Long EndBlockIndex`

                Exclusive 0-based end index of the cited block range in the source's `content` array.

                Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

              - `required string? FileID`

              - `required Long StartBlockIndex`

                0-based index of the first cited block in the source's `content` array.

              - `JsonElement Type "content_block_location"constant`

            - `class BetaCitationsWebSearchResultLocation:`

              - `required string CitedText`

              - `required string EncryptedIndex`

              - `required string? Title`

              - `JsonElement Type "web_search_result_location"constant`

              - `required string Url`

            - `class BetaCitationSearchResultLocation:`

              - `required string CitedText`

                The full text of the cited block range, concatenated.

                Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

              - `required Long EndBlockIndex`

                Exclusive 0-based end index of the cited block range in the source's `content` array.

                Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

              - `required Long SearchResultIndex`

                0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

                Counted separately from `document_index`; server-side web search results are not included in this count.

              - `required string Source`

              - `required Long StartBlockIndex`

                0-based index of the first cited block in the source's `content` array.

              - `required string? Title`

              - `JsonElement Type "search_result_location"constant`

          - `required string Text`

          - `JsonElement Type "text"constant`

        - `class BetaThinkingBlock:`

          - `required string Signature`

          - `required string Thinking`

          - `JsonElement Type "thinking"constant`

        - `class BetaRedactedThinkingBlock:`

          - `required string Data`

          - `JsonElement Type "redacted_thinking"constant`

        - `class BetaToolUseBlock:`

          - `required string ID`

          - `required IReadOnlyDictionary<string, JsonElement> Input`

          - `required string Name`

          - `JsonElement Type "tool_use"constant`

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

              - `JsonElement Type "direct"constant`

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

              - `required string ToolID`

              - `JsonElement Type "code_execution_20250825"constant`

            - `class BetaServerToolCaller20260120:`

              - `required string ToolID`

              - `JsonElement Type "code_execution_20260120"constant`

        - `class BetaServerToolUseBlock:`

          - `required string ID`

          - `required IReadOnlyDictionary<string, JsonElement> Input`

          - `required Name Name`

            - `"advisor"Advisor`

            - `"web_search"WebSearch`

            - `"web_fetch"WebFetch`

            - `"code_execution"CodeExecution`

            - `"bash_code_execution"BashCodeExecution`

            - `"text_editor_code_execution"TextEditorCodeExecution`

            - `"tool_search_tool_regex"ToolSearchToolRegex`

            - `"tool_search_tool_bm25"ToolSearchToolBm25`

          - `JsonElement Type "server_tool_use"constant`

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

            - `class BetaServerToolCaller20260120:`

        - `class BetaWebSearchToolResultBlock:`

          - `required BetaWebSearchToolResultBlockContent Content`

            - `class BetaWebSearchToolResultError:`

              - `required BetaWebSearchToolResultErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"max_uses_exceeded"MaxUsesExceeded`

                - `"too_many_requests"TooManyRequests`

                - `"query_too_long"QueryTooLong`

                - `"request_too_large"RequestTooLarge`

              - `JsonElement Type "web_search_tool_result_error"constant`

            - `IReadOnlyList<BetaWebSearchResultBlock>`

              - `required string EncryptedContent`

              - `required string? PageAge`

              - `required string Title`

              - `JsonElement Type "web_search_result"constant`

              - `required string Url`

          - `required string ToolUseID`

          - `JsonElement Type "web_search_tool_result"constant`

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

            - `class BetaServerToolCaller20260120:`

        - `class BetaWebFetchToolResultBlock:`

          - `required Content Content`

            - `class BetaWebFetchToolResultErrorBlock:`

              - `required BetaWebFetchToolResultErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"url_too_long"UrlTooLong`

                - `"url_not_allowed"UrlNotAllowed`

                - `"url_not_in_prior_context"UrlNotInPriorContext`

                - `"url_not_accessible"UrlNotAccessible`

                - `"unsupported_content_type"UnsupportedContentType`

                - `"too_many_requests"TooManyRequests`

                - `"max_uses_exceeded"MaxUsesExceeded`

                - `"unavailable"Unavailable`

              - `JsonElement Type "web_fetch_tool_result_error"constant`

            - `class BetaWebFetchBlock:`

              - `required BetaDocumentBlock Content`

                - `required BetaCitationConfig? Citations`

                  Citation configuration for the document

                  - `required Boolean Enabled`

                - `required Source Source`

                  - `class BetaBase64PdfSource:`

                    - `required string Data`

                    - `JsonElement MediaType "application/pdf"constant`

                    - `JsonElement Type "base64"constant`

                  - `class BetaPlainTextSource:`

                    - `required string Data`

                    - `JsonElement MediaType "text/plain"constant`

                    - `JsonElement Type "text"constant`

                - `required string? Title`

                  The title of the document

                - `JsonElement Type "document"constant`

              - `required string? RetrievedAt`

                ISO 8601 timestamp when the content was retrieved

              - `JsonElement Type "web_fetch_result"constant`

              - `required string Url`

                Fetched content URL

          - `required string ToolUseID`

          - `JsonElement Type "web_fetch_tool_result"constant`

          - `Caller Caller`

            Tool invocation directly from the model.

            - `class BetaDirectCaller:`

              Tool invocation directly from the model.

            - `class BetaServerToolCaller:`

              Tool invocation generated by a server-side tool.

            - `class BetaServerToolCaller20260120:`

        - `class BetaAdvisorToolResultBlock:`

          - `required Content Content`

            - `class BetaAdvisorToolResultError:`

              - `required ErrorCode ErrorCode`

                - `"max_uses_exceeded"MaxUsesExceeded`

                - `"prompt_too_long"PromptTooLong`

                - `"too_many_requests"TooManyRequests`

                - `"overloaded"Overloaded`

                - `"unavailable"Unavailable`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `JsonElement Type "advisor_tool_result_error"constant`

            - `class BetaAdvisorResultBlock:`

              - `required string? StopReason`

                The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the tool's `max_tokens` value or the advisor model's policy cap.

              - `required string Text`

              - `JsonElement Type "advisor_result"constant`

            - `class BetaAdvisorRedactedResultBlock:`

              - `required string EncryptedContent`

                Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.

              - `required string? StopReason`

                The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`).

              - `JsonElement Type "advisor_redacted_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "advisor_tool_result"constant`

        - `class BetaCodeExecutionToolResultBlock:`

          - `required BetaCodeExecutionToolResultBlockContent Content`

            Code execution result with encrypted stdout for PFC + web_search results.

            - `class BetaCodeExecutionToolResultError:`

              - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `JsonElement Type "code_execution_tool_result_error"constant`

            - `class BetaCodeExecutionResultBlock:`

              - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

                - `required string FileID`

                - `JsonElement Type "code_execution_output"constant`

              - `required Long ReturnCode`

              - `required string Stderr`

              - `required string Stdout`

              - `JsonElement Type "code_execution_result"constant`

            - `class BetaEncryptedCodeExecutionResultBlock:`

              Code execution result with encrypted stdout for PFC + web_search results.

              - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

                - `required string FileID`

                - `JsonElement Type "code_execution_output"constant`

              - `required string EncryptedStdout`

              - `required Long ReturnCode`

              - `required string Stderr`

              - `JsonElement Type "encrypted_code_execution_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "code_execution_tool_result"constant`

        - `class BetaBashCodeExecutionToolResultBlock:`

          - `required Content Content`

            - `class BetaBashCodeExecutionToolResultError:`

              - `required ErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `"output_file_too_large"OutputFileTooLarge`

              - `JsonElement Type "bash_code_execution_tool_result_error"constant`

            - `class BetaBashCodeExecutionResultBlock:`

              - `required IReadOnlyList<BetaBashCodeExecutionOutputBlock> Content`

                - `required string FileID`

                - `JsonElement Type "bash_code_execution_output"constant`

              - `required Long ReturnCode`

              - `required string Stderr`

              - `required string Stdout`

              - `JsonElement Type "bash_code_execution_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "bash_code_execution_tool_result"constant`

        - `class BetaTextEditorCodeExecutionToolResultBlock:`

          - `required Content Content`

            - `class BetaTextEditorCodeExecutionToolResultError:`

              - `required ErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

                - `"file_not_found"FileNotFound`

              - `required string? ErrorMessage`

              - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

            - `class BetaTextEditorCodeExecutionViewResultBlock:`

              - `required string Content`

              - `required FileType FileType`

                - `"text"Text`

                - `"image"Image`

                - `"pdf"Pdf`

              - `required Long? NumLines`

              - `required Long? StartLine`

              - `required Long? TotalLines`

              - `JsonElement Type "text_editor_code_execution_view_result"constant`

            - `class BetaTextEditorCodeExecutionCreateResultBlock:`

              - `required Boolean IsFileUpdate`

              - `JsonElement Type "text_editor_code_execution_create_result"constant`

            - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:`

              - `required IReadOnlyList<string>? Lines`

              - `required Long? NewLines`

              - `required Long? NewStart`

              - `required Long? OldLines`

              - `required Long? OldStart`

              - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "text_editor_code_execution_tool_result"constant`

        - `class BetaToolSearchToolResultBlock:`

          - `required Content Content`

            - `class BetaToolSearchToolResultError:`

              - `required ErrorCode ErrorCode`

                - `"invalid_tool_input"InvalidToolInput`

                - `"unavailable"Unavailable`

                - `"too_many_requests"TooManyRequests`

                - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `required string? ErrorMessage`

              - `JsonElement Type "tool_search_tool_result_error"constant`

            - `class BetaToolSearchToolSearchResultBlock:`

              - `required IReadOnlyList<BetaToolReferenceBlock> ToolReferences`

                - `required string ToolName`

                - `JsonElement Type "tool_reference"constant`

              - `JsonElement Type "tool_search_tool_search_result"constant`

          - `required string ToolUseID`

          - `JsonElement Type "tool_search_tool_result"constant`

        - `class BetaMcpToolUseBlock:`

          - `required string ID`

          - `required IReadOnlyDictionary<string, JsonElement> Input`

          - `required string Name`

            The name of the MCP tool

          - `required string ServerName`

            The name of the MCP server

          - `JsonElement Type "mcp_tool_use"constant`

        - `class BetaMcpToolResultBlock:`

          - `required Content Content`

            - `string`

            - `IReadOnlyList<BetaTextBlock>`

              - `required IReadOnlyList<BetaTextCitation>? Citations`

                Citations supporting the text block.

                The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

              - `required string Text`

              - `JsonElement Type "text"constant`

          - `required Boolean IsError`

          - `required string ToolUseID`

          - `JsonElement Type "mcp_tool_result"constant`

        - `class BetaContainerUploadBlock:`

          Response model for a file uploaded to the container.

          - `required string FileID`

          - `JsonElement Type "container_upload"constant`

        - `class BetaCompactionBlock:`

          A compaction block returned when autocompact is triggered.

          When content is None, it indicates the compaction failed to produce a valid
          summary (e.g., malformed output from the model). Clients may round-trip
          compaction blocks with null content; the server treats them as no-ops.

          - `required string? Content`

            Summary of compacted content, or null if compaction failed

          - `required string? EncryptedContent`

            Opaque metadata from prior compaction, to be round-tripped verbatim

          - `JsonElement Type "compaction"constant`

      - `required BetaContextManagementResponse? ContextManagement`

        Context management response.

        Information about context management strategies applied during the request.

        - `required IReadOnlyList<AppliedEdit> AppliedEdits`

          List of context management edits that were applied.

          - `class BetaClearToolUses20250919EditResponse:`

            - `required Long ClearedInputTokens`

              Number of input tokens cleared by this edit.

            - `required Long ClearedToolUses`

              Number of tool uses that were cleared.

            - `JsonElement Type "clear_tool_uses_20250919"constant`

              The type of context management edit applied.

          - `class BetaClearThinking20251015EditResponse:`

            - `required Long ClearedInputTokens`

              Number of input tokens cleared by this edit.

            - `required Long ClearedThinkingTurns`

              Number of thinking turns that were cleared.

            - `JsonElement Type "clear_thinking_20251015"constant`

              The type of context management edit applied.

      - `required BetaDiagnostics? Diagnostics`

        Response envelope for request-level diagnostics. Present (possibly
        null) whenever the caller supplied `diagnostics` on the request.

        - `required CacheMissReason? CacheMissReason`

          Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.

          - `class BetaCacheMissModelChanged:`

            - `required Long CacheMissedInputTokens`

              Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

            - `JsonElement Type "model_changed"constant`

          - `class BetaCacheMissSystemChanged:`

            - `required Long CacheMissedInputTokens`

              Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

            - `JsonElement Type "system_changed"constant`

          - `class BetaCacheMissToolsChanged:`

            - `required Long CacheMissedInputTokens`

              Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

            - `JsonElement Type "tools_changed"constant`

          - `class BetaCacheMissMessagesChanged:`

            - `required Long CacheMissedInputTokens`

              Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

            - `JsonElement Type "messages_changed"constant`

          - `class BetaCacheMissPreviousMessageNotFound:`

            - `JsonElement Type "previous_message_not_found"constant`

          - `class BetaCacheMissUnavailable:`

            - `JsonElement Type "unavailable"constant`

      - `required Model Model`

        The model that will complete your prompt.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-mythos-preview"ClaudeMythosPreview`

          New class of intelligence, strongest in coding and cybersecurity

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Frontier intelligence for long-running agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

        - `"claude-opus-4-1"ClaudeOpus4_1`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

          Exceptional model for specialized complex tasks

        - `"claude-opus-4-0"ClaudeOpus4_0`

          Powerful model for complex tasks

        - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

          Powerful model for complex tasks

        - `"claude-sonnet-4-0"ClaudeSonnet4_0`

          High-performance model with extended thinking

        - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

          High-performance model with extended thinking

        - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

          Fast and cost-effective model

      - `JsonElement Role "assistant"constant`

        Conversational role of the generated message.

        This will always be `"assistant"`.

      - `required BetaRefusalStopDetails? StopDetails`

        Structured information about a refusal.

        - `required Category? Category`

          The policy category that triggered the refusal.

          `null` when the refusal doesn't map to a named category.

          - `"cyber"Cyber`

          - `"bio"Bio`

        - `required string? Explanation`

          Human-readable explanation of the refusal.

          This text is not guaranteed to be stable. `null` when no explanation is available for the category.

        - `JsonElement Type "refusal"constant`

      - `required BetaStopReason? StopReason`

        The reason that we stopped.

        This may be one the following values:

        * `"end_turn"`: the model reached a natural stopping point
        * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
        * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
        * `"tool_use"`: the model invoked one or more tools
        * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.
        * `"refusal"`: when streaming classifiers intervene to handle potential policy violations

        In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise.

        - `"end_turn"EndTurn`

        - `"max_tokens"MaxTokens`

        - `"stop_sequence"StopSequence`

        - `"tool_use"ToolUse`

        - `"pause_turn"PauseTurn`

        - `"compaction"Compaction`

        - `"refusal"Refusal`

        - `"model_context_window_exceeded"ModelContextWindowExceeded`

      - `required string? StopSequence`

        Which custom stop sequence was generated, if any.

        This value will be a non-null string if one of your custom stop sequences was generated.

      - `JsonElement Type "message"constant`

        Object type.

        For Messages, this is always `"message"`.

      - `required BetaUsage Usage`

        Billing and rate-limit usage.

        Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

        Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.

        For example, `output_tokens` will be non-zero, even for an empty string response from Claude.

        Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.

        - `required BetaCacheCreation? CacheCreation`

          Breakdown of cached tokens by TTL

          - `required Long Ephemeral1hInputTokens`

            The number of input tokens used to create the 1 hour cache entry.

          - `required Long Ephemeral5mInputTokens`

            The number of input tokens used to create the 5 minute cache entry.

        - `required Long? CacheCreationInputTokens`

          The number of input tokens used to create the cache entry.

        - `required Long? CacheReadInputTokens`

          The number of input tokens read from the cache.

        - `required string? InferenceGeo`

          The geographic region where inference was performed for this request.

        - `required Long InputTokens`

          The number of input tokens which were used.

        - `required IReadOnlyList<BetaIterationsUsageItems>? Iterations`

          Per-iteration token usage breakdown.

          Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:

          - Determine which iterations exceeded long context thresholds (>=200k tokens)
          - Calculate the true context window size from the last iteration
          - Understand token accumulation across server-side tool use loops

          - `class BetaMessageIterationUsage:`

            Token usage for a sampling iteration.

            - `required BetaCacheCreation? CacheCreation`

              Breakdown of cached tokens by TTL

            - `required Long CacheCreationInputTokens`

              The number of input tokens used to create the cache entry.

            - `required Long CacheReadInputTokens`

              The number of input tokens read from the cache.

            - `required Long InputTokens`

              The number of input tokens which were used.

            - `required Long OutputTokens`

              The number of output tokens which were used.

            - `JsonElement Type "message"constant`

              Usage for a sampling iteration

          - `class BetaCompactionIterationUsage:`

            Token usage for a compaction iteration.

            - `required BetaCacheCreation? CacheCreation`

              Breakdown of cached tokens by TTL

            - `required Long CacheCreationInputTokens`

              The number of input tokens used to create the cache entry.

            - `required Long CacheReadInputTokens`

              The number of input tokens read from the cache.

            - `required Long InputTokens`

              The number of input tokens which were used.

            - `required Long OutputTokens`

              The number of output tokens which were used.

            - `JsonElement Type "compaction"constant`

              Usage for a compaction iteration

          - `class BetaAdvisorMessageIterationUsage:`

            Token usage for an advisor sub-inference iteration.

            - `required BetaCacheCreation? CacheCreation`

              Breakdown of cached tokens by TTL

            - `required Long CacheCreationInputTokens`

              The number of input tokens used to create the cache entry.

            - `required Long CacheReadInputTokens`

              The number of input tokens read from the cache.

            - `required Long InputTokens`

              The number of input tokens which were used.

            - `required Model Model`

              The model that will complete your prompt.

              See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

            - `required Long OutputTokens`

              The number of output tokens which were used.

            - `JsonElement Type "advisor_message"constant`

              Usage for an advisor sub-inference iteration

        - `required Long OutputTokens`

          The number of output tokens which were used.

        - `required BetaOutputTokensDetails? OutputTokensDetails`

          Breakdown of output tokens by category.

          `output_tokens` remains the inclusive, authoritative total used for billing.
          This object provides a read-only decomposition for observability — for example,
          how many of the billed output tokens were spent on internal reasoning that may
          have been summarized before being returned to you.

          - `required Long ThinkingTokens`

            Number of output tokens the model generated as internal reasoning, including
            the thinking-block delimiter tokens.

            Reflects the raw reasoning the model produced, not the (possibly shorter)
            summarized thinking text returned in the response body. Computed by
            re-tokenizing the raw reasoning text, so it may differ from the model's exact
            generation count by a small number of tokens. Always ≤ `output_tokens`;
            `output_tokens - thinking_tokens` approximates the non-reasoning output.

        - `required BetaServerToolUsage? ServerToolUse`

          The number of server tool requests.

          - `required Long WebFetchRequests`

            The number of web fetch tool requests.

          - `required Long WebSearchRequests`

            The number of web search tool requests.

        - `required ServiceTier? ServiceTier`

          If the request used the priority, standard, or batch tier.

          - `"standard"Standard`

          - `"priority"Priority`

          - `"batch"Batch`

        - `required Speed? Speed`

          The inference speed mode used for this request.

          - `"standard"Standard`

          - `"fast"Fast`

    - `JsonElement Type "succeeded"constant`

  - `class BetaMessageBatchErroredResult:`

    - `required BetaErrorResponse Error`

      - `required BetaError Error`

        - `class BetaInvalidRequestError:`

          - `required string Message`

          - `JsonElement Type "invalid_request_error"constant`

        - `class BetaAuthenticationError:`

          - `required string Message`

          - `JsonElement Type "authentication_error"constant`

        - `class BetaBillingError:`

          - `required string Message`

          - `JsonElement Type "billing_error"constant`

        - `class BetaPermissionError:`

          - `required string Message`

          - `JsonElement Type "permission_error"constant`

        - `class BetaNotFoundError:`

          - `required string Message`

          - `JsonElement Type "not_found_error"constant`

        - `class BetaRateLimitError:`

          - `required string Message`

          - `JsonElement Type "rate_limit_error"constant`

        - `class BetaGatewayTimeoutError:`

          - `required string Message`

          - `JsonElement Type "timeout_error"constant`

        - `class BetaApiError:`

          - `required string Message`

          - `JsonElement Type "api_error"constant`

        - `class BetaOverloadedError:`

          - `required string Message`

          - `JsonElement Type "overloaded_error"constant`

      - `required string? RequestID`

      - `JsonElement Type "error"constant`

    - `JsonElement Type "errored"constant`

  - `class BetaMessageBatchCanceledResult:`

    - `JsonElement Type "canceled"constant`

  - `class BetaMessageBatchExpiredResult:`

    - `JsonElement Type "expired"constant`

### Beta Message Batch Succeeded Result

- `class BetaMessageBatchSucceededResult:`

  - `required BetaMessage Message`

    - `required string ID`

      Unique object identifier.

      The format and length of IDs may change over time.

    - `required BetaContainer? Container`

      Information about the container used in the request (for the code execution tool)

      - `required string ID`

        Identifier for the container used in this request

      - `required DateTimeOffset ExpiresAt`

        The time at which the container will expire.

      - `required IReadOnlyList<BetaSkill>? Skills`

        Skills loaded in the container

        - `required string SkillID`

          Skill ID

        - `required Type Type`

          Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

          - `"anthropic"Anthropic`

          - `"custom"Custom`

        - `required string Version`

          Skill version or 'latest' for most recent version

    - `required IReadOnlyList<BetaContentBlock> Content`

      Content generated by the model.

      This is an array of content blocks, each of which has a `type` that determines its shape.

      Example:

      ```json
      [{"type": "text", "text": "Hi, I'm Claude."}]
      ```

      If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.

      For example, if the input `messages` were:

      ```json
      [
        {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
        {"role": "assistant", "content": "The best answer is ("}
      ]
      ```

      Then the response `content` might be:

      ```json
      [{"type": "text", "text": "B)"}]
      ```

      - `class BetaTextBlock:`

        - `required IReadOnlyList<BetaTextCitation>? Citations`

          Citations supporting the text block.

          The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

          - `class BetaCitationCharLocation:`

            - `required string CitedText`

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndCharIndex`

            - `required string? FileID`

            - `required Long StartCharIndex`

            - `JsonElement Type "char_location"constant`

          - `class BetaCitationPageLocation:`

            - `required string CitedText`

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndPageNumber`

            - `required string? FileID`

            - `required Long StartPageNumber`

            - `JsonElement Type "page_location"constant`

          - `class BetaCitationContentBlockLocation:`

            - `required string CitedText`

              The full text of the cited block range, concatenated.

              Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

            - `required Long DocumentIndex`

            - `required string? DocumentTitle`

            - `required Long EndBlockIndex`

              Exclusive 0-based end index of the cited block range in the source's `content` array.

              Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

            - `required string? FileID`

            - `required Long StartBlockIndex`

              0-based index of the first cited block in the source's `content` array.

            - `JsonElement Type "content_block_location"constant`

          - `class BetaCitationsWebSearchResultLocation:`

            - `required string CitedText`

            - `required string EncryptedIndex`

            - `required string? Title`

            - `JsonElement Type "web_search_result_location"constant`

            - `required string Url`

          - `class BetaCitationSearchResultLocation:`

            - `required string CitedText`

              The full text of the cited block range, concatenated.

              Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

            - `required Long EndBlockIndex`

              Exclusive 0-based end index of the cited block range in the source's `content` array.

              Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

            - `required Long SearchResultIndex`

              0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

              Counted separately from `document_index`; server-side web search results are not included in this count.

            - `required string Source`

            - `required Long StartBlockIndex`

              0-based index of the first cited block in the source's `content` array.

            - `required string? Title`

            - `JsonElement Type "search_result_location"constant`

        - `required string Text`

        - `JsonElement Type "text"constant`

      - `class BetaThinkingBlock:`

        - `required string Signature`

        - `required string Thinking`

        - `JsonElement Type "thinking"constant`

      - `class BetaRedactedThinkingBlock:`

        - `required string Data`

        - `JsonElement Type "redacted_thinking"constant`

      - `class BetaToolUseBlock:`

        - `required string ID`

        - `required IReadOnlyDictionary<string, JsonElement> Input`

        - `required string Name`

        - `JsonElement Type "tool_use"constant`

        - `Caller Caller`

          Tool invocation directly from the model.

          - `class BetaDirectCaller:`

            Tool invocation directly from the model.

            - `JsonElement Type "direct"constant`

          - `class BetaServerToolCaller:`

            Tool invocation generated by a server-side tool.

            - `required string ToolID`

            - `JsonElement Type "code_execution_20250825"constant`

          - `class BetaServerToolCaller20260120:`

            - `required string ToolID`

            - `JsonElement Type "code_execution_20260120"constant`

      - `class BetaServerToolUseBlock:`

        - `required string ID`

        - `required IReadOnlyDictionary<string, JsonElement> Input`

        - `required Name Name`

          - `"advisor"Advisor`

          - `"web_search"WebSearch`

          - `"web_fetch"WebFetch`

          - `"code_execution"CodeExecution`

          - `"bash_code_execution"BashCodeExecution`

          - `"text_editor_code_execution"TextEditorCodeExecution`

          - `"tool_search_tool_regex"ToolSearchToolRegex`

          - `"tool_search_tool_bm25"ToolSearchToolBm25`

        - `JsonElement Type "server_tool_use"constant`

        - `Caller Caller`

          Tool invocation directly from the model.

          - `class BetaDirectCaller:`

            Tool invocation directly from the model.

          - `class BetaServerToolCaller:`

            Tool invocation generated by a server-side tool.

          - `class BetaServerToolCaller20260120:`

      - `class BetaWebSearchToolResultBlock:`

        - `required BetaWebSearchToolResultBlockContent Content`

          - `class BetaWebSearchToolResultError:`

            - `required BetaWebSearchToolResultErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"max_uses_exceeded"MaxUsesExceeded`

              - `"too_many_requests"TooManyRequests`

              - `"query_too_long"QueryTooLong`

              - `"request_too_large"RequestTooLarge`

            - `JsonElement Type "web_search_tool_result_error"constant`

          - `IReadOnlyList<BetaWebSearchResultBlock>`

            - `required string EncryptedContent`

            - `required string? PageAge`

            - `required string Title`

            - `JsonElement Type "web_search_result"constant`

            - `required string Url`

        - `required string ToolUseID`

        - `JsonElement Type "web_search_tool_result"constant`

        - `Caller Caller`

          Tool invocation directly from the model.

          - `class BetaDirectCaller:`

            Tool invocation directly from the model.

          - `class BetaServerToolCaller:`

            Tool invocation generated by a server-side tool.

          - `class BetaServerToolCaller20260120:`

      - `class BetaWebFetchToolResultBlock:`

        - `required Content Content`

          - `class BetaWebFetchToolResultErrorBlock:`

            - `required BetaWebFetchToolResultErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"url_too_long"UrlTooLong`

              - `"url_not_allowed"UrlNotAllowed`

              - `"url_not_in_prior_context"UrlNotInPriorContext`

              - `"url_not_accessible"UrlNotAccessible`

              - `"unsupported_content_type"UnsupportedContentType`

              - `"too_many_requests"TooManyRequests`

              - `"max_uses_exceeded"MaxUsesExceeded`

              - `"unavailable"Unavailable`

            - `JsonElement Type "web_fetch_tool_result_error"constant`

          - `class BetaWebFetchBlock:`

            - `required BetaDocumentBlock Content`

              - `required BetaCitationConfig? Citations`

                Citation configuration for the document

                - `required Boolean Enabled`

              - `required Source Source`

                - `class BetaBase64PdfSource:`

                  - `required string Data`

                  - `JsonElement MediaType "application/pdf"constant`

                  - `JsonElement Type "base64"constant`

                - `class BetaPlainTextSource:`

                  - `required string Data`

                  - `JsonElement MediaType "text/plain"constant`

                  - `JsonElement Type "text"constant`

              - `required string? Title`

                The title of the document

              - `JsonElement Type "document"constant`

            - `required string? RetrievedAt`

              ISO 8601 timestamp when the content was retrieved

            - `JsonElement Type "web_fetch_result"constant`

            - `required string Url`

              Fetched content URL

        - `required string ToolUseID`

        - `JsonElement Type "web_fetch_tool_result"constant`

        - `Caller Caller`

          Tool invocation directly from the model.

          - `class BetaDirectCaller:`

            Tool invocation directly from the model.

          - `class BetaServerToolCaller:`

            Tool invocation generated by a server-side tool.

          - `class BetaServerToolCaller20260120:`

      - `class BetaAdvisorToolResultBlock:`

        - `required Content Content`

          - `class BetaAdvisorToolResultError:`

            - `required ErrorCode ErrorCode`

              - `"max_uses_exceeded"MaxUsesExceeded`

              - `"prompt_too_long"PromptTooLong`

              - `"too_many_requests"TooManyRequests`

              - `"overloaded"Overloaded`

              - `"unavailable"Unavailable`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `JsonElement Type "advisor_tool_result_error"constant`

          - `class BetaAdvisorResultBlock:`

            - `required string? StopReason`

              The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the tool's `max_tokens` value or the advisor model's policy cap.

            - `required string Text`

            - `JsonElement Type "advisor_result"constant`

          - `class BetaAdvisorRedactedResultBlock:`

            - `required string EncryptedContent`

              Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.

            - `required string? StopReason`

              The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`).

            - `JsonElement Type "advisor_redacted_result"constant`

        - `required string ToolUseID`

        - `JsonElement Type "advisor_tool_result"constant`

      - `class BetaCodeExecutionToolResultBlock:`

        - `required BetaCodeExecutionToolResultBlockContent Content`

          Code execution result with encrypted stdout for PFC + web_search results.

          - `class BetaCodeExecutionToolResultError:`

            - `required BetaCodeExecutionToolResultErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"too_many_requests"TooManyRequests`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `JsonElement Type "code_execution_tool_result_error"constant`

          - `class BetaCodeExecutionResultBlock:`

            - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

              - `required string FileID`

              - `JsonElement Type "code_execution_output"constant`

            - `required Long ReturnCode`

            - `required string Stderr`

            - `required string Stdout`

            - `JsonElement Type "code_execution_result"constant`

          - `class BetaEncryptedCodeExecutionResultBlock:`

            Code execution result with encrypted stdout for PFC + web_search results.

            - `required IReadOnlyList<BetaCodeExecutionOutputBlock> Content`

              - `required string FileID`

              - `JsonElement Type "code_execution_output"constant`

            - `required string EncryptedStdout`

            - `required Long ReturnCode`

            - `required string Stderr`

            - `JsonElement Type "encrypted_code_execution_result"constant`

        - `required string ToolUseID`

        - `JsonElement Type "code_execution_tool_result"constant`

      - `class BetaBashCodeExecutionToolResultBlock:`

        - `required Content Content`

          - `class BetaBashCodeExecutionToolResultError:`

            - `required ErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"too_many_requests"TooManyRequests`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `"output_file_too_large"OutputFileTooLarge`

            - `JsonElement Type "bash_code_execution_tool_result_error"constant`

          - `class BetaBashCodeExecutionResultBlock:`

            - `required IReadOnlyList<BetaBashCodeExecutionOutputBlock> Content`

              - `required string FileID`

              - `JsonElement Type "bash_code_execution_output"constant`

            - `required Long ReturnCode`

            - `required string Stderr`

            - `required string Stdout`

            - `JsonElement Type "bash_code_execution_result"constant`

        - `required string ToolUseID`

        - `JsonElement Type "bash_code_execution_tool_result"constant`

      - `class BetaTextEditorCodeExecutionToolResultBlock:`

        - `required Content Content`

          - `class BetaTextEditorCodeExecutionToolResultError:`

            - `required ErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"too_many_requests"TooManyRequests`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

              - `"file_not_found"FileNotFound`

            - `required string? ErrorMessage`

            - `JsonElement Type "text_editor_code_execution_tool_result_error"constant`

          - `class BetaTextEditorCodeExecutionViewResultBlock:`

            - `required string Content`

            - `required FileType FileType`

              - `"text"Text`

              - `"image"Image`

              - `"pdf"Pdf`

            - `required Long? NumLines`

            - `required Long? StartLine`

            - `required Long? TotalLines`

            - `JsonElement Type "text_editor_code_execution_view_result"constant`

          - `class BetaTextEditorCodeExecutionCreateResultBlock:`

            - `required Boolean IsFileUpdate`

            - `JsonElement Type "text_editor_code_execution_create_result"constant`

          - `class BetaTextEditorCodeExecutionStrReplaceResultBlock:`

            - `required IReadOnlyList<string>? Lines`

            - `required Long? NewLines`

            - `required Long? NewStart`

            - `required Long? OldLines`

            - `required Long? OldStart`

            - `JsonElement Type "text_editor_code_execution_str_replace_result"constant`

        - `required string ToolUseID`

        - `JsonElement Type "text_editor_code_execution_tool_result"constant`

      - `class BetaToolSearchToolResultBlock:`

        - `required Content Content`

          - `class BetaToolSearchToolResultError:`

            - `required ErrorCode ErrorCode`

              - `"invalid_tool_input"InvalidToolInput`

              - `"unavailable"Unavailable`

              - `"too_many_requests"TooManyRequests`

              - `"execution_time_exceeded"ExecutionTimeExceeded`

            - `required string? ErrorMessage`

            - `JsonElement Type "tool_search_tool_result_error"constant`

          - `class BetaToolSearchToolSearchResultBlock:`

            - `required IReadOnlyList<BetaToolReferenceBlock> ToolReferences`

              - `required string ToolName`

              - `JsonElement Type "tool_reference"constant`

            - `JsonElement Type "tool_search_tool_search_result"constant`

        - `required string ToolUseID`

        - `JsonElement Type "tool_search_tool_result"constant`

      - `class BetaMcpToolUseBlock:`

        - `required string ID`

        - `required IReadOnlyDictionary<string, JsonElement> Input`

        - `required string Name`

          The name of the MCP tool

        - `required string ServerName`

          The name of the MCP server

        - `JsonElement Type "mcp_tool_use"constant`

      - `class BetaMcpToolResultBlock:`

        - `required Content Content`

          - `string`

          - `IReadOnlyList<BetaTextBlock>`

            - `required IReadOnlyList<BetaTextCitation>? Citations`

              Citations supporting the text block.

              The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

            - `required string Text`

            - `JsonElement Type "text"constant`

        - `required Boolean IsError`

        - `required string ToolUseID`

        - `JsonElement Type "mcp_tool_result"constant`

      - `class BetaContainerUploadBlock:`

        Response model for a file uploaded to the container.

        - `required string FileID`

        - `JsonElement Type "container_upload"constant`

      - `class BetaCompactionBlock:`

        A compaction block returned when autocompact is triggered.

        When content is None, it indicates the compaction failed to produce a valid
        summary (e.g., malformed output from the model). Clients may round-trip
        compaction blocks with null content; the server treats them as no-ops.

        - `required string? Content`

          Summary of compacted content, or null if compaction failed

        - `required string? EncryptedContent`

          Opaque metadata from prior compaction, to be round-tripped verbatim

        - `JsonElement Type "compaction"constant`

    - `required BetaContextManagementResponse? ContextManagement`

      Context management response.

      Information about context management strategies applied during the request.

      - `required IReadOnlyList<AppliedEdit> AppliedEdits`

        List of context management edits that were applied.

        - `class BetaClearToolUses20250919EditResponse:`

          - `required Long ClearedInputTokens`

            Number of input tokens cleared by this edit.

          - `required Long ClearedToolUses`

            Number of tool uses that were cleared.

          - `JsonElement Type "clear_tool_uses_20250919"constant`

            The type of context management edit applied.

        - `class BetaClearThinking20251015EditResponse:`

          - `required Long ClearedInputTokens`

            Number of input tokens cleared by this edit.

          - `required Long ClearedThinkingTurns`

            Number of thinking turns that were cleared.

          - `JsonElement Type "clear_thinking_20251015"constant`

            The type of context management edit applied.

    - `required BetaDiagnostics? Diagnostics`

      Response envelope for request-level diagnostics. Present (possibly
      null) whenever the caller supplied `diagnostics` on the request.

      - `required CacheMissReason? CacheMissReason`

        Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.

        - `class BetaCacheMissModelChanged:`

          - `required Long CacheMissedInputTokens`

            Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

          - `JsonElement Type "model_changed"constant`

        - `class BetaCacheMissSystemChanged:`

          - `required Long CacheMissedInputTokens`

            Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

          - `JsonElement Type "system_changed"constant`

        - `class BetaCacheMissToolsChanged:`

          - `required Long CacheMissedInputTokens`

            Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

          - `JsonElement Type "tools_changed"constant`

        - `class BetaCacheMissMessagesChanged:`

          - `required Long CacheMissedInputTokens`

            Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

          - `JsonElement Type "messages_changed"constant`

        - `class BetaCacheMissPreviousMessageNotFound:`

          - `JsonElement Type "previous_message_not_found"constant`

        - `class BetaCacheMissUnavailable:`

          - `JsonElement Type "unavailable"constant`

    - `required Model Model`

      The model that will complete your prompt.

      See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

      - `"claude-opus-4-8"ClaudeOpus4_8`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-7"ClaudeOpus4_7`

        Frontier intelligence for long-running agents and coding

      - `"claude-mythos-preview"ClaudeMythosPreview`

        New class of intelligence, strongest in coding and cybersecurity

      - `"claude-opus-4-6"ClaudeOpus4_6`

        Frontier intelligence for long-running agents and coding

      - `"claude-sonnet-4-6"ClaudeSonnet4_6`

        Best combination of speed and intelligence

      - `"claude-haiku-4-5"ClaudeHaiku4_5`

        Fastest model with near-frontier intelligence

      - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

        Fastest model with near-frontier intelligence

      - `"claude-opus-4-5"ClaudeOpus4_5`

        Premium model combining maximum intelligence with practical performance

      - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

        Premium model combining maximum intelligence with practical performance

      - `"claude-sonnet-4-5"ClaudeSonnet4_5`

        High-performance model for agents and coding

      - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

        High-performance model for agents and coding

      - `"claude-opus-4-1"ClaudeOpus4_1`

        Exceptional model for specialized complex tasks

      - `"claude-opus-4-1-20250805"ClaudeOpus4_1_20250805`

        Exceptional model for specialized complex tasks

      - `"claude-opus-4-0"ClaudeOpus4_0`

        Powerful model for complex tasks

      - `"claude-opus-4-20250514"ClaudeOpus4_20250514`

        Powerful model for complex tasks

      - `"claude-sonnet-4-0"ClaudeSonnet4_0`

        High-performance model with extended thinking

      - `"claude-sonnet-4-20250514"ClaudeSonnet4_20250514`

        High-performance model with extended thinking

      - `"claude-3-haiku-20240307"Claude_3_Haiku_20240307`

        Fast and cost-effective model

    - `JsonElement Role "assistant"constant`

      Conversational role of the generated message.

      This will always be `"assistant"`.

    - `required BetaRefusalStopDetails? StopDetails`

      Structured information about a refusal.

      - `required Category? Category`

        The policy category that triggered the refusal.

        `null` when the refusal doesn't map to a named category.

        - `"cyber"Cyber`

        - `"bio"Bio`

      - `required string? Explanation`

        Human-readable explanation of the refusal.

        This text is not guaranteed to be stable. `null` when no explanation is available for the category.

      - `JsonElement Type "refusal"constant`

    - `required BetaStopReason? StopReason`

      The reason that we stopped.

      This may be one the following values:

      * `"end_turn"`: the model reached a natural stopping point
      * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
      * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
      * `"tool_use"`: the model invoked one or more tools
      * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.
      * `"refusal"`: when streaming classifiers intervene to handle potential policy violations

      In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise.

      - `"end_turn"EndTurn`

      - `"max_tokens"MaxTokens`

      - `"stop_sequence"StopSequence`

      - `"tool_use"ToolUse`

      - `"pause_turn"PauseTurn`

      - `"compaction"Compaction`

      - `"refusal"Refusal`

      - `"model_context_window_exceeded"ModelContextWindowExceeded`

    - `required string? StopSequence`

      Which custom stop sequence was generated, if any.

      This value will be a non-null string if one of your custom stop sequences was generated.

    - `JsonElement Type "message"constant`

      Object type.

      For Messages, this is always `"message"`.

    - `required BetaUsage Usage`

      Billing and rate-limit usage.

      Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

      Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.

      For example, `output_tokens` will be non-zero, even for an empty string response from Claude.

      Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.

      - `required BetaCacheCreation? CacheCreation`

        Breakdown of cached tokens by TTL

        - `required Long Ephemeral1hInputTokens`

          The number of input tokens used to create the 1 hour cache entry.

        - `required Long Ephemeral5mInputTokens`

          The number of input tokens used to create the 5 minute cache entry.

      - `required Long? CacheCreationInputTokens`

        The number of input tokens used to create the cache entry.

      - `required Long? CacheReadInputTokens`

        The number of input tokens read from the cache.

      - `required string? InferenceGeo`

        The geographic region where inference was performed for this request.

      - `required Long InputTokens`

        The number of input tokens which were used.

      - `required IReadOnlyList<BetaIterationsUsageItems>? Iterations`

        Per-iteration token usage breakdown.

        Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:

        - Determine which iterations exceeded long context thresholds (>=200k tokens)
        - Calculate the true context window size from the last iteration
        - Understand token accumulation across server-side tool use loops

        - `class BetaMessageIterationUsage:`

          Token usage for a sampling iteration.

          - `required BetaCacheCreation? CacheCreation`

            Breakdown of cached tokens by TTL

          - `required Long CacheCreationInputTokens`

            The number of input tokens used to create the cache entry.

          - `required Long CacheReadInputTokens`

            The number of input tokens read from the cache.

          - `required Long InputTokens`

            The number of input tokens which were used.

          - `required Long OutputTokens`

            The number of output tokens which were used.

          - `JsonElement Type "message"constant`

            Usage for a sampling iteration

        - `class BetaCompactionIterationUsage:`

          Token usage for a compaction iteration.

          - `required BetaCacheCreation? CacheCreation`

            Breakdown of cached tokens by TTL

          - `required Long CacheCreationInputTokens`

            The number of input tokens used to create the cache entry.

          - `required Long CacheReadInputTokens`

            The number of input tokens read from the cache.

          - `required Long InputTokens`

            The number of input tokens which were used.

          - `required Long OutputTokens`

            The number of output tokens which were used.

          - `JsonElement Type "compaction"constant`

            Usage for a compaction iteration

        - `class BetaAdvisorMessageIterationUsage:`

          Token usage for an advisor sub-inference iteration.

          - `required BetaCacheCreation? CacheCreation`

            Breakdown of cached tokens by TTL

          - `required Long CacheCreationInputTokens`

            The number of input tokens used to create the cache entry.

          - `required Long CacheReadInputTokens`

            The number of input tokens read from the cache.

          - `required Long InputTokens`

            The number of input tokens which were used.

          - `required Model Model`

            The model that will complete your prompt.

            See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `required Long OutputTokens`

            The number of output tokens which were used.

          - `JsonElement Type "advisor_message"constant`

            Usage for an advisor sub-inference iteration

      - `required Long OutputTokens`

        The number of output tokens which were used.

      - `required BetaOutputTokensDetails? OutputTokensDetails`

        Breakdown of output tokens by category.

        `output_tokens` remains the inclusive, authoritative total used for billing.
        This object provides a read-only decomposition for observability — for example,
        how many of the billed output tokens were spent on internal reasoning that may
        have been summarized before being returned to you.

        - `required Long ThinkingTokens`

          Number of output tokens the model generated as internal reasoning, including
          the thinking-block delimiter tokens.

          Reflects the raw reasoning the model produced, not the (possibly shorter)
          summarized thinking text returned in the response body. Computed by
          re-tokenizing the raw reasoning text, so it may differ from the model's exact
          generation count by a small number of tokens. Always ≤ `output_tokens`;
          `output_tokens - thinking_tokens` approximates the non-reasoning output.

      - `required BetaServerToolUsage? ServerToolUse`

        The number of server tool requests.

        - `required Long WebFetchRequests`

          The number of web fetch tool requests.

        - `required Long WebSearchRequests`

          The number of web search tool requests.

      - `required ServiceTier? ServiceTier`

        If the request used the priority, standard, or batch tier.

        - `"standard"Standard`

        - `"priority"Priority`

        - `"batch"Batch`

      - `required Speed? Speed`

        The inference speed mode used for this request.

        - `"standard"Standard`

        - `"fast"Fast`

  - `JsonElement Type "succeeded"constant`

# Agents

## Create Agent

`BetaManagedAgentsAgent Beta.Agents.Create(AgentCreateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/agents`

Create Agent

### Parameters

- `AgentCreateParams parameters`

  - `required Model model`

    Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control

    - `enum BetaManagedAgentsModel:`

      The model that will power your agent.

      See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

      - `"claude-opus-4-8"ClaudeOpus4_8`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-7"ClaudeOpus4_7`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-6"ClaudeOpus4_6`

        Most intelligent model for building agents and coding

      - `"claude-sonnet-4-6"ClaudeSonnet4_6`

        Best combination of speed and intelligence

      - `"claude-haiku-4-5"ClaudeHaiku4_5`

        Fastest model with near-frontier intelligence

      - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

        Fastest model with near-frontier intelligence

      - `"claude-opus-4-5"ClaudeOpus4_5`

        Premium model combining maximum intelligence with practical performance

      - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

        Premium model combining maximum intelligence with practical performance

      - `"claude-sonnet-4-5"ClaudeSonnet4_5`

        High-performance model for agents and coding

      - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

        High-performance model for agents and coding

    - `class BetaManagedAgentsModelConfigParams:`

      An object that defines additional configuration control over model use

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed? Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

  - `required string name`

    Body param: Human-readable name for the agent. 1-256 characters.

  - `string? description`

    Body param: Description of what the agent does. Up to 2048 characters.

  - `IReadOnlyList<BetaManagedAgentsUrlMcpServerParams> mcpServers`

    Body param: MCP servers this agent connects to. Maximum 20. Names must be unique within the array.

    - `required string Name`

      Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters.

    - `required Type Type`

      - `"url"Url`

    - `required string Url`

      Endpoint URL for the MCP server.

  - `IReadOnlyDictionary<string, string> metadata`

    Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

  - `BetaManagedAgentsMultiagentParams? multiagent`

    Body param: A coordinator topology: the session's primary thread orchestrates work by spawning session threads, each running an agent drawn from the `agents` roster.

  - `IReadOnlyList<BetaManagedAgentsSkillParams> skills`

    Body param: Skills available to the agent. Maximum 20.

    - `class BetaManagedAgentsAnthropicSkillParams:`

      An Anthropic-managed skill.

      - `required string SkillID`

        Identifier of the Anthropic skill (e.g., "xlsx").

      - `required Type Type`

        - `"anthropic"Anthropic`

      - `string? Version`

        Version to pin. Defaults to latest if omitted.

    - `class BetaManagedAgentsCustomSkillParams:`

      A user-created custom skill.

      - `required string SkillID`

        Tagged ID of the custom skill (e.g., "skill_01XJ5...").

      - `required Type Type`

        - `"custom"Custom`

      - `string? Version`

        Version to pin. Defaults to latest if omitted.

  - `string? system`

    Body param: System prompt for the agent. Up to 100,000 characters.

  - `IReadOnlyList<Tool> tools`

    Body param: Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed.

    - `class BetaManagedAgentsAgentToolset20260401Params:`

      Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent.

      - `required Type Type`

        - `"agent_toolset_20260401"AgentToolset20260401`

      - `IReadOnlyList<BetaManagedAgentsAgentToolConfigParams> Configs`

        Per-tool configuration overrides.

        - `required Name Name`

          Built-in agent tool identifier.

          - `"bash"Bash`

          - `"edit"Edit`

          - `"read"Read`

          - `"write"Write`

          - `"glob"Glob`

          - `"grep"Grep`

          - `"web_fetch"WebFetch`

          - `"web_search"WebSearch`

        - `Boolean? Enabled`

          Whether this tool is enabled and available to Claude. Overrides the default_config setting.

        - `PermissionPolicy? PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

            - `required Type Type`

              - `"always_allow"AlwaysAllow`

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"always_ask"AlwaysAsk`

      - `BetaManagedAgentsAgentToolsetDefaultConfigParams? DefaultConfig`

        Default configuration for all tools in a toolset.

        - `Boolean? Enabled`

          Whether tools are enabled and available to Claude by default. Defaults to true if not specified.

        - `PermissionPolicy? PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

    - `class BetaManagedAgentsMcpToolsetParams:`

      Configuration for tools from an MCP server defined in `mcp_servers`.

      - `required string McpServerName`

        Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters.

      - `required Type Type`

        - `"mcp_toolset"McpToolset`

      - `IReadOnlyList<BetaManagedAgentsMcpToolConfigParams> Configs`

        Per-tool configuration overrides.

        - `required string Name`

          Name of the MCP tool to configure. 1-128 characters.

        - `Boolean? Enabled`

          Whether this tool is enabled. Overrides the `default_config` setting.

        - `PermissionPolicy? PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `BetaManagedAgentsMcpToolsetDefaultConfigParams? DefaultConfig`

        Default configuration for all tools from an MCP server.

        - `Boolean? Enabled`

          Whether tools are enabled by default. Defaults to true if not specified.

        - `PermissionPolicy? PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

    - `class BetaManagedAgentsCustomToolParams:`

      A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event.

      - `required string Description`

        Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters.

      - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

        JSON Schema for custom tool input parameters.

        - `IReadOnlyDictionary<string, JsonElement>? Properties`

          JSON Schema properties defining the tool's input parameters.

        - `IReadOnlyList<string> Required`

          List of required property names.

        - `Type Type`

          Must be 'object' for tool input schemas.

          - `"object"Object`

      - `required string Name`

        Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens.

      - `required Type Type`

        - `"custom"Custom`

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsAgent:`

  A Managed Agents `agent`.

  - `required string ID`

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string? Description`

  - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

    - `required string Name`

    - `required Type Type`

      - `"url"Url`

    - `required string Url`

  - `required IReadOnlyDictionary<string, string> Metadata`

  - `required BetaManagedAgentsModelConfig Model`

    Model identifier and configuration.

    - `required BetaManagedAgentsModel ID`

      The model that will power your agent.

      See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

      - `"claude-opus-4-8"ClaudeOpus4_8`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-7"ClaudeOpus4_7`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-6"ClaudeOpus4_6`

        Most intelligent model for building agents and coding

      - `"claude-sonnet-4-6"ClaudeSonnet4_6`

        Best combination of speed and intelligence

      - `"claude-haiku-4-5"ClaudeHaiku4_5`

        Fastest model with near-frontier intelligence

      - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

        Fastest model with near-frontier intelligence

      - `"claude-opus-4-5"ClaudeOpus4_5`

        Premium model combining maximum intelligence with practical performance

      - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

        Premium model combining maximum intelligence with practical performance

      - `"claude-sonnet-4-5"ClaudeSonnet4_5`

        High-performance model for agents and coding

      - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

        High-performance model for agents and coding

    - `Speed Speed`

      Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

      - `"standard"Standard`

      - `"fast"Fast`

  - `required BetaManagedAgentsMultiagent? Multiagent`

    Resolved coordinator topology with a concrete agent roster.

    - `required IReadOnlyList<BetaManagedAgentsAgentReference> Agents`

      Agents the coordinator may spawn as session threads, each resolved to a specific version.

      - `required string ID`

      - `required Type Type`

        - `"agent"Agent`

      - `required Int Version`

    - `required Type Type`

      - `"coordinator"Coordinator`

  - `required string Name`

  - `required IReadOnlyList<Skill> Skills`

    - `class BetaManagedAgentsAnthropicSkill:`

      A resolved Anthropic-managed skill.

      - `required string SkillID`

      - `required Type Type`

        - `"anthropic"Anthropic`

      - `required string Version`

    - `class BetaManagedAgentsCustomSkill:`

      A resolved user-created custom skill.

      - `required string SkillID`

      - `required Type Type`

        - `"custom"Custom`

      - `required string Version`

  - `required string? System`

  - `required IReadOnlyList<Tool> Tools`

    - `class BetaManagedAgentsAgentToolset20260401:`

      - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

        - `required Boolean Enabled`

        - `required Name Name`

          Built-in agent tool identifier.

          - `"bash"Bash`

          - `"edit"Edit`

          - `"read"Read`

          - `"write"Write`

          - `"glob"Glob`

          - `"grep"Grep`

          - `"web_fetch"WebFetch`

          - `"web_search"WebSearch`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

            - `required Type Type`

              - `"always_allow"AlwaysAllow`

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"always_ask"AlwaysAsk`

      - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

        Resolved default configuration for agent tools.

        - `required Boolean Enabled`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"agent_toolset_20260401"AgentToolset20260401`

    - `class BetaManagedAgentsMcpToolset:`

      - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

        - `required Boolean Enabled`

        - `required string Name`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

        Resolved default configuration for all tools from an MCP server.

        - `required Boolean Enabled`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required string McpServerName`

      - `required Type Type`

        - `"mcp_toolset"McpToolset`

    - `class BetaManagedAgentsCustomTool:`

      A custom tool as returned in API responses.

      - `required string Description`

      - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

        JSON Schema for custom tool input parameters.

        - `IReadOnlyDictionary<string, JsonElement>? Properties`

          JSON Schema properties defining the tool's input parameters.

        - `IReadOnlyList<string> Required`

          List of required property names.

        - `Type Type`

          Must be 'object' for tool input schemas.

          - `"object"Object`

      - `required string Name`

      - `required Type Type`

        - `"custom"Custom`

  - `required Type Type`

    - `"agent"Agent`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required Int Version`

    The agent's current version. Starts at 1 and increments when the agent is modified.

### Example

```csharp
AgentCreateParams parameters = new()
{
    Model = BetaManagedAgentsModel.ClaudeSonnet4_6,
    Name = "My First Agent",
};

var betaManagedAgentsAgent = await client.Beta.Agents.Create(parameters);

Console.WriteLine(betaManagedAgentsAgent);
```

#### Response

```json
{
  "id": "agent_011CZkYpogX7uDKUyvBTophP",
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "description": "A general-purpose starter agent.",
  "mcp_servers": [
    {
      "name": "example-mcp",
      "type": "url",
      "url": "https://example-server.modelcontextprotocol.io/sse"
    }
  ],
  "metadata": {
    "foo": "bar"
  },
  "model": {
    "id": "claude-sonnet-4-6",
    "speed": "standard"
  },
  "multiagent": {
    "agents": [
      {
        "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
        "type": "agent",
        "version": 1
      }
    ],
    "type": "coordinator"
  },
  "name": "My First Agent",
  "skills": [
    {
      "skill_id": "xlsx",
      "type": "anthropic",
      "version": "1"
    },
    {
      "skill_id": "skill_011CZkZFNu9hAbo3jZPRgTlx",
      "type": "custom",
      "version": "2"
    }
  ],
  "system": "You are a general-purpose agent that can research, write code, run commands, and use connected tools to complete the user's task end to end.",
  "tools": [
    {
      "configs": [
        {
          "enabled": true,
          "name": "bash",
          "permission_policy": {
            "type": "always_allow"
          }
        }
      ],
      "default_config": {
        "enabled": true,
        "permission_policy": {
          "type": "always_ask"
        }
      },
      "type": "agent_toolset_20260401"
    }
  ],
  "type": "agent",
  "updated_at": "2026-03-15T10:00:00Z",
  "version": 1
}
```

## List Agents

`AgentListPageResponse Beta.Agents.List(AgentListParams?parameters, CancellationTokencancellationToken = default)`

**get** `/v1/agents`

List Agents

### Parameters

- `AgentListParams parameters`

  - `DateTimeOffset createdAtGte`

    Query param: Return agents created at or after this time (inclusive).

  - `DateTimeOffset createdAtLte`

    Query param: Return agents created at or before this time (inclusive).

  - `Boolean includeArchived`

    Query param: Include archived agents in results. Defaults to false.

  - `Int limit`

    Query param: Maximum results per page. Default 20, maximum 100.

  - `string page`

    Query param: Opaque pagination cursor from a previous response.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class AgentListPageResponse:`

  Paginated list of agents.

  - `IReadOnlyList<BetaManagedAgentsAgent> Data`

    List of agents.

    - `required string ID`

    - `required DateTimeOffset? ArchivedAt`

      A timestamp in RFC 3339 format

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string? Description`

    - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

      - `required string Name`

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

    - `required IReadOnlyDictionary<string, string> Metadata`

    - `required BetaManagedAgentsModelConfig Model`

      Model identifier and configuration.

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

    - `required BetaManagedAgentsMultiagent? Multiagent`

      Resolved coordinator topology with a concrete agent roster.

      - `required IReadOnlyList<BetaManagedAgentsAgentReference> Agents`

        Agents the coordinator may spawn as session threads, each resolved to a specific version.

        - `required string ID`

        - `required Type Type`

          - `"agent"Agent`

        - `required Int Version`

      - `required Type Type`

        - `"coordinator"Coordinator`

    - `required string Name`

    - `required IReadOnlyList<Skill> Skills`

      - `class BetaManagedAgentsAnthropicSkill:`

        A resolved Anthropic-managed skill.

        - `required string SkillID`

        - `required Type Type`

          - `"anthropic"Anthropic`

        - `required string Version`

      - `class BetaManagedAgentsCustomSkill:`

        A resolved user-created custom skill.

        - `required string SkillID`

        - `required Type Type`

          - `"custom"Custom`

        - `required string Version`

    - `required string? System`

    - `required IReadOnlyList<Tool> Tools`

      - `class BetaManagedAgentsAgentToolset20260401:`

        - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

          - `required Boolean Enabled`

          - `required Name Name`

            Built-in agent tool identifier.

            - `"bash"Bash`

            - `"edit"Edit`

            - `"read"Read`

            - `"write"Write`

            - `"glob"Glob`

            - `"grep"Grep`

            - `"web_fetch"WebFetch`

            - `"web_search"WebSearch`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

              - `required Type Type`

                - `"always_allow"AlwaysAllow`

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

              - `required Type Type`

                - `"always_ask"AlwaysAsk`

        - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

          Resolved default configuration for agent tools.

          - `required Boolean Enabled`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required Type Type`

          - `"agent_toolset_20260401"AgentToolset20260401`

      - `class BetaManagedAgentsMcpToolset:`

        - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

          - `required Boolean Enabled`

          - `required string Name`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

          Resolved default configuration for all tools from an MCP server.

          - `required Boolean Enabled`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required string McpServerName`

        - `required Type Type`

          - `"mcp_toolset"McpToolset`

      - `class BetaManagedAgentsCustomTool:`

        A custom tool as returned in API responses.

        - `required string Description`

        - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

          JSON Schema for custom tool input parameters.

          - `IReadOnlyDictionary<string, JsonElement>? Properties`

            JSON Schema properties defining the tool's input parameters.

          - `IReadOnlyList<string> Required`

            List of required property names.

          - `Type Type`

            Must be 'object' for tool input schemas.

            - `"object"Object`

        - `required string Name`

        - `required Type Type`

          - `"custom"Custom`

    - `required Type Type`

      - `"agent"Agent`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

    - `required Int Version`

      The agent's current version. Starts at 1 and increments when the agent is modified.

  - `string? NextPage`

    Opaque cursor for the next page. Null when no more results.

### Example

```csharp
AgentListParams parameters = new();

var page = await client.Beta.Agents.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "agent_011CZkYpogX7uDKUyvBTophP",
      "archived_at": null,
      "created_at": "2026-03-15T10:00:00Z",
      "description": "A general-purpose starter agent.",
      "mcp_servers": [
        {
          "name": "example-mcp",
          "type": "url",
          "url": "https://example-server.modelcontextprotocol.io/sse"
        }
      ],
      "metadata": {
        "foo": "bar"
      },
      "model": {
        "id": "claude-sonnet-4-6",
        "speed": "standard"
      },
      "multiagent": {
        "agents": [
          {
            "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
            "type": "agent",
            "version": 1
          }
        ],
        "type": "coordinator"
      },
      "name": "My First Agent",
      "skills": [
        {
          "skill_id": "xlsx",
          "type": "anthropic",
          "version": "1"
        },
        {
          "skill_id": "skill_011CZkZFNu9hAbo3jZPRgTlx",
          "type": "custom",
          "version": "2"
        }
      ],
      "system": "You are a general-purpose agent that can research, write code, run commands, and use connected tools to complete the user's task end to end.",
      "tools": [
        {
          "configs": [
            {
              "enabled": true,
              "name": "bash",
              "permission_policy": {
                "type": "always_allow"
              }
            }
          ],
          "default_config": {
            "enabled": true,
            "permission_policy": {
              "type": "always_ask"
            }
          },
          "type": "agent_toolset_20260401"
        }
      ],
      "type": "agent",
      "updated_at": "2026-03-15T10:00:00Z",
      "version": 1
    }
  ],
  "next_page": "next_page"
}
```

## Get Agent

`BetaManagedAgentsAgent Beta.Agents.Retrieve(AgentRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/agents/{agent_id}`

Get Agent

### Parameters

- `AgentRetrieveParams parameters`

  - `required string agentID`

    Path param: Path parameter agent_id

  - `Int version`

    Query param: Agent version. Omit for the most recent version. Must be at least 1 if specified.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsAgent:`

  A Managed Agents `agent`.

  - `required string ID`

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string? Description`

  - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

    - `required string Name`

    - `required Type Type`

      - `"url"Url`

    - `required string Url`

  - `required IReadOnlyDictionary<string, string> Metadata`

  - `required BetaManagedAgentsModelConfig Model`

    Model identifier and configuration.

    - `required BetaManagedAgentsModel ID`

      The model that will power your agent.

      See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

      - `"claude-opus-4-8"ClaudeOpus4_8`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-7"ClaudeOpus4_7`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-6"ClaudeOpus4_6`

        Most intelligent model for building agents and coding

      - `"claude-sonnet-4-6"ClaudeSonnet4_6`

        Best combination of speed and intelligence

      - `"claude-haiku-4-5"ClaudeHaiku4_5`

        Fastest model with near-frontier intelligence

      - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

        Fastest model with near-frontier intelligence

      - `"claude-opus-4-5"ClaudeOpus4_5`

        Premium model combining maximum intelligence with practical performance

      - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

        Premium model combining maximum intelligence with practical performance

      - `"claude-sonnet-4-5"ClaudeSonnet4_5`

        High-performance model for agents and coding

      - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

        High-performance model for agents and coding

    - `Speed Speed`

      Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

      - `"standard"Standard`

      - `"fast"Fast`

  - `required BetaManagedAgentsMultiagent? Multiagent`

    Resolved coordinator topology with a concrete agent roster.

    - `required IReadOnlyList<BetaManagedAgentsAgentReference> Agents`

      Agents the coordinator may spawn as session threads, each resolved to a specific version.

      - `required string ID`

      - `required Type Type`

        - `"agent"Agent`

      - `required Int Version`

    - `required Type Type`

      - `"coordinator"Coordinator`

  - `required string Name`

  - `required IReadOnlyList<Skill> Skills`

    - `class BetaManagedAgentsAnthropicSkill:`

      A resolved Anthropic-managed skill.

      - `required string SkillID`

      - `required Type Type`

        - `"anthropic"Anthropic`

      - `required string Version`

    - `class BetaManagedAgentsCustomSkill:`

      A resolved user-created custom skill.

      - `required string SkillID`

      - `required Type Type`

        - `"custom"Custom`

      - `required string Version`

  - `required string? System`

  - `required IReadOnlyList<Tool> Tools`

    - `class BetaManagedAgentsAgentToolset20260401:`

      - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

        - `required Boolean Enabled`

        - `required Name Name`

          Built-in agent tool identifier.

          - `"bash"Bash`

          - `"edit"Edit`

          - `"read"Read`

          - `"write"Write`

          - `"glob"Glob`

          - `"grep"Grep`

          - `"web_fetch"WebFetch`

          - `"web_search"WebSearch`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

            - `required Type Type`

              - `"always_allow"AlwaysAllow`

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"always_ask"AlwaysAsk`

      - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

        Resolved default configuration for agent tools.

        - `required Boolean Enabled`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"agent_toolset_20260401"AgentToolset20260401`

    - `class BetaManagedAgentsMcpToolset:`

      - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

        - `required Boolean Enabled`

        - `required string Name`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

        Resolved default configuration for all tools from an MCP server.

        - `required Boolean Enabled`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required string McpServerName`

      - `required Type Type`

        - `"mcp_toolset"McpToolset`

    - `class BetaManagedAgentsCustomTool:`

      A custom tool as returned in API responses.

      - `required string Description`

      - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

        JSON Schema for custom tool input parameters.

        - `IReadOnlyDictionary<string, JsonElement>? Properties`

          JSON Schema properties defining the tool's input parameters.

        - `IReadOnlyList<string> Required`

          List of required property names.

        - `Type Type`

          Must be 'object' for tool input schemas.

          - `"object"Object`

      - `required string Name`

      - `required Type Type`

        - `"custom"Custom`

  - `required Type Type`

    - `"agent"Agent`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required Int Version`

    The agent's current version. Starts at 1 and increments when the agent is modified.

### Example

```csharp
AgentRetrieveParams parameters = new()
{
    AgentID = "agent_011CZkYpogX7uDKUyvBTophP"
};

var betaManagedAgentsAgent = await client.Beta.Agents.Retrieve(parameters);

Console.WriteLine(betaManagedAgentsAgent);
```

#### Response

```json
{
  "id": "agent_011CZkYpogX7uDKUyvBTophP",
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "description": "A general-purpose starter agent.",
  "mcp_servers": [
    {
      "name": "example-mcp",
      "type": "url",
      "url": "https://example-server.modelcontextprotocol.io/sse"
    }
  ],
  "metadata": {
    "foo": "bar"
  },
  "model": {
    "id": "claude-sonnet-4-6",
    "speed": "standard"
  },
  "multiagent": {
    "agents": [
      {
        "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
        "type": "agent",
        "version": 1
      }
    ],
    "type": "coordinator"
  },
  "name": "My First Agent",
  "skills": [
    {
      "skill_id": "xlsx",
      "type": "anthropic",
      "version": "1"
    },
    {
      "skill_id": "skill_011CZkZFNu9hAbo3jZPRgTlx",
      "type": "custom",
      "version": "2"
    }
  ],
  "system": "You are a general-purpose agent that can research, write code, run commands, and use connected tools to complete the user's task end to end.",
  "tools": [
    {
      "configs": [
        {
          "enabled": true,
          "name": "bash",
          "permission_policy": {
            "type": "always_allow"
          }
        }
      ],
      "default_config": {
        "enabled": true,
        "permission_policy": {
          "type": "always_ask"
        }
      },
      "type": "agent_toolset_20260401"
    }
  ],
  "type": "agent",
  "updated_at": "2026-03-15T10:00:00Z",
  "version": 1
}
```

## Update Agent

`BetaManagedAgentsAgent Beta.Agents.Update(AgentUpdateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/agents/{agent_id}`

Update Agent

### Parameters

- `AgentUpdateParams parameters`

  - `required string agentID`

    Path param: Path parameter agent_id

  - `required Int version`

    Body param: The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version.

  - `string? description`

    Body param: Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear.

  - `IReadOnlyList<BetaManagedAgentsUrlMcpServerParams>? mcpServers`

    Body param: MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20.

    - `required string Name`

      Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters.

    - `required Type Type`

      - `"url"Url`

    - `required string Url`

      Endpoint URL for the MCP server.

  - `IReadOnlyDictionary<string, string>? metadata`

    Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars.

  - `Model model`

    Body param: Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared.

    - `enum BetaManagedAgentsModel:`

      The model that will power your agent.

      See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

      - `"claude-opus-4-8"ClaudeOpus4_8`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-7"ClaudeOpus4_7`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-6"ClaudeOpus4_6`

        Most intelligent model for building agents and coding

      - `"claude-sonnet-4-6"ClaudeSonnet4_6`

        Best combination of speed and intelligence

      - `"claude-haiku-4-5"ClaudeHaiku4_5`

        Fastest model with near-frontier intelligence

      - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

        Fastest model with near-frontier intelligence

      - `"claude-opus-4-5"ClaudeOpus4_5`

        Premium model combining maximum intelligence with practical performance

      - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

        Premium model combining maximum intelligence with practical performance

      - `"claude-sonnet-4-5"ClaudeSonnet4_5`

        High-performance model for agents and coding

      - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

        High-performance model for agents and coding

    - `class BetaManagedAgentsModelConfigParams:`

      An object that defines additional configuration control over model use

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed? Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

  - `BetaManagedAgentsMultiagentParams? multiagent`

    Body param: A coordinator topology: the session's primary thread orchestrates work by spawning session threads, each running an agent drawn from the `agents` roster.

  - `string name`

    Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared.

  - `IReadOnlyList<BetaManagedAgentsSkillParams>? skills`

    Body param: Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20.

    - `class BetaManagedAgentsAnthropicSkillParams:`

      An Anthropic-managed skill.

      - `required string SkillID`

        Identifier of the Anthropic skill (e.g., "xlsx").

      - `required Type Type`

        - `"anthropic"Anthropic`

      - `string? Version`

        Version to pin. Defaults to latest if omitted.

    - `class BetaManagedAgentsCustomSkillParams:`

      A user-created custom skill.

      - `required string SkillID`

        Tagged ID of the custom skill (e.g., "skill_01XJ5...").

      - `required Type Type`

        - `"custom"Custom`

      - `string? Version`

        Version to pin. Defaults to latest if omitted.

  - `string? system`

    Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear.

  - `IReadOnlyList<Tool>? tools`

    Body param: Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed.

    - `class BetaManagedAgentsAgentToolset20260401Params:`

      Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent.

      - `required Type Type`

        - `"agent_toolset_20260401"AgentToolset20260401`

      - `IReadOnlyList<BetaManagedAgentsAgentToolConfigParams> Configs`

        Per-tool configuration overrides.

        - `required Name Name`

          Built-in agent tool identifier.

          - `"bash"Bash`

          - `"edit"Edit`

          - `"read"Read`

          - `"write"Write`

          - `"glob"Glob`

          - `"grep"Grep`

          - `"web_fetch"WebFetch`

          - `"web_search"WebSearch`

        - `Boolean? Enabled`

          Whether this tool is enabled and available to Claude. Overrides the default_config setting.

        - `PermissionPolicy? PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

            - `required Type Type`

              - `"always_allow"AlwaysAllow`

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"always_ask"AlwaysAsk`

      - `BetaManagedAgentsAgentToolsetDefaultConfigParams? DefaultConfig`

        Default configuration for all tools in a toolset.

        - `Boolean? Enabled`

          Whether tools are enabled and available to Claude by default. Defaults to true if not specified.

        - `PermissionPolicy? PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

    - `class BetaManagedAgentsMcpToolsetParams:`

      Configuration for tools from an MCP server defined in `mcp_servers`.

      - `required string McpServerName`

        Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters.

      - `required Type Type`

        - `"mcp_toolset"McpToolset`

      - `IReadOnlyList<BetaManagedAgentsMcpToolConfigParams> Configs`

        Per-tool configuration overrides.

        - `required string Name`

          Name of the MCP tool to configure. 1-128 characters.

        - `Boolean? Enabled`

          Whether this tool is enabled. Overrides the `default_config` setting.

        - `PermissionPolicy? PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `BetaManagedAgentsMcpToolsetDefaultConfigParams? DefaultConfig`

        Default configuration for all tools from an MCP server.

        - `Boolean? Enabled`

          Whether tools are enabled by default. Defaults to true if not specified.

        - `PermissionPolicy? PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

    - `class BetaManagedAgentsCustomToolParams:`

      A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event.

      - `required string Description`

        Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters.

      - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

        JSON Schema for custom tool input parameters.

        - `IReadOnlyDictionary<string, JsonElement>? Properties`

          JSON Schema properties defining the tool's input parameters.

        - `IReadOnlyList<string> Required`

          List of required property names.

        - `Type Type`

          Must be 'object' for tool input schemas.

          - `"object"Object`

      - `required string Name`

        Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens.

      - `required Type Type`

        - `"custom"Custom`

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsAgent:`

  A Managed Agents `agent`.

  - `required string ID`

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string? Description`

  - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

    - `required string Name`

    - `required Type Type`

      - `"url"Url`

    - `required string Url`

  - `required IReadOnlyDictionary<string, string> Metadata`

  - `required BetaManagedAgentsModelConfig Model`

    Model identifier and configuration.

    - `required BetaManagedAgentsModel ID`

      The model that will power your agent.

      See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

      - `"claude-opus-4-8"ClaudeOpus4_8`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-7"ClaudeOpus4_7`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-6"ClaudeOpus4_6`

        Most intelligent model for building agents and coding

      - `"claude-sonnet-4-6"ClaudeSonnet4_6`

        Best combination of speed and intelligence

      - `"claude-haiku-4-5"ClaudeHaiku4_5`

        Fastest model with near-frontier intelligence

      - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

        Fastest model with near-frontier intelligence

      - `"claude-opus-4-5"ClaudeOpus4_5`

        Premium model combining maximum intelligence with practical performance

      - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

        Premium model combining maximum intelligence with practical performance

      - `"claude-sonnet-4-5"ClaudeSonnet4_5`

        High-performance model for agents and coding

      - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

        High-performance model for agents and coding

    - `Speed Speed`

      Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

      - `"standard"Standard`

      - `"fast"Fast`

  - `required BetaManagedAgentsMultiagent? Multiagent`

    Resolved coordinator topology with a concrete agent roster.

    - `required IReadOnlyList<BetaManagedAgentsAgentReference> Agents`

      Agents the coordinator may spawn as session threads, each resolved to a specific version.

      - `required string ID`

      - `required Type Type`

        - `"agent"Agent`

      - `required Int Version`

    - `required Type Type`

      - `"coordinator"Coordinator`

  - `required string Name`

  - `required IReadOnlyList<Skill> Skills`

    - `class BetaManagedAgentsAnthropicSkill:`

      A resolved Anthropic-managed skill.

      - `required string SkillID`

      - `required Type Type`

        - `"anthropic"Anthropic`

      - `required string Version`

    - `class BetaManagedAgentsCustomSkill:`

      A resolved user-created custom skill.

      - `required string SkillID`

      - `required Type Type`

        - `"custom"Custom`

      - `required string Version`

  - `required string? System`

  - `required IReadOnlyList<Tool> Tools`

    - `class BetaManagedAgentsAgentToolset20260401:`

      - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

        - `required Boolean Enabled`

        - `required Name Name`

          Built-in agent tool identifier.

          - `"bash"Bash`

          - `"edit"Edit`

          - `"read"Read`

          - `"write"Write`

          - `"glob"Glob`

          - `"grep"Grep`

          - `"web_fetch"WebFetch`

          - `"web_search"WebSearch`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

            - `required Type Type`

              - `"always_allow"AlwaysAllow`

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"always_ask"AlwaysAsk`

      - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

        Resolved default configuration for agent tools.

        - `required Boolean Enabled`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"agent_toolset_20260401"AgentToolset20260401`

    - `class BetaManagedAgentsMcpToolset:`

      - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

        - `required Boolean Enabled`

        - `required string Name`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

        Resolved default configuration for all tools from an MCP server.

        - `required Boolean Enabled`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required string McpServerName`

      - `required Type Type`

        - `"mcp_toolset"McpToolset`

    - `class BetaManagedAgentsCustomTool:`

      A custom tool as returned in API responses.

      - `required string Description`

      - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

        JSON Schema for custom tool input parameters.

        - `IReadOnlyDictionary<string, JsonElement>? Properties`

          JSON Schema properties defining the tool's input parameters.

        - `IReadOnlyList<string> Required`

          List of required property names.

        - `Type Type`

          Must be 'object' for tool input schemas.

          - `"object"Object`

      - `required string Name`

      - `required Type Type`

        - `"custom"Custom`

  - `required Type Type`

    - `"agent"Agent`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required Int Version`

    The agent's current version. Starts at 1 and increments when the agent is modified.

### Example

```csharp
AgentUpdateParams parameters = new()
{
    AgentID = "agent_011CZkYpogX7uDKUyvBTophP",
    Version = 1,
};

var betaManagedAgentsAgent = await client.Beta.Agents.Update(parameters);

Console.WriteLine(betaManagedAgentsAgent);
```

#### Response

```json
{
  "id": "agent_011CZkYpogX7uDKUyvBTophP",
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "description": "A general-purpose starter agent.",
  "mcp_servers": [
    {
      "name": "example-mcp",
      "type": "url",
      "url": "https://example-server.modelcontextprotocol.io/sse"
    }
  ],
  "metadata": {
    "foo": "bar"
  },
  "model": {
    "id": "claude-sonnet-4-6",
    "speed": "standard"
  },
  "multiagent": {
    "agents": [
      {
        "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
        "type": "agent",
        "version": 1
      }
    ],
    "type": "coordinator"
  },
  "name": "My First Agent",
  "skills": [
    {
      "skill_id": "xlsx",
      "type": "anthropic",
      "version": "1"
    },
    {
      "skill_id": "skill_011CZkZFNu9hAbo3jZPRgTlx",
      "type": "custom",
      "version": "2"
    }
  ],
  "system": "You are a general-purpose agent that can research, write code, run commands, and use connected tools to complete the user's task end to end.",
  "tools": [
    {
      "configs": [
        {
          "enabled": true,
          "name": "bash",
          "permission_policy": {
            "type": "always_allow"
          }
        }
      ],
      "default_config": {
        "enabled": true,
        "permission_policy": {
          "type": "always_ask"
        }
      },
      "type": "agent_toolset_20260401"
    }
  ],
  "type": "agent",
  "updated_at": "2026-03-15T10:00:00Z",
  "version": 1
}
```

## Archive Agent

`BetaManagedAgentsAgent Beta.Agents.Archive(AgentArchiveParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/agents/{agent_id}/archive`

Archive Agent

### Parameters

- `AgentArchiveParams parameters`

  - `required string agentID`

    Path parameter agent_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsAgent:`

  A Managed Agents `agent`.

  - `required string ID`

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string? Description`

  - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

    - `required string Name`

    - `required Type Type`

      - `"url"Url`

    - `required string Url`

  - `required IReadOnlyDictionary<string, string> Metadata`

  - `required BetaManagedAgentsModelConfig Model`

    Model identifier and configuration.

    - `required BetaManagedAgentsModel ID`

      The model that will power your agent.

      See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

      - `"claude-opus-4-8"ClaudeOpus4_8`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-7"ClaudeOpus4_7`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-6"ClaudeOpus4_6`

        Most intelligent model for building agents and coding

      - `"claude-sonnet-4-6"ClaudeSonnet4_6`

        Best combination of speed and intelligence

      - `"claude-haiku-4-5"ClaudeHaiku4_5`

        Fastest model with near-frontier intelligence

      - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

        Fastest model with near-frontier intelligence

      - `"claude-opus-4-5"ClaudeOpus4_5`

        Premium model combining maximum intelligence with practical performance

      - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

        Premium model combining maximum intelligence with practical performance

      - `"claude-sonnet-4-5"ClaudeSonnet4_5`

        High-performance model for agents and coding

      - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

        High-performance model for agents and coding

    - `Speed Speed`

      Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

      - `"standard"Standard`

      - `"fast"Fast`

  - `required BetaManagedAgentsMultiagent? Multiagent`

    Resolved coordinator topology with a concrete agent roster.

    - `required IReadOnlyList<BetaManagedAgentsAgentReference> Agents`

      Agents the coordinator may spawn as session threads, each resolved to a specific version.

      - `required string ID`

      - `required Type Type`

        - `"agent"Agent`

      - `required Int Version`

    - `required Type Type`

      - `"coordinator"Coordinator`

  - `required string Name`

  - `required IReadOnlyList<Skill> Skills`

    - `class BetaManagedAgentsAnthropicSkill:`

      A resolved Anthropic-managed skill.

      - `required string SkillID`

      - `required Type Type`

        - `"anthropic"Anthropic`

      - `required string Version`

    - `class BetaManagedAgentsCustomSkill:`

      A resolved user-created custom skill.

      - `required string SkillID`

      - `required Type Type`

        - `"custom"Custom`

      - `required string Version`

  - `required string? System`

  - `required IReadOnlyList<Tool> Tools`

    - `class BetaManagedAgentsAgentToolset20260401:`

      - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

        - `required Boolean Enabled`

        - `required Name Name`

          Built-in agent tool identifier.

          - `"bash"Bash`

          - `"edit"Edit`

          - `"read"Read`

          - `"write"Write`

          - `"glob"Glob`

          - `"grep"Grep`

          - `"web_fetch"WebFetch`

          - `"web_search"WebSearch`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

            - `required Type Type`

              - `"always_allow"AlwaysAllow`

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"always_ask"AlwaysAsk`

      - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

        Resolved default configuration for agent tools.

        - `required Boolean Enabled`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"agent_toolset_20260401"AgentToolset20260401`

    - `class BetaManagedAgentsMcpToolset:`

      - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

        - `required Boolean Enabled`

        - `required string Name`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

        Resolved default configuration for all tools from an MCP server.

        - `required Boolean Enabled`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required string McpServerName`

      - `required Type Type`

        - `"mcp_toolset"McpToolset`

    - `class BetaManagedAgentsCustomTool:`

      A custom tool as returned in API responses.

      - `required string Description`

      - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

        JSON Schema for custom tool input parameters.

        - `IReadOnlyDictionary<string, JsonElement>? Properties`

          JSON Schema properties defining the tool's input parameters.

        - `IReadOnlyList<string> Required`

          List of required property names.

        - `Type Type`

          Must be 'object' for tool input schemas.

          - `"object"Object`

      - `required string Name`

      - `required Type Type`

        - `"custom"Custom`

  - `required Type Type`

    - `"agent"Agent`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required Int Version`

    The agent's current version. Starts at 1 and increments when the agent is modified.

### Example

```csharp
AgentArchiveParams parameters = new()
{
    AgentID = "agent_011CZkYpogX7uDKUyvBTophP"
};

var betaManagedAgentsAgent = await client.Beta.Agents.Archive(parameters);

Console.WriteLine(betaManagedAgentsAgent);
```

#### Response

```json
{
  "id": "agent_011CZkYpogX7uDKUyvBTophP",
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "description": "A general-purpose starter agent.",
  "mcp_servers": [
    {
      "name": "example-mcp",
      "type": "url",
      "url": "https://example-server.modelcontextprotocol.io/sse"
    }
  ],
  "metadata": {
    "foo": "bar"
  },
  "model": {
    "id": "claude-sonnet-4-6",
    "speed": "standard"
  },
  "multiagent": {
    "agents": [
      {
        "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
        "type": "agent",
        "version": 1
      }
    ],
    "type": "coordinator"
  },
  "name": "My First Agent",
  "skills": [
    {
      "skill_id": "xlsx",
      "type": "anthropic",
      "version": "1"
    },
    {
      "skill_id": "skill_011CZkZFNu9hAbo3jZPRgTlx",
      "type": "custom",
      "version": "2"
    }
  ],
  "system": "You are a general-purpose agent that can research, write code, run commands, and use connected tools to complete the user's task end to end.",
  "tools": [
    {
      "configs": [
        {
          "enabled": true,
          "name": "bash",
          "permission_policy": {
            "type": "always_allow"
          }
        }
      ],
      "default_config": {
        "enabled": true,
        "permission_policy": {
          "type": "always_ask"
        }
      },
      "type": "agent_toolset_20260401"
    }
  ],
  "type": "agent",
  "updated_at": "2026-03-15T10:00:00Z",
  "version": 1
}
```

## Domain Types

### Beta Managed Agents Agent

- `class BetaManagedAgentsAgent:`

  A Managed Agents `agent`.

  - `required string ID`

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string? Description`

  - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

    - `required string Name`

    - `required Type Type`

      - `"url"Url`

    - `required string Url`

  - `required IReadOnlyDictionary<string, string> Metadata`

  - `required BetaManagedAgentsModelConfig Model`

    Model identifier and configuration.

    - `required BetaManagedAgentsModel ID`

      The model that will power your agent.

      See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

      - `"claude-opus-4-8"ClaudeOpus4_8`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-7"ClaudeOpus4_7`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-6"ClaudeOpus4_6`

        Most intelligent model for building agents and coding

      - `"claude-sonnet-4-6"ClaudeSonnet4_6`

        Best combination of speed and intelligence

      - `"claude-haiku-4-5"ClaudeHaiku4_5`

        Fastest model with near-frontier intelligence

      - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

        Fastest model with near-frontier intelligence

      - `"claude-opus-4-5"ClaudeOpus4_5`

        Premium model combining maximum intelligence with practical performance

      - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

        Premium model combining maximum intelligence with practical performance

      - `"claude-sonnet-4-5"ClaudeSonnet4_5`

        High-performance model for agents and coding

      - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

        High-performance model for agents and coding

    - `Speed Speed`

      Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

      - `"standard"Standard`

      - `"fast"Fast`

  - `required BetaManagedAgentsMultiagent? Multiagent`

    Resolved coordinator topology with a concrete agent roster.

    - `required IReadOnlyList<BetaManagedAgentsAgentReference> Agents`

      Agents the coordinator may spawn as session threads, each resolved to a specific version.

      - `required string ID`

      - `required Type Type`

        - `"agent"Agent`

      - `required Int Version`

    - `required Type Type`

      - `"coordinator"Coordinator`

  - `required string Name`

  - `required IReadOnlyList<Skill> Skills`

    - `class BetaManagedAgentsAnthropicSkill:`

      A resolved Anthropic-managed skill.

      - `required string SkillID`

      - `required Type Type`

        - `"anthropic"Anthropic`

      - `required string Version`

    - `class BetaManagedAgentsCustomSkill:`

      A resolved user-created custom skill.

      - `required string SkillID`

      - `required Type Type`

        - `"custom"Custom`

      - `required string Version`

  - `required string? System`

  - `required IReadOnlyList<Tool> Tools`

    - `class BetaManagedAgentsAgentToolset20260401:`

      - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

        - `required Boolean Enabled`

        - `required Name Name`

          Built-in agent tool identifier.

          - `"bash"Bash`

          - `"edit"Edit`

          - `"read"Read`

          - `"write"Write`

          - `"glob"Glob`

          - `"grep"Grep`

          - `"web_fetch"WebFetch`

          - `"web_search"WebSearch`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

            - `required Type Type`

              - `"always_allow"AlwaysAllow`

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"always_ask"AlwaysAsk`

      - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

        Resolved default configuration for agent tools.

        - `required Boolean Enabled`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"agent_toolset_20260401"AgentToolset20260401`

    - `class BetaManagedAgentsMcpToolset:`

      - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

        - `required Boolean Enabled`

        - `required string Name`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

        Resolved default configuration for all tools from an MCP server.

        - `required Boolean Enabled`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required string McpServerName`

      - `required Type Type`

        - `"mcp_toolset"McpToolset`

    - `class BetaManagedAgentsCustomTool:`

      A custom tool as returned in API responses.

      - `required string Description`

      - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

        JSON Schema for custom tool input parameters.

        - `IReadOnlyDictionary<string, JsonElement>? Properties`

          JSON Schema properties defining the tool's input parameters.

        - `IReadOnlyList<string> Required`

          List of required property names.

        - `Type Type`

          Must be 'object' for tool input schemas.

          - `"object"Object`

      - `required string Name`

      - `required Type Type`

        - `"custom"Custom`

  - `required Type Type`

    - `"agent"Agent`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required Int Version`

    The agent's current version. Starts at 1 and increments when the agent is modified.

### Beta Managed Agents Agent Reference

- `class BetaManagedAgentsAgentReference:`

  A resolved agent reference with a concrete version.

  - `required string ID`

  - `required Type Type`

    - `"agent"Agent`

  - `required Int Version`

### Beta Managed Agents Agent Tool Config

- `class BetaManagedAgentsAgentToolConfig:`

  Configuration for a specific agent tool.

  - `required Boolean Enabled`

  - `required Name Name`

    Built-in agent tool identifier.

    - `"bash"Bash`

    - `"edit"Edit`

    - `"read"Read`

    - `"write"Write`

    - `"glob"Glob`

    - `"grep"Grep`

    - `"web_fetch"WebFetch`

    - `"web_search"WebSearch`

  - `required PermissionPolicy PermissionPolicy`

    Permission policy for tool execution.

    - `class BetaManagedAgentsAlwaysAllowPolicy:`

      Tool calls are automatically approved without user confirmation.

      - `required Type Type`

        - `"always_allow"AlwaysAllow`

    - `class BetaManagedAgentsAlwaysAskPolicy:`

      Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"always_ask"AlwaysAsk`

### Beta Managed Agents Agent Tool Config Params

- `class BetaManagedAgentsAgentToolConfigParams:`

  Configuration override for a specific tool within a toolset.

  - `required Name Name`

    Built-in agent tool identifier.

    - `"bash"Bash`

    - `"edit"Edit`

    - `"read"Read`

    - `"write"Write`

    - `"glob"Glob`

    - `"grep"Grep`

    - `"web_fetch"WebFetch`

    - `"web_search"WebSearch`

  - `Boolean? Enabled`

    Whether this tool is enabled and available to Claude. Overrides the default_config setting.

  - `PermissionPolicy? PermissionPolicy`

    Permission policy for tool execution.

    - `class BetaManagedAgentsAlwaysAllowPolicy:`

      Tool calls are automatically approved without user confirmation.

      - `required Type Type`

        - `"always_allow"AlwaysAllow`

    - `class BetaManagedAgentsAlwaysAskPolicy:`

      Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"always_ask"AlwaysAsk`

### Beta Managed Agents Agent Toolset Default Config

- `class BetaManagedAgentsAgentToolsetDefaultConfig:`

  Resolved default configuration for agent tools.

  - `required Boolean Enabled`

  - `required PermissionPolicy PermissionPolicy`

    Permission policy for tool execution.

    - `class BetaManagedAgentsAlwaysAllowPolicy:`

      Tool calls are automatically approved without user confirmation.

      - `required Type Type`

        - `"always_allow"AlwaysAllow`

    - `class BetaManagedAgentsAlwaysAskPolicy:`

      Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"always_ask"AlwaysAsk`

### Beta Managed Agents Agent Toolset Default Config Params

- `class BetaManagedAgentsAgentToolsetDefaultConfigParams:`

  Default configuration for all tools in a toolset.

  - `Boolean? Enabled`

    Whether tools are enabled and available to Claude by default. Defaults to true if not specified.

  - `PermissionPolicy? PermissionPolicy`

    Permission policy for tool execution.

    - `class BetaManagedAgentsAlwaysAllowPolicy:`

      Tool calls are automatically approved without user confirmation.

      - `required Type Type`

        - `"always_allow"AlwaysAllow`

    - `class BetaManagedAgentsAlwaysAskPolicy:`

      Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"always_ask"AlwaysAsk`

### Beta Managed Agents Agent Toolset20260401

- `class BetaManagedAgentsAgentToolset20260401:`

  - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

    - `required Boolean Enabled`

    - `required Name Name`

      Built-in agent tool identifier.

      - `"bash"Bash`

      - `"edit"Edit`

      - `"read"Read`

      - `"write"Write`

      - `"glob"Glob`

      - `"grep"Grep`

      - `"web_fetch"WebFetch`

      - `"web_search"WebSearch`

    - `required PermissionPolicy PermissionPolicy`

      Permission policy for tool execution.

      - `class BetaManagedAgentsAlwaysAllowPolicy:`

        Tool calls are automatically approved without user confirmation.

        - `required Type Type`

          - `"always_allow"AlwaysAllow`

      - `class BetaManagedAgentsAlwaysAskPolicy:`

        Tool calls require user confirmation before execution.

        - `required Type Type`

          - `"always_ask"AlwaysAsk`

  - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

    Resolved default configuration for agent tools.

    - `required Boolean Enabled`

    - `required PermissionPolicy PermissionPolicy`

      Permission policy for tool execution.

      - `class BetaManagedAgentsAlwaysAllowPolicy:`

        Tool calls are automatically approved without user confirmation.

      - `class BetaManagedAgentsAlwaysAskPolicy:`

        Tool calls require user confirmation before execution.

  - `required Type Type`

    - `"agent_toolset_20260401"AgentToolset20260401`

### Beta Managed Agents Agent Toolset20260401 Bash Input

- `class BetaManagedAgentsAgentToolset20260401BashInput:`

  Input payload for the `bash` tool of the
  `agent_toolset_20260401` toolset. All fields are optional;
  a normal invocation supplies `command`, while `restart=true`
  (with no `command`) reboots the runner-side bash session.

  - `string Command`

    Shell command to execute. Omit only when `restart` is true.

  - `Boolean Restart`

    When true, restart the persistent bash session instead of
    running a command. Subsequent calls without `restart` will
    run against the fresh session.

  - `Long TimeoutMs`

    Per-call timeout in milliseconds. Defaults to the
    runner-wide tool timeout when omitted or zero.

### Beta Managed Agents Agent Toolset20260401 Edit Input

- `class BetaManagedAgentsAgentToolset20260401EditInput:`

  Input payload for the `edit` tool. Performs a string
  replacement in the named file; by default `old_string` must
  occur exactly once.

  - `required string FilePath`

    Path of the file to edit.

  - `required string NewString`

    Replacement text.

  - `required string OldString`

    Substring to find and replace.

  - `Boolean ReplaceAll`

    When true, replace every occurrence of `old_string`
    instead of requiring a unique match.

### Beta Managed Agents Agent Toolset20260401 Glob Input

- `class BetaManagedAgentsAgentToolset20260401GlobInput:`

  Input payload for the `glob` tool. Returns paths matching a
  doublestar glob pattern, newest first.

  - `required string Pattern`

    Doublestar glob pattern (e.g. `**/*.go`). Absolute patterns
    are only permitted when the runner is configured to allow
    them.

  - `string Path`

    Optional directory root to search under. Defaults to the
    runner's working directory.

### Beta Managed Agents Agent Toolset20260401 Grep Input

- `class BetaManagedAgentsAgentToolset20260401GrepInput:`

  Input payload for the `grep` tool. Searches file contents for
  a regular expression, returning matching lines.

  - `required string Pattern`

    Regular expression to search for.

  - `string Path`

    Optional directory root to search under. Defaults to the
    runner's working directory.

### Beta Managed Agents Agent Toolset20260401 Params

- `class BetaManagedAgentsAgentToolset20260401Params:`

  Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent.

  - `required Type Type`

    - `"agent_toolset_20260401"AgentToolset20260401`

  - `IReadOnlyList<BetaManagedAgentsAgentToolConfigParams> Configs`

    Per-tool configuration overrides.

    - `required Name Name`

      Built-in agent tool identifier.

      - `"bash"Bash`

      - `"edit"Edit`

      - `"read"Read`

      - `"write"Write`

      - `"glob"Glob`

      - `"grep"Grep`

      - `"web_fetch"WebFetch`

      - `"web_search"WebSearch`

    - `Boolean? Enabled`

      Whether this tool is enabled and available to Claude. Overrides the default_config setting.

    - `PermissionPolicy? PermissionPolicy`

      Permission policy for tool execution.

      - `class BetaManagedAgentsAlwaysAllowPolicy:`

        Tool calls are automatically approved without user confirmation.

        - `required Type Type`

          - `"always_allow"AlwaysAllow`

      - `class BetaManagedAgentsAlwaysAskPolicy:`

        Tool calls require user confirmation before execution.

        - `required Type Type`

          - `"always_ask"AlwaysAsk`

  - `BetaManagedAgentsAgentToolsetDefaultConfigParams? DefaultConfig`

    Default configuration for all tools in a toolset.

    - `Boolean? Enabled`

      Whether tools are enabled and available to Claude by default. Defaults to true if not specified.

    - `PermissionPolicy? PermissionPolicy`

      Permission policy for tool execution.

      - `class BetaManagedAgentsAlwaysAllowPolicy:`

        Tool calls are automatically approved without user confirmation.

      - `class BetaManagedAgentsAlwaysAskPolicy:`

        Tool calls require user confirmation before execution.

### Beta Managed Agents Agent Toolset20260401 Read Input

- `class BetaManagedAgentsAgentToolset20260401ReadInput:`

  Input payload for the `read` tool. Reads file contents
  relative to the runner's working directory (or absolute when
  the runner permits).

  - `required string FilePath`

    Path of the file to read.

  - `IReadOnlyList<Long> ViewRange`

    Optional `[start_line, end_line]` 1-indexed inclusive
    range. When omitted the entire file is returned.
    `end_line` of 0 or negative means "to end of file".

### Beta Managed Agents Agent Toolset20260401 Write Input

- `class BetaManagedAgentsAgentToolset20260401WriteInput:`

  Input payload for the `write` tool. Writes (overwriting) the
  entire file contents.

  - `required string Content`

    Full file contents to write.

  - `required string FilePath`

    Path of the file to write.

### Beta Managed Agents Always Allow Policy

- `class BetaManagedAgentsAlwaysAllowPolicy:`

  Tool calls are automatically approved without user confirmation.

  - `required Type Type`

    - `"always_allow"AlwaysAllow`

### Beta Managed Agents Always Ask Policy

- `class BetaManagedAgentsAlwaysAskPolicy:`

  Tool calls require user confirmation before execution.

  - `required Type Type`

    - `"always_ask"AlwaysAsk`

### Beta Managed Agents Anthropic Skill

- `class BetaManagedAgentsAnthropicSkill:`

  A resolved Anthropic-managed skill.

  - `required string SkillID`

  - `required Type Type`

    - `"anthropic"Anthropic`

  - `required string Version`

### Beta Managed Agents Anthropic Skill Params

- `class BetaManagedAgentsAnthropicSkillParams:`

  An Anthropic-managed skill.

  - `required string SkillID`

    Identifier of the Anthropic skill (e.g., "xlsx").

  - `required Type Type`

    - `"anthropic"Anthropic`

  - `string? Version`

    Version to pin. Defaults to latest if omitted.

### Beta Managed Agents Custom Skill

- `class BetaManagedAgentsCustomSkill:`

  A resolved user-created custom skill.

  - `required string SkillID`

  - `required Type Type`

    - `"custom"Custom`

  - `required string Version`

### Beta Managed Agents Custom Skill Params

- `class BetaManagedAgentsCustomSkillParams:`

  A user-created custom skill.

  - `required string SkillID`

    Tagged ID of the custom skill (e.g., "skill_01XJ5...").

  - `required Type Type`

    - `"custom"Custom`

  - `string? Version`

    Version to pin. Defaults to latest if omitted.

### Beta Managed Agents Custom Tool

- `class BetaManagedAgentsCustomTool:`

  A custom tool as returned in API responses.

  - `required string Description`

  - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

    JSON Schema for custom tool input parameters.

    - `IReadOnlyDictionary<string, JsonElement>? Properties`

      JSON Schema properties defining the tool's input parameters.

    - `IReadOnlyList<string> Required`

      List of required property names.

    - `Type Type`

      Must be 'object' for tool input schemas.

      - `"object"Object`

  - `required string Name`

  - `required Type Type`

    - `"custom"Custom`

### Beta Managed Agents Custom Tool Input Schema

- `class BetaManagedAgentsCustomToolInputSchema:`

  JSON Schema for custom tool input parameters.

  - `IReadOnlyDictionary<string, JsonElement>? Properties`

    JSON Schema properties defining the tool's input parameters.

  - `IReadOnlyList<string> Required`

    List of required property names.

  - `Type Type`

    Must be 'object' for tool input schemas.

    - `"object"Object`

### Beta Managed Agents Custom Tool Params

- `class BetaManagedAgentsCustomToolParams:`

  A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event.

  - `required string Description`

    Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters.

  - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

    JSON Schema for custom tool input parameters.

    - `IReadOnlyDictionary<string, JsonElement>? Properties`

      JSON Schema properties defining the tool's input parameters.

    - `IReadOnlyList<string> Required`

      List of required property names.

    - `Type Type`

      Must be 'object' for tool input schemas.

      - `"object"Object`

  - `required string Name`

    Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens.

  - `required Type Type`

    - `"custom"Custom`

### Beta Managed Agents MCP Server URL Definition

- `class BetaManagedAgentsMcpServerUrlDefinition:`

  URL-based MCP server connection as returned in API responses.

  - `required string Name`

  - `required Type Type`

    - `"url"Url`

  - `required string Url`

### Beta Managed Agents MCP Tool Config

- `class BetaManagedAgentsMcpToolConfig:`

  Resolved configuration for a specific MCP tool.

  - `required Boolean Enabled`

  - `required string Name`

  - `required PermissionPolicy PermissionPolicy`

    Permission policy for tool execution.

    - `class BetaManagedAgentsAlwaysAllowPolicy:`

      Tool calls are automatically approved without user confirmation.

      - `required Type Type`

        - `"always_allow"AlwaysAllow`

    - `class BetaManagedAgentsAlwaysAskPolicy:`

      Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"always_ask"AlwaysAsk`

### Beta Managed Agents MCP Tool Config Params

- `class BetaManagedAgentsMcpToolConfigParams:`

  Configuration override for a specific MCP tool.

  - `required string Name`

    Name of the MCP tool to configure. 1-128 characters.

  - `Boolean? Enabled`

    Whether this tool is enabled. Overrides the `default_config` setting.

  - `PermissionPolicy? PermissionPolicy`

    Permission policy for tool execution.

    - `class BetaManagedAgentsAlwaysAllowPolicy:`

      Tool calls are automatically approved without user confirmation.

      - `required Type Type`

        - `"always_allow"AlwaysAllow`

    - `class BetaManagedAgentsAlwaysAskPolicy:`

      Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"always_ask"AlwaysAsk`

### Beta Managed Agents MCP Toolset

- `class BetaManagedAgentsMcpToolset:`

  - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

    - `required Boolean Enabled`

    - `required string Name`

    - `required PermissionPolicy PermissionPolicy`

      Permission policy for tool execution.

      - `class BetaManagedAgentsAlwaysAllowPolicy:`

        Tool calls are automatically approved without user confirmation.

        - `required Type Type`

          - `"always_allow"AlwaysAllow`

      - `class BetaManagedAgentsAlwaysAskPolicy:`

        Tool calls require user confirmation before execution.

        - `required Type Type`

          - `"always_ask"AlwaysAsk`

  - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

    Resolved default configuration for all tools from an MCP server.

    - `required Boolean Enabled`

    - `required PermissionPolicy PermissionPolicy`

      Permission policy for tool execution.

      - `class BetaManagedAgentsAlwaysAllowPolicy:`

        Tool calls are automatically approved without user confirmation.

      - `class BetaManagedAgentsAlwaysAskPolicy:`

        Tool calls require user confirmation before execution.

  - `required string McpServerName`

  - `required Type Type`

    - `"mcp_toolset"McpToolset`

### Beta Managed Agents MCP Toolset Default Config

- `class BetaManagedAgentsMcpToolsetDefaultConfig:`

  Resolved default configuration for all tools from an MCP server.

  - `required Boolean Enabled`

  - `required PermissionPolicy PermissionPolicy`

    Permission policy for tool execution.

    - `class BetaManagedAgentsAlwaysAllowPolicy:`

      Tool calls are automatically approved without user confirmation.

      - `required Type Type`

        - `"always_allow"AlwaysAllow`

    - `class BetaManagedAgentsAlwaysAskPolicy:`

      Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"always_ask"AlwaysAsk`

### Beta Managed Agents MCP Toolset Default Config Params

- `class BetaManagedAgentsMcpToolsetDefaultConfigParams:`

  Default configuration for all tools from an MCP server.

  - `Boolean? Enabled`

    Whether tools are enabled by default. Defaults to true if not specified.

  - `PermissionPolicy? PermissionPolicy`

    Permission policy for tool execution.

    - `class BetaManagedAgentsAlwaysAllowPolicy:`

      Tool calls are automatically approved without user confirmation.

      - `required Type Type`

        - `"always_allow"AlwaysAllow`

    - `class BetaManagedAgentsAlwaysAskPolicy:`

      Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"always_ask"AlwaysAsk`

### Beta Managed Agents MCP Toolset Params

- `class BetaManagedAgentsMcpToolsetParams:`

  Configuration for tools from an MCP server defined in `mcp_servers`.

  - `required string McpServerName`

    Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters.

  - `required Type Type`

    - `"mcp_toolset"McpToolset`

  - `IReadOnlyList<BetaManagedAgentsMcpToolConfigParams> Configs`

    Per-tool configuration overrides.

    - `required string Name`

      Name of the MCP tool to configure. 1-128 characters.

    - `Boolean? Enabled`

      Whether this tool is enabled. Overrides the `default_config` setting.

    - `PermissionPolicy? PermissionPolicy`

      Permission policy for tool execution.

      - `class BetaManagedAgentsAlwaysAllowPolicy:`

        Tool calls are automatically approved without user confirmation.

        - `required Type Type`

          - `"always_allow"AlwaysAllow`

      - `class BetaManagedAgentsAlwaysAskPolicy:`

        Tool calls require user confirmation before execution.

        - `required Type Type`

          - `"always_ask"AlwaysAsk`

  - `BetaManagedAgentsMcpToolsetDefaultConfigParams? DefaultConfig`

    Default configuration for all tools from an MCP server.

    - `Boolean? Enabled`

      Whether tools are enabled by default. Defaults to true if not specified.

    - `PermissionPolicy? PermissionPolicy`

      Permission policy for tool execution.

      - `class BetaManagedAgentsAlwaysAllowPolicy:`

        Tool calls are automatically approved without user confirmation.

      - `class BetaManagedAgentsAlwaysAskPolicy:`

        Tool calls require user confirmation before execution.

### Beta Managed Agents Model Config

- `class BetaManagedAgentsModelConfig:`

  Model identifier and configuration.

  - `required BetaManagedAgentsModel ID`

    The model that will power your agent.

    See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

    - `"claude-opus-4-8"ClaudeOpus4_8`

      Frontier intelligence for long-running agents and coding

    - `"claude-opus-4-7"ClaudeOpus4_7`

      Frontier intelligence for long-running agents and coding

    - `"claude-opus-4-6"ClaudeOpus4_6`

      Most intelligent model for building agents and coding

    - `"claude-sonnet-4-6"ClaudeSonnet4_6`

      Best combination of speed and intelligence

    - `"claude-haiku-4-5"ClaudeHaiku4_5`

      Fastest model with near-frontier intelligence

    - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

      Fastest model with near-frontier intelligence

    - `"claude-opus-4-5"ClaudeOpus4_5`

      Premium model combining maximum intelligence with practical performance

    - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

      Premium model combining maximum intelligence with practical performance

    - `"claude-sonnet-4-5"ClaudeSonnet4_5`

      High-performance model for agents and coding

    - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

      High-performance model for agents and coding

  - `Speed Speed`

    Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

    - `"standard"Standard`

    - `"fast"Fast`

### Beta Managed Agents Model Config Params

- `class BetaManagedAgentsModelConfigParams:`

  An object that defines additional configuration control over model use

  - `required BetaManagedAgentsModel ID`

    The model that will power your agent.

    See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

    - `"claude-opus-4-8"ClaudeOpus4_8`

      Frontier intelligence for long-running agents and coding

    - `"claude-opus-4-7"ClaudeOpus4_7`

      Frontier intelligence for long-running agents and coding

    - `"claude-opus-4-6"ClaudeOpus4_6`

      Most intelligent model for building agents and coding

    - `"claude-sonnet-4-6"ClaudeSonnet4_6`

      Best combination of speed and intelligence

    - `"claude-haiku-4-5"ClaudeHaiku4_5`

      Fastest model with near-frontier intelligence

    - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

      Fastest model with near-frontier intelligence

    - `"claude-opus-4-5"ClaudeOpus4_5`

      Premium model combining maximum intelligence with practical performance

    - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

      Premium model combining maximum intelligence with practical performance

    - `"claude-sonnet-4-5"ClaudeSonnet4_5`

      High-performance model for agents and coding

    - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

      High-performance model for agents and coding

  - `Speed? Speed`

    Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

    - `"standard"Standard`

    - `"fast"Fast`

### Beta Managed Agents Multiagent Coordinator

- `class BetaManagedAgentsMultiagentCoordinator:`

  Resolved coordinator topology with a concrete agent roster.

  - `required IReadOnlyList<BetaManagedAgentsAgentReference> Agents`

    Agents the coordinator may spawn as session threads, each resolved to a specific version.

    - `required string ID`

    - `required Type Type`

      - `"agent"Agent`

    - `required Int Version`

  - `required Type Type`

    - `"coordinator"Coordinator`

### Beta Managed Agents Multiagent Coordinator Params

- `class BetaManagedAgentsMultiagentCoordinatorParams:`

  A coordinator topology: the session's primary thread orchestrates work by spawning session threads, each running an agent drawn from the `agents` roster.

  - `required IReadOnlyList<BetaManagedAgentsMultiagentRosterEntryParams> Agents`

    Agents the coordinator may spawn as session threads. 1–20 entries. Each entry is an agent ID string, a versioned `{"type":"agent","id","version"}` reference, or `{"type":"self"}` to allow recursive self-invocation. Entries must reference distinct agents (after resolving `self` and string forms); at most one `self`. Referenced agents must exist, must not be archived, and must not themselves have `multiagent` set (depth limit 1).

    - `string`

    - `class BetaManagedAgentsAgentParams:`

      Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version

      - `required string ID`

        The `agent` ID.

      - `required Type Type`

        - `"agent"Agent`

      - `Int Version`

        The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified.

    - `class BetaManagedAgentsMultiagentSelfParams:`

      Sentinel roster entry meaning "the agent that owns this configuration". Resolved server-side to a concrete agent reference.

      - `required Type Type`

        - `"self"Self`

  - `required Type Type`

    - `"coordinator"Coordinator`

### Beta Managed Agents Multiagent Self Params

- `class BetaManagedAgentsMultiagentSelfParams:`

  Sentinel roster entry meaning "the agent that owns this configuration". Resolved server-side to a concrete agent reference.

  - `required Type Type`

    - `"self"Self`

### Beta Managed Agents Session Thread Agent

- `class BetaManagedAgentsSessionThreadAgent:`

  Resolved `agent` definition for a single `session_thread`. Snapshot of the agent at thread creation time. The multiagent roster is not repeated here; read it from `Session.agent`.

  - `required string ID`

  - `required string? Description`

  - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

    - `required string Name`

    - `required Type Type`

      - `"url"Url`

    - `required string Url`

  - `required BetaManagedAgentsModelConfig Model`

    Model identifier and configuration.

    - `required BetaManagedAgentsModel ID`

      The model that will power your agent.

      See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

      - `"claude-opus-4-8"ClaudeOpus4_8`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-7"ClaudeOpus4_7`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-6"ClaudeOpus4_6`

        Most intelligent model for building agents and coding

      - `"claude-sonnet-4-6"ClaudeSonnet4_6`

        Best combination of speed and intelligence

      - `"claude-haiku-4-5"ClaudeHaiku4_5`

        Fastest model with near-frontier intelligence

      - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

        Fastest model with near-frontier intelligence

      - `"claude-opus-4-5"ClaudeOpus4_5`

        Premium model combining maximum intelligence with practical performance

      - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

        Premium model combining maximum intelligence with practical performance

      - `"claude-sonnet-4-5"ClaudeSonnet4_5`

        High-performance model for agents and coding

      - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

        High-performance model for agents and coding

    - `Speed Speed`

      Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

      - `"standard"Standard`

      - `"fast"Fast`

  - `required string Name`

  - `required IReadOnlyList<Skill> Skills`

    - `class BetaManagedAgentsAnthropicSkill:`

      A resolved Anthropic-managed skill.

      - `required string SkillID`

      - `required Type Type`

        - `"anthropic"Anthropic`

      - `required string Version`

    - `class BetaManagedAgentsCustomSkill:`

      A resolved user-created custom skill.

      - `required string SkillID`

      - `required Type Type`

        - `"custom"Custom`

      - `required string Version`

  - `required string? System`

  - `required IReadOnlyList<Tool> Tools`

    - `class BetaManagedAgentsAgentToolset20260401:`

      - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

        - `required Boolean Enabled`

        - `required Name Name`

          Built-in agent tool identifier.

          - `"bash"Bash`

          - `"edit"Edit`

          - `"read"Read`

          - `"write"Write`

          - `"glob"Glob`

          - `"grep"Grep`

          - `"web_fetch"WebFetch`

          - `"web_search"WebSearch`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

            - `required Type Type`

              - `"always_allow"AlwaysAllow`

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"always_ask"AlwaysAsk`

      - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

        Resolved default configuration for agent tools.

        - `required Boolean Enabled`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required Type Type`

        - `"agent_toolset_20260401"AgentToolset20260401`

    - `class BetaManagedAgentsMcpToolset:`

      - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

        - `required Boolean Enabled`

        - `required string Name`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

        Resolved default configuration for all tools from an MCP server.

        - `required Boolean Enabled`

        - `required PermissionPolicy PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `required string McpServerName`

      - `required Type Type`

        - `"mcp_toolset"McpToolset`

    - `class BetaManagedAgentsCustomTool:`

      A custom tool as returned in API responses.

      - `required string Description`

      - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

        JSON Schema for custom tool input parameters.

        - `IReadOnlyDictionary<string, JsonElement>? Properties`

          JSON Schema properties defining the tool's input parameters.

        - `IReadOnlyList<string> Required`

          List of required property names.

        - `Type Type`

          Must be 'object' for tool input schemas.

          - `"object"Object`

      - `required string Name`

      - `required Type Type`

        - `"custom"Custom`

  - `required Type Type`

    - `"agent"Agent`

  - `required Int Version`

### Beta Managed Agents Skill Params

- `class BetaManagedAgentsSkillParams: A class that can be one of several variants.union`

  Skill to load in the session container.

  - `class BetaManagedAgentsAnthropicSkillParams:`

    An Anthropic-managed skill.

    - `required string SkillID`

      Identifier of the Anthropic skill (e.g., "xlsx").

    - `required Type Type`

      - `"anthropic"Anthropic`

    - `string? Version`

      Version to pin. Defaults to latest if omitted.

  - `class BetaManagedAgentsCustomSkillParams:`

    A user-created custom skill.

    - `required string SkillID`

      Tagged ID of the custom skill (e.g., "skill_01XJ5...").

    - `required Type Type`

      - `"custom"Custom`

    - `string? Version`

      Version to pin. Defaults to latest if omitted.

### Beta Managed Agents URL MCP Server Params

- `class BetaManagedAgentsUrlMcpServerParams:`

  URL-based MCP server connection.

  - `required string Name`

    Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters.

  - `required Type Type`

    - `"url"Url`

  - `required string Url`

    Endpoint URL for the MCP server.

# Versions

## List Agent Versions

`VersionListPageResponse Beta.Agents.Versions.List(VersionListParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/agents/{agent_id}/versions`

List Agent Versions

### Parameters

- `VersionListParams parameters`

  - `required string agentID`

    Path param: Path parameter agent_id

  - `Int limit`

    Query param: Maximum results per page. Default 20, maximum 100.

  - `string page`

    Query param: Opaque pagination cursor.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class VersionListPageResponse:`

  Paginated list of agent versions.

  - `IReadOnlyList<BetaManagedAgentsAgent> Data`

    Agent versions.

    - `required string ID`

    - `required DateTimeOffset? ArchivedAt`

      A timestamp in RFC 3339 format

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string? Description`

    - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

      - `required string Name`

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

    - `required IReadOnlyDictionary<string, string> Metadata`

    - `required BetaManagedAgentsModelConfig Model`

      Model identifier and configuration.

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

    - `required BetaManagedAgentsMultiagent? Multiagent`

      Resolved coordinator topology with a concrete agent roster.

      - `required IReadOnlyList<BetaManagedAgentsAgentReference> Agents`

        Agents the coordinator may spawn as session threads, each resolved to a specific version.

        - `required string ID`

        - `required Type Type`

          - `"agent"Agent`

        - `required Int Version`

      - `required Type Type`

        - `"coordinator"Coordinator`

    - `required string Name`

    - `required IReadOnlyList<Skill> Skills`

      - `class BetaManagedAgentsAnthropicSkill:`

        A resolved Anthropic-managed skill.

        - `required string SkillID`

        - `required Type Type`

          - `"anthropic"Anthropic`

        - `required string Version`

      - `class BetaManagedAgentsCustomSkill:`

        A resolved user-created custom skill.

        - `required string SkillID`

        - `required Type Type`

          - `"custom"Custom`

        - `required string Version`

    - `required string? System`

    - `required IReadOnlyList<Tool> Tools`

      - `class BetaManagedAgentsAgentToolset20260401:`

        - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

          - `required Boolean Enabled`

          - `required Name Name`

            Built-in agent tool identifier.

            - `"bash"Bash`

            - `"edit"Edit`

            - `"read"Read`

            - `"write"Write`

            - `"glob"Glob`

            - `"grep"Grep`

            - `"web_fetch"WebFetch`

            - `"web_search"WebSearch`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

              - `required Type Type`

                - `"always_allow"AlwaysAllow`

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

              - `required Type Type`

                - `"always_ask"AlwaysAsk`

        - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

          Resolved default configuration for agent tools.

          - `required Boolean Enabled`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required Type Type`

          - `"agent_toolset_20260401"AgentToolset20260401`

      - `class BetaManagedAgentsMcpToolset:`

        - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

          - `required Boolean Enabled`

          - `required string Name`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

          Resolved default configuration for all tools from an MCP server.

          - `required Boolean Enabled`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required string McpServerName`

        - `required Type Type`

          - `"mcp_toolset"McpToolset`

      - `class BetaManagedAgentsCustomTool:`

        A custom tool as returned in API responses.

        - `required string Description`

        - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

          JSON Schema for custom tool input parameters.

          - `IReadOnlyDictionary<string, JsonElement>? Properties`

            JSON Schema properties defining the tool's input parameters.

          - `IReadOnlyList<string> Required`

            List of required property names.

          - `Type Type`

            Must be 'object' for tool input schemas.

            - `"object"Object`

        - `required string Name`

        - `required Type Type`

          - `"custom"Custom`

    - `required Type Type`

      - `"agent"Agent`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

    - `required Int Version`

      The agent's current version. Starts at 1 and increments when the agent is modified.

  - `string? NextPage`

    Opaque cursor for the next page. Null when no more results.

### Example

```csharp
VersionListParams parameters = new()
{
    AgentID = "agent_011CZkYpogX7uDKUyvBTophP"
};

var page = await client.Beta.Agents.Versions.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "agent_011CZkYpogX7uDKUyvBTophP",
      "archived_at": null,
      "created_at": "2026-03-15T10:00:00Z",
      "description": "A general-purpose starter agent.",
      "mcp_servers": [
        {
          "name": "example-mcp",
          "type": "url",
          "url": "https://example-server.modelcontextprotocol.io/sse"
        }
      ],
      "metadata": {
        "foo": "bar"
      },
      "model": {
        "id": "claude-sonnet-4-6",
        "speed": "standard"
      },
      "multiagent": {
        "agents": [
          {
            "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
            "type": "agent",
            "version": 1
          }
        ],
        "type": "coordinator"
      },
      "name": "My First Agent",
      "skills": [
        {
          "skill_id": "xlsx",
          "type": "anthropic",
          "version": "1"
        },
        {
          "skill_id": "skill_011CZkZFNu9hAbo3jZPRgTlx",
          "type": "custom",
          "version": "2"
        }
      ],
      "system": "You are a general-purpose agent that can research, write code, run commands, and use connected tools to complete the user's task end to end.",
      "tools": [
        {
          "configs": [
            {
              "enabled": true,
              "name": "bash",
              "permission_policy": {
                "type": "always_allow"
              }
            }
          ],
          "default_config": {
            "enabled": true,
            "permission_policy": {
              "type": "always_ask"
            }
          },
          "type": "agent_toolset_20260401"
        }
      ],
      "type": "agent",
      "updated_at": "2026-03-15T10:00:00Z",
      "version": 1
    }
  ],
  "next_page": "next_page"
}
```

# Environments

## Create Environment

`BetaEnvironment Beta.Environments.Create(EnvironmentCreateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/environments`

Create a new environment with the specified configuration.

### Parameters

- `EnvironmentCreateParams parameters`

  - `required string name`

    Body param: Human-readable name for the environment

  - `Config? config`

    Body param: Environment configuration

    - `class BetaCloudConfigParams:`

      Request params for `cloud` environment configuration.

      Fields default to null; on update, omitted fields preserve the
      existing value.

      - `JsonElement Type "cloud"constant`

        Environment type

      - `Networking? Networking`

        Network configuration policy. Omit on update to preserve the existing value.

        - `class BetaUnrestrictedNetwork:`

          Unrestricted network access.

          - `JsonElement Type "unrestricted"constant`

            Network policy type

        - `class BetaLimitedNetworkParams:`

          Limited network request params.

          Fields default to null; on update, omitted fields preserve the
          existing value.

          - `JsonElement Type "limited"constant`

            Network policy type

          - `Boolean? AllowMcpServers`

            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`.

          - `Boolean? AllowPackageManagers`

            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`.

          - `IReadOnlyList<string>? AllowedHosts`

            Specifies domains the container can reach.

      - `BetaPackagesParams? Packages`

        Specify packages (and optionally their versions) available in this environment.

        When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest.

        - `IReadOnlyList<string>? Apt`

          Ubuntu/Debian packages to install

        - `IReadOnlyList<string>? Cargo`

          Rust packages to install

        - `IReadOnlyList<string>? Gem`

          Ruby packages to install

        - `IReadOnlyList<string>? Go`

          Go packages to install

        - `IReadOnlyList<string>? Npm`

          Node.js packages to install

        - `IReadOnlyList<string>? Pip`

          Python packages to install

        - `Type Type`

          Package configuration type

          - `"packages"Packages`

    - `class BetaSelfHostedConfigParams:`

      Request params for `self_hosted` environment configuration.

      - `JsonElement Type "self_hosted"constant`

        Environment type

  - `string? description`

    Body param: Optional description of the environment

  - `IReadOnlyDictionary<string, string> metadata`

    Body param: User-provided metadata key-value pairs

  - `Scope? scope`

    Body param: The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only. Only applicable for self-hosted environments. If not specified, defaults based on organization type.

    - `"organization"Organization`

    - `"account"Account`

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaEnvironment:`

  Unified Environment resource for both cloud and self-hosted environments.

  - `required string ID`

    Environment identifier (e.g., 'env_...')

  - `required string? ArchivedAt`

    RFC 3339 timestamp when environment was archived, or null if not archived

  - `required Config Config`

    Environment configuration (either Anthropic Cloud or self-hosted)

    - `class BetaCloudConfig:`

      `cloud` environment configuration.

      - `required Networking Networking`

        Network configuration policy.

        - `class BetaUnrestrictedNetwork:`

          Unrestricted network access.

          - `JsonElement Type "unrestricted"constant`

            Network policy type

        - `class BetaLimitedNetwork:`

          Limited network access.

          - `required Boolean AllowMcpServers`

            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.

          - `required Boolean AllowPackageManagers`

            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.

          - `required IReadOnlyList<string> AllowedHosts`

            Specifies domains the container can reach.

          - `JsonElement Type "limited"constant`

            Network policy type

      - `required BetaPackages Packages`

        Package manager configuration.

        - `required IReadOnlyList<string> Apt`

          Ubuntu/Debian packages to install

        - `required IReadOnlyList<string> Cargo`

          Rust packages to install

        - `required IReadOnlyList<string> Gem`

          Ruby packages to install

        - `required IReadOnlyList<string> Go`

          Go packages to install

        - `required IReadOnlyList<string> Npm`

          Node.js packages to install

        - `required IReadOnlyList<string> Pip`

          Python packages to install

        - `Type Type`

          Package configuration type

          - `"packages"Packages`

      - `JsonElement Type "cloud"constant`

        Environment type

    - `class BetaSelfHostedConfig:`

      Configuration for self-hosted environments.

      - `JsonElement Type "self_hosted"constant`

        Environment type

  - `required string CreatedAt`

    RFC 3339 timestamp when environment was created

  - `required string Description`

    User-provided description for the environment

  - `required IReadOnlyDictionary<string, string> Metadata`

    User-provided metadata key-value pairs

  - `required string Name`

    Human-readable name for the environment

  - `JsonElement Type "environment"constant`

    The type of object (always 'environment')

  - `required string UpdatedAt`

    RFC 3339 timestamp when environment was last updated

  - `Scope Scope`

    The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.

    - `"organization"Organization`

    - `"account"Account`

### Example

```csharp
EnvironmentCreateParams parameters = new() { Name = "python-data-analysis" };

var betaEnvironment = await client.Beta.Environments.Create(parameters);

Console.WriteLine(betaEnvironment);
```

#### Response

```json
{
  "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
  "archived_at": null,
  "config": {
    "networking": {
      "allow_mcp_servers": false,
      "allow_package_managers": true,
      "allowed_hosts": [
        "api.example.com"
      ],
      "type": "limited"
    },
    "packages": {
      "apt": [
        "string"
      ],
      "cargo": [
        "string"
      ],
      "gem": [
        "string"
      ],
      "go": [
        "string"
      ],
      "npm": [
        "string"
      ],
      "pip": [
        "pandas",
        "numpy"
      ],
      "type": "packages"
    },
    "type": "cloud"
  },
  "created_at": "2026-03-15T10:00:00Z",
  "description": "Python environment with data-analysis packages.",
  "metadata": {},
  "name": "python-data-analysis",
  "type": "environment",
  "updated_at": "2026-03-15T10:00:00Z",
  "scope": "organization"
}
```

## List Environments

`EnvironmentListPageResponse Beta.Environments.List(EnvironmentListParams?parameters, CancellationTokencancellationToken = default)`

**get** `/v1/environments`

List environments with pagination support.

### Parameters

- `EnvironmentListParams parameters`

  - `Boolean includeArchived`

    Query param: Include archived environments in the response

  - `Long limit`

    Query param: Maximum number of environments to return

  - `string? page`

    Query param: Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class EnvironmentListPageResponse:`

  Response when listing environments.

  This response model uses opaque cursor-based pagination. Use the `page`
  query parameter with the value from `next_page` to fetch the next page.

  - `required IReadOnlyList<BetaEnvironment> Data`

    List of environments.

    - `required string ID`

      Environment identifier (e.g., 'env_...')

    - `required string? ArchivedAt`

      RFC 3339 timestamp when environment was archived, or null if not archived

    - `required Config Config`

      Environment configuration (either Anthropic Cloud or self-hosted)

      - `class BetaCloudConfig:`

        `cloud` environment configuration.

        - `required Networking Networking`

          Network configuration policy.

          - `class BetaUnrestrictedNetwork:`

            Unrestricted network access.

            - `JsonElement Type "unrestricted"constant`

              Network policy type

          - `class BetaLimitedNetwork:`

            Limited network access.

            - `required Boolean AllowMcpServers`

              Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.

            - `required Boolean AllowPackageManagers`

              Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.

            - `required IReadOnlyList<string> AllowedHosts`

              Specifies domains the container can reach.

            - `JsonElement Type "limited"constant`

              Network policy type

        - `required BetaPackages Packages`

          Package manager configuration.

          - `required IReadOnlyList<string> Apt`

            Ubuntu/Debian packages to install

          - `required IReadOnlyList<string> Cargo`

            Rust packages to install

          - `required IReadOnlyList<string> Gem`

            Ruby packages to install

          - `required IReadOnlyList<string> Go`

            Go packages to install

          - `required IReadOnlyList<string> Npm`

            Node.js packages to install

          - `required IReadOnlyList<string> Pip`

            Python packages to install

          - `Type Type`

            Package configuration type

            - `"packages"Packages`

        - `JsonElement Type "cloud"constant`

          Environment type

      - `class BetaSelfHostedConfig:`

        Configuration for self-hosted environments.

        - `JsonElement Type "self_hosted"constant`

          Environment type

    - `required string CreatedAt`

      RFC 3339 timestamp when environment was created

    - `required string Description`

      User-provided description for the environment

    - `required IReadOnlyDictionary<string, string> Metadata`

      User-provided metadata key-value pairs

    - `required string Name`

      Human-readable name for the environment

    - `JsonElement Type "environment"constant`

      The type of object (always 'environment')

    - `required string UpdatedAt`

      RFC 3339 timestamp when environment was last updated

    - `Scope Scope`

      The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.

      - `"organization"Organization`

      - `"account"Account`

  - `required string? NextPage`

    Token for fetching the next page of results. If `null`, there are no more results available. Pass this value to the `page` parameter in the next request.

### Example

```csharp
EnvironmentListParams parameters = new();

var page = await client.Beta.Environments.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
      "archived_at": null,
      "config": {
        "networking": {
          "allow_mcp_servers": false,
          "allow_package_managers": true,
          "allowed_hosts": [
            "api.example.com"
          ],
          "type": "limited"
        },
        "packages": {
          "apt": [
            "string"
          ],
          "cargo": [
            "string"
          ],
          "gem": [
            "string"
          ],
          "go": [
            "string"
          ],
          "npm": [
            "string"
          ],
          "pip": [
            "pandas",
            "numpy"
          ],
          "type": "packages"
        },
        "type": "cloud"
      },
      "created_at": "2026-03-15T10:00:00Z",
      "description": "Python environment with data-analysis packages.",
      "metadata": {},
      "name": "python-data-analysis",
      "type": "environment",
      "updated_at": "2026-03-15T10:00:00Z",
      "scope": "organization"
    }
  ],
  "next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo="
}
```

## Get Environment

`BetaEnvironment Beta.Environments.Retrieve(EnvironmentRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/environments/{environment_id}`

Retrieve a specific environment by ID.

### Parameters

- `EnvironmentRetrieveParams parameters`

  - `required string environmentID`

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaEnvironment:`

  Unified Environment resource for both cloud and self-hosted environments.

  - `required string ID`

    Environment identifier (e.g., 'env_...')

  - `required string? ArchivedAt`

    RFC 3339 timestamp when environment was archived, or null if not archived

  - `required Config Config`

    Environment configuration (either Anthropic Cloud or self-hosted)

    - `class BetaCloudConfig:`

      `cloud` environment configuration.

      - `required Networking Networking`

        Network configuration policy.

        - `class BetaUnrestrictedNetwork:`

          Unrestricted network access.

          - `JsonElement Type "unrestricted"constant`

            Network policy type

        - `class BetaLimitedNetwork:`

          Limited network access.

          - `required Boolean AllowMcpServers`

            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.

          - `required Boolean AllowPackageManagers`

            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.

          - `required IReadOnlyList<string> AllowedHosts`

            Specifies domains the container can reach.

          - `JsonElement Type "limited"constant`

            Network policy type

      - `required BetaPackages Packages`

        Package manager configuration.

        - `required IReadOnlyList<string> Apt`

          Ubuntu/Debian packages to install

        - `required IReadOnlyList<string> Cargo`

          Rust packages to install

        - `required IReadOnlyList<string> Gem`

          Ruby packages to install

        - `required IReadOnlyList<string> Go`

          Go packages to install

        - `required IReadOnlyList<string> Npm`

          Node.js packages to install

        - `required IReadOnlyList<string> Pip`

          Python packages to install

        - `Type Type`

          Package configuration type

          - `"packages"Packages`

      - `JsonElement Type "cloud"constant`

        Environment type

    - `class BetaSelfHostedConfig:`

      Configuration for self-hosted environments.

      - `JsonElement Type "self_hosted"constant`

        Environment type

  - `required string CreatedAt`

    RFC 3339 timestamp when environment was created

  - `required string Description`

    User-provided description for the environment

  - `required IReadOnlyDictionary<string, string> Metadata`

    User-provided metadata key-value pairs

  - `required string Name`

    Human-readable name for the environment

  - `JsonElement Type "environment"constant`

    The type of object (always 'environment')

  - `required string UpdatedAt`

    RFC 3339 timestamp when environment was last updated

  - `Scope Scope`

    The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.

    - `"organization"Organization`

    - `"account"Account`

### Example

```csharp
EnvironmentRetrieveParams parameters = new()
{
    EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW"
};

var betaEnvironment = await client.Beta.Environments.Retrieve(parameters);

Console.WriteLine(betaEnvironment);
```

#### Response

```json
{
  "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
  "archived_at": null,
  "config": {
    "networking": {
      "allow_mcp_servers": false,
      "allow_package_managers": true,
      "allowed_hosts": [
        "api.example.com"
      ],
      "type": "limited"
    },
    "packages": {
      "apt": [
        "string"
      ],
      "cargo": [
        "string"
      ],
      "gem": [
        "string"
      ],
      "go": [
        "string"
      ],
      "npm": [
        "string"
      ],
      "pip": [
        "pandas",
        "numpy"
      ],
      "type": "packages"
    },
    "type": "cloud"
  },
  "created_at": "2026-03-15T10:00:00Z",
  "description": "Python environment with data-analysis packages.",
  "metadata": {},
  "name": "python-data-analysis",
  "type": "environment",
  "updated_at": "2026-03-15T10:00:00Z",
  "scope": "organization"
}
```

## Update Environment

`BetaEnvironment Beta.Environments.Update(EnvironmentUpdateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/environments/{environment_id}`

Update an existing environment's configuration.

### Parameters

- `EnvironmentUpdateParams parameters`

  - `required string environmentID`

    Path param

  - `Config? config`

    Body param: Updated environment configuration

    - `class BetaCloudConfigParams:`

      Request params for `cloud` environment configuration.

      Fields default to null; on update, omitted fields preserve the
      existing value.

      - `JsonElement Type "cloud"constant`

        Environment type

      - `Networking? Networking`

        Network configuration policy. Omit on update to preserve the existing value.

        - `class BetaUnrestrictedNetwork:`

          Unrestricted network access.

          - `JsonElement Type "unrestricted"constant`

            Network policy type

        - `class BetaLimitedNetworkParams:`

          Limited network request params.

          Fields default to null; on update, omitted fields preserve the
          existing value.

          - `JsonElement Type "limited"constant`

            Network policy type

          - `Boolean? AllowMcpServers`

            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`.

          - `Boolean? AllowPackageManagers`

            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`.

          - `IReadOnlyList<string>? AllowedHosts`

            Specifies domains the container can reach.

      - `BetaPackagesParams? Packages`

        Specify packages (and optionally their versions) available in this environment.

        When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest.

        - `IReadOnlyList<string>? Apt`

          Ubuntu/Debian packages to install

        - `IReadOnlyList<string>? Cargo`

          Rust packages to install

        - `IReadOnlyList<string>? Gem`

          Ruby packages to install

        - `IReadOnlyList<string>? Go`

          Go packages to install

        - `IReadOnlyList<string>? Npm`

          Node.js packages to install

        - `IReadOnlyList<string>? Pip`

          Python packages to install

        - `Type Type`

          Package configuration type

          - `"packages"Packages`

    - `class BetaSelfHostedConfigParams:`

      Request params for `self_hosted` environment configuration.

      - `JsonElement Type "self_hosted"constant`

        Environment type

  - `string? description`

    Body param: Updated description of the environment

  - `IReadOnlyDictionary<string, string> metadata`

    Body param: User-provided metadata key-value pairs. Set a value to null or empty string to delete the key.

  - `string? name`

    Body param: Updated name for the environment

  - `Scope? scope`

    Body param: The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only.

    - `"organization"Organization`

    - `"account"Account`

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaEnvironment:`

  Unified Environment resource for both cloud and self-hosted environments.

  - `required string ID`

    Environment identifier (e.g., 'env_...')

  - `required string? ArchivedAt`

    RFC 3339 timestamp when environment was archived, or null if not archived

  - `required Config Config`

    Environment configuration (either Anthropic Cloud or self-hosted)

    - `class BetaCloudConfig:`

      `cloud` environment configuration.

      - `required Networking Networking`

        Network configuration policy.

        - `class BetaUnrestrictedNetwork:`

          Unrestricted network access.

          - `JsonElement Type "unrestricted"constant`

            Network policy type

        - `class BetaLimitedNetwork:`

          Limited network access.

          - `required Boolean AllowMcpServers`

            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.

          - `required Boolean AllowPackageManagers`

            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.

          - `required IReadOnlyList<string> AllowedHosts`

            Specifies domains the container can reach.

          - `JsonElement Type "limited"constant`

            Network policy type

      - `required BetaPackages Packages`

        Package manager configuration.

        - `required IReadOnlyList<string> Apt`

          Ubuntu/Debian packages to install

        - `required IReadOnlyList<string> Cargo`

          Rust packages to install

        - `required IReadOnlyList<string> Gem`

          Ruby packages to install

        - `required IReadOnlyList<string> Go`

          Go packages to install

        - `required IReadOnlyList<string> Npm`

          Node.js packages to install

        - `required IReadOnlyList<string> Pip`

          Python packages to install

        - `Type Type`

          Package configuration type

          - `"packages"Packages`

      - `JsonElement Type "cloud"constant`

        Environment type

    - `class BetaSelfHostedConfig:`

      Configuration for self-hosted environments.

      - `JsonElement Type "self_hosted"constant`

        Environment type

  - `required string CreatedAt`

    RFC 3339 timestamp when environment was created

  - `required string Description`

    User-provided description for the environment

  - `required IReadOnlyDictionary<string, string> Metadata`

    User-provided metadata key-value pairs

  - `required string Name`

    Human-readable name for the environment

  - `JsonElement Type "environment"constant`

    The type of object (always 'environment')

  - `required string UpdatedAt`

    RFC 3339 timestamp when environment was last updated

  - `Scope Scope`

    The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.

    - `"organization"Organization`

    - `"account"Account`

### Example

```csharp
EnvironmentUpdateParams parameters = new()
{
    EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW"
};

var betaEnvironment = await client.Beta.Environments.Update(parameters);

Console.WriteLine(betaEnvironment);
```

#### Response

```json
{
  "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
  "archived_at": null,
  "config": {
    "networking": {
      "allow_mcp_servers": false,
      "allow_package_managers": true,
      "allowed_hosts": [
        "api.example.com"
      ],
      "type": "limited"
    },
    "packages": {
      "apt": [
        "string"
      ],
      "cargo": [
        "string"
      ],
      "gem": [
        "string"
      ],
      "go": [
        "string"
      ],
      "npm": [
        "string"
      ],
      "pip": [
        "pandas",
        "numpy"
      ],
      "type": "packages"
    },
    "type": "cloud"
  },
  "created_at": "2026-03-15T10:00:00Z",
  "description": "Python environment with data-analysis packages.",
  "metadata": {},
  "name": "python-data-analysis",
  "type": "environment",
  "updated_at": "2026-03-15T10:00:00Z",
  "scope": "organization"
}
```

## Delete Environment

`BetaEnvironmentDeleteResponse Beta.Environments.Delete(EnvironmentDeleteParamsparameters, CancellationTokencancellationToken = default)`

**delete** `/v1/environments/{environment_id}`

Delete an environment by ID. Returns a confirmation of the deletion.

### Parameters

- `EnvironmentDeleteParams parameters`

  - `required string environmentID`

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaEnvironmentDeleteResponse:`

  Response after deleting an environment.

  - `required string ID`

    Environment identifier

  - `JsonElement Type "environment_deleted"constant`

    The type of response

### Example

```csharp
EnvironmentDeleteParams parameters = new()
{
    EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW"
};

var betaEnvironmentDeleteResponse = await client.Beta.Environments.Delete(parameters);

Console.WriteLine(betaEnvironmentDeleteResponse);
```

#### Response

```json
{
  "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
  "type": "environment_deleted"
}
```

## Archive Environment

`BetaEnvironment Beta.Environments.Archive(EnvironmentArchiveParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/environments/{environment_id}/archive`

Archive an environment by ID. Archived environments cannot be used to create new sessions.

### Parameters

- `EnvironmentArchiveParams parameters`

  - `required string environmentID`

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaEnvironment:`

  Unified Environment resource for both cloud and self-hosted environments.

  - `required string ID`

    Environment identifier (e.g., 'env_...')

  - `required string? ArchivedAt`

    RFC 3339 timestamp when environment was archived, or null if not archived

  - `required Config Config`

    Environment configuration (either Anthropic Cloud or self-hosted)

    - `class BetaCloudConfig:`

      `cloud` environment configuration.

      - `required Networking Networking`

        Network configuration policy.

        - `class BetaUnrestrictedNetwork:`

          Unrestricted network access.

          - `JsonElement Type "unrestricted"constant`

            Network policy type

        - `class BetaLimitedNetwork:`

          Limited network access.

          - `required Boolean AllowMcpServers`

            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.

          - `required Boolean AllowPackageManagers`

            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.

          - `required IReadOnlyList<string> AllowedHosts`

            Specifies domains the container can reach.

          - `JsonElement Type "limited"constant`

            Network policy type

      - `required BetaPackages Packages`

        Package manager configuration.

        - `required IReadOnlyList<string> Apt`

          Ubuntu/Debian packages to install

        - `required IReadOnlyList<string> Cargo`

          Rust packages to install

        - `required IReadOnlyList<string> Gem`

          Ruby packages to install

        - `required IReadOnlyList<string> Go`

          Go packages to install

        - `required IReadOnlyList<string> Npm`

          Node.js packages to install

        - `required IReadOnlyList<string> Pip`

          Python packages to install

        - `Type Type`

          Package configuration type

          - `"packages"Packages`

      - `JsonElement Type "cloud"constant`

        Environment type

    - `class BetaSelfHostedConfig:`

      Configuration for self-hosted environments.

      - `JsonElement Type "self_hosted"constant`

        Environment type

  - `required string CreatedAt`

    RFC 3339 timestamp when environment was created

  - `required string Description`

    User-provided description for the environment

  - `required IReadOnlyDictionary<string, string> Metadata`

    User-provided metadata key-value pairs

  - `required string Name`

    Human-readable name for the environment

  - `JsonElement Type "environment"constant`

    The type of object (always 'environment')

  - `required string UpdatedAt`

    RFC 3339 timestamp when environment was last updated

  - `Scope Scope`

    The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.

    - `"organization"Organization`

    - `"account"Account`

### Example

```csharp
EnvironmentArchiveParams parameters = new()
{
    EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW"
};

var betaEnvironment = await client.Beta.Environments.Archive(parameters);

Console.WriteLine(betaEnvironment);
```

#### Response

```json
{
  "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
  "archived_at": null,
  "config": {
    "networking": {
      "allow_mcp_servers": false,
      "allow_package_managers": true,
      "allowed_hosts": [
        "api.example.com"
      ],
      "type": "limited"
    },
    "packages": {
      "apt": [
        "string"
      ],
      "cargo": [
        "string"
      ],
      "gem": [
        "string"
      ],
      "go": [
        "string"
      ],
      "npm": [
        "string"
      ],
      "pip": [
        "pandas",
        "numpy"
      ],
      "type": "packages"
    },
    "type": "cloud"
  },
  "created_at": "2026-03-15T10:00:00Z",
  "description": "Python environment with data-analysis packages.",
  "metadata": {},
  "name": "python-data-analysis",
  "type": "environment",
  "updated_at": "2026-03-15T10:00:00Z",
  "scope": "organization"
}
```

## Domain Types

### Beta Cloud Config

- `class BetaCloudConfig:`

  `cloud` environment configuration.

  - `required Networking Networking`

    Network configuration policy.

    - `class BetaUnrestrictedNetwork:`

      Unrestricted network access.

      - `JsonElement Type "unrestricted"constant`

        Network policy type

    - `class BetaLimitedNetwork:`

      Limited network access.

      - `required Boolean AllowMcpServers`

        Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.

      - `required Boolean AllowPackageManagers`

        Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.

      - `required IReadOnlyList<string> AllowedHosts`

        Specifies domains the container can reach.

      - `JsonElement Type "limited"constant`

        Network policy type

  - `required BetaPackages Packages`

    Package manager configuration.

    - `required IReadOnlyList<string> Apt`

      Ubuntu/Debian packages to install

    - `required IReadOnlyList<string> Cargo`

      Rust packages to install

    - `required IReadOnlyList<string> Gem`

      Ruby packages to install

    - `required IReadOnlyList<string> Go`

      Go packages to install

    - `required IReadOnlyList<string> Npm`

      Node.js packages to install

    - `required IReadOnlyList<string> Pip`

      Python packages to install

    - `Type Type`

      Package configuration type

      - `"packages"Packages`

  - `JsonElement Type "cloud"constant`

    Environment type

### Beta Cloud Config Params

- `class BetaCloudConfigParams:`

  Request params for `cloud` environment configuration.

  Fields default to null; on update, omitted fields preserve the
  existing value.

  - `JsonElement Type "cloud"constant`

    Environment type

  - `Networking? Networking`

    Network configuration policy. Omit on update to preserve the existing value.

    - `class BetaUnrestrictedNetwork:`

      Unrestricted network access.

      - `JsonElement Type "unrestricted"constant`

        Network policy type

    - `class BetaLimitedNetworkParams:`

      Limited network request params.

      Fields default to null; on update, omitted fields preserve the
      existing value.

      - `JsonElement Type "limited"constant`

        Network policy type

      - `Boolean? AllowMcpServers`

        Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`.

      - `Boolean? AllowPackageManagers`

        Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`.

      - `IReadOnlyList<string>? AllowedHosts`

        Specifies domains the container can reach.

  - `BetaPackagesParams? Packages`

    Specify packages (and optionally their versions) available in this environment.

    When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest.

    - `IReadOnlyList<string>? Apt`

      Ubuntu/Debian packages to install

    - `IReadOnlyList<string>? Cargo`

      Rust packages to install

    - `IReadOnlyList<string>? Gem`

      Ruby packages to install

    - `IReadOnlyList<string>? Go`

      Go packages to install

    - `IReadOnlyList<string>? Npm`

      Node.js packages to install

    - `IReadOnlyList<string>? Pip`

      Python packages to install

    - `Type Type`

      Package configuration type

      - `"packages"Packages`

### Beta Environment

- `class BetaEnvironment:`

  Unified Environment resource for both cloud and self-hosted environments.

  - `required string ID`

    Environment identifier (e.g., 'env_...')

  - `required string? ArchivedAt`

    RFC 3339 timestamp when environment was archived, or null if not archived

  - `required Config Config`

    Environment configuration (either Anthropic Cloud or self-hosted)

    - `class BetaCloudConfig:`

      `cloud` environment configuration.

      - `required Networking Networking`

        Network configuration policy.

        - `class BetaUnrestrictedNetwork:`

          Unrestricted network access.

          - `JsonElement Type "unrestricted"constant`

            Network policy type

        - `class BetaLimitedNetwork:`

          Limited network access.

          - `required Boolean AllowMcpServers`

            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.

          - `required Boolean AllowPackageManagers`

            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.

          - `required IReadOnlyList<string> AllowedHosts`

            Specifies domains the container can reach.

          - `JsonElement Type "limited"constant`

            Network policy type

      - `required BetaPackages Packages`

        Package manager configuration.

        - `required IReadOnlyList<string> Apt`

          Ubuntu/Debian packages to install

        - `required IReadOnlyList<string> Cargo`

          Rust packages to install

        - `required IReadOnlyList<string> Gem`

          Ruby packages to install

        - `required IReadOnlyList<string> Go`

          Go packages to install

        - `required IReadOnlyList<string> Npm`

          Node.js packages to install

        - `required IReadOnlyList<string> Pip`

          Python packages to install

        - `Type Type`

          Package configuration type

          - `"packages"Packages`

      - `JsonElement Type "cloud"constant`

        Environment type

    - `class BetaSelfHostedConfig:`

      Configuration for self-hosted environments.

      - `JsonElement Type "self_hosted"constant`

        Environment type

  - `required string CreatedAt`

    RFC 3339 timestamp when environment was created

  - `required string Description`

    User-provided description for the environment

  - `required IReadOnlyDictionary<string, string> Metadata`

    User-provided metadata key-value pairs

  - `required string Name`

    Human-readable name for the environment

  - `JsonElement Type "environment"constant`

    The type of object (always 'environment')

  - `required string UpdatedAt`

    RFC 3339 timestamp when environment was last updated

  - `Scope Scope`

    The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.

    - `"organization"Organization`

    - `"account"Account`

### Beta Environment Delete Response

- `class BetaEnvironmentDeleteResponse:`

  Response after deleting an environment.

  - `required string ID`

    Environment identifier

  - `JsonElement Type "environment_deleted"constant`

    The type of response

### Beta Limited Network

- `class BetaLimitedNetwork:`

  Limited network access.

  - `required Boolean AllowMcpServers`

    Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.

  - `required Boolean AllowPackageManagers`

    Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.

  - `required IReadOnlyList<string> AllowedHosts`

    Specifies domains the container can reach.

  - `JsonElement Type "limited"constant`

    Network policy type

### Beta Limited Network Params

- `class BetaLimitedNetworkParams:`

  Limited network request params.

  Fields default to null; on update, omitted fields preserve the
  existing value.

  - `JsonElement Type "limited"constant`

    Network policy type

  - `Boolean? AllowMcpServers`

    Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`.

  - `Boolean? AllowPackageManagers`

    Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`.

  - `IReadOnlyList<string>? AllowedHosts`

    Specifies domains the container can reach.

### Beta Packages

- `class BetaPackages:`

  Packages (and their versions) available in this environment.

  - `required IReadOnlyList<string> Apt`

    Ubuntu/Debian packages to install

  - `required IReadOnlyList<string> Cargo`

    Rust packages to install

  - `required IReadOnlyList<string> Gem`

    Ruby packages to install

  - `required IReadOnlyList<string> Go`

    Go packages to install

  - `required IReadOnlyList<string> Npm`

    Node.js packages to install

  - `required IReadOnlyList<string> Pip`

    Python packages to install

  - `Type Type`

    Package configuration type

    - `"packages"Packages`

### Beta Packages Params

- `class BetaPackagesParams:`

  Specify packages (and optionally their versions) available in this environment.

  When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest.

  - `IReadOnlyList<string>? Apt`

    Ubuntu/Debian packages to install

  - `IReadOnlyList<string>? Cargo`

    Rust packages to install

  - `IReadOnlyList<string>? Gem`

    Ruby packages to install

  - `IReadOnlyList<string>? Go`

    Go packages to install

  - `IReadOnlyList<string>? Npm`

    Node.js packages to install

  - `IReadOnlyList<string>? Pip`

    Python packages to install

  - `Type Type`

    Package configuration type

    - `"packages"Packages`

### Beta Self Hosted Config

- `class BetaSelfHostedConfig:`

  Configuration for self-hosted environments.

  - `JsonElement Type "self_hosted"constant`

    Environment type

### Beta Self Hosted Config Params

- `class BetaSelfHostedConfigParams:`

  Request params for `self_hosted` environment configuration.

  - `JsonElement Type "self_hosted"constant`

    Environment type

### Beta Unrestricted Network

- `class BetaUnrestrictedNetwork:`

  Unrestricted network access.

  - `JsonElement Type "unrestricted"constant`

    Network policy type

# Work

## Get Work Item

`BetaSelfHostedWork Beta.Environments.Work.Retrieve(WorkRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/environments/{environment_id}/work/{work_id}`

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

Retrieve detailed information about a specific work item.

### Parameters

- `WorkRetrieveParams parameters`

  - `required string environmentID`

    Path param

  - `required string workID`

    Path param

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaSelfHostedWork:`

  Work resource representing a unit of work in a self-hosted environment.

  Work items are queued when sessions are created or when long-dormant sessions
  receive new messages. The environment worker polls for work to execute in a
  self-hosted sandbox.

  - `required string ID`

    Work identifier (e.g., 'work_...')

  - `required string? AcknowledgedAt`

    RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox

  - `required string CreatedAt`

    RFC 3339 timestamp when work was created

  - `required BetaSessionWorkData Data`

    The actual work to be performed

    - `required string ID`

      Session identifier (e.g., 'session_...')

    - `JsonElement Type "session"constant`

      Type of work data

  - `required string EnvironmentID`

    Environment identifier this work belongs to (e.g., `env_...`)

  - `required string? LatestHeartbeatAt`

    RFC 3339 timestamp of the most recent heartbeat

  - `required IReadOnlyDictionary<string, string> Metadata`

    User-provided metadata key-value pairs associated with this work item

  - `required string? StartedAt`

    RFC 3339 timestamp when work execution started

  - `required State State`

    Current state of the work item

    - `"queued"Queued`

    - `"starting"Starting`

    - `"active"Active`

    - `"stopping"Stopping`

    - `"stopped"Stopped`

  - `required string? StopRequestedAt`

    RFC 3339 timestamp when stop was requested

  - `required string? StoppedAt`

    RFC 3339 timestamp when work execution stopped

  - `JsonElement Type "work"constant`

    The type of object (always 'work')

### Example

```csharp
WorkRetrieveParams parameters = new()
{
    EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW",
    WorkID = "work_id",
};

var betaSelfHostedWork = await client.Beta.Environments.Work.Retrieve(parameters);

Console.WriteLine(betaSelfHostedWork);
```

#### Response

```json
{
  "id": "id",
  "acknowledged_at": "acknowledged_at",
  "created_at": "created_at",
  "data": {
    "id": "id",
    "type": "session"
  },
  "environment_id": "environment_id",
  "latest_heartbeat_at": "latest_heartbeat_at",
  "metadata": {
    "foo": "string"
  },
  "started_at": "started_at",
  "state": "queued",
  "stop_requested_at": "stop_requested_at",
  "stopped_at": "stopped_at",
  "type": "work"
}
```

## Poll for Work

`BetaSelfHostedWork? Beta.Environments.Work.Poll(WorkPollParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/environments/{environment_id}/work/poll`

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

Long poll for work items in the queue.

### Parameters

- `WorkPollParams parameters`

  - `required string environmentID`

    Path param

  - `Long? blockMs`

    Query param: How long to wait for work to arrive before returning. Must be 1-999 in milliseconds. Defaults to non-blocking (returns immediately if no work is available).

  - `Long? reclaimOlderThanMs`

    Query param: Reclaim unacknowledged work items older than this many milliseconds. If omitted, uses the default (5000ms).

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

  - `string anthropicWorkerID`

    Header param: Unique identifier for the specific worker polling, used to track aggregated environment-level work metrics in Console

### Returns

- `class BetaSelfHostedWork:`

  Work resource representing a unit of work in a self-hosted environment.

  Work items are queued when sessions are created or when long-dormant sessions
  receive new messages. The environment worker polls for work to execute in a
  self-hosted sandbox.

  - `required string ID`

    Work identifier (e.g., 'work_...')

  - `required string? AcknowledgedAt`

    RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox

  - `required string CreatedAt`

    RFC 3339 timestamp when work was created

  - `required BetaSessionWorkData Data`

    The actual work to be performed

    - `required string ID`

      Session identifier (e.g., 'session_...')

    - `JsonElement Type "session"constant`

      Type of work data

  - `required string EnvironmentID`

    Environment identifier this work belongs to (e.g., `env_...`)

  - `required string? LatestHeartbeatAt`

    RFC 3339 timestamp of the most recent heartbeat

  - `required IReadOnlyDictionary<string, string> Metadata`

    User-provided metadata key-value pairs associated with this work item

  - `required string? StartedAt`

    RFC 3339 timestamp when work execution started

  - `required State State`

    Current state of the work item

    - `"queued"Queued`

    - `"starting"Starting`

    - `"active"Active`

    - `"stopping"Stopping`

    - `"stopped"Stopped`

  - `required string? StopRequestedAt`

    RFC 3339 timestamp when stop was requested

  - `required string? StoppedAt`

    RFC 3339 timestamp when work execution stopped

  - `JsonElement Type "work"constant`

    The type of object (always 'work')

### Example

```csharp
WorkPollParams parameters = new()
{
    EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW"
};

var betaSelfHostedWork = await client.Beta.Environments.Work.Poll(parameters);

Console.WriteLine(betaSelfHostedWork);
```

#### Response

```json
{
  "id": "id",
  "acknowledged_at": "acknowledged_at",
  "created_at": "created_at",
  "data": {
    "id": "id",
    "type": "session"
  },
  "environment_id": "environment_id",
  "latest_heartbeat_at": "latest_heartbeat_at",
  "metadata": {
    "foo": "string"
  },
  "started_at": "started_at",
  "state": "queued",
  "stop_requested_at": "stop_requested_at",
  "stopped_at": "stopped_at",
  "type": "work"
}
```

## Acknowledge Work

`BetaSelfHostedWork Beta.Environments.Work.Ack(WorkAckParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/environments/{environment_id}/work/{work_id}/ack`

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

Acknowledge receipt of a work item, transitioning it from 'queued' to 'starting' and removing it from the queue.

### Parameters

- `WorkAckParams parameters`

  - `required string environmentID`

    Path param

  - `required string workID`

    Path param

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaSelfHostedWork:`

  Work resource representing a unit of work in a self-hosted environment.

  Work items are queued when sessions are created or when long-dormant sessions
  receive new messages. The environment worker polls for work to execute in a
  self-hosted sandbox.

  - `required string ID`

    Work identifier (e.g., 'work_...')

  - `required string? AcknowledgedAt`

    RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox

  - `required string CreatedAt`

    RFC 3339 timestamp when work was created

  - `required BetaSessionWorkData Data`

    The actual work to be performed

    - `required string ID`

      Session identifier (e.g., 'session_...')

    - `JsonElement Type "session"constant`

      Type of work data

  - `required string EnvironmentID`

    Environment identifier this work belongs to (e.g., `env_...`)

  - `required string? LatestHeartbeatAt`

    RFC 3339 timestamp of the most recent heartbeat

  - `required IReadOnlyDictionary<string, string> Metadata`

    User-provided metadata key-value pairs associated with this work item

  - `required string? StartedAt`

    RFC 3339 timestamp when work execution started

  - `required State State`

    Current state of the work item

    - `"queued"Queued`

    - `"starting"Starting`

    - `"active"Active`

    - `"stopping"Stopping`

    - `"stopped"Stopped`

  - `required string? StopRequestedAt`

    RFC 3339 timestamp when stop was requested

  - `required string? StoppedAt`

    RFC 3339 timestamp when work execution stopped

  - `JsonElement Type "work"constant`

    The type of object (always 'work')

### Example

```csharp
WorkAckParams parameters = new()
{
    EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW",
    WorkID = "work_id",
};

var betaSelfHostedWork = await client.Beta.Environments.Work.Ack(parameters);

Console.WriteLine(betaSelfHostedWork);
```

#### Response

```json
{
  "id": "id",
  "acknowledged_at": "acknowledged_at",
  "created_at": "created_at",
  "data": {
    "id": "id",
    "type": "session"
  },
  "environment_id": "environment_id",
  "latest_heartbeat_at": "latest_heartbeat_at",
  "metadata": {
    "foo": "string"
  },
  "started_at": "started_at",
  "state": "queued",
  "stop_requested_at": "stop_requested_at",
  "stopped_at": "stopped_at",
  "type": "work"
}
```

## Record Heartbeat

`BetaSelfHostedWorkHeartbeatResponse Beta.Environments.Work.Heartbeat(WorkHeartbeatParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/environments/{environment_id}/work/{work_id}/heartbeat`

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

Record a heartbeat for a work item to maintain the lease.

### Parameters

- `WorkHeartbeatParams parameters`

  - `required string environmentID`

    Path param

  - `required string workID`

    Path param

  - `Long? desiredTtlSeconds`

    Query param: Desired TTL in seconds

  - `string? expectedLastHeartbeat`

    Query param: Expected last_heartbeat for conditional update (optimistic concurrency). Use literal 'NO_HEARTBEAT' to claim an unclaimed lease (first heartbeat). For subsequent heartbeats, echo the server's previous last_heartbeat value exactly. Returns 412 Precondition Failed if the actual value doesn't match.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaSelfHostedWorkHeartbeatResponse:`

  Response after recording a heartbeat for a work item.

  - `required string LastHeartbeat`

    RFC 3339 timestamp of the actual heartbeat from DB

  - `required Boolean LeaseExtended`

    Whether the heartbeat succeeded in extending the lease

  - `required State State`

    Current state of the work item (active/stopping/stopped)

    - `"queued"Queued`

    - `"starting"Starting`

    - `"active"Active`

    - `"stopping"Stopping`

    - `"stopped"Stopped`

  - `required Long TtlSeconds`

    Effective TTL applied to the lease

  - `JsonElement Type "work_heartbeat"constant`

    The type of response

### Example

```csharp
WorkHeartbeatParams parameters = new()
{
    EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW",
    WorkID = "work_id",
};

var betaSelfHostedWorkHeartbeatResponse = await client.Beta.Environments.Work.Heartbeat(parameters);

Console.WriteLine(betaSelfHostedWorkHeartbeatResponse);
```

#### Response

```json
{
  "last_heartbeat": "last_heartbeat",
  "lease_extended": true,
  "state": "queued",
  "ttl_seconds": 0,
  "type": "work_heartbeat"
}
```

## Stop Work

`BetaSelfHostedWork Beta.Environments.Work.Stop(WorkStopParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/environments/{environment_id}/work/{work_id}/stop`

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

Stop a work item, initiating graceful or forced shutdown.

### Parameters

- `WorkStopParams parameters`

  - `required string environmentID`

    Path param

  - `required string workID`

    Path param

  - `Boolean force`

    Body param: If true, immediately stop work without graceful shutdown

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaSelfHostedWork:`

  Work resource representing a unit of work in a self-hosted environment.

  Work items are queued when sessions are created or when long-dormant sessions
  receive new messages. The environment worker polls for work to execute in a
  self-hosted sandbox.

  - `required string ID`

    Work identifier (e.g., 'work_...')

  - `required string? AcknowledgedAt`

    RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox

  - `required string CreatedAt`

    RFC 3339 timestamp when work was created

  - `required BetaSessionWorkData Data`

    The actual work to be performed

    - `required string ID`

      Session identifier (e.g., 'session_...')

    - `JsonElement Type "session"constant`

      Type of work data

  - `required string EnvironmentID`

    Environment identifier this work belongs to (e.g., `env_...`)

  - `required string? LatestHeartbeatAt`

    RFC 3339 timestamp of the most recent heartbeat

  - `required IReadOnlyDictionary<string, string> Metadata`

    User-provided metadata key-value pairs associated with this work item

  - `required string? StartedAt`

    RFC 3339 timestamp when work execution started

  - `required State State`

    Current state of the work item

    - `"queued"Queued`

    - `"starting"Starting`

    - `"active"Active`

    - `"stopping"Stopping`

    - `"stopped"Stopped`

  - `required string? StopRequestedAt`

    RFC 3339 timestamp when stop was requested

  - `required string? StoppedAt`

    RFC 3339 timestamp when work execution stopped

  - `JsonElement Type "work"constant`

    The type of object (always 'work')

### Example

```csharp
WorkStopParams parameters = new()
{
    EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW",
    WorkID = "work_id",
};

var betaSelfHostedWork = await client.Beta.Environments.Work.Stop(parameters);

Console.WriteLine(betaSelfHostedWork);
```

#### Response

```json
{
  "id": "id",
  "acknowledged_at": "acknowledged_at",
  "created_at": "created_at",
  "data": {
    "id": "id",
    "type": "session"
  },
  "environment_id": "environment_id",
  "latest_heartbeat_at": "latest_heartbeat_at",
  "metadata": {
    "foo": "string"
  },
  "started_at": "started_at",
  "state": "queued",
  "stop_requested_at": "stop_requested_at",
  "stopped_at": "stopped_at",
  "type": "work"
}
```

## List Work Items

`BetaSelfHostedWorkListResponse Beta.Environments.Work.List(WorkListParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/environments/{environment_id}/work`

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

List work items in an environment.

### Parameters

- `WorkListParams parameters`

  - `required string environmentID`

    Path param

  - `Long limit`

    Query param: Maximum number of work items to return

  - `string? page`

    Query param: Opaque cursor from previous response for pagination

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaSelfHostedWorkListResponse:`

  Response when listing work items with cursor-based pagination.

  - `required IReadOnlyList<BetaSelfHostedWork> Data`

    List of work items

    - `required string ID`

      Work identifier (e.g., 'work_...')

    - `required string? AcknowledgedAt`

      RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox

    - `required string CreatedAt`

      RFC 3339 timestamp when work was created

    - `required BetaSessionWorkData Data`

      The actual work to be performed

      - `required string ID`

        Session identifier (e.g., 'session_...')

      - `JsonElement Type "session"constant`

        Type of work data

    - `required string EnvironmentID`

      Environment identifier this work belongs to (e.g., `env_...`)

    - `required string? LatestHeartbeatAt`

      RFC 3339 timestamp of the most recent heartbeat

    - `required IReadOnlyDictionary<string, string> Metadata`

      User-provided metadata key-value pairs associated with this work item

    - `required string? StartedAt`

      RFC 3339 timestamp when work execution started

    - `required State State`

      Current state of the work item

      - `"queued"Queued`

      - `"starting"Starting`

      - `"active"Active`

      - `"stopping"Stopping`

      - `"stopped"Stopped`

    - `required string? StopRequestedAt`

      RFC 3339 timestamp when stop was requested

    - `required string? StoppedAt`

      RFC 3339 timestamp when work execution stopped

    - `JsonElement Type "work"constant`

      The type of object (always 'work')

  - `required string? NextPage`

    Opaque cursor for fetching the next page of results

### Example

```csharp
WorkListParams parameters = new()
{
    EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW"
};

var page = await client.Beta.Environments.Work.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "acknowledged_at": "acknowledged_at",
      "created_at": "created_at",
      "data": {
        "id": "id",
        "type": "session"
      },
      "environment_id": "environment_id",
      "latest_heartbeat_at": "latest_heartbeat_at",
      "metadata": {
        "foo": "string"
      },
      "started_at": "started_at",
      "state": "queued",
      "stop_requested_at": "stop_requested_at",
      "stopped_at": "stopped_at",
      "type": "work"
    }
  ],
  "next_page": "next_page"
}
```

## Update Work Item

`BetaSelfHostedWork Beta.Environments.Work.Update(WorkUpdateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/environments/{environment_id}/work/{work_id}`

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

Update work item metadata with merge semantics.

### Parameters

- `WorkUpdateParams parameters`

  - `required string environmentID`

    Path param

  - `required string workID`

    Path param

  - `required IReadOnlyDictionary<string, string> metadata`

    Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve existing metadata.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaSelfHostedWork:`

  Work resource representing a unit of work in a self-hosted environment.

  Work items are queued when sessions are created or when long-dormant sessions
  receive new messages. The environment worker polls for work to execute in a
  self-hosted sandbox.

  - `required string ID`

    Work identifier (e.g., 'work_...')

  - `required string? AcknowledgedAt`

    RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox

  - `required string CreatedAt`

    RFC 3339 timestamp when work was created

  - `required BetaSessionWorkData Data`

    The actual work to be performed

    - `required string ID`

      Session identifier (e.g., 'session_...')

    - `JsonElement Type "session"constant`

      Type of work data

  - `required string EnvironmentID`

    Environment identifier this work belongs to (e.g., `env_...`)

  - `required string? LatestHeartbeatAt`

    RFC 3339 timestamp of the most recent heartbeat

  - `required IReadOnlyDictionary<string, string> Metadata`

    User-provided metadata key-value pairs associated with this work item

  - `required string? StartedAt`

    RFC 3339 timestamp when work execution started

  - `required State State`

    Current state of the work item

    - `"queued"Queued`

    - `"starting"Starting`

    - `"active"Active`

    - `"stopping"Stopping`

    - `"stopped"Stopped`

  - `required string? StopRequestedAt`

    RFC 3339 timestamp when stop was requested

  - `required string? StoppedAt`

    RFC 3339 timestamp when work execution stopped

  - `JsonElement Type "work"constant`

    The type of object (always 'work')

### Example

```csharp
WorkUpdateParams parameters = new()
{
    EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW",
    WorkID = "work_id",
    Metadata = new Dictionary<string, string?>() { { "foo", "string" } },
};

var betaSelfHostedWork = await client.Beta.Environments.Work.Update(parameters);

Console.WriteLine(betaSelfHostedWork);
```

#### Response

```json
{
  "id": "id",
  "acknowledged_at": "acknowledged_at",
  "created_at": "created_at",
  "data": {
    "id": "id",
    "type": "session"
  },
  "environment_id": "environment_id",
  "latest_heartbeat_at": "latest_heartbeat_at",
  "metadata": {
    "foo": "string"
  },
  "started_at": "started_at",
  "state": "queued",
  "stop_requested_at": "stop_requested_at",
  "stopped_at": "stopped_at",
  "type": "work"
}
```

## Get Queue Statistics

`BetaSelfHostedWorkQueueStats Beta.Environments.Work.Stats(WorkStatsParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/environments/{environment_id}/work/stats`

Get statistics about the work queue for an environment.

### Parameters

- `WorkStatsParams parameters`

  - `required string environmentID`

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaSelfHostedWorkQueueStats:`

  Statistics about the work queue for an environment.

  Uses Redis Stream consumer group metrics for O(1) queries.

  - `required Long Depth`

    Number of work items waiting to be picked up (lag from consumer group)

  - `required string? OldestQueuedAt`

    RFC 3339 timestamp of oldest item in the work stream (includes both queued and pending items), null if stream empty

  - `required Long Pending`

    Number of work items being processed (polled but not acknowledged)

  - `JsonElement Type "work_queue_stats"constant`

    The type of object

  - `required Long? WorkersPolling`

    Number of workers that have polled for work in the last 30 seconds. Requires worker_id to be sent with poll requests.

### Example

```csharp
WorkStatsParams parameters = new()
{
    EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW"
};

var betaSelfHostedWorkQueueStats = await client.Beta.Environments.Work.Stats(parameters);

Console.WriteLine(betaSelfHostedWorkQueueStats);
```

#### Response

```json
{
  "depth": 0,
  "oldest_queued_at": "oldest_queued_at",
  "pending": 0,
  "type": "work_queue_stats",
  "workers_polling": 0
}
```

## Domain Types

### Beta Self Hosted Work

- `class BetaSelfHostedWork:`

  Work resource representing a unit of work in a self-hosted environment.

  Work items are queued when sessions are created or when long-dormant sessions
  receive new messages. The environment worker polls for work to execute in a
  self-hosted sandbox.

  - `required string ID`

    Work identifier (e.g., 'work_...')

  - `required string? AcknowledgedAt`

    RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox

  - `required string CreatedAt`

    RFC 3339 timestamp when work was created

  - `required BetaSessionWorkData Data`

    The actual work to be performed

    - `required string ID`

      Session identifier (e.g., 'session_...')

    - `JsonElement Type "session"constant`

      Type of work data

  - `required string EnvironmentID`

    Environment identifier this work belongs to (e.g., `env_...`)

  - `required string? LatestHeartbeatAt`

    RFC 3339 timestamp of the most recent heartbeat

  - `required IReadOnlyDictionary<string, string> Metadata`

    User-provided metadata key-value pairs associated with this work item

  - `required string? StartedAt`

    RFC 3339 timestamp when work execution started

  - `required State State`

    Current state of the work item

    - `"queued"Queued`

    - `"starting"Starting`

    - `"active"Active`

    - `"stopping"Stopping`

    - `"stopped"Stopped`

  - `required string? StopRequestedAt`

    RFC 3339 timestamp when stop was requested

  - `required string? StoppedAt`

    RFC 3339 timestamp when work execution stopped

  - `JsonElement Type "work"constant`

    The type of object (always 'work')

### Beta Self Hosted Work Heartbeat Response

- `class BetaSelfHostedWorkHeartbeatResponse:`

  Response after recording a heartbeat for a work item.

  - `required string LastHeartbeat`

    RFC 3339 timestamp of the actual heartbeat from DB

  - `required Boolean LeaseExtended`

    Whether the heartbeat succeeded in extending the lease

  - `required State State`

    Current state of the work item (active/stopping/stopped)

    - `"queued"Queued`

    - `"starting"Starting`

    - `"active"Active`

    - `"stopping"Stopping`

    - `"stopped"Stopped`

  - `required Long TtlSeconds`

    Effective TTL applied to the lease

  - `JsonElement Type "work_heartbeat"constant`

    The type of response

### Beta Self Hosted Work List Response

- `class BetaSelfHostedWorkListResponse:`

  Response when listing work items with cursor-based pagination.

  - `required IReadOnlyList<BetaSelfHostedWork> Data`

    List of work items

    - `required string ID`

      Work identifier (e.g., 'work_...')

    - `required string? AcknowledgedAt`

      RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox

    - `required string CreatedAt`

      RFC 3339 timestamp when work was created

    - `required BetaSessionWorkData Data`

      The actual work to be performed

      - `required string ID`

        Session identifier (e.g., 'session_...')

      - `JsonElement Type "session"constant`

        Type of work data

    - `required string EnvironmentID`

      Environment identifier this work belongs to (e.g., `env_...`)

    - `required string? LatestHeartbeatAt`

      RFC 3339 timestamp of the most recent heartbeat

    - `required IReadOnlyDictionary<string, string> Metadata`

      User-provided metadata key-value pairs associated with this work item

    - `required string? StartedAt`

      RFC 3339 timestamp when work execution started

    - `required State State`

      Current state of the work item

      - `"queued"Queued`

      - `"starting"Starting`

      - `"active"Active`

      - `"stopping"Stopping`

      - `"stopped"Stopped`

    - `required string? StopRequestedAt`

      RFC 3339 timestamp when stop was requested

    - `required string? StoppedAt`

      RFC 3339 timestamp when work execution stopped

    - `JsonElement Type "work"constant`

      The type of object (always 'work')

  - `required string? NextPage`

    Opaque cursor for fetching the next page of results

### Beta Self Hosted Work Queue Stats

- `class BetaSelfHostedWorkQueueStats:`

  Statistics about the work queue for an environment.

  Uses Redis Stream consumer group metrics for O(1) queries.

  - `required Long Depth`

    Number of work items waiting to be picked up (lag from consumer group)

  - `required string? OldestQueuedAt`

    RFC 3339 timestamp of oldest item in the work stream (includes both queued and pending items), null if stream empty

  - `required Long Pending`

    Number of work items being processed (polled but not acknowledged)

  - `JsonElement Type "work_queue_stats"constant`

    The type of object

  - `required Long? WorkersPolling`

    Number of workers that have polled for work in the last 30 seconds. Requires worker_id to be sent with poll requests.

### Beta Self Hosted Work Stop Request

- `class BetaSelfHostedWorkStopRequest:`

  Request to stop a work item.

  - `Boolean Force`

    If true, immediately stop work without graceful shutdown

### Beta Self Hosted Work Update Request

- `class BetaSelfHostedWorkUpdateRequest:`

  Request to update work item metadata.

  - `required IReadOnlyDictionary<string, string> Metadata`

    Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve existing metadata.

### Beta Session Work Data

- `class BetaSessionWorkData:`

  Work data for session work items.

  This resource type is used when work represents a session that needs to be executed
  in a self-hosted environment.

  - `required string ID`

    Session identifier (e.g., 'session_...')

  - `JsonElement Type "session"constant`

    Type of work data

# Sessions

## Create Session

`BetaManagedAgentsSession Beta.Sessions.Create(SessionCreateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/sessions`

Create Session

### Parameters

- `SessionCreateParams parameters`

  - `required Agent agent`

    Body param: Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified.

    - `string`

    - `class BetaManagedAgentsAgentParams:`

      Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version

      - `required string ID`

        The `agent` ID.

      - `required Type Type`

        - `"agent"Agent`

      - `Int Version`

        The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified.

  - `required string environmentID`

    Body param: ID of the `environment` defining the container configuration for this session.

  - `IReadOnlyDictionary<string, string> metadata`

    Body param: Arbitrary key-value metadata attached to the session. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

  - `IReadOnlyList<Resource> resources`

    Body param: Resources (e.g. repositories, files) to mount into the session's container.

    - `class BetaManagedAgentsGitHubRepositoryResourceParams:`

      Mount a GitHub repository into the session's container.

      - `required string AuthorizationToken`

        GitHub authorization token used to clone the repository.

      - `required Type Type`

        - `"github_repository"GitHubRepository`

      - `required string Url`

        Github URL of the repository

      - `Checkout? Checkout`

        Branch or commit to check out. Defaults to the repository's default branch.

        - `class BetaManagedAgentsBranchCheckout:`

          - `required string Name`

            Branch name to check out.

          - `required Type Type`

            - `"branch"Branch`

        - `class BetaManagedAgentsCommitCheckout:`

          - `required string Sha`

            Full commit SHA to check out.

          - `required Type Type`

            - `"commit"Commit`

      - `string? MountPath`

        Mount path in the container. Defaults to `/workspace/<repo-name>`.

    - `class BetaManagedAgentsFileResourceParams:`

      Mount a file uploaded via the Files API into the session.

      - `required string FileID`

        ID of a previously uploaded file.

      - `required Type Type`

        - `"file"File`

      - `string? MountPath`

        Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.

    - `class BetaManagedAgentsMemoryStoreResourceParam:`

      Parameters for attaching a memory store to an agent session.

      - `required string MemoryStoreID`

        The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

      - `required Type Type`

        - `"memory_store"MemoryStore`

      - `Access? Access`

        Access mode for an attached memory store.

        - `"read_write"ReadWrite`

        - `"read_only"ReadOnly`

      - `string? Instructions`

        Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

  - `string? title`

    Body param: Human-readable session title.

  - `IReadOnlyList<string> vaultIds`

    Body param: Vault IDs for stored credentials the agent can use during the session.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsSession:`

  A Managed Agents `session`.

  - `required string ID`

  - `required BetaManagedAgentsSessionAgent Agent`

    Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

    - `required string ID`

    - `required string? Description`

    - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

      - `required string Name`

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

    - `required BetaManagedAgentsModelConfig Model`

      Model identifier and configuration.

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

    - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

      Resolved coordinator topology with full agent definitions for each roster member.

      - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

        Full `agent` definitions the coordinator may spawn as session threads.

        - `required string ID`

        - `required string? Description`

        - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

          - `required string Name`

          - `required Type Type`

          - `required string Url`

        - `required BetaManagedAgentsModelConfig Model`

          Model identifier and configuration.

        - `required string Name`

        - `required IReadOnlyList<Skill> Skills`

          - `class BetaManagedAgentsAnthropicSkill:`

            A resolved Anthropic-managed skill.

            - `required string SkillID`

            - `required Type Type`

              - `"anthropic"Anthropic`

            - `required string Version`

          - `class BetaManagedAgentsCustomSkill:`

            A resolved user-created custom skill.

            - `required string SkillID`

            - `required Type Type`

              - `"custom"Custom`

            - `required string Version`

        - `required string? System`

        - `required IReadOnlyList<Tool> Tools`

          - `class BetaManagedAgentsAgentToolset20260401:`

            - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

              - `required Boolean Enabled`

              - `required Name Name`

                Built-in agent tool identifier.

                - `"bash"Bash`

                - `"edit"Edit`

                - `"read"Read`

                - `"write"Write`

                - `"glob"Glob`

                - `"grep"Grep`

                - `"web_fetch"WebFetch`

                - `"web_search"WebSearch`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                  - `required Type Type`

                    - `"always_allow"AlwaysAllow`

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

                  - `required Type Type`

                    - `"always_ask"AlwaysAsk`

            - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

              Resolved default configuration for agent tools.

              - `required Boolean Enabled`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"agent_toolset_20260401"AgentToolset20260401`

          - `class BetaManagedAgentsMcpToolset:`

            - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

              - `required Boolean Enabled`

              - `required string Name`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

              Resolved default configuration for all tools from an MCP server.

              - `required Boolean Enabled`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required string McpServerName`

            - `required Type Type`

              - `"mcp_toolset"McpToolset`

          - `class BetaManagedAgentsCustomTool:`

            A custom tool as returned in API responses.

            - `required string Description`

            - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

              JSON Schema for custom tool input parameters.

              - `IReadOnlyDictionary<string, JsonElement>? Properties`

                JSON Schema properties defining the tool's input parameters.

              - `IReadOnlyList<string> Required`

                List of required property names.

              - `Type Type`

                Must be 'object' for tool input schemas.

                - `"object"Object`

            - `required string Name`

            - `required Type Type`

              - `"custom"Custom`

        - `required Type Type`

          - `"agent"Agent`

        - `required Int Version`

      - `required Type Type`

        - `"coordinator"Coordinator`

    - `required string Name`

    - `required IReadOnlyList<Skill> Skills`

      - `class BetaManagedAgentsAnthropicSkill:`

        A resolved Anthropic-managed skill.

      - `class BetaManagedAgentsCustomSkill:`

        A resolved user-created custom skill.

    - `required string? System`

    - `required IReadOnlyList<Tool> Tools`

      - `class BetaManagedAgentsAgentToolset20260401:`

      - `class BetaManagedAgentsMcpToolset:`

      - `class BetaManagedAgentsCustomTool:`

        A custom tool as returned in API responses.

    - `required Type Type`

      - `"agent"Agent`

    - `required Int Version`

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string EnvironmentID`

  - `required IReadOnlyDictionary<string, string> Metadata`

  - `required IReadOnlyList<BetaManagedAgentsOutcomeEvaluationResource> OutcomeEvaluations`

    Per-outcome evaluation state. One entry per define_outcome event sent to the session.

    - `required DateTimeOffset? CompletedAt`

      A timestamp in RFC 3339 format

    - `required string Description`

      What the agent should produce.

    - `required string? Explanation`

      Grader's verdict text from the most recent evaluation. For satisfied, explains why criteria are met; for needs_revision (intermediate), what's missing; for failed, why unrecoverable.

    - `required Int Iteration`

      0-indexed revision cycle the outcome is currently on.

    - `required string OutcomeID`

      Server-generated outc_ ID for this outcome.

    - `required string Result`

      Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal.

    - `required Type Type`

      - `"outcome_evaluation"OutcomeEvaluation`

  - `required IReadOnlyList<BetaManagedAgentsSessionResource> Resources`

    - `class BetaManagedAgentsGitHubRepositoryResource:`

      - `required string ID`

      - `required DateTimeOffset CreatedAt`

        A timestamp in RFC 3339 format

      - `required string MountPath`

      - `required Type Type`

        - `"github_repository"GitHubRepository`

      - `required DateTimeOffset UpdatedAt`

        A timestamp in RFC 3339 format

      - `required string Url`

      - `Checkout? Checkout`

        - `class BetaManagedAgentsBranchCheckout:`

          - `required string Name`

            Branch name to check out.

          - `required Type Type`

            - `"branch"Branch`

        - `class BetaManagedAgentsCommitCheckout:`

          - `required string Sha`

            Full commit SHA to check out.

          - `required Type Type`

            - `"commit"Commit`

    - `class BetaManagedAgentsFileResource:`

      - `required string ID`

      - `required DateTimeOffset CreatedAt`

        A timestamp in RFC 3339 format

      - `required string FileID`

      - `required string MountPath`

      - `required Type Type`

        - `"file"File`

      - `required DateTimeOffset UpdatedAt`

        A timestamp in RFC 3339 format

    - `class BetaManagedAgentsMemoryStoreResource:`

      A memory store attached to an agent session.

      - `required string MemoryStoreID`

        The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

      - `required Type Type`

        - `"memory_store"MemoryStore`

      - `Access? Access`

        Access mode for an attached memory store.

        - `"read_write"ReadWrite`

        - `"read_only"ReadOnly`

      - `string Description`

        Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.

      - `string? Instructions`

        Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

      - `string? MountPath`

        Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.

      - `string? Name`

        Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.

  - `required BetaManagedAgentsSessionStats Stats`

    Timing statistics for a session.

    - `Double ActiveSeconds`

      Cumulative time in seconds the session spent in running status. Excludes idle time.

    - `Double DurationSeconds`

      Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update.

  - `required Status Status`

    SessionStatus enum

    - `"rescheduling"Rescheduling`

    - `"running"Running`

    - `"idle"Idle`

    - `"terminated"Terminated`

  - `required string? Title`

  - `required Type Type`

    - `"session"Session`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required BetaManagedAgentsSessionUsage Usage`

    Cumulative token usage for a session across all turns.

    - `BetaManagedAgentsCacheCreationUsage CacheCreation`

      Prompt-cache creation token usage broken down by cache lifetime.

      - `Int Ephemeral1hInputTokens`

        Tokens used to create 1-hour ephemeral cache entries.

      - `Int Ephemeral5mInputTokens`

        Tokens used to create 5-minute ephemeral cache entries.

    - `Int CacheReadInputTokens`

      Total tokens read from prompt cache.

    - `Int InputTokens`

      Total input tokens consumed across all turns.

    - `Int OutputTokens`

      Total output tokens generated across all turns.

  - `required IReadOnlyList<string> VaultIds`

    Vault IDs attached to the session at creation. Empty when no vaults were supplied.

### Example

```csharp
SessionCreateParams parameters = new()
{
    Agent = "agent_011CZkYpogX7uDKUyvBTophP",
    EnvironmentID = "env_011CZkZ9X2dpNyB7HsEFoRfW",
};

var betaManagedAgentsSession = await client.Beta.Sessions.Create(parameters);

Console.WriteLine(betaManagedAgentsSession);
```

#### Response

```json
{
  "id": "sesn_011CZkZAtmR3yMPDzynEDxu7",
  "agent": {
    "id": "agent_011CZkYpogX7uDKUyvBTophP",
    "description": "A general-purpose starter agent.",
    "mcp_servers": [
      {
        "name": "example-mcp",
        "type": "url",
        "url": "https://example-server.modelcontextprotocol.io/sse"
      }
    ],
    "model": {
      "id": "claude-sonnet-4-6",
      "speed": "standard"
    },
    "multiagent": {
      "agents": [
        {
          "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
          "description": "A focused research subagent.",
          "mcp_servers": [
            {
              "name": "example-mcp",
              "type": "url",
              "url": "https://example-server.modelcontextprotocol.io/sse"
            }
          ],
          "model": {
            "id": "claude-sonnet-4-6",
            "speed": "standard"
          },
          "name": "Researcher",
          "skills": [
            {
              "skill_id": "xlsx",
              "type": "anthropic",
              "version": "1"
            }
          ],
          "system": "You are a research subagent that gathers and summarises sources for the coordinating agent.",
          "tools": [
            {
              "configs": [
                {
                  "enabled": true,
                  "name": "bash",
                  "permission_policy": {
                    "type": "always_allow"
                  }
                }
              ],
              "default_config": {
                "enabled": true,
                "permission_policy": {
                  "type": "always_ask"
                }
              },
              "type": "agent_toolset_20260401"
            }
          ],
          "type": "agent",
          "version": 1
        }
      ],
      "type": "coordinator"
    },
    "name": "My First Agent",
    "skills": [
      {
        "skill_id": "xlsx",
        "type": "anthropic",
        "version": "1"
      },
      {
        "skill_id": "skill_011CZkZFNu9hAbo3jZPRgTlx",
        "type": "custom",
        "version": "2"
      }
    ],
    "system": "You are a general-purpose agent that can research, write code, run commands, and use connected tools to complete the user's task end to end.",
    "tools": [
      {
        "configs": [
          {
            "enabled": true,
            "name": "bash",
            "permission_policy": {
              "type": "always_allow"
            }
          }
        ],
        "default_config": {
          "enabled": true,
          "permission_policy": {
            "type": "always_ask"
          }
        },
        "type": "agent_toolset_20260401"
      }
    ],
    "type": "agent",
    "version": 1
  },
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "environment_id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
  "metadata": {},
  "outcome_evaluations": [
    {
      "completed_at": "2026-03-15T10:02:31Z",
      "description": "Produce a 2-page summary as summary.md",
      "explanation": "All five sections present with inline citations.",
      "iteration": 0,
      "outcome_id": "outc_011CZkZRSw2kEfs6ncTVljxP",
      "result": "satisfied",
      "type": "outcome_evaluation"
    }
  ],
  "resources": [
    {
      "id": "sesrsc_011CZkZBJq5dWxk9fVLNcPht",
      "created_at": "2026-03-15T10:00:00Z",
      "file_id": "file_011CNha8iCJcU1wXNR6q4V8w",
      "mount_path": "/uploads/receipt.pdf",
      "type": "file",
      "updated_at": "2026-03-15T10:00:00Z"
    },
    {
      "id": "sesrsc_011CZkZCKr6eXyl0gWMOdQiu",
      "created_at": "2026-03-15T10:00:00Z",
      "mount_path": "/workspace/example-repo",
      "type": "github_repository",
      "updated_at": "2026-03-15T10:00:00Z",
      "url": "https://github.com/example-org/example-repo",
      "checkout": {
        "name": "main",
        "type": "branch"
      }
    }
  ],
  "stats": {
    "active_seconds": 0,
    "duration_seconds": 0
  },
  "status": "idle",
  "title": "Order #1234 inquiry",
  "type": "session",
  "updated_at": "2026-03-15T10:00:00Z",
  "usage": {
    "cache_creation": {
      "ephemeral_1h_input_tokens": 0,
      "ephemeral_5m_input_tokens": 0
    },
    "cache_read_input_tokens": 0,
    "input_tokens": 0,
    "output_tokens": 0
  },
  "vault_ids": [
    "vlt_011CZkZDLs7fYzm1hXNPeRjv"
  ]
}
```

## List Sessions

`SessionListPageResponse Beta.Sessions.List(SessionListParams?parameters, CancellationTokencancellationToken = default)`

**get** `/v1/sessions`

List Sessions

### Parameters

- `SessionListParams parameters`

  - `string agentID`

    Query param: Filter sessions created with this agent ID.

  - `Int agentVersion`

    Query param: Filter by agent version. Only applies when agent_id is also set.

  - `DateTimeOffset createdAtGt`

    Query param: Return sessions created after this time (exclusive).

  - `DateTimeOffset createdAtGte`

    Query param: Return sessions created at or after this time (inclusive).

  - `DateTimeOffset createdAtLt`

    Query param: Return sessions created before this time (exclusive).

  - `DateTimeOffset createdAtLte`

    Query param: Return sessions created at or before this time (inclusive).

  - `Boolean includeArchived`

    Query param: When true, includes archived sessions. Default: false (exclude archived).

  - `Int limit`

    Query param: Maximum number of results to return.

  - `string memoryStoreID`

    Query param: Filter sessions whose resources contain a memory_store with this memory store ID.

  - `Order order`

    Query param: Sort direction for results, ordered by created_at. Defaults to desc (newest first).

    - `"asc"Asc`

    - `"desc"Desc`

  - `string page`

    Query param: Opaque pagination cursor from a previous response's next_page.

  - `IReadOnlyList<Status> statuses`

    Query param: Filter by session status. Repeat the parameter to match any of multiple statuses.

    - `"rescheduling"Rescheduling`

    - `"running"Running`

    - `"idle"Idle`

    - `"terminated"Terminated`

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class SessionListPageResponse:`

  Paginated list of sessions.

  - `IReadOnlyList<BetaManagedAgentsSession> Data`

    List of sessions.

    - `required string ID`

    - `required BetaManagedAgentsSessionAgent Agent`

      Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

      - `required string ID`

      - `required string? Description`

      - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

        - `required string Name`

        - `required Type Type`

          - `"url"Url`

        - `required string Url`

      - `required BetaManagedAgentsModelConfig Model`

        Model identifier and configuration.

        - `required BetaManagedAgentsModel ID`

          The model that will power your agent.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `"claude-opus-4-8"ClaudeOpus4_8`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-7"ClaudeOpus4_7`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-6"ClaudeOpus4_6`

            Most intelligent model for building agents and coding

          - `"claude-sonnet-4-6"ClaudeSonnet4_6`

            Best combination of speed and intelligence

          - `"claude-haiku-4-5"ClaudeHaiku4_5`

            Fastest model with near-frontier intelligence

          - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

            Fastest model with near-frontier intelligence

          - `"claude-opus-4-5"ClaudeOpus4_5`

            Premium model combining maximum intelligence with practical performance

          - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

            Premium model combining maximum intelligence with practical performance

          - `"claude-sonnet-4-5"ClaudeSonnet4_5`

            High-performance model for agents and coding

          - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

            High-performance model for agents and coding

        - `Speed Speed`

          Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

          - `"standard"Standard`

          - `"fast"Fast`

      - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

        Resolved coordinator topology with full agent definitions for each roster member.

        - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

          Full `agent` definitions the coordinator may spawn as session threads.

          - `required string ID`

          - `required string? Description`

          - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

            - `required string Name`

            - `required Type Type`

            - `required string Url`

          - `required BetaManagedAgentsModelConfig Model`

            Model identifier and configuration.

          - `required string Name`

          - `required IReadOnlyList<Skill> Skills`

            - `class BetaManagedAgentsAnthropicSkill:`

              A resolved Anthropic-managed skill.

              - `required string SkillID`

              - `required Type Type`

                - `"anthropic"Anthropic`

              - `required string Version`

            - `class BetaManagedAgentsCustomSkill:`

              A resolved user-created custom skill.

              - `required string SkillID`

              - `required Type Type`

                - `"custom"Custom`

              - `required string Version`

          - `required string? System`

          - `required IReadOnlyList<Tool> Tools`

            - `class BetaManagedAgentsAgentToolset20260401:`

              - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

                - `required Boolean Enabled`

                - `required Name Name`

                  Built-in agent tool identifier.

                  - `"bash"Bash`

                  - `"edit"Edit`

                  - `"read"Read`

                  - `"write"Write`

                  - `"glob"Glob`

                  - `"grep"Grep`

                  - `"web_fetch"WebFetch`

                  - `"web_search"WebSearch`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                    - `required Type Type`

                      - `"always_allow"AlwaysAllow`

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

                    - `required Type Type`

                      - `"always_ask"AlwaysAsk`

              - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

                Resolved default configuration for agent tools.

                - `required Boolean Enabled`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required Type Type`

                - `"agent_toolset_20260401"AgentToolset20260401`

            - `class BetaManagedAgentsMcpToolset:`

              - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

                - `required Boolean Enabled`

                - `required string Name`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

                Resolved default configuration for all tools from an MCP server.

                - `required Boolean Enabled`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required string McpServerName`

              - `required Type Type`

                - `"mcp_toolset"McpToolset`

            - `class BetaManagedAgentsCustomTool:`

              A custom tool as returned in API responses.

              - `required string Description`

              - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

                JSON Schema for custom tool input parameters.

                - `IReadOnlyDictionary<string, JsonElement>? Properties`

                  JSON Schema properties defining the tool's input parameters.

                - `IReadOnlyList<string> Required`

                  List of required property names.

                - `Type Type`

                  Must be 'object' for tool input schemas.

                  - `"object"Object`

              - `required string Name`

              - `required Type Type`

                - `"custom"Custom`

          - `required Type Type`

            - `"agent"Agent`

          - `required Int Version`

        - `required Type Type`

          - `"coordinator"Coordinator`

      - `required string Name`

      - `required IReadOnlyList<Skill> Skills`

        - `class BetaManagedAgentsAnthropicSkill:`

          A resolved Anthropic-managed skill.

        - `class BetaManagedAgentsCustomSkill:`

          A resolved user-created custom skill.

      - `required string? System`

      - `required IReadOnlyList<Tool> Tools`

        - `class BetaManagedAgentsAgentToolset20260401:`

        - `class BetaManagedAgentsMcpToolset:`

        - `class BetaManagedAgentsCustomTool:`

          A custom tool as returned in API responses.

      - `required Type Type`

        - `"agent"Agent`

      - `required Int Version`

    - `required DateTimeOffset? ArchivedAt`

      A timestamp in RFC 3339 format

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string EnvironmentID`

    - `required IReadOnlyDictionary<string, string> Metadata`

    - `required IReadOnlyList<BetaManagedAgentsOutcomeEvaluationResource> OutcomeEvaluations`

      Per-outcome evaluation state. One entry per define_outcome event sent to the session.

      - `required DateTimeOffset? CompletedAt`

        A timestamp in RFC 3339 format

      - `required string Description`

        What the agent should produce.

      - `required string? Explanation`

        Grader's verdict text from the most recent evaluation. For satisfied, explains why criteria are met; for needs_revision (intermediate), what's missing; for failed, why unrecoverable.

      - `required Int Iteration`

        0-indexed revision cycle the outcome is currently on.

      - `required string OutcomeID`

        Server-generated outc_ ID for this outcome.

      - `required string Result`

        Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal.

      - `required Type Type`

        - `"outcome_evaluation"OutcomeEvaluation`

    - `required IReadOnlyList<BetaManagedAgentsSessionResource> Resources`

      - `class BetaManagedAgentsGitHubRepositoryResource:`

        - `required string ID`

        - `required DateTimeOffset CreatedAt`

          A timestamp in RFC 3339 format

        - `required string MountPath`

        - `required Type Type`

          - `"github_repository"GitHubRepository`

        - `required DateTimeOffset UpdatedAt`

          A timestamp in RFC 3339 format

        - `required string Url`

        - `Checkout? Checkout`

          - `class BetaManagedAgentsBranchCheckout:`

            - `required string Name`

              Branch name to check out.

            - `required Type Type`

              - `"branch"Branch`

          - `class BetaManagedAgentsCommitCheckout:`

            - `required string Sha`

              Full commit SHA to check out.

            - `required Type Type`

              - `"commit"Commit`

      - `class BetaManagedAgentsFileResource:`

        - `required string ID`

        - `required DateTimeOffset CreatedAt`

          A timestamp in RFC 3339 format

        - `required string FileID`

        - `required string MountPath`

        - `required Type Type`

          - `"file"File`

        - `required DateTimeOffset UpdatedAt`

          A timestamp in RFC 3339 format

      - `class BetaManagedAgentsMemoryStoreResource:`

        A memory store attached to an agent session.

        - `required string MemoryStoreID`

          The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

        - `required Type Type`

          - `"memory_store"MemoryStore`

        - `Access? Access`

          Access mode for an attached memory store.

          - `"read_write"ReadWrite`

          - `"read_only"ReadOnly`

        - `string Description`

          Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.

        - `string? Instructions`

          Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

        - `string? MountPath`

          Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.

        - `string? Name`

          Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.

    - `required BetaManagedAgentsSessionStats Stats`

      Timing statistics for a session.

      - `Double ActiveSeconds`

        Cumulative time in seconds the session spent in running status. Excludes idle time.

      - `Double DurationSeconds`

        Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update.

    - `required Status Status`

      SessionStatus enum

      - `"rescheduling"Rescheduling`

      - `"running"Running`

      - `"idle"Idle`

      - `"terminated"Terminated`

    - `required string? Title`

    - `required Type Type`

      - `"session"Session`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

    - `required BetaManagedAgentsSessionUsage Usage`

      Cumulative token usage for a session across all turns.

      - `BetaManagedAgentsCacheCreationUsage CacheCreation`

        Prompt-cache creation token usage broken down by cache lifetime.

        - `Int Ephemeral1hInputTokens`

          Tokens used to create 1-hour ephemeral cache entries.

        - `Int Ephemeral5mInputTokens`

          Tokens used to create 5-minute ephemeral cache entries.

      - `Int CacheReadInputTokens`

        Total tokens read from prompt cache.

      - `Int InputTokens`

        Total input tokens consumed across all turns.

      - `Int OutputTokens`

        Total output tokens generated across all turns.

    - `required IReadOnlyList<string> VaultIds`

      Vault IDs attached to the session at creation. Empty when no vaults were supplied.

  - `string? NextPage`

    Opaque cursor for the next page. Null when no more results.

### Example

```csharp
SessionListParams parameters = new();

var page = await client.Beta.Sessions.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "sesn_011CZkZAtmR3yMPDzynEDxu7",
      "agent": {
        "id": "agent_011CZkYpogX7uDKUyvBTophP",
        "description": "A general-purpose starter agent.",
        "mcp_servers": [
          {
            "name": "example-mcp",
            "type": "url",
            "url": "https://example-server.modelcontextprotocol.io/sse"
          }
        ],
        "model": {
          "id": "claude-sonnet-4-6",
          "speed": "standard"
        },
        "multiagent": {
          "agents": [
            {
              "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
              "description": "A focused research subagent.",
              "mcp_servers": [
                {
                  "name": "example-mcp",
                  "type": "url",
                  "url": "https://example-server.modelcontextprotocol.io/sse"
                }
              ],
              "model": {
                "id": "claude-sonnet-4-6",
                "speed": "standard"
              },
              "name": "Researcher",
              "skills": [
                {
                  "skill_id": "xlsx",
                  "type": "anthropic",
                  "version": "1"
                }
              ],
              "system": "You are a research subagent that gathers and summarises sources for the coordinating agent.",
              "tools": [
                {
                  "configs": [
                    {
                      "enabled": true,
                      "name": "bash",
                      "permission_policy": {
                        "type": "always_allow"
                      }
                    }
                  ],
                  "default_config": {
                    "enabled": true,
                    "permission_policy": {
                      "type": "always_ask"
                    }
                  },
                  "type": "agent_toolset_20260401"
                }
              ],
              "type": "agent",
              "version": 1
            }
          ],
          "type": "coordinator"
        },
        "name": "My First Agent",
        "skills": [
          {
            "skill_id": "xlsx",
            "type": "anthropic",
            "version": "1"
          },
          {
            "skill_id": "skill_011CZkZFNu9hAbo3jZPRgTlx",
            "type": "custom",
            "version": "2"
          }
        ],
        "system": "You are a general-purpose agent that can research, write code, run commands, and use connected tools to complete the user's task end to end.",
        "tools": [
          {
            "configs": [
              {
                "enabled": true,
                "name": "bash",
                "permission_policy": {
                  "type": "always_allow"
                }
              }
            ],
            "default_config": {
              "enabled": true,
              "permission_policy": {
                "type": "always_ask"
              }
            },
            "type": "agent_toolset_20260401"
          }
        ],
        "type": "agent",
        "version": 1
      },
      "archived_at": null,
      "created_at": "2026-03-15T10:00:00Z",
      "environment_id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
      "metadata": {},
      "outcome_evaluations": [
        {
          "completed_at": "2026-03-15T10:02:31Z",
          "description": "Produce a 2-page summary as summary.md",
          "explanation": "All five sections present with inline citations.",
          "iteration": 0,
          "outcome_id": "outc_011CZkZRSw2kEfs6ncTVljxP",
          "result": "satisfied",
          "type": "outcome_evaluation"
        }
      ],
      "resources": [
        {
          "id": "sesrsc_011CZkZBJq5dWxk9fVLNcPht",
          "created_at": "2026-03-15T10:00:00Z",
          "file_id": "file_011CNha8iCJcU1wXNR6q4V8w",
          "mount_path": "/uploads/receipt.pdf",
          "type": "file",
          "updated_at": "2026-03-15T10:00:00Z"
        },
        {
          "id": "sesrsc_011CZkZCKr6eXyl0gWMOdQiu",
          "created_at": "2026-03-15T10:00:00Z",
          "mount_path": "/workspace/example-repo",
          "type": "github_repository",
          "updated_at": "2026-03-15T10:00:00Z",
          "url": "https://github.com/example-org/example-repo",
          "checkout": {
            "name": "main",
            "type": "branch"
          }
        }
      ],
      "stats": {
        "active_seconds": 0,
        "duration_seconds": 0
      },
      "status": "idle",
      "title": "Order #1234 inquiry",
      "type": "session",
      "updated_at": "2026-03-15T10:00:00Z",
      "usage": {
        "cache_creation": {
          "ephemeral_1h_input_tokens": 0,
          "ephemeral_5m_input_tokens": 0
        },
        "cache_read_input_tokens": 0,
        "input_tokens": 0,
        "output_tokens": 0
      },
      "vault_ids": [
        "vlt_011CZkZDLs7fYzm1hXNPeRjv"
      ]
    }
  ],
  "next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo="
}
```

## Get Session

`BetaManagedAgentsSession Beta.Sessions.Retrieve(SessionRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/sessions/{session_id}`

Get Session

### Parameters

- `SessionRetrieveParams parameters`

  - `required string sessionID`

    Path parameter session_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsSession:`

  A Managed Agents `session`.

  - `required string ID`

  - `required BetaManagedAgentsSessionAgent Agent`

    Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

    - `required string ID`

    - `required string? Description`

    - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

      - `required string Name`

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

    - `required BetaManagedAgentsModelConfig Model`

      Model identifier and configuration.

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

    - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

      Resolved coordinator topology with full agent definitions for each roster member.

      - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

        Full `agent` definitions the coordinator may spawn as session threads.

        - `required string ID`

        - `required string? Description`

        - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

          - `required string Name`

          - `required Type Type`

          - `required string Url`

        - `required BetaManagedAgentsModelConfig Model`

          Model identifier and configuration.

        - `required string Name`

        - `required IReadOnlyList<Skill> Skills`

          - `class BetaManagedAgentsAnthropicSkill:`

            A resolved Anthropic-managed skill.

            - `required string SkillID`

            - `required Type Type`

              - `"anthropic"Anthropic`

            - `required string Version`

          - `class BetaManagedAgentsCustomSkill:`

            A resolved user-created custom skill.

            - `required string SkillID`

            - `required Type Type`

              - `"custom"Custom`

            - `required string Version`

        - `required string? System`

        - `required IReadOnlyList<Tool> Tools`

          - `class BetaManagedAgentsAgentToolset20260401:`

            - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

              - `required Boolean Enabled`

              - `required Name Name`

                Built-in agent tool identifier.

                - `"bash"Bash`

                - `"edit"Edit`

                - `"read"Read`

                - `"write"Write`

                - `"glob"Glob`

                - `"grep"Grep`

                - `"web_fetch"WebFetch`

                - `"web_search"WebSearch`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                  - `required Type Type`

                    - `"always_allow"AlwaysAllow`

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

                  - `required Type Type`

                    - `"always_ask"AlwaysAsk`

            - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

              Resolved default configuration for agent tools.

              - `required Boolean Enabled`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"agent_toolset_20260401"AgentToolset20260401`

          - `class BetaManagedAgentsMcpToolset:`

            - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

              - `required Boolean Enabled`

              - `required string Name`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

              Resolved default configuration for all tools from an MCP server.

              - `required Boolean Enabled`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required string McpServerName`

            - `required Type Type`

              - `"mcp_toolset"McpToolset`

          - `class BetaManagedAgentsCustomTool:`

            A custom tool as returned in API responses.

            - `required string Description`

            - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

              JSON Schema for custom tool input parameters.

              - `IReadOnlyDictionary<string, JsonElement>? Properties`

                JSON Schema properties defining the tool's input parameters.

              - `IReadOnlyList<string> Required`

                List of required property names.

              - `Type Type`

                Must be 'object' for tool input schemas.

                - `"object"Object`

            - `required string Name`

            - `required Type Type`

              - `"custom"Custom`

        - `required Type Type`

          - `"agent"Agent`

        - `required Int Version`

      - `required Type Type`

        - `"coordinator"Coordinator`

    - `required string Name`

    - `required IReadOnlyList<Skill> Skills`

      - `class BetaManagedAgentsAnthropicSkill:`

        A resolved Anthropic-managed skill.

      - `class BetaManagedAgentsCustomSkill:`

        A resolved user-created custom skill.

    - `required string? System`

    - `required IReadOnlyList<Tool> Tools`

      - `class BetaManagedAgentsAgentToolset20260401:`

      - `class BetaManagedAgentsMcpToolset:`

      - `class BetaManagedAgentsCustomTool:`

        A custom tool as returned in API responses.

    - `required Type Type`

      - `"agent"Agent`

    - `required Int Version`

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string EnvironmentID`

  - `required IReadOnlyDictionary<string, string> Metadata`

  - `required IReadOnlyList<BetaManagedAgentsOutcomeEvaluationResource> OutcomeEvaluations`

    Per-outcome evaluation state. One entry per define_outcome event sent to the session.

    - `required DateTimeOffset? CompletedAt`

      A timestamp in RFC 3339 format

    - `required string Description`

      What the agent should produce.

    - `required string? Explanation`

      Grader's verdict text from the most recent evaluation. For satisfied, explains why criteria are met; for needs_revision (intermediate), what's missing; for failed, why unrecoverable.

    - `required Int Iteration`

      0-indexed revision cycle the outcome is currently on.

    - `required string OutcomeID`

      Server-generated outc_ ID for this outcome.

    - `required string Result`

      Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal.

    - `required Type Type`

      - `"outcome_evaluation"OutcomeEvaluation`

  - `required IReadOnlyList<BetaManagedAgentsSessionResource> Resources`

    - `class BetaManagedAgentsGitHubRepositoryResource:`

      - `required string ID`

      - `required DateTimeOffset CreatedAt`

        A timestamp in RFC 3339 format

      - `required string MountPath`

      - `required Type Type`

        - `"github_repository"GitHubRepository`

      - `required DateTimeOffset UpdatedAt`

        A timestamp in RFC 3339 format

      - `required string Url`

      - `Checkout? Checkout`

        - `class BetaManagedAgentsBranchCheckout:`

          - `required string Name`

            Branch name to check out.

          - `required Type Type`

            - `"branch"Branch`

        - `class BetaManagedAgentsCommitCheckout:`

          - `required string Sha`

            Full commit SHA to check out.

          - `required Type Type`

            - `"commit"Commit`

    - `class BetaManagedAgentsFileResource:`

      - `required string ID`

      - `required DateTimeOffset CreatedAt`

        A timestamp in RFC 3339 format

      - `required string FileID`

      - `required string MountPath`

      - `required Type Type`

        - `"file"File`

      - `required DateTimeOffset UpdatedAt`

        A timestamp in RFC 3339 format

    - `class BetaManagedAgentsMemoryStoreResource:`

      A memory store attached to an agent session.

      - `required string MemoryStoreID`

        The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

      - `required Type Type`

        - `"memory_store"MemoryStore`

      - `Access? Access`

        Access mode for an attached memory store.

        - `"read_write"ReadWrite`

        - `"read_only"ReadOnly`

      - `string Description`

        Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.

      - `string? Instructions`

        Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

      - `string? MountPath`

        Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.

      - `string? Name`

        Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.

  - `required BetaManagedAgentsSessionStats Stats`

    Timing statistics for a session.

    - `Double ActiveSeconds`

      Cumulative time in seconds the session spent in running status. Excludes idle time.

    - `Double DurationSeconds`

      Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update.

  - `required Status Status`

    SessionStatus enum

    - `"rescheduling"Rescheduling`

    - `"running"Running`

    - `"idle"Idle`

    - `"terminated"Terminated`

  - `required string? Title`

  - `required Type Type`

    - `"session"Session`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required BetaManagedAgentsSessionUsage Usage`

    Cumulative token usage for a session across all turns.

    - `BetaManagedAgentsCacheCreationUsage CacheCreation`

      Prompt-cache creation token usage broken down by cache lifetime.

      - `Int Ephemeral1hInputTokens`

        Tokens used to create 1-hour ephemeral cache entries.

      - `Int Ephemeral5mInputTokens`

        Tokens used to create 5-minute ephemeral cache entries.

    - `Int CacheReadInputTokens`

      Total tokens read from prompt cache.

    - `Int InputTokens`

      Total input tokens consumed across all turns.

    - `Int OutputTokens`

      Total output tokens generated across all turns.

  - `required IReadOnlyList<string> VaultIds`

    Vault IDs attached to the session at creation. Empty when no vaults were supplied.

### Example

```csharp
SessionRetrieveParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7"
};

var betaManagedAgentsSession = await client.Beta.Sessions.Retrieve(parameters);

Console.WriteLine(betaManagedAgentsSession);
```

#### Response

```json
{
  "id": "sesn_011CZkZAtmR3yMPDzynEDxu7",
  "agent": {
    "id": "agent_011CZkYpogX7uDKUyvBTophP",
    "description": "A general-purpose starter agent.",
    "mcp_servers": [
      {
        "name": "example-mcp",
        "type": "url",
        "url": "https://example-server.modelcontextprotocol.io/sse"
      }
    ],
    "model": {
      "id": "claude-sonnet-4-6",
      "speed": "standard"
    },
    "multiagent": {
      "agents": [
        {
          "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
          "description": "A focused research subagent.",
          "mcp_servers": [
            {
              "name": "example-mcp",
              "type": "url",
              "url": "https://example-server.modelcontextprotocol.io/sse"
            }
          ],
          "model": {
            "id": "claude-sonnet-4-6",
            "speed": "standard"
          },
          "name": "Researcher",
          "skills": [
            {
              "skill_id": "xlsx",
              "type": "anthropic",
              "version": "1"
            }
          ],
          "system": "You are a research subagent that gathers and summarises sources for the coordinating agent.",
          "tools": [
            {
              "configs": [
                {
                  "enabled": true,
                  "name": "bash",
                  "permission_policy": {
                    "type": "always_allow"
                  }
                }
              ],
              "default_config": {
                "enabled": true,
                "permission_policy": {
                  "type": "always_ask"
                }
              },
              "type": "agent_toolset_20260401"
            }
          ],
          "type": "agent",
          "version": 1
        }
      ],
      "type": "coordinator"
    },
    "name": "My First Agent",
    "skills": [
      {
        "skill_id": "xlsx",
        "type": "anthropic",
        "version": "1"
      },
      {
        "skill_id": "skill_011CZkZFNu9hAbo3jZPRgTlx",
        "type": "custom",
        "version": "2"
      }
    ],
    "system": "You are a general-purpose agent that can research, write code, run commands, and use connected tools to complete the user's task end to end.",
    "tools": [
      {
        "configs": [
          {
            "enabled": true,
            "name": "bash",
            "permission_policy": {
              "type": "always_allow"
            }
          }
        ],
        "default_config": {
          "enabled": true,
          "permission_policy": {
            "type": "always_ask"
          }
        },
        "type": "agent_toolset_20260401"
      }
    ],
    "type": "agent",
    "version": 1
  },
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "environment_id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
  "metadata": {},
  "outcome_evaluations": [
    {
      "completed_at": "2026-03-15T10:02:31Z",
      "description": "Produce a 2-page summary as summary.md",
      "explanation": "All five sections present with inline citations.",
      "iteration": 0,
      "outcome_id": "outc_011CZkZRSw2kEfs6ncTVljxP",
      "result": "satisfied",
      "type": "outcome_evaluation"
    }
  ],
  "resources": [
    {
      "id": "sesrsc_011CZkZBJq5dWxk9fVLNcPht",
      "created_at": "2026-03-15T10:00:00Z",
      "file_id": "file_011CNha8iCJcU1wXNR6q4V8w",
      "mount_path": "/uploads/receipt.pdf",
      "type": "file",
      "updated_at": "2026-03-15T10:00:00Z"
    },
    {
      "id": "sesrsc_011CZkZCKr6eXyl0gWMOdQiu",
      "created_at": "2026-03-15T10:00:00Z",
      "mount_path": "/workspace/example-repo",
      "type": "github_repository",
      "updated_at": "2026-03-15T10:00:00Z",
      "url": "https://github.com/example-org/example-repo",
      "checkout": {
        "name": "main",
        "type": "branch"
      }
    }
  ],
  "stats": {
    "active_seconds": 0,
    "duration_seconds": 0
  },
  "status": "idle",
  "title": "Order #1234 inquiry",
  "type": "session",
  "updated_at": "2026-03-15T10:00:00Z",
  "usage": {
    "cache_creation": {
      "ephemeral_1h_input_tokens": 0,
      "ephemeral_5m_input_tokens": 0
    },
    "cache_read_input_tokens": 0,
    "input_tokens": 0,
    "output_tokens": 0
  },
  "vault_ids": [
    "vlt_011CZkZDLs7fYzm1hXNPeRjv"
  ]
}
```

## Update Session

`BetaManagedAgentsSession Beta.Sessions.Update(SessionUpdateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/sessions/{session_id}`

Update Session

### Parameters

- `SessionUpdateParams parameters`

  - `required string sessionID`

    Path param: Path parameter session_id

  - `BetaManagedAgentsSessionAgentUpdate agent`

    Body param: Mid-session agent configuration update. Only `tools` and `mcp_servers` are updatable. Full replacement: the provided array becomes the new value. To preserve existing entries, GET the session, modify the array, and POST it back.

  - `IReadOnlyDictionary<string, string>? metadata`

    Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve.

  - `string? title`

    Body param: Human-readable session title.

  - `IReadOnlyList<string> vaultIds`

    Body param: Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsSession:`

  A Managed Agents `session`.

  - `required string ID`

  - `required BetaManagedAgentsSessionAgent Agent`

    Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

    - `required string ID`

    - `required string? Description`

    - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

      - `required string Name`

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

    - `required BetaManagedAgentsModelConfig Model`

      Model identifier and configuration.

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

    - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

      Resolved coordinator topology with full agent definitions for each roster member.

      - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

        Full `agent` definitions the coordinator may spawn as session threads.

        - `required string ID`

        - `required string? Description`

        - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

          - `required string Name`

          - `required Type Type`

          - `required string Url`

        - `required BetaManagedAgentsModelConfig Model`

          Model identifier and configuration.

        - `required string Name`

        - `required IReadOnlyList<Skill> Skills`

          - `class BetaManagedAgentsAnthropicSkill:`

            A resolved Anthropic-managed skill.

            - `required string SkillID`

            - `required Type Type`

              - `"anthropic"Anthropic`

            - `required string Version`

          - `class BetaManagedAgentsCustomSkill:`

            A resolved user-created custom skill.

            - `required string SkillID`

            - `required Type Type`

              - `"custom"Custom`

            - `required string Version`

        - `required string? System`

        - `required IReadOnlyList<Tool> Tools`

          - `class BetaManagedAgentsAgentToolset20260401:`

            - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

              - `required Boolean Enabled`

              - `required Name Name`

                Built-in agent tool identifier.

                - `"bash"Bash`

                - `"edit"Edit`

                - `"read"Read`

                - `"write"Write`

                - `"glob"Glob`

                - `"grep"Grep`

                - `"web_fetch"WebFetch`

                - `"web_search"WebSearch`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                  - `required Type Type`

                    - `"always_allow"AlwaysAllow`

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

                  - `required Type Type`

                    - `"always_ask"AlwaysAsk`

            - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

              Resolved default configuration for agent tools.

              - `required Boolean Enabled`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"agent_toolset_20260401"AgentToolset20260401`

          - `class BetaManagedAgentsMcpToolset:`

            - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

              - `required Boolean Enabled`

              - `required string Name`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

              Resolved default configuration for all tools from an MCP server.

              - `required Boolean Enabled`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required string McpServerName`

            - `required Type Type`

              - `"mcp_toolset"McpToolset`

          - `class BetaManagedAgentsCustomTool:`

            A custom tool as returned in API responses.

            - `required string Description`

            - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

              JSON Schema for custom tool input parameters.

              - `IReadOnlyDictionary<string, JsonElement>? Properties`

                JSON Schema properties defining the tool's input parameters.

              - `IReadOnlyList<string> Required`

                List of required property names.

              - `Type Type`

                Must be 'object' for tool input schemas.

                - `"object"Object`

            - `required string Name`

            - `required Type Type`

              - `"custom"Custom`

        - `required Type Type`

          - `"agent"Agent`

        - `required Int Version`

      - `required Type Type`

        - `"coordinator"Coordinator`

    - `required string Name`

    - `required IReadOnlyList<Skill> Skills`

      - `class BetaManagedAgentsAnthropicSkill:`

        A resolved Anthropic-managed skill.

      - `class BetaManagedAgentsCustomSkill:`

        A resolved user-created custom skill.

    - `required string? System`

    - `required IReadOnlyList<Tool> Tools`

      - `class BetaManagedAgentsAgentToolset20260401:`

      - `class BetaManagedAgentsMcpToolset:`

      - `class BetaManagedAgentsCustomTool:`

        A custom tool as returned in API responses.

    - `required Type Type`

      - `"agent"Agent`

    - `required Int Version`

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string EnvironmentID`

  - `required IReadOnlyDictionary<string, string> Metadata`

  - `required IReadOnlyList<BetaManagedAgentsOutcomeEvaluationResource> OutcomeEvaluations`

    Per-outcome evaluation state. One entry per define_outcome event sent to the session.

    - `required DateTimeOffset? CompletedAt`

      A timestamp in RFC 3339 format

    - `required string Description`

      What the agent should produce.

    - `required string? Explanation`

      Grader's verdict text from the most recent evaluation. For satisfied, explains why criteria are met; for needs_revision (intermediate), what's missing; for failed, why unrecoverable.

    - `required Int Iteration`

      0-indexed revision cycle the outcome is currently on.

    - `required string OutcomeID`

      Server-generated outc_ ID for this outcome.

    - `required string Result`

      Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal.

    - `required Type Type`

      - `"outcome_evaluation"OutcomeEvaluation`

  - `required IReadOnlyList<BetaManagedAgentsSessionResource> Resources`

    - `class BetaManagedAgentsGitHubRepositoryResource:`

      - `required string ID`

      - `required DateTimeOffset CreatedAt`

        A timestamp in RFC 3339 format

      - `required string MountPath`

      - `required Type Type`

        - `"github_repository"GitHubRepository`

      - `required DateTimeOffset UpdatedAt`

        A timestamp in RFC 3339 format

      - `required string Url`

      - `Checkout? Checkout`

        - `class BetaManagedAgentsBranchCheckout:`

          - `required string Name`

            Branch name to check out.

          - `required Type Type`

            - `"branch"Branch`

        - `class BetaManagedAgentsCommitCheckout:`

          - `required string Sha`

            Full commit SHA to check out.

          - `required Type Type`

            - `"commit"Commit`

    - `class BetaManagedAgentsFileResource:`

      - `required string ID`

      - `required DateTimeOffset CreatedAt`

        A timestamp in RFC 3339 format

      - `required string FileID`

      - `required string MountPath`

      - `required Type Type`

        - `"file"File`

      - `required DateTimeOffset UpdatedAt`

        A timestamp in RFC 3339 format

    - `class BetaManagedAgentsMemoryStoreResource:`

      A memory store attached to an agent session.

      - `required string MemoryStoreID`

        The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

      - `required Type Type`

        - `"memory_store"MemoryStore`

      - `Access? Access`

        Access mode for an attached memory store.

        - `"read_write"ReadWrite`

        - `"read_only"ReadOnly`

      - `string Description`

        Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.

      - `string? Instructions`

        Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

      - `string? MountPath`

        Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.

      - `string? Name`

        Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.

  - `required BetaManagedAgentsSessionStats Stats`

    Timing statistics for a session.

    - `Double ActiveSeconds`

      Cumulative time in seconds the session spent in running status. Excludes idle time.

    - `Double DurationSeconds`

      Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update.

  - `required Status Status`

    SessionStatus enum

    - `"rescheduling"Rescheduling`

    - `"running"Running`

    - `"idle"Idle`

    - `"terminated"Terminated`

  - `required string? Title`

  - `required Type Type`

    - `"session"Session`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required BetaManagedAgentsSessionUsage Usage`

    Cumulative token usage for a session across all turns.

    - `BetaManagedAgentsCacheCreationUsage CacheCreation`

      Prompt-cache creation token usage broken down by cache lifetime.

      - `Int Ephemeral1hInputTokens`

        Tokens used to create 1-hour ephemeral cache entries.

      - `Int Ephemeral5mInputTokens`

        Tokens used to create 5-minute ephemeral cache entries.

    - `Int CacheReadInputTokens`

      Total tokens read from prompt cache.

    - `Int InputTokens`

      Total input tokens consumed across all turns.

    - `Int OutputTokens`

      Total output tokens generated across all turns.

  - `required IReadOnlyList<string> VaultIds`

    Vault IDs attached to the session at creation. Empty when no vaults were supplied.

### Example

```csharp
SessionUpdateParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7"
};

var betaManagedAgentsSession = await client.Beta.Sessions.Update(parameters);

Console.WriteLine(betaManagedAgentsSession);
```

#### Response

```json
{
  "id": "sesn_011CZkZAtmR3yMPDzynEDxu7",
  "agent": {
    "id": "agent_011CZkYpogX7uDKUyvBTophP",
    "description": "A general-purpose starter agent.",
    "mcp_servers": [
      {
        "name": "example-mcp",
        "type": "url",
        "url": "https://example-server.modelcontextprotocol.io/sse"
      }
    ],
    "model": {
      "id": "claude-sonnet-4-6",
      "speed": "standard"
    },
    "multiagent": {
      "agents": [
        {
          "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
          "description": "A focused research subagent.",
          "mcp_servers": [
            {
              "name": "example-mcp",
              "type": "url",
              "url": "https://example-server.modelcontextprotocol.io/sse"
            }
          ],
          "model": {
            "id": "claude-sonnet-4-6",
            "speed": "standard"
          },
          "name": "Researcher",
          "skills": [
            {
              "skill_id": "xlsx",
              "type": "anthropic",
              "version": "1"
            }
          ],
          "system": "You are a research subagent that gathers and summarises sources for the coordinating agent.",
          "tools": [
            {
              "configs": [
                {
                  "enabled": true,
                  "name": "bash",
                  "permission_policy": {
                    "type": "always_allow"
                  }
                }
              ],
              "default_config": {
                "enabled": true,
                "permission_policy": {
                  "type": "always_ask"
                }
              },
              "type": "agent_toolset_20260401"
            }
          ],
          "type": "agent",
          "version": 1
        }
      ],
      "type": "coordinator"
    },
    "name": "My First Agent",
    "skills": [
      {
        "skill_id": "xlsx",
        "type": "anthropic",
        "version": "1"
      },
      {
        "skill_id": "skill_011CZkZFNu9hAbo3jZPRgTlx",
        "type": "custom",
        "version": "2"
      }
    ],
    "system": "You are a general-purpose agent that can research, write code, run commands, and use connected tools to complete the user's task end to end.",
    "tools": [
      {
        "configs": [
          {
            "enabled": true,
            "name": "bash",
            "permission_policy": {
              "type": "always_allow"
            }
          }
        ],
        "default_config": {
          "enabled": true,
          "permission_policy": {
            "type": "always_ask"
          }
        },
        "type": "agent_toolset_20260401"
      }
    ],
    "type": "agent",
    "version": 1
  },
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "environment_id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
  "metadata": {},
  "outcome_evaluations": [
    {
      "completed_at": "2026-03-15T10:02:31Z",
      "description": "Produce a 2-page summary as summary.md",
      "explanation": "All five sections present with inline citations.",
      "iteration": 0,
      "outcome_id": "outc_011CZkZRSw2kEfs6ncTVljxP",
      "result": "satisfied",
      "type": "outcome_evaluation"
    }
  ],
  "resources": [
    {
      "id": "sesrsc_011CZkZBJq5dWxk9fVLNcPht",
      "created_at": "2026-03-15T10:00:00Z",
      "file_id": "file_011CNha8iCJcU1wXNR6q4V8w",
      "mount_path": "/uploads/receipt.pdf",
      "type": "file",
      "updated_at": "2026-03-15T10:00:00Z"
    },
    {
      "id": "sesrsc_011CZkZCKr6eXyl0gWMOdQiu",
      "created_at": "2026-03-15T10:00:00Z",
      "mount_path": "/workspace/example-repo",
      "type": "github_repository",
      "updated_at": "2026-03-15T10:00:00Z",
      "url": "https://github.com/example-org/example-repo",
      "checkout": {
        "name": "main",
        "type": "branch"
      }
    }
  ],
  "stats": {
    "active_seconds": 0,
    "duration_seconds": 0
  },
  "status": "idle",
  "title": "Order #1234 inquiry",
  "type": "session",
  "updated_at": "2026-03-15T10:00:00Z",
  "usage": {
    "cache_creation": {
      "ephemeral_1h_input_tokens": 0,
      "ephemeral_5m_input_tokens": 0
    },
    "cache_read_input_tokens": 0,
    "input_tokens": 0,
    "output_tokens": 0
  },
  "vault_ids": [
    "vlt_011CZkZDLs7fYzm1hXNPeRjv"
  ]
}
```

## Delete Session

`BetaManagedAgentsDeletedSession Beta.Sessions.Delete(SessionDeleteParamsparameters, CancellationTokencancellationToken = default)`

**delete** `/v1/sessions/{session_id}`

Delete Session

### Parameters

- `SessionDeleteParams parameters`

  - `required string sessionID`

    Path parameter session_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsDeletedSession:`

  Confirmation that a `session` has been permanently deleted.

  - `required string ID`

  - `required Type Type`

    - `"session_deleted"SessionDeleted`

### Example

```csharp
SessionDeleteParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7"
};

var betaManagedAgentsDeletedSession = await client.Beta.Sessions.Delete(parameters);

Console.WriteLine(betaManagedAgentsDeletedSession);
```

#### Response

```json
{
  "id": "sesn_011CZkZAtmR3yMPDzynEDxu7",
  "type": "session_deleted"
}
```

## Archive Session

`BetaManagedAgentsSession Beta.Sessions.Archive(SessionArchiveParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/sessions/{session_id}/archive`

Archive Session

### Parameters

- `SessionArchiveParams parameters`

  - `required string sessionID`

    Path parameter session_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsSession:`

  A Managed Agents `session`.

  - `required string ID`

  - `required BetaManagedAgentsSessionAgent Agent`

    Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

    - `required string ID`

    - `required string? Description`

    - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

      - `required string Name`

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

    - `required BetaManagedAgentsModelConfig Model`

      Model identifier and configuration.

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

    - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

      Resolved coordinator topology with full agent definitions for each roster member.

      - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

        Full `agent` definitions the coordinator may spawn as session threads.

        - `required string ID`

        - `required string? Description`

        - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

          - `required string Name`

          - `required Type Type`

          - `required string Url`

        - `required BetaManagedAgentsModelConfig Model`

          Model identifier and configuration.

        - `required string Name`

        - `required IReadOnlyList<Skill> Skills`

          - `class BetaManagedAgentsAnthropicSkill:`

            A resolved Anthropic-managed skill.

            - `required string SkillID`

            - `required Type Type`

              - `"anthropic"Anthropic`

            - `required string Version`

          - `class BetaManagedAgentsCustomSkill:`

            A resolved user-created custom skill.

            - `required string SkillID`

            - `required Type Type`

              - `"custom"Custom`

            - `required string Version`

        - `required string? System`

        - `required IReadOnlyList<Tool> Tools`

          - `class BetaManagedAgentsAgentToolset20260401:`

            - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

              - `required Boolean Enabled`

              - `required Name Name`

                Built-in agent tool identifier.

                - `"bash"Bash`

                - `"edit"Edit`

                - `"read"Read`

                - `"write"Write`

                - `"glob"Glob`

                - `"grep"Grep`

                - `"web_fetch"WebFetch`

                - `"web_search"WebSearch`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                  - `required Type Type`

                    - `"always_allow"AlwaysAllow`

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

                  - `required Type Type`

                    - `"always_ask"AlwaysAsk`

            - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

              Resolved default configuration for agent tools.

              - `required Boolean Enabled`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"agent_toolset_20260401"AgentToolset20260401`

          - `class BetaManagedAgentsMcpToolset:`

            - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

              - `required Boolean Enabled`

              - `required string Name`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

              Resolved default configuration for all tools from an MCP server.

              - `required Boolean Enabled`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required string McpServerName`

            - `required Type Type`

              - `"mcp_toolset"McpToolset`

          - `class BetaManagedAgentsCustomTool:`

            A custom tool as returned in API responses.

            - `required string Description`

            - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

              JSON Schema for custom tool input parameters.

              - `IReadOnlyDictionary<string, JsonElement>? Properties`

                JSON Schema properties defining the tool's input parameters.

              - `IReadOnlyList<string> Required`

                List of required property names.

              - `Type Type`

                Must be 'object' for tool input schemas.

                - `"object"Object`

            - `required string Name`

            - `required Type Type`

              - `"custom"Custom`

        - `required Type Type`

          - `"agent"Agent`

        - `required Int Version`

      - `required Type Type`

        - `"coordinator"Coordinator`

    - `required string Name`

    - `required IReadOnlyList<Skill> Skills`

      - `class BetaManagedAgentsAnthropicSkill:`

        A resolved Anthropic-managed skill.

      - `class BetaManagedAgentsCustomSkill:`

        A resolved user-created custom skill.

    - `required string? System`

    - `required IReadOnlyList<Tool> Tools`

      - `class BetaManagedAgentsAgentToolset20260401:`

      - `class BetaManagedAgentsMcpToolset:`

      - `class BetaManagedAgentsCustomTool:`

        A custom tool as returned in API responses.

    - `required Type Type`

      - `"agent"Agent`

    - `required Int Version`

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string EnvironmentID`

  - `required IReadOnlyDictionary<string, string> Metadata`

  - `required IReadOnlyList<BetaManagedAgentsOutcomeEvaluationResource> OutcomeEvaluations`

    Per-outcome evaluation state. One entry per define_outcome event sent to the session.

    - `required DateTimeOffset? CompletedAt`

      A timestamp in RFC 3339 format

    - `required string Description`

      What the agent should produce.

    - `required string? Explanation`

      Grader's verdict text from the most recent evaluation. For satisfied, explains why criteria are met; for needs_revision (intermediate), what's missing; for failed, why unrecoverable.

    - `required Int Iteration`

      0-indexed revision cycle the outcome is currently on.

    - `required string OutcomeID`

      Server-generated outc_ ID for this outcome.

    - `required string Result`

      Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal.

    - `required Type Type`

      - `"outcome_evaluation"OutcomeEvaluation`

  - `required IReadOnlyList<BetaManagedAgentsSessionResource> Resources`

    - `class BetaManagedAgentsGitHubRepositoryResource:`

      - `required string ID`

      - `required DateTimeOffset CreatedAt`

        A timestamp in RFC 3339 format

      - `required string MountPath`

      - `required Type Type`

        - `"github_repository"GitHubRepository`

      - `required DateTimeOffset UpdatedAt`

        A timestamp in RFC 3339 format

      - `required string Url`

      - `Checkout? Checkout`

        - `class BetaManagedAgentsBranchCheckout:`

          - `required string Name`

            Branch name to check out.

          - `required Type Type`

            - `"branch"Branch`

        - `class BetaManagedAgentsCommitCheckout:`

          - `required string Sha`

            Full commit SHA to check out.

          - `required Type Type`

            - `"commit"Commit`

    - `class BetaManagedAgentsFileResource:`

      - `required string ID`

      - `required DateTimeOffset CreatedAt`

        A timestamp in RFC 3339 format

      - `required string FileID`

      - `required string MountPath`

      - `required Type Type`

        - `"file"File`

      - `required DateTimeOffset UpdatedAt`

        A timestamp in RFC 3339 format

    - `class BetaManagedAgentsMemoryStoreResource:`

      A memory store attached to an agent session.

      - `required string MemoryStoreID`

        The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

      - `required Type Type`

        - `"memory_store"MemoryStore`

      - `Access? Access`

        Access mode for an attached memory store.

        - `"read_write"ReadWrite`

        - `"read_only"ReadOnly`

      - `string Description`

        Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.

      - `string? Instructions`

        Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

      - `string? MountPath`

        Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.

      - `string? Name`

        Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.

  - `required BetaManagedAgentsSessionStats Stats`

    Timing statistics for a session.

    - `Double ActiveSeconds`

      Cumulative time in seconds the session spent in running status. Excludes idle time.

    - `Double DurationSeconds`

      Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update.

  - `required Status Status`

    SessionStatus enum

    - `"rescheduling"Rescheduling`

    - `"running"Running`

    - `"idle"Idle`

    - `"terminated"Terminated`

  - `required string? Title`

  - `required Type Type`

    - `"session"Session`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required BetaManagedAgentsSessionUsage Usage`

    Cumulative token usage for a session across all turns.

    - `BetaManagedAgentsCacheCreationUsage CacheCreation`

      Prompt-cache creation token usage broken down by cache lifetime.

      - `Int Ephemeral1hInputTokens`

        Tokens used to create 1-hour ephemeral cache entries.

      - `Int Ephemeral5mInputTokens`

        Tokens used to create 5-minute ephemeral cache entries.

    - `Int CacheReadInputTokens`

      Total tokens read from prompt cache.

    - `Int InputTokens`

      Total input tokens consumed across all turns.

    - `Int OutputTokens`

      Total output tokens generated across all turns.

  - `required IReadOnlyList<string> VaultIds`

    Vault IDs attached to the session at creation. Empty when no vaults were supplied.

### Example

```csharp
SessionArchiveParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7"
};

var betaManagedAgentsSession = await client.Beta.Sessions.Archive(parameters);

Console.WriteLine(betaManagedAgentsSession);
```

#### Response

```json
{
  "id": "sesn_011CZkZAtmR3yMPDzynEDxu7",
  "agent": {
    "id": "agent_011CZkYpogX7uDKUyvBTophP",
    "description": "A general-purpose starter agent.",
    "mcp_servers": [
      {
        "name": "example-mcp",
        "type": "url",
        "url": "https://example-server.modelcontextprotocol.io/sse"
      }
    ],
    "model": {
      "id": "claude-sonnet-4-6",
      "speed": "standard"
    },
    "multiagent": {
      "agents": [
        {
          "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
          "description": "A focused research subagent.",
          "mcp_servers": [
            {
              "name": "example-mcp",
              "type": "url",
              "url": "https://example-server.modelcontextprotocol.io/sse"
            }
          ],
          "model": {
            "id": "claude-sonnet-4-6",
            "speed": "standard"
          },
          "name": "Researcher",
          "skills": [
            {
              "skill_id": "xlsx",
              "type": "anthropic",
              "version": "1"
            }
          ],
          "system": "You are a research subagent that gathers and summarises sources for the coordinating agent.",
          "tools": [
            {
              "configs": [
                {
                  "enabled": true,
                  "name": "bash",
                  "permission_policy": {
                    "type": "always_allow"
                  }
                }
              ],
              "default_config": {
                "enabled": true,
                "permission_policy": {
                  "type": "always_ask"
                }
              },
              "type": "agent_toolset_20260401"
            }
          ],
          "type": "agent",
          "version": 1
        }
      ],
      "type": "coordinator"
    },
    "name": "My First Agent",
    "skills": [
      {
        "skill_id": "xlsx",
        "type": "anthropic",
        "version": "1"
      },
      {
        "skill_id": "skill_011CZkZFNu9hAbo3jZPRgTlx",
        "type": "custom",
        "version": "2"
      }
    ],
    "system": "You are a general-purpose agent that can research, write code, run commands, and use connected tools to complete the user's task end to end.",
    "tools": [
      {
        "configs": [
          {
            "enabled": true,
            "name": "bash",
            "permission_policy": {
              "type": "always_allow"
            }
          }
        ],
        "default_config": {
          "enabled": true,
          "permission_policy": {
            "type": "always_ask"
          }
        },
        "type": "agent_toolset_20260401"
      }
    ],
    "type": "agent",
    "version": 1
  },
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "environment_id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
  "metadata": {},
  "outcome_evaluations": [
    {
      "completed_at": "2026-03-15T10:02:31Z",
      "description": "Produce a 2-page summary as summary.md",
      "explanation": "All five sections present with inline citations.",
      "iteration": 0,
      "outcome_id": "outc_011CZkZRSw2kEfs6ncTVljxP",
      "result": "satisfied",
      "type": "outcome_evaluation"
    }
  ],
  "resources": [
    {
      "id": "sesrsc_011CZkZBJq5dWxk9fVLNcPht",
      "created_at": "2026-03-15T10:00:00Z",
      "file_id": "file_011CNha8iCJcU1wXNR6q4V8w",
      "mount_path": "/uploads/receipt.pdf",
      "type": "file",
      "updated_at": "2026-03-15T10:00:00Z"
    },
    {
      "id": "sesrsc_011CZkZCKr6eXyl0gWMOdQiu",
      "created_at": "2026-03-15T10:00:00Z",
      "mount_path": "/workspace/example-repo",
      "type": "github_repository",
      "updated_at": "2026-03-15T10:00:00Z",
      "url": "https://github.com/example-org/example-repo",
      "checkout": {
        "name": "main",
        "type": "branch"
      }
    }
  ],
  "stats": {
    "active_seconds": 0,
    "duration_seconds": 0
  },
  "status": "idle",
  "title": "Order #1234 inquiry",
  "type": "session",
  "updated_at": "2026-03-15T10:00:00Z",
  "usage": {
    "cache_creation": {
      "ephemeral_1h_input_tokens": 0,
      "ephemeral_5m_input_tokens": 0
    },
    "cache_read_input_tokens": 0,
    "input_tokens": 0,
    "output_tokens": 0
  },
  "vault_ids": [
    "vlt_011CZkZDLs7fYzm1hXNPeRjv"
  ]
}
```

## Domain Types

### Beta Managed Agents Agent Params

- `class BetaManagedAgentsAgentParams:`

  Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version

  - `required string ID`

    The `agent` ID.

  - `required Type Type`

    - `"agent"Agent`

  - `Int Version`

    The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified.

### Beta Managed Agents Branch Checkout

- `class BetaManagedAgentsBranchCheckout:`

  - `required string Name`

    Branch name to check out.

  - `required Type Type`

    - `"branch"Branch`

### Beta Managed Agents Cache Creation Usage

- `class BetaManagedAgentsCacheCreationUsage:`

  Prompt-cache creation token usage broken down by cache lifetime.

  - `Int Ephemeral1hInputTokens`

    Tokens used to create 1-hour ephemeral cache entries.

  - `Int Ephemeral5mInputTokens`

    Tokens used to create 5-minute ephemeral cache entries.

### Beta Managed Agents Commit Checkout

- `class BetaManagedAgentsCommitCheckout:`

  - `required string Sha`

    Full commit SHA to check out.

  - `required Type Type`

    - `"commit"Commit`

### Beta Managed Agents Deleted Session

- `class BetaManagedAgentsDeletedSession:`

  Confirmation that a `session` has been permanently deleted.

  - `required string ID`

  - `required Type Type`

    - `"session_deleted"SessionDeleted`

### Beta Managed Agents File Resource Params

- `class BetaManagedAgentsFileResourceParams:`

  Mount a file uploaded via the Files API into the session.

  - `required string FileID`

    ID of a previously uploaded file.

  - `required Type Type`

    - `"file"File`

  - `string? MountPath`

    Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.

### Beta Managed Agents GitHub Repository Resource Params

- `class BetaManagedAgentsGitHubRepositoryResourceParams:`

  Mount a GitHub repository into the session's container.

  - `required string AuthorizationToken`

    GitHub authorization token used to clone the repository.

  - `required Type Type`

    - `"github_repository"GitHubRepository`

  - `required string Url`

    Github URL of the repository

  - `Checkout? Checkout`

    Branch or commit to check out. Defaults to the repository's default branch.

    - `class BetaManagedAgentsBranchCheckout:`

      - `required string Name`

        Branch name to check out.

      - `required Type Type`

        - `"branch"Branch`

    - `class BetaManagedAgentsCommitCheckout:`

      - `required string Sha`

        Full commit SHA to check out.

      - `required Type Type`

        - `"commit"Commit`

  - `string? MountPath`

    Mount path in the container. Defaults to `/workspace/<repo-name>`.

### Beta Managed Agents Memory Store Resource Param

- `class BetaManagedAgentsMemoryStoreResourceParam:`

  Parameters for attaching a memory store to an agent session.

  - `required string MemoryStoreID`

    The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

  - `required Type Type`

    - `"memory_store"MemoryStore`

  - `Access? Access`

    Access mode for an attached memory store.

    - `"read_write"ReadWrite`

    - `"read_only"ReadOnly`

  - `string? Instructions`

    Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

### Beta Managed Agents Multiagent

- `class BetaManagedAgentsMultiagent:`

  Resolved coordinator topology with a concrete agent roster.

  - `required IReadOnlyList<BetaManagedAgentsAgentReference> Agents`

    Agents the coordinator may spawn as session threads, each resolved to a specific version.

    - `required string ID`

    - `required Type Type`

      - `"agent"Agent`

    - `required Int Version`

  - `required Type Type`

    - `"coordinator"Coordinator`

### Beta Managed Agents Multiagent Params

- `class BetaManagedAgentsMultiagentParams:`

  A coordinator topology: the session's primary thread orchestrates work by spawning session threads, each running an agent drawn from the `agents` roster.

  - `required IReadOnlyList<BetaManagedAgentsMultiagentRosterEntryParams> Agents`

    Agents the coordinator may spawn as session threads. 1–20 entries. Each entry is an agent ID string, a versioned `{"type":"agent","id","version"}` reference, or `{"type":"self"}` to allow recursive self-invocation. Entries must reference distinct agents (after resolving `self` and string forms); at most one `self`. Referenced agents must exist, must not be archived, and must not themselves have `multiagent` set (depth limit 1).

    - `string`

    - `class BetaManagedAgentsAgentParams:`

      Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version

      - `required string ID`

        The `agent` ID.

      - `required Type Type`

        - `"agent"Agent`

      - `Int Version`

        The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified.

    - `class BetaManagedAgentsMultiagentSelfParams:`

      Sentinel roster entry meaning "the agent that owns this configuration". Resolved server-side to a concrete agent reference.

      - `required Type Type`

        - `"self"Self`

  - `required Type Type`

    - `"coordinator"Coordinator`

### Beta Managed Agents Multiagent Roster Entry Params

- `class BetaManagedAgentsMultiagentRosterEntryParams: A class that can be one of several variants.union`

  An entry in a multiagent roster: an agent ID string, a versioned agent reference, or `self`.

  - `string`

  - `class BetaManagedAgentsAgentParams:`

    Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version

    - `required string ID`

      The `agent` ID.

    - `required Type Type`

      - `"agent"Agent`

    - `Int Version`

      The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified.

  - `class BetaManagedAgentsMultiagentSelfParams:`

    Sentinel roster entry meaning "the agent that owns this configuration". Resolved server-side to a concrete agent reference.

    - `required Type Type`

      - `"self"Self`

### Beta Managed Agents Outcome Evaluation Resource

- `class BetaManagedAgentsOutcomeEvaluationResource:`

  Evaluation state for a single outcome defined via a define_outcome event.

  - `required DateTimeOffset? CompletedAt`

    A timestamp in RFC 3339 format

  - `required string Description`

    What the agent should produce.

  - `required string? Explanation`

    Grader's verdict text from the most recent evaluation. For satisfied, explains why criteria are met; for needs_revision (intermediate), what's missing; for failed, why unrecoverable.

  - `required Int Iteration`

    0-indexed revision cycle the outcome is currently on.

  - `required string OutcomeID`

    Server-generated outc_ ID for this outcome.

  - `required string Result`

    Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal.

  - `required Type Type`

    - `"outcome_evaluation"OutcomeEvaluation`

### Beta Managed Agents Session

- `class BetaManagedAgentsSession:`

  A Managed Agents `session`.

  - `required string ID`

  - `required BetaManagedAgentsSessionAgent Agent`

    Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

    - `required string ID`

    - `required string? Description`

    - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

      - `required string Name`

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

    - `required BetaManagedAgentsModelConfig Model`

      Model identifier and configuration.

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

    - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

      Resolved coordinator topology with full agent definitions for each roster member.

      - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

        Full `agent` definitions the coordinator may spawn as session threads.

        - `required string ID`

        - `required string? Description`

        - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

          - `required string Name`

          - `required Type Type`

          - `required string Url`

        - `required BetaManagedAgentsModelConfig Model`

          Model identifier and configuration.

        - `required string Name`

        - `required IReadOnlyList<Skill> Skills`

          - `class BetaManagedAgentsAnthropicSkill:`

            A resolved Anthropic-managed skill.

            - `required string SkillID`

            - `required Type Type`

              - `"anthropic"Anthropic`

            - `required string Version`

          - `class BetaManagedAgentsCustomSkill:`

            A resolved user-created custom skill.

            - `required string SkillID`

            - `required Type Type`

              - `"custom"Custom`

            - `required string Version`

        - `required string? System`

        - `required IReadOnlyList<Tool> Tools`

          - `class BetaManagedAgentsAgentToolset20260401:`

            - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

              - `required Boolean Enabled`

              - `required Name Name`

                Built-in agent tool identifier.

                - `"bash"Bash`

                - `"edit"Edit`

                - `"read"Read`

                - `"write"Write`

                - `"glob"Glob`

                - `"grep"Grep`

                - `"web_fetch"WebFetch`

                - `"web_search"WebSearch`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                  - `required Type Type`

                    - `"always_allow"AlwaysAllow`

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

                  - `required Type Type`

                    - `"always_ask"AlwaysAsk`

            - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

              Resolved default configuration for agent tools.

              - `required Boolean Enabled`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"agent_toolset_20260401"AgentToolset20260401`

          - `class BetaManagedAgentsMcpToolset:`

            - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

              - `required Boolean Enabled`

              - `required string Name`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

              Resolved default configuration for all tools from an MCP server.

              - `required Boolean Enabled`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required string McpServerName`

            - `required Type Type`

              - `"mcp_toolset"McpToolset`

          - `class BetaManagedAgentsCustomTool:`

            A custom tool as returned in API responses.

            - `required string Description`

            - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

              JSON Schema for custom tool input parameters.

              - `IReadOnlyDictionary<string, JsonElement>? Properties`

                JSON Schema properties defining the tool's input parameters.

              - `IReadOnlyList<string> Required`

                List of required property names.

              - `Type Type`

                Must be 'object' for tool input schemas.

                - `"object"Object`

            - `required string Name`

            - `required Type Type`

              - `"custom"Custom`

        - `required Type Type`

          - `"agent"Agent`

        - `required Int Version`

      - `required Type Type`

        - `"coordinator"Coordinator`

    - `required string Name`

    - `required IReadOnlyList<Skill> Skills`

      - `class BetaManagedAgentsAnthropicSkill:`

        A resolved Anthropic-managed skill.

      - `class BetaManagedAgentsCustomSkill:`

        A resolved user-created custom skill.

    - `required string? System`

    - `required IReadOnlyList<Tool> Tools`

      - `class BetaManagedAgentsAgentToolset20260401:`

      - `class BetaManagedAgentsMcpToolset:`

      - `class BetaManagedAgentsCustomTool:`

        A custom tool as returned in API responses.

    - `required Type Type`

      - `"agent"Agent`

    - `required Int Version`

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string EnvironmentID`

  - `required IReadOnlyDictionary<string, string> Metadata`

  - `required IReadOnlyList<BetaManagedAgentsOutcomeEvaluationResource> OutcomeEvaluations`

    Per-outcome evaluation state. One entry per define_outcome event sent to the session.

    - `required DateTimeOffset? CompletedAt`

      A timestamp in RFC 3339 format

    - `required string Description`

      What the agent should produce.

    - `required string? Explanation`

      Grader's verdict text from the most recent evaluation. For satisfied, explains why criteria are met; for needs_revision (intermediate), what's missing; for failed, why unrecoverable.

    - `required Int Iteration`

      0-indexed revision cycle the outcome is currently on.

    - `required string OutcomeID`

      Server-generated outc_ ID for this outcome.

    - `required string Result`

      Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal.

    - `required Type Type`

      - `"outcome_evaluation"OutcomeEvaluation`

  - `required IReadOnlyList<BetaManagedAgentsSessionResource> Resources`

    - `class BetaManagedAgentsGitHubRepositoryResource:`

      - `required string ID`

      - `required DateTimeOffset CreatedAt`

        A timestamp in RFC 3339 format

      - `required string MountPath`

      - `required Type Type`

        - `"github_repository"GitHubRepository`

      - `required DateTimeOffset UpdatedAt`

        A timestamp in RFC 3339 format

      - `required string Url`

      - `Checkout? Checkout`

        - `class BetaManagedAgentsBranchCheckout:`

          - `required string Name`

            Branch name to check out.

          - `required Type Type`

            - `"branch"Branch`

        - `class BetaManagedAgentsCommitCheckout:`

          - `required string Sha`

            Full commit SHA to check out.

          - `required Type Type`

            - `"commit"Commit`

    - `class BetaManagedAgentsFileResource:`

      - `required string ID`

      - `required DateTimeOffset CreatedAt`

        A timestamp in RFC 3339 format

      - `required string FileID`

      - `required string MountPath`

      - `required Type Type`

        - `"file"File`

      - `required DateTimeOffset UpdatedAt`

        A timestamp in RFC 3339 format

    - `class BetaManagedAgentsMemoryStoreResource:`

      A memory store attached to an agent session.

      - `required string MemoryStoreID`

        The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

      - `required Type Type`

        - `"memory_store"MemoryStore`

      - `Access? Access`

        Access mode for an attached memory store.

        - `"read_write"ReadWrite`

        - `"read_only"ReadOnly`

      - `string Description`

        Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.

      - `string? Instructions`

        Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

      - `string? MountPath`

        Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.

      - `string? Name`

        Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.

  - `required BetaManagedAgentsSessionStats Stats`

    Timing statistics for a session.

    - `Double ActiveSeconds`

      Cumulative time in seconds the session spent in running status. Excludes idle time.

    - `Double DurationSeconds`

      Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update.

  - `required Status Status`

    SessionStatus enum

    - `"rescheduling"Rescheduling`

    - `"running"Running`

    - `"idle"Idle`

    - `"terminated"Terminated`

  - `required string? Title`

  - `required Type Type`

    - `"session"Session`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required BetaManagedAgentsSessionUsage Usage`

    Cumulative token usage for a session across all turns.

    - `BetaManagedAgentsCacheCreationUsage CacheCreation`

      Prompt-cache creation token usage broken down by cache lifetime.

      - `Int Ephemeral1hInputTokens`

        Tokens used to create 1-hour ephemeral cache entries.

      - `Int Ephemeral5mInputTokens`

        Tokens used to create 5-minute ephemeral cache entries.

    - `Int CacheReadInputTokens`

      Total tokens read from prompt cache.

    - `Int InputTokens`

      Total input tokens consumed across all turns.

    - `Int OutputTokens`

      Total output tokens generated across all turns.

  - `required IReadOnlyList<string> VaultIds`

    Vault IDs attached to the session at creation. Empty when no vaults were supplied.

### Beta Managed Agents Session Agent

- `class BetaManagedAgentsSessionAgent:`

  Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

  - `required string ID`

  - `required string? Description`

  - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

    - `required string Name`

    - `required Type Type`

      - `"url"Url`

    - `required string Url`

  - `required BetaManagedAgentsModelConfig Model`

    Model identifier and configuration.

    - `required BetaManagedAgentsModel ID`

      The model that will power your agent.

      See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

      - `"claude-opus-4-8"ClaudeOpus4_8`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-7"ClaudeOpus4_7`

        Frontier intelligence for long-running agents and coding

      - `"claude-opus-4-6"ClaudeOpus4_6`

        Most intelligent model for building agents and coding

      - `"claude-sonnet-4-6"ClaudeSonnet4_6`

        Best combination of speed and intelligence

      - `"claude-haiku-4-5"ClaudeHaiku4_5`

        Fastest model with near-frontier intelligence

      - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

        Fastest model with near-frontier intelligence

      - `"claude-opus-4-5"ClaudeOpus4_5`

        Premium model combining maximum intelligence with practical performance

      - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

        Premium model combining maximum intelligence with practical performance

      - `"claude-sonnet-4-5"ClaudeSonnet4_5`

        High-performance model for agents and coding

      - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

        High-performance model for agents and coding

    - `Speed Speed`

      Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

      - `"standard"Standard`

      - `"fast"Fast`

  - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

    Resolved coordinator topology with full agent definitions for each roster member.

    - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

      Full `agent` definitions the coordinator may spawn as session threads.

      - `required string ID`

      - `required string? Description`

      - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

        - `required string Name`

        - `required Type Type`

        - `required string Url`

      - `required BetaManagedAgentsModelConfig Model`

        Model identifier and configuration.

      - `required string Name`

      - `required IReadOnlyList<Skill> Skills`

        - `class BetaManagedAgentsAnthropicSkill:`

          A resolved Anthropic-managed skill.

          - `required string SkillID`

          - `required Type Type`

            - `"anthropic"Anthropic`

          - `required string Version`

        - `class BetaManagedAgentsCustomSkill:`

          A resolved user-created custom skill.

          - `required string SkillID`

          - `required Type Type`

            - `"custom"Custom`

          - `required string Version`

      - `required string? System`

      - `required IReadOnlyList<Tool> Tools`

        - `class BetaManagedAgentsAgentToolset20260401:`

          - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

            - `required Boolean Enabled`

            - `required Name Name`

              Built-in agent tool identifier.

              - `"bash"Bash`

              - `"edit"Edit`

              - `"read"Read`

              - `"write"Write`

              - `"glob"Glob`

              - `"grep"Grep`

              - `"web_fetch"WebFetch`

              - `"web_search"WebSearch`

            - `required PermissionPolicy PermissionPolicy`

              Permission policy for tool execution.

              - `class BetaManagedAgentsAlwaysAllowPolicy:`

                Tool calls are automatically approved without user confirmation.

                - `required Type Type`

                  - `"always_allow"AlwaysAllow`

              - `class BetaManagedAgentsAlwaysAskPolicy:`

                Tool calls require user confirmation before execution.

                - `required Type Type`

                  - `"always_ask"AlwaysAsk`

          - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

            Resolved default configuration for agent tools.

            - `required Boolean Enabled`

            - `required PermissionPolicy PermissionPolicy`

              Permission policy for tool execution.

              - `class BetaManagedAgentsAlwaysAllowPolicy:`

                Tool calls are automatically approved without user confirmation.

              - `class BetaManagedAgentsAlwaysAskPolicy:`

                Tool calls require user confirmation before execution.

          - `required Type Type`

            - `"agent_toolset_20260401"AgentToolset20260401`

        - `class BetaManagedAgentsMcpToolset:`

          - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

            - `required Boolean Enabled`

            - `required string Name`

            - `required PermissionPolicy PermissionPolicy`

              Permission policy for tool execution.

              - `class BetaManagedAgentsAlwaysAllowPolicy:`

                Tool calls are automatically approved without user confirmation.

              - `class BetaManagedAgentsAlwaysAskPolicy:`

                Tool calls require user confirmation before execution.

          - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

            Resolved default configuration for all tools from an MCP server.

            - `required Boolean Enabled`

            - `required PermissionPolicy PermissionPolicy`

              Permission policy for tool execution.

              - `class BetaManagedAgentsAlwaysAllowPolicy:`

                Tool calls are automatically approved without user confirmation.

              - `class BetaManagedAgentsAlwaysAskPolicy:`

                Tool calls require user confirmation before execution.

          - `required string McpServerName`

          - `required Type Type`

            - `"mcp_toolset"McpToolset`

        - `class BetaManagedAgentsCustomTool:`

          A custom tool as returned in API responses.

          - `required string Description`

          - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

            JSON Schema for custom tool input parameters.

            - `IReadOnlyDictionary<string, JsonElement>? Properties`

              JSON Schema properties defining the tool's input parameters.

            - `IReadOnlyList<string> Required`

              List of required property names.

            - `Type Type`

              Must be 'object' for tool input schemas.

              - `"object"Object`

          - `required string Name`

          - `required Type Type`

            - `"custom"Custom`

      - `required Type Type`

        - `"agent"Agent`

      - `required Int Version`

    - `required Type Type`

      - `"coordinator"Coordinator`

  - `required string Name`

  - `required IReadOnlyList<Skill> Skills`

    - `class BetaManagedAgentsAnthropicSkill:`

      A resolved Anthropic-managed skill.

    - `class BetaManagedAgentsCustomSkill:`

      A resolved user-created custom skill.

  - `required string? System`

  - `required IReadOnlyList<Tool> Tools`

    - `class BetaManagedAgentsAgentToolset20260401:`

    - `class BetaManagedAgentsMcpToolset:`

    - `class BetaManagedAgentsCustomTool:`

      A custom tool as returned in API responses.

  - `required Type Type`

    - `"agent"Agent`

  - `required Int Version`

### Beta Managed Agents Session Agent Update

- `class BetaManagedAgentsSessionAgentUpdate:`

  Mid-session agent configuration update. Only `tools` and `mcp_servers` are updatable. Full replacement: the provided array becomes the new value. To preserve existing entries, GET the session, modify the array, and POST it back.

  - `IReadOnlyList<BetaManagedAgentsUrlMcpServerParams> McpServers`

    Replacement MCP server list. Full replacement: the provided array becomes the new value. Send an empty array to clear; omit to preserve.

    - `required string Name`

      Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters.

    - `required Type Type`

      - `"url"Url`

    - `required string Url`

      Endpoint URL for the MCP server.

  - `IReadOnlyList<Tool> Tools`

    Replacement tool list. Full replacement: the provided array becomes the new value. Send an empty array to clear; omit to preserve.

    - `class BetaManagedAgentsAgentToolset20260401Params:`

      Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent.

      - `required Type Type`

        - `"agent_toolset_20260401"AgentToolset20260401`

      - `IReadOnlyList<BetaManagedAgentsAgentToolConfigParams> Configs`

        Per-tool configuration overrides.

        - `required Name Name`

          Built-in agent tool identifier.

          - `"bash"Bash`

          - `"edit"Edit`

          - `"read"Read`

          - `"write"Write`

          - `"glob"Glob`

          - `"grep"Grep`

          - `"web_fetch"WebFetch`

          - `"web_search"WebSearch`

        - `Boolean? Enabled`

          Whether this tool is enabled and available to Claude. Overrides the default_config setting.

        - `PermissionPolicy? PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

            - `required Type Type`

              - `"always_allow"AlwaysAllow`

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"always_ask"AlwaysAsk`

      - `BetaManagedAgentsAgentToolsetDefaultConfigParams? DefaultConfig`

        Default configuration for all tools in a toolset.

        - `Boolean? Enabled`

          Whether tools are enabled and available to Claude by default. Defaults to true if not specified.

        - `PermissionPolicy? PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

    - `class BetaManagedAgentsMcpToolsetParams:`

      Configuration for tools from an MCP server defined in `mcp_servers`.

      - `required string McpServerName`

        Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters.

      - `required Type Type`

        - `"mcp_toolset"McpToolset`

      - `IReadOnlyList<BetaManagedAgentsMcpToolConfigParams> Configs`

        Per-tool configuration overrides.

        - `required string Name`

          Name of the MCP tool to configure. 1-128 characters.

        - `Boolean? Enabled`

          Whether this tool is enabled. Overrides the `default_config` setting.

        - `PermissionPolicy? PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

      - `BetaManagedAgentsMcpToolsetDefaultConfigParams? DefaultConfig`

        Default configuration for all tools from an MCP server.

        - `Boolean? Enabled`

          Whether tools are enabled by default. Defaults to true if not specified.

        - `PermissionPolicy? PermissionPolicy`

          Permission policy for tool execution.

          - `class BetaManagedAgentsAlwaysAllowPolicy:`

            Tool calls are automatically approved without user confirmation.

          - `class BetaManagedAgentsAlwaysAskPolicy:`

            Tool calls require user confirmation before execution.

    - `class BetaManagedAgentsCustomToolParams:`

      A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event.

      - `required string Description`

        Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters.

      - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

        JSON Schema for custom tool input parameters.

        - `IReadOnlyDictionary<string, JsonElement>? Properties`

          JSON Schema properties defining the tool's input parameters.

        - `IReadOnlyList<string> Required`

          List of required property names.

        - `Type Type`

          Must be 'object' for tool input schemas.

          - `"object"Object`

      - `required string Name`

        Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens.

      - `required Type Type`

        - `"custom"Custom`

### Beta Managed Agents Session Multiagent Coordinator

- `class BetaManagedAgentsSessionMultiagentCoordinator:`

  Resolved coordinator topology with full agent definitions for each roster member.

  - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

    Full `agent` definitions the coordinator may spawn as session threads.

    - `required string ID`

    - `required string? Description`

    - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

      - `required string Name`

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

    - `required BetaManagedAgentsModelConfig Model`

      Model identifier and configuration.

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

    - `required string Name`

    - `required IReadOnlyList<Skill> Skills`

      - `class BetaManagedAgentsAnthropicSkill:`

        A resolved Anthropic-managed skill.

        - `required string SkillID`

        - `required Type Type`

          - `"anthropic"Anthropic`

        - `required string Version`

      - `class BetaManagedAgentsCustomSkill:`

        A resolved user-created custom skill.

        - `required string SkillID`

        - `required Type Type`

          - `"custom"Custom`

        - `required string Version`

    - `required string? System`

    - `required IReadOnlyList<Tool> Tools`

      - `class BetaManagedAgentsAgentToolset20260401:`

        - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

          - `required Boolean Enabled`

          - `required Name Name`

            Built-in agent tool identifier.

            - `"bash"Bash`

            - `"edit"Edit`

            - `"read"Read`

            - `"write"Write`

            - `"glob"Glob`

            - `"grep"Grep`

            - `"web_fetch"WebFetch`

            - `"web_search"WebSearch`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

              - `required Type Type`

                - `"always_allow"AlwaysAllow`

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

              - `required Type Type`

                - `"always_ask"AlwaysAsk`

        - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

          Resolved default configuration for agent tools.

          - `required Boolean Enabled`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required Type Type`

          - `"agent_toolset_20260401"AgentToolset20260401`

      - `class BetaManagedAgentsMcpToolset:`

        - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

          - `required Boolean Enabled`

          - `required string Name`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

          Resolved default configuration for all tools from an MCP server.

          - `required Boolean Enabled`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required string McpServerName`

        - `required Type Type`

          - `"mcp_toolset"McpToolset`

      - `class BetaManagedAgentsCustomTool:`

        A custom tool as returned in API responses.

        - `required string Description`

        - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

          JSON Schema for custom tool input parameters.

          - `IReadOnlyDictionary<string, JsonElement>? Properties`

            JSON Schema properties defining the tool's input parameters.

          - `IReadOnlyList<string> Required`

            List of required property names.

          - `Type Type`

            Must be 'object' for tool input schemas.

            - `"object"Object`

        - `required string Name`

        - `required Type Type`

          - `"custom"Custom`

    - `required Type Type`

      - `"agent"Agent`

    - `required Int Version`

  - `required Type Type`

    - `"coordinator"Coordinator`

### Beta Managed Agents Session Stats

- `class BetaManagedAgentsSessionStats:`

  Timing statistics for a session.

  - `Double ActiveSeconds`

    Cumulative time in seconds the session spent in running status. Excludes idle time.

  - `Double DurationSeconds`

    Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update.

### Beta Managed Agents Session Updated Event

- `class BetaManagedAgentsSessionUpdatedEvent:`

  Emitted when an UpdateSession request changed at least one field. Carries only the fields that changed; absent fields were not part of the update. The new configuration applies from the next turn.

  - `required string ID`

    Unique identifier for this event.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"session.updated"SessionUpdated`

  - `BetaManagedAgentsSessionAgent? Agent`

    Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

    - `required string ID`

    - `required string? Description`

    - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

      - `required string Name`

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

    - `required BetaManagedAgentsModelConfig Model`

      Model identifier and configuration.

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

    - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

      Resolved coordinator topology with full agent definitions for each roster member.

      - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

        Full `agent` definitions the coordinator may spawn as session threads.

        - `required string ID`

        - `required string? Description`

        - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

          - `required string Name`

          - `required Type Type`

          - `required string Url`

        - `required BetaManagedAgentsModelConfig Model`

          Model identifier and configuration.

        - `required string Name`

        - `required IReadOnlyList<Skill> Skills`

          - `class BetaManagedAgentsAnthropicSkill:`

            A resolved Anthropic-managed skill.

            - `required string SkillID`

            - `required Type Type`

              - `"anthropic"Anthropic`

            - `required string Version`

          - `class BetaManagedAgentsCustomSkill:`

            A resolved user-created custom skill.

            - `required string SkillID`

            - `required Type Type`

              - `"custom"Custom`

            - `required string Version`

        - `required string? System`

        - `required IReadOnlyList<Tool> Tools`

          - `class BetaManagedAgentsAgentToolset20260401:`

            - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

              - `required Boolean Enabled`

              - `required Name Name`

                Built-in agent tool identifier.

                - `"bash"Bash`

                - `"edit"Edit`

                - `"read"Read`

                - `"write"Write`

                - `"glob"Glob`

                - `"grep"Grep`

                - `"web_fetch"WebFetch`

                - `"web_search"WebSearch`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                  - `required Type Type`

                    - `"always_allow"AlwaysAllow`

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

                  - `required Type Type`

                    - `"always_ask"AlwaysAsk`

            - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

              Resolved default configuration for agent tools.

              - `required Boolean Enabled`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required Type Type`

              - `"agent_toolset_20260401"AgentToolset20260401`

          - `class BetaManagedAgentsMcpToolset:`

            - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

              - `required Boolean Enabled`

              - `required string Name`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

              Resolved default configuration for all tools from an MCP server.

              - `required Boolean Enabled`

              - `required PermissionPolicy PermissionPolicy`

                Permission policy for tool execution.

                - `class BetaManagedAgentsAlwaysAllowPolicy:`

                  Tool calls are automatically approved without user confirmation.

                - `class BetaManagedAgentsAlwaysAskPolicy:`

                  Tool calls require user confirmation before execution.

            - `required string McpServerName`

            - `required Type Type`

              - `"mcp_toolset"McpToolset`

          - `class BetaManagedAgentsCustomTool:`

            A custom tool as returned in API responses.

            - `required string Description`

            - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

              JSON Schema for custom tool input parameters.

              - `IReadOnlyDictionary<string, JsonElement>? Properties`

                JSON Schema properties defining the tool's input parameters.

              - `IReadOnlyList<string> Required`

                List of required property names.

              - `Type Type`

                Must be 'object' for tool input schemas.

                - `"object"Object`

            - `required string Name`

            - `required Type Type`

              - `"custom"Custom`

        - `required Type Type`

          - `"agent"Agent`

        - `required Int Version`

      - `required Type Type`

        - `"coordinator"Coordinator`

    - `required string Name`

    - `required IReadOnlyList<Skill> Skills`

      - `class BetaManagedAgentsAnthropicSkill:`

        A resolved Anthropic-managed skill.

      - `class BetaManagedAgentsCustomSkill:`

        A resolved user-created custom skill.

    - `required string? System`

    - `required IReadOnlyList<Tool> Tools`

      - `class BetaManagedAgentsAgentToolset20260401:`

      - `class BetaManagedAgentsMcpToolset:`

      - `class BetaManagedAgentsCustomTool:`

        A custom tool as returned in API responses.

    - `required Type Type`

      - `"agent"Agent`

    - `required Int Version`

  - `IReadOnlyDictionary<string, string> Metadata`

    The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty.

  - `string? Title`

    The session's new title. Present only when the update changed it.

### Beta Managed Agents Session Usage

- `class BetaManagedAgentsSessionUsage:`

  Cumulative token usage for a session across all turns.

  - `BetaManagedAgentsCacheCreationUsage CacheCreation`

    Prompt-cache creation token usage broken down by cache lifetime.

    - `Int Ephemeral1hInputTokens`

      Tokens used to create 1-hour ephemeral cache entries.

    - `Int Ephemeral5mInputTokens`

      Tokens used to create 5-minute ephemeral cache entries.

  - `Int CacheReadInputTokens`

    Total tokens read from prompt cache.

  - `Int InputTokens`

    Total input tokens consumed across all turns.

  - `Int OutputTokens`

    Total output tokens generated across all turns.

### Beta Managed Agents User Tool Result Event

- `class BetaManagedAgentsUserToolResultEvent:`

  Event sent by the client providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.

  - `required string ID`

    Unique identifier for this event.

  - `required string ToolUseID`

    The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

  - `required Type Type`

    - `"user.tool_result"UserToolResult`

  - `IReadOnlyList<Content> Content`

    The result content returned by the tool.

    - `class BetaManagedAgentsTextBlock:`

      Regular text content.

      - `required string Text`

        The text content.

      - `required Type Type`

        - `"text"Text`

    - `class BetaManagedAgentsImageBlock:`

      Image content specified directly as base64 data or as a reference via a URL.

      - `required Source Source`

        Union type for image source variants.

        - `class BetaManagedAgentsBase64ImageSource:`

          Base64-encoded image data.

          - `required string Data`

            Base64-encoded image data.

          - `required string MediaType`

            MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsUrlImageSource:`

          Image referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the image to fetch.

        - `class BetaManagedAgentsFileImageSource:`

          Image referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"image"Image`

    - `class BetaManagedAgentsDocumentBlock:`

      Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required Source Source`

        Union type for document source variants.

        - `class BetaManagedAgentsBase64DocumentSource:`

          Base64-encoded document data.

          - `required string Data`

            Base64-encoded document data.

          - `required string MediaType`

            MIME type of the document (e.g., "application/pdf").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsPlainTextDocumentSource:`

          Plain text document content.

          - `required string Data`

            The plain text content.

          - `required MediaType MediaType`

            MIME type of the text content. Must be "text/plain".

            - `"text/plain"TextPlain`

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsUrlDocumentSource:`

          Document referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the document to fetch.

        - `class BetaManagedAgentsFileDocumentSource:`

          Document referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"document"Document`

      - `string? Context`

        Additional context about the document for the model.

      - `string? Title`

        The title of the document.

    - `class BetaManagedAgentsSearchResultBlock:`

      A block containing a web search result.

      - `required BetaManagedAgentsSearchResultCitations Citations`

        Citation settings for a search result.

        - `required Boolean Enabled`

          Whether citations are enabled for this search result.

      - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

        Array of text content blocks from the search result.

        - `required string Text`

          The text content.

        - `required Type Type`

          - `"text"Text`

      - `required string Source`

        The URL source of the search result.

      - `required string Title`

        The title of the search result.

      - `required Type Type`

        - `"search_result"SearchResult`

  - `Boolean? IsError`

    Whether the tool execution resulted in an error.

  - `DateTimeOffset? ProcessedAt`

    A timestamp in RFC 3339 format

  - `string? SessionThreadID`

    Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`.

# Events

## List Events

`EventListPageResponse Beta.Sessions.Events.List(EventListParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/sessions/{session_id}/events`

List Events

### Parameters

- `EventListParams parameters`

  - `required string sessionID`

    Path param: Path parameter session_id

  - `DateTimeOffset createdAtGt`

    Query param: Return events created after this time (exclusive).

  - `DateTimeOffset createdAtGte`

    Query param: Return events created at or after this time (inclusive).

  - `DateTimeOffset createdAtLt`

    Query param: Return events created before this time (exclusive).

  - `DateTimeOffset createdAtLte`

    Query param: Return events created at or before this time (inclusive).

  - `Int limit`

    Query param: Query parameter for limit

  - `Order order`

    Query param: Sort direction for results, ordered by created_at. Defaults to asc (chronological).

    - `"asc"Asc`

    - `"desc"Desc`

  - `string page`

    Query param: Opaque pagination cursor from a previous response's next_page.

  - `IReadOnlyList<string> types`

    Query param: Filter by event type. Values match the `type` field on returned events (for example, `user.message` or `agent.tool_use`). Omit to return all event types.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class EventListPageResponse:`

  Paginated list of events for a `session`.

  - `IReadOnlyList<BetaManagedAgentsSessionEvent> Data`

    Events for the session, ordered by `created_at`.

    - `class BetaManagedAgentsUserMessageEvent:`

      A user message event in the session conversation.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyList<Content> Content`

        Array of content blocks comprising the user message.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

          - `required string Text`

            The text content.

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

          - `required Source Source`

            Union type for image source variants.

            - `class BetaManagedAgentsBase64ImageSource:`

              Base64-encoded image data.

              - `required string Data`

                Base64-encoded image data.

              - `required string MediaType`

                MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

              - `required Type Type`

                - `"base64"Base64`

            - `class BetaManagedAgentsUrlImageSource:`

              Image referenced by URL.

              - `required Type Type`

                - `"url"Url`

              - `required string Url`

                URL of the image to fetch.

            - `class BetaManagedAgentsFileImageSource:`

              Image referenced by file ID.

              - `required string FileID`

                ID of a previously uploaded file.

              - `required Type Type`

                - `"file"File`

          - `required Type Type`

            - `"image"Image`

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

          - `required Source Source`

            Union type for document source variants.

            - `class BetaManagedAgentsBase64DocumentSource:`

              Base64-encoded document data.

              - `required string Data`

                Base64-encoded document data.

              - `required string MediaType`

                MIME type of the document (e.g., "application/pdf").

              - `required Type Type`

                - `"base64"Base64`

            - `class BetaManagedAgentsPlainTextDocumentSource:`

              Plain text document content.

              - `required string Data`

                The plain text content.

              - `required MediaType MediaType`

                MIME type of the text content. Must be "text/plain".

                - `"text/plain"TextPlain`

              - `required Type Type`

                - `"text"Text`

            - `class BetaManagedAgentsUrlDocumentSource:`

              Document referenced by URL.

              - `required Type Type`

                - `"url"Url`

              - `required string Url`

                URL of the document to fetch.

            - `class BetaManagedAgentsFileDocumentSource:`

              Document referenced by file ID.

              - `required string FileID`

                ID of a previously uploaded file.

              - `required Type Type`

                - `"file"File`

          - `required Type Type`

            - `"document"Document`

          - `string? Context`

            Additional context about the document for the model.

          - `string? Title`

            The title of the document.

      - `required Type Type`

        - `"user.message"UserMessage`

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

    - `class BetaManagedAgentsUserInterruptEvent:`

      An interrupt event that pauses agent execution and returns control to the user.

      - `required string ID`

        Unique identifier for this event.

      - `required Type Type`

        - `"user.interrupt"UserInterrupt`

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.

    - `class BetaManagedAgentsUserToolConfirmationEvent:`

      A tool confirmation event that approves or denies a pending tool execution.

      - `required string ID`

        Unique identifier for this event.

      - `required Result Result`

        UserToolConfirmationResult enum

        - `"allow"Allow`

        - `"deny"Deny`

      - `required string ToolUseID`

        The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.tool_confirmation"UserToolConfirmation`

      - `string? DenyMessage`

        Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval.

    - `class BetaManagedAgentsUserCustomToolResultEvent:`

      Event sent by the client providing the result of a custom tool execution.

      - `required string ID`

        Unique identifier for this event.

      - `required string CustomToolUseID`

        The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.custom_tool_result"UserCustomToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

          - `required BetaManagedAgentsSearchResultCitations Citations`

            Citation settings for a search result.

            - `required Boolean Enabled`

              Whether citations are enabled for this search result.

          - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

            Array of text content blocks from the search result.

            - `required string Text`

              The text content.

            - `required Type Type`

              - `"text"Text`

          - `required string Source`

            The URL source of the search result.

          - `required string Title`

            The title of the search result.

          - `required Type Type`

            - `"search_result"SearchResult`

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`.

    - `class BetaManagedAgentsAgentCustomToolUseEvent:`

      Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyDictionary<string, JsonElement> Input`

        Input parameters for the tool call.

      - `required string Name`

        Name of the custom tool being called.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.custom_tool_use"AgentCustomToolUse`

      - `string? SessionThreadID`

        When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.custom_tool_result` event to route the result back.

    - `class BetaManagedAgentsAgentMessageEvent:`

      An agent response event in the session conversation.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyList<BetaManagedAgentsTextBlock> Content`

        Array of text blocks comprising the agent response.

        - `required string Text`

          The text content.

        - `required Type Type`

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.message"AgentMessage`

    - `class BetaManagedAgentsAgentThinkingEvent:`

      Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.thinking"AgentThinking`

    - `class BetaManagedAgentsAgentMcpToolUseEvent:`

      Event emitted when the agent invokes a tool provided by an MCP server.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyDictionary<string, JsonElement> Input`

        Input parameters for the tool call.

      - `required string McpServerName`

        Name of the MCP server providing the tool.

      - `required string Name`

        Name of the MCP tool being used.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.mcp_tool_use"AgentMcpToolUse`

      - `EvaluatedPermission EvaluatedPermission`

        AgentEvaluatedPermission enum

        - `"allow"Allow`

        - `"ask"Ask`

        - `"deny"Deny`

      - `string? SessionThreadID`

        When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

    - `class BetaManagedAgentsAgentMcpToolResultEvent:`

      Event representing the result of an MCP tool execution.

      - `required string ID`

        Unique identifier for this event.

      - `required string McpToolUseID`

        The id of the `agent.mcp_tool_use` event this result corresponds to.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.mcp_tool_result"AgentMcpToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

    - `class BetaManagedAgentsAgentToolUseEvent:`

      Event emitted when the agent invokes a built-in agent tool.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyDictionary<string, JsonElement> Input`

        Input parameters for the tool call.

      - `required string Name`

        Name of the agent tool being used.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.tool_use"AgentToolUse`

      - `EvaluatedPermission EvaluatedPermission`

        AgentEvaluatedPermission enum

        - `"allow"Allow`

        - `"ask"Ask`

        - `"deny"Deny`

      - `string? SessionThreadID`

        When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

    - `class BetaManagedAgentsAgentToolResultEvent:`

      Event representing the result of an agent tool execution.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string ToolUseID`

        The id of the `agent.tool_use` event this result corresponds to.

      - `required Type Type`

        - `"agent.tool_result"AgentToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

    - `class BetaManagedAgentsAgentThreadMessageReceivedEvent:`

      Delivery event written to the target thread's input stream when an agent-to-agent message arrives.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyList<Content> Content`

        Message content blocks.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required string FromSessionThreadID`

        Public `sthr_` ID of the thread that sent the message.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.thread_message_received"AgentThreadMessageReceived`

      - `string? FromAgentName`

        Name of the callable agent this message came from. Absent when received from the primary agent.

    - `class BetaManagedAgentsAgentThreadMessageSentEvent:`

      Observability event emitted to the sender's output stream when an agent-to-agent message is sent.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyList<Content> Content`

        Message content blocks.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string ToSessionThreadID`

        Public `sthr_` ID of the thread the message was sent to.

      - `required Type Type`

        - `"agent.thread_message_sent"AgentThreadMessageSent`

      - `string? ToAgentName`

        Name of the callable agent this message was sent to. Absent when sent to the primary agent.

    - `class BetaManagedAgentsAgentThreadContextCompactedEvent:`

      Indicates that context compaction (summarization) occurred during the session.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.thread_context_compacted"AgentThreadContextCompacted`

    - `class BetaManagedAgentsSessionErrorEvent:`

      An error event indicating a problem occurred during session execution.

      - `required string ID`

        Unique identifier for this event.

      - `required Error Error`

        An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

        - `class BetaManagedAgentsUnknownError:`

          An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

              - `required Type Type`

                - `"retrying"Retrying`

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

              - `required Type Type`

                - `"exhausted"Exhausted`

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

              - `required Type Type`

                - `"terminal"Terminal`

          - `required Type Type`

            - `"unknown_error"UnknownError`

        - `class BetaManagedAgentsModelOverloadedError:`

          The model is currently overloaded. Emitted after automatic retries are exhausted.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

          - `required Type Type`

            - `"model_overloaded_error"ModelOverloadedError`

        - `class BetaManagedAgentsModelRateLimitedError:`

          The model request was rate-limited.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

          - `required Type Type`

            - `"model_rate_limited_error"ModelRateLimitedError`

        - `class BetaManagedAgentsModelRequestFailedError:`

          A model request failed for a reason other than overload or rate-limiting.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

          - `required Type Type`

            - `"model_request_failed_error"ModelRequestFailedError`

        - `class BetaManagedAgentsMcpConnectionFailedError:`

          Failed to connect to an MCP server.

          - `required string McpServerName`

            Name of the MCP server that failed to connect.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

          - `required Type Type`

            - `"mcp_connection_failed_error"McpConnectionFailedError`

        - `class BetaManagedAgentsMcpAuthenticationFailedError:`

          Authentication to an MCP server failed.

          - `required string McpServerName`

            Name of the MCP server that failed authentication.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

          - `required Type Type`

            - `"mcp_authentication_failed_error"McpAuthenticationFailedError`

        - `class BetaManagedAgentsBillingError:`

          The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

          - `required Type Type`

            - `"billing_error"BillingError`

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"session.error"SessionError`

    - `class BetaManagedAgentsSessionStatusRescheduledEvent:`

      Indicates the session is recovering from an error state and is rescheduled for execution.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"session.status_rescheduled"SessionStatusRescheduled`

    - `class BetaManagedAgentsSessionStatusRunningEvent:`

      Indicates the session is actively running and the agent is working.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"session.status_running"SessionStatusRunning`

    - `class BetaManagedAgentsSessionStatusIdleEvent:`

      Indicates the agent has paused and is awaiting user input.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required StopReason StopReason`

        The agent completed its turn naturally and is ready for the next user message.

        - `class BetaManagedAgentsSessionEndTurn:`

          The agent completed its turn naturally and is ready for the next user message.

          - `required Type Type`

            - `"end_turn"EndTurn`

        - `class BetaManagedAgentsSessionRequiresAction:`

          The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

          - `required IReadOnlyList<string> EventIds`

            The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder.

          - `required Type Type`

            - `"requires_action"RequiresAction`

        - `class BetaManagedAgentsSessionRetriesExhausted:`

          The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

          - `required Type Type`

            - `"retries_exhausted"RetriesExhausted`

      - `required Type Type`

        - `"session.status_idle"SessionStatusIdle`

    - `class BetaManagedAgentsSessionStatusTerminatedEvent:`

      Indicates the session has terminated, either due to an error or completion.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"session.status_terminated"SessionStatusTerminated`

    - `class BetaManagedAgentsSessionThreadCreatedEvent:`

      Emitted when a subagent is spawned as a new thread. Written to the parent thread's output stream so clients observing the session see child creation.

      - `required string ID`

        Unique identifier for this event.

      - `required string AgentName`

        Name of the callable agent the thread runs.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string SessionThreadID`

        Public `sthr_` ID of the newly created thread.

      - `required Type Type`

        - `"session.thread_created"SessionThreadCreated`

    - `class BetaManagedAgentsSpanOutcomeEvaluationStartEvent:`

      Emitted when an outcome evaluation cycle begins.

      - `required string ID`

        Unique identifier for this event.

      - `required Int Iteration`

        0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.

      - `required string OutcomeID`

        The `outc_` ID of the outcome being evaluated.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"span.outcome_evaluation_start"SpanOutcomeEvaluationStart`

    - `class BetaManagedAgentsSpanOutcomeEvaluationEndEvent:`

      Emitted when an outcome evaluation cycle completes. Carries the verdict and aggregate token usage. A verdict of `needs_revision` means another evaluation cycle follows; `satisfied`, `max_iterations_reached`, `failed`, or `interrupted` are terminal — no further evaluation cycles follow.

      - `required string ID`

        Unique identifier for this event.

      - `required string Explanation`

        Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why.

      - `required Int Iteration`

        0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

      - `required string OutcomeEvaluationStartID`

        The id of the corresponding `span.outcome_evaluation_start` event.

      - `required string OutcomeID`

        The `outc_` ID of the outcome being evaluated.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string Result`

        Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress.

      - `required Type Type`

        - `"span.outcome_evaluation_end"SpanOutcomeEvaluationEnd`

      - `required BetaManagedAgentsSpanModelUsage Usage`

        Token usage for a single model request.

        - `required Int CacheCreationInputTokens`

          Tokens used to create prompt cache in this request.

        - `required Int CacheReadInputTokens`

          Tokens read from prompt cache in this request.

        - `required Int InputTokens`

          Input tokens consumed by this request.

        - `required Int OutputTokens`

          Output tokens generated by this request.

        - `Speed? Speed`

          Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

          - `"standard"Standard`

          - `"fast"Fast`

    - `class BetaManagedAgentsSpanModelRequestStartEvent:`

      Emitted when a model request is initiated by the agent.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"span.model_request_start"SpanModelRequestStart`

    - `class BetaManagedAgentsSpanModelRequestEndEvent:`

      Emitted when a model request completes.

      - `required string ID`

        Unique identifier for this event.

      - `required Boolean? IsError`

        Whether the model request resulted in an error.

      - `required string ModelRequestStartID`

        The id of the corresponding `span.model_request_start` event.

      - `required BetaManagedAgentsSpanModelUsage ModelUsage`

        Token usage for a single model request.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"span.model_request_end"SpanModelRequestEnd`

    - `class BetaManagedAgentsSpanOutcomeEvaluationOngoingEvent:`

      Periodic heartbeat emitted while an outcome evaluation cycle is in progress. Distinguishes 'evaluation is actively running' from 'evaluation is stuck' between the corresponding `span.outcome_evaluation_start` and `span.outcome_evaluation_end` events.

      - `required string ID`

        Unique identifier for this event.

      - `required Int Iteration`

        0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

      - `required string OutcomeID`

        The `outc_` ID of the outcome being evaluated.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"span.outcome_evaluation_ongoing"SpanOutcomeEvaluationOngoing`

    - `class BetaManagedAgentsUserDefineOutcomeEvent:`

      Echo of a `user.define_outcome` input event. Carries the server-generated `outcome_id` that subsequent `span.outcome_evaluation_*` events reference.

      - `required string ID`

        Unique identifier for this event.

      - `required string Description`

        What the agent should produce. Copied from the input event.

      - `required Int? MaxIterations`

        Evaluate-then-revise cycles before giving up. Default 3, max 20.

      - `required string OutcomeID`

        Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Rubric Rubric`

        Rubric for grading the quality of an outcome.

        - `class BetaManagedAgentsFileRubric:`

          Rubric referenced by a file uploaded via the Files API.

          - `required string FileID`

            ID of the rubric file.

          - `required Type Type`

            - `"file"File`

        - `class BetaManagedAgentsTextRubric:`

          Rubric content provided inline as text.

          - `required string Content`

            Rubric content. Plain text or markdown — the grader treats it as freeform text.

          - `required Type Type`

            - `"text"Text`

      - `required Type Type`

        - `"user.define_outcome"UserDefineOutcome`

    - `class BetaManagedAgentsSessionDeletedEvent:`

      Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"session.deleted"SessionDeleted`

    - `class BetaManagedAgentsSessionThreadStatusRunningEvent:`

      A session thread has begun executing. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

      - `required string ID`

        Unique identifier for this event.

      - `required string AgentName`

        Name of the agent the thread runs.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string SessionThreadID`

        Public sthr_ ID of the thread that started running.

      - `required Type Type`

        - `"session.thread_status_running"SessionThreadStatusRunning`

    - `class BetaManagedAgentsSessionThreadStatusIdleEvent:`

      A session thread has yielded and is awaiting input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

      - `required string ID`

        Unique identifier for this event.

      - `required string AgentName`

        Name of the agent the thread runs.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string SessionThreadID`

        Public sthr_ ID of the thread that went idle.

      - `required StopReason StopReason`

        The agent completed its turn naturally and is ready for the next user message.

        - `class BetaManagedAgentsSessionEndTurn:`

          The agent completed its turn naturally and is ready for the next user message.

        - `class BetaManagedAgentsSessionRequiresAction:`

          The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

        - `class BetaManagedAgentsSessionRetriesExhausted:`

          The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

      - `required Type Type`

        - `"session.thread_status_idle"SessionThreadStatusIdle`

    - `class BetaManagedAgentsSessionThreadStatusTerminatedEvent:`

      A session thread has terminated and will accept no further input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

      - `required string ID`

        Unique identifier for this event.

      - `required string AgentName`

        Name of the agent the thread runs.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string SessionThreadID`

        Public sthr_ ID of the thread that terminated.

      - `required Type Type`

        - `"session.thread_status_terminated"SessionThreadStatusTerminated`

    - `class BetaManagedAgentsUserToolResultEvent:`

      Event sent by the client providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.

      - `required string ID`

        Unique identifier for this event.

      - `required string ToolUseID`

        The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.tool_result"UserToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`.

    - `class BetaManagedAgentsSessionThreadStatusRescheduledEvent:`

      A session thread hit a transient error and is retrying automatically. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

      - `required string ID`

        Unique identifier for this event.

      - `required string AgentName`

        Name of the agent the thread runs.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string SessionThreadID`

        Public sthr_ ID of the thread that is retrying.

      - `required Type Type`

        - `"session.thread_status_rescheduled"SessionThreadStatusRescheduled`

    - `class BetaManagedAgentsSessionUpdatedEvent:`

      Emitted when an UpdateSession request changed at least one field. Carries only the fields that changed; absent fields were not part of the update. The new configuration applies from the next turn.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"session.updated"SessionUpdated`

      - `BetaManagedAgentsSessionAgent? Agent`

        Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

        - `required string ID`

        - `required string? Description`

        - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

          - `required string Name`

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

        - `required BetaManagedAgentsModelConfig Model`

          Model identifier and configuration.

          - `required BetaManagedAgentsModel ID`

            The model that will power your agent.

            See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

            - `"claude-opus-4-8"ClaudeOpus4_8`

              Frontier intelligence for long-running agents and coding

            - `"claude-opus-4-7"ClaudeOpus4_7`

              Frontier intelligence for long-running agents and coding

            - `"claude-opus-4-6"ClaudeOpus4_6`

              Most intelligent model for building agents and coding

            - `"claude-sonnet-4-6"ClaudeSonnet4_6`

              Best combination of speed and intelligence

            - `"claude-haiku-4-5"ClaudeHaiku4_5`

              Fastest model with near-frontier intelligence

            - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

              Fastest model with near-frontier intelligence

            - `"claude-opus-4-5"ClaudeOpus4_5`

              Premium model combining maximum intelligence with practical performance

            - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

              Premium model combining maximum intelligence with practical performance

            - `"claude-sonnet-4-5"ClaudeSonnet4_5`

              High-performance model for agents and coding

            - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

              High-performance model for agents and coding

          - `Speed Speed`

            Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

            - `"standard"Standard`

            - `"fast"Fast`

        - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

          Resolved coordinator topology with full agent definitions for each roster member.

          - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

            Full `agent` definitions the coordinator may spawn as session threads.

            - `required string ID`

            - `required string? Description`

            - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

              - `required string Name`

              - `required Type Type`

              - `required string Url`

            - `required BetaManagedAgentsModelConfig Model`

              Model identifier and configuration.

            - `required string Name`

            - `required IReadOnlyList<Skill> Skills`

              - `class BetaManagedAgentsAnthropicSkill:`

                A resolved Anthropic-managed skill.

                - `required string SkillID`

                - `required Type Type`

                  - `"anthropic"Anthropic`

                - `required string Version`

              - `class BetaManagedAgentsCustomSkill:`

                A resolved user-created custom skill.

                - `required string SkillID`

                - `required Type Type`

                  - `"custom"Custom`

                - `required string Version`

            - `required string? System`

            - `required IReadOnlyList<Tool> Tools`

              - `class BetaManagedAgentsAgentToolset20260401:`

                - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

                  - `required Boolean Enabled`

                  - `required Name Name`

                    Built-in agent tool identifier.

                    - `"bash"Bash`

                    - `"edit"Edit`

                    - `"read"Read`

                    - `"write"Write`

                    - `"glob"Glob`

                    - `"grep"Grep`

                    - `"web_fetch"WebFetch`

                    - `"web_search"WebSearch`

                  - `required PermissionPolicy PermissionPolicy`

                    Permission policy for tool execution.

                    - `class BetaManagedAgentsAlwaysAllowPolicy:`

                      Tool calls are automatically approved without user confirmation.

                      - `required Type Type`

                        - `"always_allow"AlwaysAllow`

                    - `class BetaManagedAgentsAlwaysAskPolicy:`

                      Tool calls require user confirmation before execution.

                      - `required Type Type`

                        - `"always_ask"AlwaysAsk`

                - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

                  Resolved default configuration for agent tools.

                  - `required Boolean Enabled`

                  - `required PermissionPolicy PermissionPolicy`

                    Permission policy for tool execution.

                    - `class BetaManagedAgentsAlwaysAllowPolicy:`

                      Tool calls are automatically approved without user confirmation.

                    - `class BetaManagedAgentsAlwaysAskPolicy:`

                      Tool calls require user confirmation before execution.

                - `required Type Type`

                  - `"agent_toolset_20260401"AgentToolset20260401`

              - `class BetaManagedAgentsMcpToolset:`

                - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

                  - `required Boolean Enabled`

                  - `required string Name`

                  - `required PermissionPolicy PermissionPolicy`

                    Permission policy for tool execution.

                    - `class BetaManagedAgentsAlwaysAllowPolicy:`

                      Tool calls are automatically approved without user confirmation.

                    - `class BetaManagedAgentsAlwaysAskPolicy:`

                      Tool calls require user confirmation before execution.

                - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

                  Resolved default configuration for all tools from an MCP server.

                  - `required Boolean Enabled`

                  - `required PermissionPolicy PermissionPolicy`

                    Permission policy for tool execution.

                    - `class BetaManagedAgentsAlwaysAllowPolicy:`

                      Tool calls are automatically approved without user confirmation.

                    - `class BetaManagedAgentsAlwaysAskPolicy:`

                      Tool calls require user confirmation before execution.

                - `required string McpServerName`

                - `required Type Type`

                  - `"mcp_toolset"McpToolset`

              - `class BetaManagedAgentsCustomTool:`

                A custom tool as returned in API responses.

                - `required string Description`

                - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

                  JSON Schema for custom tool input parameters.

                  - `IReadOnlyDictionary<string, JsonElement>? Properties`

                    JSON Schema properties defining the tool's input parameters.

                  - `IReadOnlyList<string> Required`

                    List of required property names.

                  - `Type Type`

                    Must be 'object' for tool input schemas.

                    - `"object"Object`

                - `required string Name`

                - `required Type Type`

                  - `"custom"Custom`

            - `required Type Type`

              - `"agent"Agent`

            - `required Int Version`

          - `required Type Type`

            - `"coordinator"Coordinator`

        - `required string Name`

        - `required IReadOnlyList<Skill> Skills`

          - `class BetaManagedAgentsAnthropicSkill:`

            A resolved Anthropic-managed skill.

          - `class BetaManagedAgentsCustomSkill:`

            A resolved user-created custom skill.

        - `required string? System`

        - `required IReadOnlyList<Tool> Tools`

          - `class BetaManagedAgentsAgentToolset20260401:`

          - `class BetaManagedAgentsMcpToolset:`

          - `class BetaManagedAgentsCustomTool:`

            A custom tool as returned in API responses.

        - `required Type Type`

          - `"agent"Agent`

        - `required Int Version`

      - `IReadOnlyDictionary<string, string> Metadata`

        The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty.

      - `string? Title`

        The session's new title. Present only when the update changed it.

  - `string? NextPage`

    Opaque cursor for the next page. Null when no more results.

### Example

```csharp
EventListParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7"
};

var page = await client.Beta.Sessions.Events.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "sevt_011CZkZGOp0iBcp4kaQSihUmy",
      "content": [
        {
          "text": "Where is my order #1234?",
          "type": "text"
        }
      ],
      "type": "user.message",
      "processed_at": "2026-03-15T10:00:00Z"
    },
    {
      "id": "sevt_011CZkZHPq1jCdq5lbRTjiVnz",
      "content": [
        {
          "text": "Let me look up order #1234 for you.",
          "type": "text"
        }
      ],
      "processed_at": "2026-03-15T10:00:00Z",
      "type": "agent.message"
    }
  ],
  "next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo="
}
```

## Send Events

`BetaManagedAgentsSendSessionEvents Beta.Sessions.Events.Send(EventSendParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/sessions/{session_id}/events`

Send Events

### Parameters

- `EventSendParams parameters`

  - `required string sessionID`

    Path param: Path parameter session_id

  - `required IReadOnlyList<BetaManagedAgentsEventParams> events`

    Body param: Events to send to the `session`.

    - `class BetaManagedAgentsUserMessageEventParams:`

      Parameters for sending a user message to the session.

      - `required IReadOnlyList<Content> Content`

        Array of content blocks for the user message.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

          - `required string Text`

            The text content.

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

          - `required Source Source`

            Union type for image source variants.

            - `class BetaManagedAgentsBase64ImageSource:`

              Base64-encoded image data.

              - `required string Data`

                Base64-encoded image data.

              - `required string MediaType`

                MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

              - `required Type Type`

                - `"base64"Base64`

            - `class BetaManagedAgentsUrlImageSource:`

              Image referenced by URL.

              - `required Type Type`

                - `"url"Url`

              - `required string Url`

                URL of the image to fetch.

            - `class BetaManagedAgentsFileImageSource:`

              Image referenced by file ID.

              - `required string FileID`

                ID of a previously uploaded file.

              - `required Type Type`

                - `"file"File`

          - `required Type Type`

            - `"image"Image`

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

          - `required Source Source`

            Union type for document source variants.

            - `class BetaManagedAgentsBase64DocumentSource:`

              Base64-encoded document data.

              - `required string Data`

                Base64-encoded document data.

              - `required string MediaType`

                MIME type of the document (e.g., "application/pdf").

              - `required Type Type`

                - `"base64"Base64`

            - `class BetaManagedAgentsPlainTextDocumentSource:`

              Plain text document content.

              - `required string Data`

                The plain text content.

              - `required MediaType MediaType`

                MIME type of the text content. Must be "text/plain".

                - `"text/plain"TextPlain`

              - `required Type Type`

                - `"text"Text`

            - `class BetaManagedAgentsUrlDocumentSource:`

              Document referenced by URL.

              - `required Type Type`

                - `"url"Url`

              - `required string Url`

                URL of the document to fetch.

            - `class BetaManagedAgentsFileDocumentSource:`

              Document referenced by file ID.

              - `required string FileID`

                ID of a previously uploaded file.

              - `required Type Type`

                - `"file"File`

          - `required Type Type`

            - `"document"Document`

          - `string? Context`

            Additional context about the document for the model.

          - `string? Title`

            The title of the document.

      - `required Type Type`

        - `"user.message"UserMessage`

    - `class BetaManagedAgentsUserInterruptEventParams:`

      Parameters for sending an interrupt to pause the agent.

      - `required Type Type`

        - `"user.interrupt"UserInterrupt`

      - `string? SessionThreadID`

        If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.

    - `class BetaManagedAgentsUserToolConfirmationEventParams:`

      Parameters for confirming or denying a tool execution request.

      - `required Result Result`

        UserToolConfirmationResult enum

        - `"allow"Allow`

        - `"deny"Deny`

      - `required string ToolUseID`

        The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.tool_confirmation"UserToolConfirmation`

      - `string? DenyMessage`

        Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

    - `class BetaManagedAgentsUserCustomToolResultEventParams:`

      Parameters for providing the result of a custom tool execution.

      - `required string CustomToolUseID`

        The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.custom_tool_result"UserCustomToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

          - `required BetaManagedAgentsSearchResultCitations Citations`

            Citation settings for a search result.

            - `required Boolean Enabled`

              Whether citations are enabled for this search result.

          - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

            Array of text content blocks from the search result.

            - `required string Text`

              The text content.

            - `required Type Type`

              - `"text"Text`

          - `required string Source`

            The URL source of the search result.

          - `required string Title`

            The title of the search result.

          - `required Type Type`

            - `"search_result"SearchResult`

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

    - `class BetaManagedAgentsUserDefineOutcomeEventParams:`

      Parameters for defining an outcome the agent should work toward. The agent begins work on receipt.

      - `required string Description`

        What the agent should produce. This is the task specification.

      - `required Rubric Rubric`

        Rubric for grading the quality of an outcome.

        - `class BetaManagedAgentsFileRubricParams:`

          Rubric referenced by a file uploaded via the Files API.

          - `required string FileID`

            ID of the rubric file.

          - `required Type Type`

            - `"file"File`

        - `class BetaManagedAgentsTextRubricParams:`

          Rubric content provided inline as text.

          - `required string Content`

            Rubric content. Plain text or markdown — the grader treats it as freeform text. Maximum 262144 characters.

          - `required Type Type`

            - `"text"Text`

      - `required Type Type`

        - `"user.define_outcome"UserDefineOutcome`

      - `Int? MaxIterations`

        Eval→revision cycles before giving up. Default 3, max 20.

    - `class BetaManagedAgentsUserToolResultEventParams:`

      Parameters for providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.

      - `required string ToolUseID`

        The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.tool_result"UserToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsSendSessionEvents:`

  Events that were successfully sent to the session.

  - `IReadOnlyList<Data> Data`

    Sent events

    - `class BetaManagedAgentsUserMessageEvent:`

      A user message event in the session conversation.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyList<Content> Content`

        Array of content blocks comprising the user message.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

          - `required string Text`

            The text content.

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

          - `required Source Source`

            Union type for image source variants.

            - `class BetaManagedAgentsBase64ImageSource:`

              Base64-encoded image data.

              - `required string Data`

                Base64-encoded image data.

              - `required string MediaType`

                MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

              - `required Type Type`

                - `"base64"Base64`

            - `class BetaManagedAgentsUrlImageSource:`

              Image referenced by URL.

              - `required Type Type`

                - `"url"Url`

              - `required string Url`

                URL of the image to fetch.

            - `class BetaManagedAgentsFileImageSource:`

              Image referenced by file ID.

              - `required string FileID`

                ID of a previously uploaded file.

              - `required Type Type`

                - `"file"File`

          - `required Type Type`

            - `"image"Image`

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

          - `required Source Source`

            Union type for document source variants.

            - `class BetaManagedAgentsBase64DocumentSource:`

              Base64-encoded document data.

              - `required string Data`

                Base64-encoded document data.

              - `required string MediaType`

                MIME type of the document (e.g., "application/pdf").

              - `required Type Type`

                - `"base64"Base64`

            - `class BetaManagedAgentsPlainTextDocumentSource:`

              Plain text document content.

              - `required string Data`

                The plain text content.

              - `required MediaType MediaType`

                MIME type of the text content. Must be "text/plain".

                - `"text/plain"TextPlain`

              - `required Type Type`

                - `"text"Text`

            - `class BetaManagedAgentsUrlDocumentSource:`

              Document referenced by URL.

              - `required Type Type`

                - `"url"Url`

              - `required string Url`

                URL of the document to fetch.

            - `class BetaManagedAgentsFileDocumentSource:`

              Document referenced by file ID.

              - `required string FileID`

                ID of a previously uploaded file.

              - `required Type Type`

                - `"file"File`

          - `required Type Type`

            - `"document"Document`

          - `string? Context`

            Additional context about the document for the model.

          - `string? Title`

            The title of the document.

      - `required Type Type`

        - `"user.message"UserMessage`

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

    - `class BetaManagedAgentsUserInterruptEvent:`

      An interrupt event that pauses agent execution and returns control to the user.

      - `required string ID`

        Unique identifier for this event.

      - `required Type Type`

        - `"user.interrupt"UserInterrupt`

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.

    - `class BetaManagedAgentsUserToolConfirmationEvent:`

      A tool confirmation event that approves or denies a pending tool execution.

      - `required string ID`

        Unique identifier for this event.

      - `required Result Result`

        UserToolConfirmationResult enum

        - `"allow"Allow`

        - `"deny"Deny`

      - `required string ToolUseID`

        The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.tool_confirmation"UserToolConfirmation`

      - `string? DenyMessage`

        Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval.

    - `class BetaManagedAgentsUserCustomToolResultEvent:`

      Event sent by the client providing the result of a custom tool execution.

      - `required string ID`

        Unique identifier for this event.

      - `required string CustomToolUseID`

        The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.custom_tool_result"UserCustomToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

          - `required BetaManagedAgentsSearchResultCitations Citations`

            Citation settings for a search result.

            - `required Boolean Enabled`

              Whether citations are enabled for this search result.

          - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

            Array of text content blocks from the search result.

            - `required string Text`

              The text content.

            - `required Type Type`

              - `"text"Text`

          - `required string Source`

            The URL source of the search result.

          - `required string Title`

            The title of the search result.

          - `required Type Type`

            - `"search_result"SearchResult`

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`.

    - `class BetaManagedAgentsUserDefineOutcomeEvent:`

      Echo of a `user.define_outcome` input event. Carries the server-generated `outcome_id` that subsequent `span.outcome_evaluation_*` events reference.

      - `required string ID`

        Unique identifier for this event.

      - `required string Description`

        What the agent should produce. Copied from the input event.

      - `required Int? MaxIterations`

        Evaluate-then-revise cycles before giving up. Default 3, max 20.

      - `required string OutcomeID`

        Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Rubric Rubric`

        Rubric for grading the quality of an outcome.

        - `class BetaManagedAgentsFileRubric:`

          Rubric referenced by a file uploaded via the Files API.

          - `required string FileID`

            ID of the rubric file.

          - `required Type Type`

            - `"file"File`

        - `class BetaManagedAgentsTextRubric:`

          Rubric content provided inline as text.

          - `required string Content`

            Rubric content. Plain text or markdown — the grader treats it as freeform text.

          - `required Type Type`

            - `"text"Text`

      - `required Type Type`

        - `"user.define_outcome"UserDefineOutcome`

    - `class BetaManagedAgentsUserToolResultEvent:`

      Event sent by the client providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.

      - `required string ID`

        Unique identifier for this event.

      - `required string ToolUseID`

        The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.tool_result"UserToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`.

### Example

```csharp
EventSendParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7",
    Events =
    [
        new BetaManagedAgentsUserMessageEventParams()
        {
            Content =
            [
                new BetaManagedAgentsTextBlock()
                {
                    Text = "Where is my order #1234?",
                    Type = Type.Text,
                },
            ],
            Type = Type.UserMessage,
        },
    ],
};

var betaManagedAgentsSendSessionEvents = await client.Beta.Sessions.Events.Send(parameters);

Console.WriteLine(betaManagedAgentsSendSessionEvents);
```

#### Response

```json
{
  "data": [
    {
      "id": "sevt_011CZkZGOp0iBcp4kaQSihUmy",
      "content": [
        {
          "text": "Where is my order #1234?",
          "type": "text"
        }
      ],
      "type": "user.message",
      "processed_at": "2026-03-15T10:00:00Z"
    }
  ]
}
```

## Stream Events

`BetaManagedAgentsStreamSessionEvents Beta.Sessions.Events.StreamStreaming(EventStreamParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/sessions/{session_id}/events/stream`

Stream Events

### Parameters

- `EventStreamParams parameters`

  - `required string sessionID`

    Path parameter session_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union`

  Server-sent event in the session stream.

  - `class BetaManagedAgentsUserMessageEvent:`

    A user message event in the session conversation.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Array of content blocks comprising the user message.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

        - `required string Text`

          The text content.

        - `required Type Type`

          - `"text"Text`

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

        - `required Source Source`

          Union type for image source variants.

          - `class BetaManagedAgentsBase64ImageSource:`

            Base64-encoded image data.

            - `required string Data`

              Base64-encoded image data.

            - `required string MediaType`

              MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

            - `required Type Type`

              - `"base64"Base64`

          - `class BetaManagedAgentsUrlImageSource:`

            Image referenced by URL.

            - `required Type Type`

              - `"url"Url`

            - `required string Url`

              URL of the image to fetch.

          - `class BetaManagedAgentsFileImageSource:`

            Image referenced by file ID.

            - `required string FileID`

              ID of a previously uploaded file.

            - `required Type Type`

              - `"file"File`

        - `required Type Type`

          - `"image"Image`

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `required Source Source`

          Union type for document source variants.

          - `class BetaManagedAgentsBase64DocumentSource:`

            Base64-encoded document data.

            - `required string Data`

              Base64-encoded document data.

            - `required string MediaType`

              MIME type of the document (e.g., "application/pdf").

            - `required Type Type`

              - `"base64"Base64`

          - `class BetaManagedAgentsPlainTextDocumentSource:`

            Plain text document content.

            - `required string Data`

              The plain text content.

            - `required MediaType MediaType`

              MIME type of the text content. Must be "text/plain".

              - `"text/plain"TextPlain`

            - `required Type Type`

              - `"text"Text`

          - `class BetaManagedAgentsUrlDocumentSource:`

            Document referenced by URL.

            - `required Type Type`

              - `"url"Url`

            - `required string Url`

              URL of the document to fetch.

          - `class BetaManagedAgentsFileDocumentSource:`

            Document referenced by file ID.

            - `required string FileID`

              ID of a previously uploaded file.

            - `required Type Type`

              - `"file"File`

        - `required Type Type`

          - `"document"Document`

        - `string? Context`

          Additional context about the document for the model.

        - `string? Title`

          The title of the document.

    - `required Type Type`

      - `"user.message"UserMessage`

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

  - `class BetaManagedAgentsUserInterruptEvent:`

    An interrupt event that pauses agent execution and returns control to the user.

    - `required string ID`

      Unique identifier for this event.

    - `required Type Type`

      - `"user.interrupt"UserInterrupt`

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.

  - `class BetaManagedAgentsUserToolConfirmationEvent:`

    A tool confirmation event that approves or denies a pending tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required Result Result`

      UserToolConfirmationResult enum

      - `"allow"Allow`

      - `"deny"Deny`

    - `required string ToolUseID`

      The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.tool_confirmation"UserToolConfirmation`

    - `string? DenyMessage`

      Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval.

  - `class BetaManagedAgentsUserCustomToolResultEvent:`

    Event sent by the client providing the result of a custom tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required string CustomToolUseID`

      The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.custom_tool_result"UserCustomToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

        - `required BetaManagedAgentsSearchResultCitations Citations`

          Citation settings for a search result.

          - `required Boolean Enabled`

            Whether citations are enabled for this search result.

        - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

          Array of text content blocks from the search result.

          - `required string Text`

            The text content.

          - `required Type Type`

            - `"text"Text`

        - `required string Source`

          The URL source of the search result.

        - `required string Title`

          The title of the search result.

        - `required Type Type`

          - `"search_result"SearchResult`

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`.

  - `class BetaManagedAgentsAgentCustomToolUseEvent:`

    Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string Name`

      Name of the custom tool being called.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.custom_tool_use"AgentCustomToolUse`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.custom_tool_result` event to route the result back.

  - `class BetaManagedAgentsAgentMessageEvent:`

    An agent response event in the session conversation.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<BetaManagedAgentsTextBlock> Content`

      Array of text blocks comprising the agent response.

      - `required string Text`

        The text content.

      - `required Type Type`

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.message"AgentMessage`

  - `class BetaManagedAgentsAgentThinkingEvent:`

    Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thinking"AgentThinking`

  - `class BetaManagedAgentsAgentMcpToolUseEvent:`

    Event emitted when the agent invokes a tool provided by an MCP server.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string McpServerName`

      Name of the MCP server providing the tool.

    - `required string Name`

      Name of the MCP tool being used.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.mcp_tool_use"AgentMcpToolUse`

    - `EvaluatedPermission EvaluatedPermission`

      AgentEvaluatedPermission enum

      - `"allow"Allow`

      - `"ask"Ask`

      - `"deny"Deny`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

  - `class BetaManagedAgentsAgentMcpToolResultEvent:`

    Event representing the result of an MCP tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required string McpToolUseID`

      The id of the `agent.mcp_tool_use` event this result corresponds to.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.mcp_tool_result"AgentMcpToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

  - `class BetaManagedAgentsAgentToolUseEvent:`

    Event emitted when the agent invokes a built-in agent tool.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string Name`

      Name of the agent tool being used.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.tool_use"AgentToolUse`

    - `EvaluatedPermission EvaluatedPermission`

      AgentEvaluatedPermission enum

      - `"allow"Allow`

      - `"ask"Ask`

      - `"deny"Deny`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

  - `class BetaManagedAgentsAgentToolResultEvent:`

    Event representing the result of an agent tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string ToolUseID`

      The id of the `agent.tool_use` event this result corresponds to.

    - `required Type Type`

      - `"agent.tool_result"AgentToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

  - `class BetaManagedAgentsAgentThreadMessageReceivedEvent:`

    Delivery event written to the target thread's input stream when an agent-to-agent message arrives.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Message content blocks.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

    - `required string FromSessionThreadID`

      Public `sthr_` ID of the thread that sent the message.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thread_message_received"AgentThreadMessageReceived`

    - `string? FromAgentName`

      Name of the callable agent this message came from. Absent when received from the primary agent.

  - `class BetaManagedAgentsAgentThreadMessageSentEvent:`

    Observability event emitted to the sender's output stream when an agent-to-agent message is sent.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Message content blocks.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string ToSessionThreadID`

      Public `sthr_` ID of the thread the message was sent to.

    - `required Type Type`

      - `"agent.thread_message_sent"AgentThreadMessageSent`

    - `string? ToAgentName`

      Name of the callable agent this message was sent to. Absent when sent to the primary agent.

  - `class BetaManagedAgentsAgentThreadContextCompactedEvent:`

    Indicates that context compaction (summarization) occurred during the session.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thread_context_compacted"AgentThreadContextCompacted`

  - `class BetaManagedAgentsSessionErrorEvent:`

    An error event indicating a problem occurred during session execution.

    - `required string ID`

      Unique identifier for this event.

    - `required Error Error`

      An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

      - `class BetaManagedAgentsUnknownError:`

        An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `required Type Type`

              - `"retrying"Retrying`

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `required Type Type`

              - `"exhausted"Exhausted`

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

            - `required Type Type`

              - `"terminal"Terminal`

        - `required Type Type`

          - `"unknown_error"UnknownError`

      - `class BetaManagedAgentsModelOverloadedError:`

        The model is currently overloaded. Emitted after automatic retries are exhausted.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_overloaded_error"ModelOverloadedError`

      - `class BetaManagedAgentsModelRateLimitedError:`

        The model request was rate-limited.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_rate_limited_error"ModelRateLimitedError`

      - `class BetaManagedAgentsModelRequestFailedError:`

        A model request failed for a reason other than overload or rate-limiting.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_request_failed_error"ModelRequestFailedError`

      - `class BetaManagedAgentsMcpConnectionFailedError:`

        Failed to connect to an MCP server.

        - `required string McpServerName`

          Name of the MCP server that failed to connect.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"mcp_connection_failed_error"McpConnectionFailedError`

      - `class BetaManagedAgentsMcpAuthenticationFailedError:`

        Authentication to an MCP server failed.

        - `required string McpServerName`

          Name of the MCP server that failed authentication.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"mcp_authentication_failed_error"McpAuthenticationFailedError`

      - `class BetaManagedAgentsBillingError:`

        The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"billing_error"BillingError`

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.error"SessionError`

  - `class BetaManagedAgentsSessionStatusRescheduledEvent:`

    Indicates the session is recovering from an error state and is rescheduled for execution.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_rescheduled"SessionStatusRescheduled`

  - `class BetaManagedAgentsSessionStatusRunningEvent:`

    Indicates the session is actively running and the agent is working.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_running"SessionStatusRunning`

  - `class BetaManagedAgentsSessionStatusIdleEvent:`

    Indicates the agent has paused and is awaiting user input.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required StopReason StopReason`

      The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionEndTurn:`

        The agent completed its turn naturally and is ready for the next user message.

        - `required Type Type`

          - `"end_turn"EndTurn`

      - `class BetaManagedAgentsSessionRequiresAction:`

        The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

        - `required IReadOnlyList<string> EventIds`

          The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder.

        - `required Type Type`

          - `"requires_action"RequiresAction`

      - `class BetaManagedAgentsSessionRetriesExhausted:`

        The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

        - `required Type Type`

          - `"retries_exhausted"RetriesExhausted`

    - `required Type Type`

      - `"session.status_idle"SessionStatusIdle`

  - `class BetaManagedAgentsSessionStatusTerminatedEvent:`

    Indicates the session has terminated, either due to an error or completion.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_terminated"SessionStatusTerminated`

  - `class BetaManagedAgentsSessionThreadCreatedEvent:`

    Emitted when a subagent is spawned as a new thread. Written to the parent thread's output stream so clients observing the session see child creation.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the callable agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public `sthr_` ID of the newly created thread.

    - `required Type Type`

      - `"session.thread_created"SessionThreadCreated`

  - `class BetaManagedAgentsSpanOutcomeEvaluationStartEvent:`

    Emitted when an outcome evaluation cycle begins.

    - `required string ID`

      Unique identifier for this event.

    - `required Int Iteration`

      0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.outcome_evaluation_start"SpanOutcomeEvaluationStart`

  - `class BetaManagedAgentsSpanOutcomeEvaluationEndEvent:`

    Emitted when an outcome evaluation cycle completes. Carries the verdict and aggregate token usage. A verdict of `needs_revision` means another evaluation cycle follows; `satisfied`, `max_iterations_reached`, `failed`, or `interrupted` are terminal — no further evaluation cycles follow.

    - `required string ID`

      Unique identifier for this event.

    - `required string Explanation`

      Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why.

    - `required Int Iteration`

      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

    - `required string OutcomeEvaluationStartID`

      The id of the corresponding `span.outcome_evaluation_start` event.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string Result`

      Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress.

    - `required Type Type`

      - `"span.outcome_evaluation_end"SpanOutcomeEvaluationEnd`

    - `required BetaManagedAgentsSpanModelUsage Usage`

      Token usage for a single model request.

      - `required Int CacheCreationInputTokens`

        Tokens used to create prompt cache in this request.

      - `required Int CacheReadInputTokens`

        Tokens read from prompt cache in this request.

      - `required Int InputTokens`

        Input tokens consumed by this request.

      - `required Int OutputTokens`

        Output tokens generated by this request.

      - `Speed? Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

  - `class BetaManagedAgentsSpanModelRequestStartEvent:`

    Emitted when a model request is initiated by the agent.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.model_request_start"SpanModelRequestStart`

  - `class BetaManagedAgentsSpanModelRequestEndEvent:`

    Emitted when a model request completes.

    - `required string ID`

      Unique identifier for this event.

    - `required Boolean? IsError`

      Whether the model request resulted in an error.

    - `required string ModelRequestStartID`

      The id of the corresponding `span.model_request_start` event.

    - `required BetaManagedAgentsSpanModelUsage ModelUsage`

      Token usage for a single model request.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.model_request_end"SpanModelRequestEnd`

  - `class BetaManagedAgentsSpanOutcomeEvaluationOngoingEvent:`

    Periodic heartbeat emitted while an outcome evaluation cycle is in progress. Distinguishes 'evaluation is actively running' from 'evaluation is stuck' between the corresponding `span.outcome_evaluation_start` and `span.outcome_evaluation_end` events.

    - `required string ID`

      Unique identifier for this event.

    - `required Int Iteration`

      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.outcome_evaluation_ongoing"SpanOutcomeEvaluationOngoing`

  - `class BetaManagedAgentsUserDefineOutcomeEvent:`

    Echo of a `user.define_outcome` input event. Carries the server-generated `outcome_id` that subsequent `span.outcome_evaluation_*` events reference.

    - `required string ID`

      Unique identifier for this event.

    - `required string Description`

      What the agent should produce. Copied from the input event.

    - `required Int? MaxIterations`

      Evaluate-then-revise cycles before giving up. Default 3, max 20.

    - `required string OutcomeID`

      Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Rubric Rubric`

      Rubric for grading the quality of an outcome.

      - `class BetaManagedAgentsFileRubric:`

        Rubric referenced by a file uploaded via the Files API.

        - `required string FileID`

          ID of the rubric file.

        - `required Type Type`

          - `"file"File`

      - `class BetaManagedAgentsTextRubric:`

        Rubric content provided inline as text.

        - `required string Content`

          Rubric content. Plain text or markdown — the grader treats it as freeform text.

        - `required Type Type`

          - `"text"Text`

    - `required Type Type`

      - `"user.define_outcome"UserDefineOutcome`

  - `class BetaManagedAgentsSessionDeletedEvent:`

    Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.deleted"SessionDeleted`

  - `class BetaManagedAgentsSessionThreadStatusRunningEvent:`

    A session thread has begun executing. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that started running.

    - `required Type Type`

      - `"session.thread_status_running"SessionThreadStatusRunning`

  - `class BetaManagedAgentsSessionThreadStatusIdleEvent:`

    A session thread has yielded and is awaiting input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that went idle.

    - `required StopReason StopReason`

      The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionEndTurn:`

        The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionRequiresAction:`

        The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

      - `class BetaManagedAgentsSessionRetriesExhausted:`

        The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

    - `required Type Type`

      - `"session.thread_status_idle"SessionThreadStatusIdle`

  - `class BetaManagedAgentsSessionThreadStatusTerminatedEvent:`

    A session thread has terminated and will accept no further input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that terminated.

    - `required Type Type`

      - `"session.thread_status_terminated"SessionThreadStatusTerminated`

  - `class BetaManagedAgentsUserToolResultEvent:`

    Event sent by the client providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.

    - `required string ID`

      Unique identifier for this event.

    - `required string ToolUseID`

      The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.tool_result"UserToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`.

  - `class BetaManagedAgentsSessionThreadStatusRescheduledEvent:`

    A session thread hit a transient error and is retrying automatically. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that is retrying.

    - `required Type Type`

      - `"session.thread_status_rescheduled"SessionThreadStatusRescheduled`

  - `class BetaManagedAgentsSessionUpdatedEvent:`

    Emitted when an UpdateSession request changed at least one field. Carries only the fields that changed; absent fields were not part of the update. The new configuration applies from the next turn.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.updated"SessionUpdated`

    - `BetaManagedAgentsSessionAgent? Agent`

      Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

      - `required string ID`

      - `required string? Description`

      - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

        - `required string Name`

        - `required Type Type`

          - `"url"Url`

        - `required string Url`

      - `required BetaManagedAgentsModelConfig Model`

        Model identifier and configuration.

        - `required BetaManagedAgentsModel ID`

          The model that will power your agent.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `"claude-opus-4-8"ClaudeOpus4_8`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-7"ClaudeOpus4_7`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-6"ClaudeOpus4_6`

            Most intelligent model for building agents and coding

          - `"claude-sonnet-4-6"ClaudeSonnet4_6`

            Best combination of speed and intelligence

          - `"claude-haiku-4-5"ClaudeHaiku4_5`

            Fastest model with near-frontier intelligence

          - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

            Fastest model with near-frontier intelligence

          - `"claude-opus-4-5"ClaudeOpus4_5`

            Premium model combining maximum intelligence with practical performance

          - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

            Premium model combining maximum intelligence with practical performance

          - `"claude-sonnet-4-5"ClaudeSonnet4_5`

            High-performance model for agents and coding

          - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

            High-performance model for agents and coding

        - `Speed Speed`

          Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

          - `"standard"Standard`

          - `"fast"Fast`

      - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

        Resolved coordinator topology with full agent definitions for each roster member.

        - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

          Full `agent` definitions the coordinator may spawn as session threads.

          - `required string ID`

          - `required string? Description`

          - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

            - `required string Name`

            - `required Type Type`

            - `required string Url`

          - `required BetaManagedAgentsModelConfig Model`

            Model identifier and configuration.

          - `required string Name`

          - `required IReadOnlyList<Skill> Skills`

            - `class BetaManagedAgentsAnthropicSkill:`

              A resolved Anthropic-managed skill.

              - `required string SkillID`

              - `required Type Type`

                - `"anthropic"Anthropic`

              - `required string Version`

            - `class BetaManagedAgentsCustomSkill:`

              A resolved user-created custom skill.

              - `required string SkillID`

              - `required Type Type`

                - `"custom"Custom`

              - `required string Version`

          - `required string? System`

          - `required IReadOnlyList<Tool> Tools`

            - `class BetaManagedAgentsAgentToolset20260401:`

              - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

                - `required Boolean Enabled`

                - `required Name Name`

                  Built-in agent tool identifier.

                  - `"bash"Bash`

                  - `"edit"Edit`

                  - `"read"Read`

                  - `"write"Write`

                  - `"glob"Glob`

                  - `"grep"Grep`

                  - `"web_fetch"WebFetch`

                  - `"web_search"WebSearch`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                    - `required Type Type`

                      - `"always_allow"AlwaysAllow`

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

                    - `required Type Type`

                      - `"always_ask"AlwaysAsk`

              - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

                Resolved default configuration for agent tools.

                - `required Boolean Enabled`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required Type Type`

                - `"agent_toolset_20260401"AgentToolset20260401`

            - `class BetaManagedAgentsMcpToolset:`

              - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

                - `required Boolean Enabled`

                - `required string Name`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

                Resolved default configuration for all tools from an MCP server.

                - `required Boolean Enabled`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required string McpServerName`

              - `required Type Type`

                - `"mcp_toolset"McpToolset`

            - `class BetaManagedAgentsCustomTool:`

              A custom tool as returned in API responses.

              - `required string Description`

              - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

                JSON Schema for custom tool input parameters.

                - `IReadOnlyDictionary<string, JsonElement>? Properties`

                  JSON Schema properties defining the tool's input parameters.

                - `IReadOnlyList<string> Required`

                  List of required property names.

                - `Type Type`

                  Must be 'object' for tool input schemas.

                  - `"object"Object`

              - `required string Name`

              - `required Type Type`

                - `"custom"Custom`

          - `required Type Type`

            - `"agent"Agent`

          - `required Int Version`

        - `required Type Type`

          - `"coordinator"Coordinator`

      - `required string Name`

      - `required IReadOnlyList<Skill> Skills`

        - `class BetaManagedAgentsAnthropicSkill:`

          A resolved Anthropic-managed skill.

        - `class BetaManagedAgentsCustomSkill:`

          A resolved user-created custom skill.

      - `required string? System`

      - `required IReadOnlyList<Tool> Tools`

        - `class BetaManagedAgentsAgentToolset20260401:`

        - `class BetaManagedAgentsMcpToolset:`

        - `class BetaManagedAgentsCustomTool:`

          A custom tool as returned in API responses.

      - `required Type Type`

        - `"agent"Agent`

      - `required Int Version`

    - `IReadOnlyDictionary<string, string> Metadata`

      The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty.

    - `string? Title`

      The session's new title. Present only when the update changed it.

### Example

```csharp
EventStreamParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7"
};

await foreach (var betaManagedAgentsStreamSessionEvents in client.Beta.Sessions.Events.StreamStreaming(parameters))
{
    Console.WriteLine(betaManagedAgentsStreamSessionEvents);
}
```

#### Response

```json
{
  "id": "sevt_011CZkZGOp0iBcp4kaQSihUmy",
  "content": [
    {
      "text": "Where is my order #1234?",
      "type": "text"
    }
  ],
  "type": "user.message",
  "processed_at": "2026-03-15T10:00:00Z"
}
```

## Domain Types

### Beta Managed Agents Agent Custom Tool Use Event

- `class BetaManagedAgentsAgentCustomToolUseEvent:`

  Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result.

  - `required string ID`

    Unique identifier for this event.

  - `required IReadOnlyDictionary<string, JsonElement> Input`

    Input parameters for the tool call.

  - `required string Name`

    Name of the custom tool being called.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"agent.custom_tool_use"AgentCustomToolUse`

  - `string? SessionThreadID`

    When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.custom_tool_result` event to route the result back.

### Beta Managed Agents Agent MCP Tool Result Event

- `class BetaManagedAgentsAgentMcpToolResultEvent:`

  Event representing the result of an MCP tool execution.

  - `required string ID`

    Unique identifier for this event.

  - `required string McpToolUseID`

    The id of the `agent.mcp_tool_use` event this result corresponds to.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"agent.mcp_tool_result"AgentMcpToolResult`

  - `IReadOnlyList<Content> Content`

    The result content returned by the tool.

    - `class BetaManagedAgentsTextBlock:`

      Regular text content.

      - `required string Text`

        The text content.

      - `required Type Type`

        - `"text"Text`

    - `class BetaManagedAgentsImageBlock:`

      Image content specified directly as base64 data or as a reference via a URL.

      - `required Source Source`

        Union type for image source variants.

        - `class BetaManagedAgentsBase64ImageSource:`

          Base64-encoded image data.

          - `required string Data`

            Base64-encoded image data.

          - `required string MediaType`

            MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsUrlImageSource:`

          Image referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the image to fetch.

        - `class BetaManagedAgentsFileImageSource:`

          Image referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"image"Image`

    - `class BetaManagedAgentsDocumentBlock:`

      Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required Source Source`

        Union type for document source variants.

        - `class BetaManagedAgentsBase64DocumentSource:`

          Base64-encoded document data.

          - `required string Data`

            Base64-encoded document data.

          - `required string MediaType`

            MIME type of the document (e.g., "application/pdf").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsPlainTextDocumentSource:`

          Plain text document content.

          - `required string Data`

            The plain text content.

          - `required MediaType MediaType`

            MIME type of the text content. Must be "text/plain".

            - `"text/plain"TextPlain`

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsUrlDocumentSource:`

          Document referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the document to fetch.

        - `class BetaManagedAgentsFileDocumentSource:`

          Document referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"document"Document`

      - `string? Context`

        Additional context about the document for the model.

      - `string? Title`

        The title of the document.

    - `class BetaManagedAgentsSearchResultBlock:`

      A block containing a web search result.

      - `required BetaManagedAgentsSearchResultCitations Citations`

        Citation settings for a search result.

        - `required Boolean Enabled`

          Whether citations are enabled for this search result.

      - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

        Array of text content blocks from the search result.

        - `required string Text`

          The text content.

        - `required Type Type`

          - `"text"Text`

      - `required string Source`

        The URL source of the search result.

      - `required string Title`

        The title of the search result.

      - `required Type Type`

        - `"search_result"SearchResult`

  - `Boolean? IsError`

    Whether the tool execution resulted in an error.

### Beta Managed Agents Agent MCP Tool Use Event

- `class BetaManagedAgentsAgentMcpToolUseEvent:`

  Event emitted when the agent invokes a tool provided by an MCP server.

  - `required string ID`

    Unique identifier for this event.

  - `required IReadOnlyDictionary<string, JsonElement> Input`

    Input parameters for the tool call.

  - `required string McpServerName`

    Name of the MCP server providing the tool.

  - `required string Name`

    Name of the MCP tool being used.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"agent.mcp_tool_use"AgentMcpToolUse`

  - `EvaluatedPermission EvaluatedPermission`

    AgentEvaluatedPermission enum

    - `"allow"Allow`

    - `"ask"Ask`

    - `"deny"Deny`

  - `string? SessionThreadID`

    When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

### Beta Managed Agents Agent Message Event

- `class BetaManagedAgentsAgentMessageEvent:`

  An agent response event in the session conversation.

  - `required string ID`

    Unique identifier for this event.

  - `required IReadOnlyList<BetaManagedAgentsTextBlock> Content`

    Array of text blocks comprising the agent response.

    - `required string Text`

      The text content.

    - `required Type Type`

      - `"text"Text`

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"agent.message"AgentMessage`

### Beta Managed Agents Agent Thinking Event

- `class BetaManagedAgentsAgentThinkingEvent:`

  Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier.

  - `required string ID`

    Unique identifier for this event.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"agent.thinking"AgentThinking`

### Beta Managed Agents Agent Thread Context Compacted Event

- `class BetaManagedAgentsAgentThreadContextCompactedEvent:`

  Indicates that context compaction (summarization) occurred during the session.

  - `required string ID`

    Unique identifier for this event.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"agent.thread_context_compacted"AgentThreadContextCompacted`

### Beta Managed Agents Agent Thread Message Received Event

- `class BetaManagedAgentsAgentThreadMessageReceivedEvent:`

  Delivery event written to the target thread's input stream when an agent-to-agent message arrives.

  - `required string ID`

    Unique identifier for this event.

  - `required IReadOnlyList<Content> Content`

    Message content blocks.

    - `class BetaManagedAgentsTextBlock:`

      Regular text content.

      - `required string Text`

        The text content.

      - `required Type Type`

        - `"text"Text`

    - `class BetaManagedAgentsImageBlock:`

      Image content specified directly as base64 data or as a reference via a URL.

      - `required Source Source`

        Union type for image source variants.

        - `class BetaManagedAgentsBase64ImageSource:`

          Base64-encoded image data.

          - `required string Data`

            Base64-encoded image data.

          - `required string MediaType`

            MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsUrlImageSource:`

          Image referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the image to fetch.

        - `class BetaManagedAgentsFileImageSource:`

          Image referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"image"Image`

    - `class BetaManagedAgentsDocumentBlock:`

      Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required Source Source`

        Union type for document source variants.

        - `class BetaManagedAgentsBase64DocumentSource:`

          Base64-encoded document data.

          - `required string Data`

            Base64-encoded document data.

          - `required string MediaType`

            MIME type of the document (e.g., "application/pdf").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsPlainTextDocumentSource:`

          Plain text document content.

          - `required string Data`

            The plain text content.

          - `required MediaType MediaType`

            MIME type of the text content. Must be "text/plain".

            - `"text/plain"TextPlain`

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsUrlDocumentSource:`

          Document referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the document to fetch.

        - `class BetaManagedAgentsFileDocumentSource:`

          Document referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"document"Document`

      - `string? Context`

        Additional context about the document for the model.

      - `string? Title`

        The title of the document.

  - `required string FromSessionThreadID`

    Public `sthr_` ID of the thread that sent the message.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"agent.thread_message_received"AgentThreadMessageReceived`

  - `string? FromAgentName`

    Name of the callable agent this message came from. Absent when received from the primary agent.

### Beta Managed Agents Agent Thread Message Sent Event

- `class BetaManagedAgentsAgentThreadMessageSentEvent:`

  Observability event emitted to the sender's output stream when an agent-to-agent message is sent.

  - `required string ID`

    Unique identifier for this event.

  - `required IReadOnlyList<Content> Content`

    Message content blocks.

    - `class BetaManagedAgentsTextBlock:`

      Regular text content.

      - `required string Text`

        The text content.

      - `required Type Type`

        - `"text"Text`

    - `class BetaManagedAgentsImageBlock:`

      Image content specified directly as base64 data or as a reference via a URL.

      - `required Source Source`

        Union type for image source variants.

        - `class BetaManagedAgentsBase64ImageSource:`

          Base64-encoded image data.

          - `required string Data`

            Base64-encoded image data.

          - `required string MediaType`

            MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsUrlImageSource:`

          Image referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the image to fetch.

        - `class BetaManagedAgentsFileImageSource:`

          Image referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"image"Image`

    - `class BetaManagedAgentsDocumentBlock:`

      Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required Source Source`

        Union type for document source variants.

        - `class BetaManagedAgentsBase64DocumentSource:`

          Base64-encoded document data.

          - `required string Data`

            Base64-encoded document data.

          - `required string MediaType`

            MIME type of the document (e.g., "application/pdf").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsPlainTextDocumentSource:`

          Plain text document content.

          - `required string Data`

            The plain text content.

          - `required MediaType MediaType`

            MIME type of the text content. Must be "text/plain".

            - `"text/plain"TextPlain`

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsUrlDocumentSource:`

          Document referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the document to fetch.

        - `class BetaManagedAgentsFileDocumentSource:`

          Document referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"document"Document`

      - `string? Context`

        Additional context about the document for the model.

      - `string? Title`

        The title of the document.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required string ToSessionThreadID`

    Public `sthr_` ID of the thread the message was sent to.

  - `required Type Type`

    - `"agent.thread_message_sent"AgentThreadMessageSent`

  - `string? ToAgentName`

    Name of the callable agent this message was sent to. Absent when sent to the primary agent.

### Beta Managed Agents Agent Tool Result Event

- `class BetaManagedAgentsAgentToolResultEvent:`

  Event representing the result of an agent tool execution.

  - `required string ID`

    Unique identifier for this event.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required string ToolUseID`

    The id of the `agent.tool_use` event this result corresponds to.

  - `required Type Type`

    - `"agent.tool_result"AgentToolResult`

  - `IReadOnlyList<Content> Content`

    The result content returned by the tool.

    - `class BetaManagedAgentsTextBlock:`

      Regular text content.

      - `required string Text`

        The text content.

      - `required Type Type`

        - `"text"Text`

    - `class BetaManagedAgentsImageBlock:`

      Image content specified directly as base64 data or as a reference via a URL.

      - `required Source Source`

        Union type for image source variants.

        - `class BetaManagedAgentsBase64ImageSource:`

          Base64-encoded image data.

          - `required string Data`

            Base64-encoded image data.

          - `required string MediaType`

            MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsUrlImageSource:`

          Image referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the image to fetch.

        - `class BetaManagedAgentsFileImageSource:`

          Image referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"image"Image`

    - `class BetaManagedAgentsDocumentBlock:`

      Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required Source Source`

        Union type for document source variants.

        - `class BetaManagedAgentsBase64DocumentSource:`

          Base64-encoded document data.

          - `required string Data`

            Base64-encoded document data.

          - `required string MediaType`

            MIME type of the document (e.g., "application/pdf").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsPlainTextDocumentSource:`

          Plain text document content.

          - `required string Data`

            The plain text content.

          - `required MediaType MediaType`

            MIME type of the text content. Must be "text/plain".

            - `"text/plain"TextPlain`

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsUrlDocumentSource:`

          Document referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the document to fetch.

        - `class BetaManagedAgentsFileDocumentSource:`

          Document referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"document"Document`

      - `string? Context`

        Additional context about the document for the model.

      - `string? Title`

        The title of the document.

    - `class BetaManagedAgentsSearchResultBlock:`

      A block containing a web search result.

      - `required BetaManagedAgentsSearchResultCitations Citations`

        Citation settings for a search result.

        - `required Boolean Enabled`

          Whether citations are enabled for this search result.

      - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

        Array of text content blocks from the search result.

        - `required string Text`

          The text content.

        - `required Type Type`

          - `"text"Text`

      - `required string Source`

        The URL source of the search result.

      - `required string Title`

        The title of the search result.

      - `required Type Type`

        - `"search_result"SearchResult`

  - `Boolean? IsError`

    Whether the tool execution resulted in an error.

### Beta Managed Agents Agent Tool Use Event

- `class BetaManagedAgentsAgentToolUseEvent:`

  Event emitted when the agent invokes a built-in agent tool.

  - `required string ID`

    Unique identifier for this event.

  - `required IReadOnlyDictionary<string, JsonElement> Input`

    Input parameters for the tool call.

  - `required string Name`

    Name of the agent tool being used.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"agent.tool_use"AgentToolUse`

  - `EvaluatedPermission EvaluatedPermission`

    AgentEvaluatedPermission enum

    - `"allow"Allow`

    - `"ask"Ask`

    - `"deny"Deny`

  - `string? SessionThreadID`

    When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

### Beta Managed Agents Base64 Document Source

- `class BetaManagedAgentsBase64DocumentSource:`

  Base64-encoded document data.

  - `required string Data`

    Base64-encoded document data.

  - `required string MediaType`

    MIME type of the document (e.g., "application/pdf").

  - `required Type Type`

    - `"base64"Base64`

### Beta Managed Agents Base64 Image Source

- `class BetaManagedAgentsBase64ImageSource:`

  Base64-encoded image data.

  - `required string Data`

    Base64-encoded image data.

  - `required string MediaType`

    MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

  - `required Type Type`

    - `"base64"Base64`

### Beta Managed Agents Billing Error

- `class BetaManagedAgentsBillingError:`

  The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state.

  - `required string Message`

    Human-readable error description.

  - `required RetryStatus RetryStatus`

    What the client should do next in response to this error.

    - `class BetaManagedAgentsRetryStatusRetrying:`

      The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

      - `required Type Type`

        - `"retrying"Retrying`

    - `class BetaManagedAgentsRetryStatusExhausted:`

      This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

      - `required Type Type`

        - `"exhausted"Exhausted`

    - `class BetaManagedAgentsRetryStatusTerminal:`

      The session encountered a terminal error and will transition to `terminated` state.

      - `required Type Type`

        - `"terminal"Terminal`

  - `required Type Type`

    - `"billing_error"BillingError`

### Beta Managed Agents Document Block

- `class BetaManagedAgentsDocumentBlock:`

  Document content, either specified directly as base64 data, as text, or as a reference via a URL.

  - `required Source Source`

    Union type for document source variants.

    - `class BetaManagedAgentsBase64DocumentSource:`

      Base64-encoded document data.

      - `required string Data`

        Base64-encoded document data.

      - `required string MediaType`

        MIME type of the document (e.g., "application/pdf").

      - `required Type Type`

        - `"base64"Base64`

    - `class BetaManagedAgentsPlainTextDocumentSource:`

      Plain text document content.

      - `required string Data`

        The plain text content.

      - `required MediaType MediaType`

        MIME type of the text content. Must be "text/plain".

        - `"text/plain"TextPlain`

      - `required Type Type`

        - `"text"Text`

    - `class BetaManagedAgentsUrlDocumentSource:`

      Document referenced by URL.

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

        URL of the document to fetch.

    - `class BetaManagedAgentsFileDocumentSource:`

      Document referenced by file ID.

      - `required string FileID`

        ID of a previously uploaded file.

      - `required Type Type`

        - `"file"File`

  - `required Type Type`

    - `"document"Document`

  - `string? Context`

    Additional context about the document for the model.

  - `string? Title`

    The title of the document.

### Beta Managed Agents Event Params

- `class BetaManagedAgentsEventParams: A class that can be one of several variants.union`

  Union type for event parameters that can be sent to a session.

  - `class BetaManagedAgentsUserMessageEventParams:`

    Parameters for sending a user message to the session.

    - `required IReadOnlyList<Content> Content`

      Array of content blocks for the user message.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

        - `required string Text`

          The text content.

        - `required Type Type`

          - `"text"Text`

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

        - `required Source Source`

          Union type for image source variants.

          - `class BetaManagedAgentsBase64ImageSource:`

            Base64-encoded image data.

            - `required string Data`

              Base64-encoded image data.

            - `required string MediaType`

              MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

            - `required Type Type`

              - `"base64"Base64`

          - `class BetaManagedAgentsUrlImageSource:`

            Image referenced by URL.

            - `required Type Type`

              - `"url"Url`

            - `required string Url`

              URL of the image to fetch.

          - `class BetaManagedAgentsFileImageSource:`

            Image referenced by file ID.

            - `required string FileID`

              ID of a previously uploaded file.

            - `required Type Type`

              - `"file"File`

        - `required Type Type`

          - `"image"Image`

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `required Source Source`

          Union type for document source variants.

          - `class BetaManagedAgentsBase64DocumentSource:`

            Base64-encoded document data.

            - `required string Data`

              Base64-encoded document data.

            - `required string MediaType`

              MIME type of the document (e.g., "application/pdf").

            - `required Type Type`

              - `"base64"Base64`

          - `class BetaManagedAgentsPlainTextDocumentSource:`

            Plain text document content.

            - `required string Data`

              The plain text content.

            - `required MediaType MediaType`

              MIME type of the text content. Must be "text/plain".

              - `"text/plain"TextPlain`

            - `required Type Type`

              - `"text"Text`

          - `class BetaManagedAgentsUrlDocumentSource:`

            Document referenced by URL.

            - `required Type Type`

              - `"url"Url`

            - `required string Url`

              URL of the document to fetch.

          - `class BetaManagedAgentsFileDocumentSource:`

            Document referenced by file ID.

            - `required string FileID`

              ID of a previously uploaded file.

            - `required Type Type`

              - `"file"File`

        - `required Type Type`

          - `"document"Document`

        - `string? Context`

          Additional context about the document for the model.

        - `string? Title`

          The title of the document.

    - `required Type Type`

      - `"user.message"UserMessage`

  - `class BetaManagedAgentsUserInterruptEventParams:`

    Parameters for sending an interrupt to pause the agent.

    - `required Type Type`

      - `"user.interrupt"UserInterrupt`

    - `string? SessionThreadID`

      If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.

  - `class BetaManagedAgentsUserToolConfirmationEventParams:`

    Parameters for confirming or denying a tool execution request.

    - `required Result Result`

      UserToolConfirmationResult enum

      - `"allow"Allow`

      - `"deny"Deny`

    - `required string ToolUseID`

      The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.tool_confirmation"UserToolConfirmation`

    - `string? DenyMessage`

      Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

  - `class BetaManagedAgentsUserCustomToolResultEventParams:`

    Parameters for providing the result of a custom tool execution.

    - `required string CustomToolUseID`

      The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.custom_tool_result"UserCustomToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

        - `required BetaManagedAgentsSearchResultCitations Citations`

          Citation settings for a search result.

          - `required Boolean Enabled`

            Whether citations are enabled for this search result.

        - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

          Array of text content blocks from the search result.

          - `required string Text`

            The text content.

          - `required Type Type`

            - `"text"Text`

        - `required string Source`

          The URL source of the search result.

        - `required string Title`

          The title of the search result.

        - `required Type Type`

          - `"search_result"SearchResult`

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

  - `class BetaManagedAgentsUserDefineOutcomeEventParams:`

    Parameters for defining an outcome the agent should work toward. The agent begins work on receipt.

    - `required string Description`

      What the agent should produce. This is the task specification.

    - `required Rubric Rubric`

      Rubric for grading the quality of an outcome.

      - `class BetaManagedAgentsFileRubricParams:`

        Rubric referenced by a file uploaded via the Files API.

        - `required string FileID`

          ID of the rubric file.

        - `required Type Type`

          - `"file"File`

      - `class BetaManagedAgentsTextRubricParams:`

        Rubric content provided inline as text.

        - `required string Content`

          Rubric content. Plain text or markdown — the grader treats it as freeform text. Maximum 262144 characters.

        - `required Type Type`

          - `"text"Text`

    - `required Type Type`

      - `"user.define_outcome"UserDefineOutcome`

    - `Int? MaxIterations`

      Eval→revision cycles before giving up. Default 3, max 20.

  - `class BetaManagedAgentsUserToolResultEventParams:`

    Parameters for providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.

    - `required string ToolUseID`

      The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.tool_result"UserToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

### Beta Managed Agents File Document Source

- `class BetaManagedAgentsFileDocumentSource:`

  Document referenced by file ID.

  - `required string FileID`

    ID of a previously uploaded file.

  - `required Type Type`

    - `"file"File`

### Beta Managed Agents File Image Source

- `class BetaManagedAgentsFileImageSource:`

  Image referenced by file ID.

  - `required string FileID`

    ID of a previously uploaded file.

  - `required Type Type`

    - `"file"File`

### Beta Managed Agents File Rubric

- `class BetaManagedAgentsFileRubric:`

  Rubric referenced by a file uploaded via the Files API.

  - `required string FileID`

    ID of the rubric file.

  - `required Type Type`

    - `"file"File`

### Beta Managed Agents File Rubric Params

- `class BetaManagedAgentsFileRubricParams:`

  Rubric referenced by a file uploaded via the Files API.

  - `required string FileID`

    ID of the rubric file.

  - `required Type Type`

    - `"file"File`

### Beta Managed Agents Image Block

- `class BetaManagedAgentsImageBlock:`

  Image content specified directly as base64 data or as a reference via a URL.

  - `required Source Source`

    Union type for image source variants.

    - `class BetaManagedAgentsBase64ImageSource:`

      Base64-encoded image data.

      - `required string Data`

        Base64-encoded image data.

      - `required string MediaType`

        MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

      - `required Type Type`

        - `"base64"Base64`

    - `class BetaManagedAgentsUrlImageSource:`

      Image referenced by URL.

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

        URL of the image to fetch.

    - `class BetaManagedAgentsFileImageSource:`

      Image referenced by file ID.

      - `required string FileID`

        ID of a previously uploaded file.

      - `required Type Type`

        - `"file"File`

  - `required Type Type`

    - `"image"Image`

### Beta Managed Agents MCP Authentication Failed Error

- `class BetaManagedAgentsMcpAuthenticationFailedError:`

  Authentication to an MCP server failed.

  - `required string McpServerName`

    Name of the MCP server that failed authentication.

  - `required string Message`

    Human-readable error description.

  - `required RetryStatus RetryStatus`

    What the client should do next in response to this error.

    - `class BetaManagedAgentsRetryStatusRetrying:`

      The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

      - `required Type Type`

        - `"retrying"Retrying`

    - `class BetaManagedAgentsRetryStatusExhausted:`

      This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

      - `required Type Type`

        - `"exhausted"Exhausted`

    - `class BetaManagedAgentsRetryStatusTerminal:`

      The session encountered a terminal error and will transition to `terminated` state.

      - `required Type Type`

        - `"terminal"Terminal`

  - `required Type Type`

    - `"mcp_authentication_failed_error"McpAuthenticationFailedError`

### Beta Managed Agents MCP Connection Failed Error

- `class BetaManagedAgentsMcpConnectionFailedError:`

  Failed to connect to an MCP server.

  - `required string McpServerName`

    Name of the MCP server that failed to connect.

  - `required string Message`

    Human-readable error description.

  - `required RetryStatus RetryStatus`

    What the client should do next in response to this error.

    - `class BetaManagedAgentsRetryStatusRetrying:`

      The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

      - `required Type Type`

        - `"retrying"Retrying`

    - `class BetaManagedAgentsRetryStatusExhausted:`

      This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

      - `required Type Type`

        - `"exhausted"Exhausted`

    - `class BetaManagedAgentsRetryStatusTerminal:`

      The session encountered a terminal error and will transition to `terminated` state.

      - `required Type Type`

        - `"terminal"Terminal`

  - `required Type Type`

    - `"mcp_connection_failed_error"McpConnectionFailedError`

### Beta Managed Agents Model Overloaded Error

- `class BetaManagedAgentsModelOverloadedError:`

  The model is currently overloaded. Emitted after automatic retries are exhausted.

  - `required string Message`

    Human-readable error description.

  - `required RetryStatus RetryStatus`

    What the client should do next in response to this error.

    - `class BetaManagedAgentsRetryStatusRetrying:`

      The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

      - `required Type Type`

        - `"retrying"Retrying`

    - `class BetaManagedAgentsRetryStatusExhausted:`

      This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

      - `required Type Type`

        - `"exhausted"Exhausted`

    - `class BetaManagedAgentsRetryStatusTerminal:`

      The session encountered a terminal error and will transition to `terminated` state.

      - `required Type Type`

        - `"terminal"Terminal`

  - `required Type Type`

    - `"model_overloaded_error"ModelOverloadedError`

### Beta Managed Agents Model Rate Limited Error

- `class BetaManagedAgentsModelRateLimitedError:`

  The model request was rate-limited.

  - `required string Message`

    Human-readable error description.

  - `required RetryStatus RetryStatus`

    What the client should do next in response to this error.

    - `class BetaManagedAgentsRetryStatusRetrying:`

      The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

      - `required Type Type`

        - `"retrying"Retrying`

    - `class BetaManagedAgentsRetryStatusExhausted:`

      This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

      - `required Type Type`

        - `"exhausted"Exhausted`

    - `class BetaManagedAgentsRetryStatusTerminal:`

      The session encountered a terminal error and will transition to `terminated` state.

      - `required Type Type`

        - `"terminal"Terminal`

  - `required Type Type`

    - `"model_rate_limited_error"ModelRateLimitedError`

### Beta Managed Agents Model Request Failed Error

- `class BetaManagedAgentsModelRequestFailedError:`

  A model request failed for a reason other than overload or rate-limiting.

  - `required string Message`

    Human-readable error description.

  - `required RetryStatus RetryStatus`

    What the client should do next in response to this error.

    - `class BetaManagedAgentsRetryStatusRetrying:`

      The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

      - `required Type Type`

        - `"retrying"Retrying`

    - `class BetaManagedAgentsRetryStatusExhausted:`

      This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

      - `required Type Type`

        - `"exhausted"Exhausted`

    - `class BetaManagedAgentsRetryStatusTerminal:`

      The session encountered a terminal error and will transition to `terminated` state.

      - `required Type Type`

        - `"terminal"Terminal`

  - `required Type Type`

    - `"model_request_failed_error"ModelRequestFailedError`

### Beta Managed Agents Plain Text Document Source

- `class BetaManagedAgentsPlainTextDocumentSource:`

  Plain text document content.

  - `required string Data`

    The plain text content.

  - `required MediaType MediaType`

    MIME type of the text content. Must be "text/plain".

    - `"text/plain"TextPlain`

  - `required Type Type`

    - `"text"Text`

### Beta Managed Agents Retry Status Exhausted

- `class BetaManagedAgentsRetryStatusExhausted:`

  This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

  - `required Type Type`

    - `"exhausted"Exhausted`

### Beta Managed Agents Retry Status Retrying

- `class BetaManagedAgentsRetryStatusRetrying:`

  The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

  - `required Type Type`

    - `"retrying"Retrying`

### Beta Managed Agents Retry Status Terminal

- `class BetaManagedAgentsRetryStatusTerminal:`

  The session encountered a terminal error and will transition to `terminated` state.

  - `required Type Type`

    - `"terminal"Terminal`

### Beta Managed Agents Search Result Block

- `class BetaManagedAgentsSearchResultBlock:`

  A block containing a web search result.

  - `required BetaManagedAgentsSearchResultCitations Citations`

    Citation settings for a search result.

    - `required Boolean Enabled`

      Whether citations are enabled for this search result.

  - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

    Array of text content blocks from the search result.

    - `required string Text`

      The text content.

    - `required Type Type`

      - `"text"Text`

  - `required string Source`

    The URL source of the search result.

  - `required string Title`

    The title of the search result.

  - `required Type Type`

    - `"search_result"SearchResult`

### Beta Managed Agents Search Result Citations

- `class BetaManagedAgentsSearchResultCitations:`

  Citation settings for a search result.

  - `required Boolean Enabled`

    Whether citations are enabled for this search result.

### Beta Managed Agents Search Result Content

- `class BetaManagedAgentsSearchResultContent:`

  Text content within a search result.

  - `required string Text`

    The text content.

  - `required Type Type`

    - `"text"Text`

### Beta Managed Agents Send Session Events

- `class BetaManagedAgentsSendSessionEvents:`

  Events that were successfully sent to the session.

  - `IReadOnlyList<Data> Data`

    Sent events

    - `class BetaManagedAgentsUserMessageEvent:`

      A user message event in the session conversation.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyList<Content> Content`

        Array of content blocks comprising the user message.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

          - `required string Text`

            The text content.

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

          - `required Source Source`

            Union type for image source variants.

            - `class BetaManagedAgentsBase64ImageSource:`

              Base64-encoded image data.

              - `required string Data`

                Base64-encoded image data.

              - `required string MediaType`

                MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

              - `required Type Type`

                - `"base64"Base64`

            - `class BetaManagedAgentsUrlImageSource:`

              Image referenced by URL.

              - `required Type Type`

                - `"url"Url`

              - `required string Url`

                URL of the image to fetch.

            - `class BetaManagedAgentsFileImageSource:`

              Image referenced by file ID.

              - `required string FileID`

                ID of a previously uploaded file.

              - `required Type Type`

                - `"file"File`

          - `required Type Type`

            - `"image"Image`

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

          - `required Source Source`

            Union type for document source variants.

            - `class BetaManagedAgentsBase64DocumentSource:`

              Base64-encoded document data.

              - `required string Data`

                Base64-encoded document data.

              - `required string MediaType`

                MIME type of the document (e.g., "application/pdf").

              - `required Type Type`

                - `"base64"Base64`

            - `class BetaManagedAgentsPlainTextDocumentSource:`

              Plain text document content.

              - `required string Data`

                The plain text content.

              - `required MediaType MediaType`

                MIME type of the text content. Must be "text/plain".

                - `"text/plain"TextPlain`

              - `required Type Type`

                - `"text"Text`

            - `class BetaManagedAgentsUrlDocumentSource:`

              Document referenced by URL.

              - `required Type Type`

                - `"url"Url`

              - `required string Url`

                URL of the document to fetch.

            - `class BetaManagedAgentsFileDocumentSource:`

              Document referenced by file ID.

              - `required string FileID`

                ID of a previously uploaded file.

              - `required Type Type`

                - `"file"File`

          - `required Type Type`

            - `"document"Document`

          - `string? Context`

            Additional context about the document for the model.

          - `string? Title`

            The title of the document.

      - `required Type Type`

        - `"user.message"UserMessage`

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

    - `class BetaManagedAgentsUserInterruptEvent:`

      An interrupt event that pauses agent execution and returns control to the user.

      - `required string ID`

        Unique identifier for this event.

      - `required Type Type`

        - `"user.interrupt"UserInterrupt`

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.

    - `class BetaManagedAgentsUserToolConfirmationEvent:`

      A tool confirmation event that approves or denies a pending tool execution.

      - `required string ID`

        Unique identifier for this event.

      - `required Result Result`

        UserToolConfirmationResult enum

        - `"allow"Allow`

        - `"deny"Deny`

      - `required string ToolUseID`

        The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.tool_confirmation"UserToolConfirmation`

      - `string? DenyMessage`

        Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval.

    - `class BetaManagedAgentsUserCustomToolResultEvent:`

      Event sent by the client providing the result of a custom tool execution.

      - `required string ID`

        Unique identifier for this event.

      - `required string CustomToolUseID`

        The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.custom_tool_result"UserCustomToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

          - `required BetaManagedAgentsSearchResultCitations Citations`

            Citation settings for a search result.

            - `required Boolean Enabled`

              Whether citations are enabled for this search result.

          - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

            Array of text content blocks from the search result.

            - `required string Text`

              The text content.

            - `required Type Type`

              - `"text"Text`

          - `required string Source`

            The URL source of the search result.

          - `required string Title`

            The title of the search result.

          - `required Type Type`

            - `"search_result"SearchResult`

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`.

    - `class BetaManagedAgentsUserDefineOutcomeEvent:`

      Echo of a `user.define_outcome` input event. Carries the server-generated `outcome_id` that subsequent `span.outcome_evaluation_*` events reference.

      - `required string ID`

        Unique identifier for this event.

      - `required string Description`

        What the agent should produce. Copied from the input event.

      - `required Int? MaxIterations`

        Evaluate-then-revise cycles before giving up. Default 3, max 20.

      - `required string OutcomeID`

        Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Rubric Rubric`

        Rubric for grading the quality of an outcome.

        - `class BetaManagedAgentsFileRubric:`

          Rubric referenced by a file uploaded via the Files API.

          - `required string FileID`

            ID of the rubric file.

          - `required Type Type`

            - `"file"File`

        - `class BetaManagedAgentsTextRubric:`

          Rubric content provided inline as text.

          - `required string Content`

            Rubric content. Plain text or markdown — the grader treats it as freeform text.

          - `required Type Type`

            - `"text"Text`

      - `required Type Type`

        - `"user.define_outcome"UserDefineOutcome`

    - `class BetaManagedAgentsUserToolResultEvent:`

      Event sent by the client providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.

      - `required string ID`

        Unique identifier for this event.

      - `required string ToolUseID`

        The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.tool_result"UserToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`.

### Beta Managed Agents Session Deleted Event

- `class BetaManagedAgentsSessionDeletedEvent:`

  Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session.

  - `required string ID`

    Unique identifier for this event.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"session.deleted"SessionDeleted`

### Beta Managed Agents Session End Turn

- `class BetaManagedAgentsSessionEndTurn:`

  The agent completed its turn naturally and is ready for the next user message.

  - `required Type Type`

    - `"end_turn"EndTurn`

### Beta Managed Agents Session Error Event

- `class BetaManagedAgentsSessionErrorEvent:`

  An error event indicating a problem occurred during session execution.

  - `required string ID`

    Unique identifier for this event.

  - `required Error Error`

    An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

    - `class BetaManagedAgentsUnknownError:`

      An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

      - `required string Message`

        Human-readable error description.

      - `required RetryStatus RetryStatus`

        What the client should do next in response to this error.

        - `class BetaManagedAgentsRetryStatusRetrying:`

          The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `required Type Type`

            - `"retrying"Retrying`

        - `class BetaManagedAgentsRetryStatusExhausted:`

          This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `required Type Type`

            - `"exhausted"Exhausted`

        - `class BetaManagedAgentsRetryStatusTerminal:`

          The session encountered a terminal error and will transition to `terminated` state.

          - `required Type Type`

            - `"terminal"Terminal`

      - `required Type Type`

        - `"unknown_error"UnknownError`

    - `class BetaManagedAgentsModelOverloadedError:`

      The model is currently overloaded. Emitted after automatic retries are exhausted.

      - `required string Message`

        Human-readable error description.

      - `required RetryStatus RetryStatus`

        What the client should do next in response to this error.

        - `class BetaManagedAgentsRetryStatusRetrying:`

          The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

        - `class BetaManagedAgentsRetryStatusExhausted:`

          This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

        - `class BetaManagedAgentsRetryStatusTerminal:`

          The session encountered a terminal error and will transition to `terminated` state.

      - `required Type Type`

        - `"model_overloaded_error"ModelOverloadedError`

    - `class BetaManagedAgentsModelRateLimitedError:`

      The model request was rate-limited.

      - `required string Message`

        Human-readable error description.

      - `required RetryStatus RetryStatus`

        What the client should do next in response to this error.

        - `class BetaManagedAgentsRetryStatusRetrying:`

          The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

        - `class BetaManagedAgentsRetryStatusExhausted:`

          This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

        - `class BetaManagedAgentsRetryStatusTerminal:`

          The session encountered a terminal error and will transition to `terminated` state.

      - `required Type Type`

        - `"model_rate_limited_error"ModelRateLimitedError`

    - `class BetaManagedAgentsModelRequestFailedError:`

      A model request failed for a reason other than overload or rate-limiting.

      - `required string Message`

        Human-readable error description.

      - `required RetryStatus RetryStatus`

        What the client should do next in response to this error.

        - `class BetaManagedAgentsRetryStatusRetrying:`

          The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

        - `class BetaManagedAgentsRetryStatusExhausted:`

          This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

        - `class BetaManagedAgentsRetryStatusTerminal:`

          The session encountered a terminal error and will transition to `terminated` state.

      - `required Type Type`

        - `"model_request_failed_error"ModelRequestFailedError`

    - `class BetaManagedAgentsMcpConnectionFailedError:`

      Failed to connect to an MCP server.

      - `required string McpServerName`

        Name of the MCP server that failed to connect.

      - `required string Message`

        Human-readable error description.

      - `required RetryStatus RetryStatus`

        What the client should do next in response to this error.

        - `class BetaManagedAgentsRetryStatusRetrying:`

          The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

        - `class BetaManagedAgentsRetryStatusExhausted:`

          This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

        - `class BetaManagedAgentsRetryStatusTerminal:`

          The session encountered a terminal error and will transition to `terminated` state.

      - `required Type Type`

        - `"mcp_connection_failed_error"McpConnectionFailedError`

    - `class BetaManagedAgentsMcpAuthenticationFailedError:`

      Authentication to an MCP server failed.

      - `required string McpServerName`

        Name of the MCP server that failed authentication.

      - `required string Message`

        Human-readable error description.

      - `required RetryStatus RetryStatus`

        What the client should do next in response to this error.

        - `class BetaManagedAgentsRetryStatusRetrying:`

          The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

        - `class BetaManagedAgentsRetryStatusExhausted:`

          This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

        - `class BetaManagedAgentsRetryStatusTerminal:`

          The session encountered a terminal error and will transition to `terminated` state.

      - `required Type Type`

        - `"mcp_authentication_failed_error"McpAuthenticationFailedError`

    - `class BetaManagedAgentsBillingError:`

      The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state.

      - `required string Message`

        Human-readable error description.

      - `required RetryStatus RetryStatus`

        What the client should do next in response to this error.

        - `class BetaManagedAgentsRetryStatusRetrying:`

          The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

        - `class BetaManagedAgentsRetryStatusExhausted:`

          This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

        - `class BetaManagedAgentsRetryStatusTerminal:`

          The session encountered a terminal error and will transition to `terminated` state.

      - `required Type Type`

        - `"billing_error"BillingError`

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"session.error"SessionError`

### Beta Managed Agents Session Event

- `class BetaManagedAgentsSessionEvent: A class that can be one of several variants.union`

  Union type for all event types in a session.

  - `class BetaManagedAgentsUserMessageEvent:`

    A user message event in the session conversation.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Array of content blocks comprising the user message.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

        - `required string Text`

          The text content.

        - `required Type Type`

          - `"text"Text`

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

        - `required Source Source`

          Union type for image source variants.

          - `class BetaManagedAgentsBase64ImageSource:`

            Base64-encoded image data.

            - `required string Data`

              Base64-encoded image data.

            - `required string MediaType`

              MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

            - `required Type Type`

              - `"base64"Base64`

          - `class BetaManagedAgentsUrlImageSource:`

            Image referenced by URL.

            - `required Type Type`

              - `"url"Url`

            - `required string Url`

              URL of the image to fetch.

          - `class BetaManagedAgentsFileImageSource:`

            Image referenced by file ID.

            - `required string FileID`

              ID of a previously uploaded file.

            - `required Type Type`

              - `"file"File`

        - `required Type Type`

          - `"image"Image`

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `required Source Source`

          Union type for document source variants.

          - `class BetaManagedAgentsBase64DocumentSource:`

            Base64-encoded document data.

            - `required string Data`

              Base64-encoded document data.

            - `required string MediaType`

              MIME type of the document (e.g., "application/pdf").

            - `required Type Type`

              - `"base64"Base64`

          - `class BetaManagedAgentsPlainTextDocumentSource:`

            Plain text document content.

            - `required string Data`

              The plain text content.

            - `required MediaType MediaType`

              MIME type of the text content. Must be "text/plain".

              - `"text/plain"TextPlain`

            - `required Type Type`

              - `"text"Text`

          - `class BetaManagedAgentsUrlDocumentSource:`

            Document referenced by URL.

            - `required Type Type`

              - `"url"Url`

            - `required string Url`

              URL of the document to fetch.

          - `class BetaManagedAgentsFileDocumentSource:`

            Document referenced by file ID.

            - `required string FileID`

              ID of a previously uploaded file.

            - `required Type Type`

              - `"file"File`

        - `required Type Type`

          - `"document"Document`

        - `string? Context`

          Additional context about the document for the model.

        - `string? Title`

          The title of the document.

    - `required Type Type`

      - `"user.message"UserMessage`

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

  - `class BetaManagedAgentsUserInterruptEvent:`

    An interrupt event that pauses agent execution and returns control to the user.

    - `required string ID`

      Unique identifier for this event.

    - `required Type Type`

      - `"user.interrupt"UserInterrupt`

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.

  - `class BetaManagedAgentsUserToolConfirmationEvent:`

    A tool confirmation event that approves or denies a pending tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required Result Result`

      UserToolConfirmationResult enum

      - `"allow"Allow`

      - `"deny"Deny`

    - `required string ToolUseID`

      The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.tool_confirmation"UserToolConfirmation`

    - `string? DenyMessage`

      Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval.

  - `class BetaManagedAgentsUserCustomToolResultEvent:`

    Event sent by the client providing the result of a custom tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required string CustomToolUseID`

      The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.custom_tool_result"UserCustomToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

        - `required BetaManagedAgentsSearchResultCitations Citations`

          Citation settings for a search result.

          - `required Boolean Enabled`

            Whether citations are enabled for this search result.

        - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

          Array of text content blocks from the search result.

          - `required string Text`

            The text content.

          - `required Type Type`

            - `"text"Text`

        - `required string Source`

          The URL source of the search result.

        - `required string Title`

          The title of the search result.

        - `required Type Type`

          - `"search_result"SearchResult`

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`.

  - `class BetaManagedAgentsAgentCustomToolUseEvent:`

    Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string Name`

      Name of the custom tool being called.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.custom_tool_use"AgentCustomToolUse`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.custom_tool_result` event to route the result back.

  - `class BetaManagedAgentsAgentMessageEvent:`

    An agent response event in the session conversation.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<BetaManagedAgentsTextBlock> Content`

      Array of text blocks comprising the agent response.

      - `required string Text`

        The text content.

      - `required Type Type`

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.message"AgentMessage`

  - `class BetaManagedAgentsAgentThinkingEvent:`

    Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thinking"AgentThinking`

  - `class BetaManagedAgentsAgentMcpToolUseEvent:`

    Event emitted when the agent invokes a tool provided by an MCP server.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string McpServerName`

      Name of the MCP server providing the tool.

    - `required string Name`

      Name of the MCP tool being used.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.mcp_tool_use"AgentMcpToolUse`

    - `EvaluatedPermission EvaluatedPermission`

      AgentEvaluatedPermission enum

      - `"allow"Allow`

      - `"ask"Ask`

      - `"deny"Deny`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

  - `class BetaManagedAgentsAgentMcpToolResultEvent:`

    Event representing the result of an MCP tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required string McpToolUseID`

      The id of the `agent.mcp_tool_use` event this result corresponds to.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.mcp_tool_result"AgentMcpToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

  - `class BetaManagedAgentsAgentToolUseEvent:`

    Event emitted when the agent invokes a built-in agent tool.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string Name`

      Name of the agent tool being used.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.tool_use"AgentToolUse`

    - `EvaluatedPermission EvaluatedPermission`

      AgentEvaluatedPermission enum

      - `"allow"Allow`

      - `"ask"Ask`

      - `"deny"Deny`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

  - `class BetaManagedAgentsAgentToolResultEvent:`

    Event representing the result of an agent tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string ToolUseID`

      The id of the `agent.tool_use` event this result corresponds to.

    - `required Type Type`

      - `"agent.tool_result"AgentToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

  - `class BetaManagedAgentsAgentThreadMessageReceivedEvent:`

    Delivery event written to the target thread's input stream when an agent-to-agent message arrives.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Message content blocks.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

    - `required string FromSessionThreadID`

      Public `sthr_` ID of the thread that sent the message.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thread_message_received"AgentThreadMessageReceived`

    - `string? FromAgentName`

      Name of the callable agent this message came from. Absent when received from the primary agent.

  - `class BetaManagedAgentsAgentThreadMessageSentEvent:`

    Observability event emitted to the sender's output stream when an agent-to-agent message is sent.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Message content blocks.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string ToSessionThreadID`

      Public `sthr_` ID of the thread the message was sent to.

    - `required Type Type`

      - `"agent.thread_message_sent"AgentThreadMessageSent`

    - `string? ToAgentName`

      Name of the callable agent this message was sent to. Absent when sent to the primary agent.

  - `class BetaManagedAgentsAgentThreadContextCompactedEvent:`

    Indicates that context compaction (summarization) occurred during the session.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thread_context_compacted"AgentThreadContextCompacted`

  - `class BetaManagedAgentsSessionErrorEvent:`

    An error event indicating a problem occurred during session execution.

    - `required string ID`

      Unique identifier for this event.

    - `required Error Error`

      An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

      - `class BetaManagedAgentsUnknownError:`

        An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `required Type Type`

              - `"retrying"Retrying`

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `required Type Type`

              - `"exhausted"Exhausted`

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

            - `required Type Type`

              - `"terminal"Terminal`

        - `required Type Type`

          - `"unknown_error"UnknownError`

      - `class BetaManagedAgentsModelOverloadedError:`

        The model is currently overloaded. Emitted after automatic retries are exhausted.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_overloaded_error"ModelOverloadedError`

      - `class BetaManagedAgentsModelRateLimitedError:`

        The model request was rate-limited.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_rate_limited_error"ModelRateLimitedError`

      - `class BetaManagedAgentsModelRequestFailedError:`

        A model request failed for a reason other than overload or rate-limiting.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_request_failed_error"ModelRequestFailedError`

      - `class BetaManagedAgentsMcpConnectionFailedError:`

        Failed to connect to an MCP server.

        - `required string McpServerName`

          Name of the MCP server that failed to connect.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"mcp_connection_failed_error"McpConnectionFailedError`

      - `class BetaManagedAgentsMcpAuthenticationFailedError:`

        Authentication to an MCP server failed.

        - `required string McpServerName`

          Name of the MCP server that failed authentication.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"mcp_authentication_failed_error"McpAuthenticationFailedError`

      - `class BetaManagedAgentsBillingError:`

        The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"billing_error"BillingError`

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.error"SessionError`

  - `class BetaManagedAgentsSessionStatusRescheduledEvent:`

    Indicates the session is recovering from an error state and is rescheduled for execution.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_rescheduled"SessionStatusRescheduled`

  - `class BetaManagedAgentsSessionStatusRunningEvent:`

    Indicates the session is actively running and the agent is working.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_running"SessionStatusRunning`

  - `class BetaManagedAgentsSessionStatusIdleEvent:`

    Indicates the agent has paused and is awaiting user input.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required StopReason StopReason`

      The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionEndTurn:`

        The agent completed its turn naturally and is ready for the next user message.

        - `required Type Type`

          - `"end_turn"EndTurn`

      - `class BetaManagedAgentsSessionRequiresAction:`

        The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

        - `required IReadOnlyList<string> EventIds`

          The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder.

        - `required Type Type`

          - `"requires_action"RequiresAction`

      - `class BetaManagedAgentsSessionRetriesExhausted:`

        The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

        - `required Type Type`

          - `"retries_exhausted"RetriesExhausted`

    - `required Type Type`

      - `"session.status_idle"SessionStatusIdle`

  - `class BetaManagedAgentsSessionStatusTerminatedEvent:`

    Indicates the session has terminated, either due to an error or completion.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_terminated"SessionStatusTerminated`

  - `class BetaManagedAgentsSessionThreadCreatedEvent:`

    Emitted when a subagent is spawned as a new thread. Written to the parent thread's output stream so clients observing the session see child creation.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the callable agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public `sthr_` ID of the newly created thread.

    - `required Type Type`

      - `"session.thread_created"SessionThreadCreated`

  - `class BetaManagedAgentsSpanOutcomeEvaluationStartEvent:`

    Emitted when an outcome evaluation cycle begins.

    - `required string ID`

      Unique identifier for this event.

    - `required Int Iteration`

      0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.outcome_evaluation_start"SpanOutcomeEvaluationStart`

  - `class BetaManagedAgentsSpanOutcomeEvaluationEndEvent:`

    Emitted when an outcome evaluation cycle completes. Carries the verdict and aggregate token usage. A verdict of `needs_revision` means another evaluation cycle follows; `satisfied`, `max_iterations_reached`, `failed`, or `interrupted` are terminal — no further evaluation cycles follow.

    - `required string ID`

      Unique identifier for this event.

    - `required string Explanation`

      Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why.

    - `required Int Iteration`

      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

    - `required string OutcomeEvaluationStartID`

      The id of the corresponding `span.outcome_evaluation_start` event.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string Result`

      Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress.

    - `required Type Type`

      - `"span.outcome_evaluation_end"SpanOutcomeEvaluationEnd`

    - `required BetaManagedAgentsSpanModelUsage Usage`

      Token usage for a single model request.

      - `required Int CacheCreationInputTokens`

        Tokens used to create prompt cache in this request.

      - `required Int CacheReadInputTokens`

        Tokens read from prompt cache in this request.

      - `required Int InputTokens`

        Input tokens consumed by this request.

      - `required Int OutputTokens`

        Output tokens generated by this request.

      - `Speed? Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

  - `class BetaManagedAgentsSpanModelRequestStartEvent:`

    Emitted when a model request is initiated by the agent.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.model_request_start"SpanModelRequestStart`

  - `class BetaManagedAgentsSpanModelRequestEndEvent:`

    Emitted when a model request completes.

    - `required string ID`

      Unique identifier for this event.

    - `required Boolean? IsError`

      Whether the model request resulted in an error.

    - `required string ModelRequestStartID`

      The id of the corresponding `span.model_request_start` event.

    - `required BetaManagedAgentsSpanModelUsage ModelUsage`

      Token usage for a single model request.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.model_request_end"SpanModelRequestEnd`

  - `class BetaManagedAgentsSpanOutcomeEvaluationOngoingEvent:`

    Periodic heartbeat emitted while an outcome evaluation cycle is in progress. Distinguishes 'evaluation is actively running' from 'evaluation is stuck' between the corresponding `span.outcome_evaluation_start` and `span.outcome_evaluation_end` events.

    - `required string ID`

      Unique identifier for this event.

    - `required Int Iteration`

      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.outcome_evaluation_ongoing"SpanOutcomeEvaluationOngoing`

  - `class BetaManagedAgentsUserDefineOutcomeEvent:`

    Echo of a `user.define_outcome` input event. Carries the server-generated `outcome_id` that subsequent `span.outcome_evaluation_*` events reference.

    - `required string ID`

      Unique identifier for this event.

    - `required string Description`

      What the agent should produce. Copied from the input event.

    - `required Int? MaxIterations`

      Evaluate-then-revise cycles before giving up. Default 3, max 20.

    - `required string OutcomeID`

      Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Rubric Rubric`

      Rubric for grading the quality of an outcome.

      - `class BetaManagedAgentsFileRubric:`

        Rubric referenced by a file uploaded via the Files API.

        - `required string FileID`

          ID of the rubric file.

        - `required Type Type`

          - `"file"File`

      - `class BetaManagedAgentsTextRubric:`

        Rubric content provided inline as text.

        - `required string Content`

          Rubric content. Plain text or markdown — the grader treats it as freeform text.

        - `required Type Type`

          - `"text"Text`

    - `required Type Type`

      - `"user.define_outcome"UserDefineOutcome`

  - `class BetaManagedAgentsSessionDeletedEvent:`

    Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.deleted"SessionDeleted`

  - `class BetaManagedAgentsSessionThreadStatusRunningEvent:`

    A session thread has begun executing. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that started running.

    - `required Type Type`

      - `"session.thread_status_running"SessionThreadStatusRunning`

  - `class BetaManagedAgentsSessionThreadStatusIdleEvent:`

    A session thread has yielded and is awaiting input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that went idle.

    - `required StopReason StopReason`

      The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionEndTurn:`

        The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionRequiresAction:`

        The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

      - `class BetaManagedAgentsSessionRetriesExhausted:`

        The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

    - `required Type Type`

      - `"session.thread_status_idle"SessionThreadStatusIdle`

  - `class BetaManagedAgentsSessionThreadStatusTerminatedEvent:`

    A session thread has terminated and will accept no further input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that terminated.

    - `required Type Type`

      - `"session.thread_status_terminated"SessionThreadStatusTerminated`

  - `class BetaManagedAgentsUserToolResultEvent:`

    Event sent by the client providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.

    - `required string ID`

      Unique identifier for this event.

    - `required string ToolUseID`

      The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.tool_result"UserToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`.

  - `class BetaManagedAgentsSessionThreadStatusRescheduledEvent:`

    A session thread hit a transient error and is retrying automatically. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that is retrying.

    - `required Type Type`

      - `"session.thread_status_rescheduled"SessionThreadStatusRescheduled`

  - `class BetaManagedAgentsSessionUpdatedEvent:`

    Emitted when an UpdateSession request changed at least one field. Carries only the fields that changed; absent fields were not part of the update. The new configuration applies from the next turn.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.updated"SessionUpdated`

    - `BetaManagedAgentsSessionAgent? Agent`

      Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

      - `required string ID`

      - `required string? Description`

      - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

        - `required string Name`

        - `required Type Type`

          - `"url"Url`

        - `required string Url`

      - `required BetaManagedAgentsModelConfig Model`

        Model identifier and configuration.

        - `required BetaManagedAgentsModel ID`

          The model that will power your agent.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `"claude-opus-4-8"ClaudeOpus4_8`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-7"ClaudeOpus4_7`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-6"ClaudeOpus4_6`

            Most intelligent model for building agents and coding

          - `"claude-sonnet-4-6"ClaudeSonnet4_6`

            Best combination of speed and intelligence

          - `"claude-haiku-4-5"ClaudeHaiku4_5`

            Fastest model with near-frontier intelligence

          - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

            Fastest model with near-frontier intelligence

          - `"claude-opus-4-5"ClaudeOpus4_5`

            Premium model combining maximum intelligence with practical performance

          - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

            Premium model combining maximum intelligence with practical performance

          - `"claude-sonnet-4-5"ClaudeSonnet4_5`

            High-performance model for agents and coding

          - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

            High-performance model for agents and coding

        - `Speed Speed`

          Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

          - `"standard"Standard`

          - `"fast"Fast`

      - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

        Resolved coordinator topology with full agent definitions for each roster member.

        - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

          Full `agent` definitions the coordinator may spawn as session threads.

          - `required string ID`

          - `required string? Description`

          - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

            - `required string Name`

            - `required Type Type`

            - `required string Url`

          - `required BetaManagedAgentsModelConfig Model`

            Model identifier and configuration.

          - `required string Name`

          - `required IReadOnlyList<Skill> Skills`

            - `class BetaManagedAgentsAnthropicSkill:`

              A resolved Anthropic-managed skill.

              - `required string SkillID`

              - `required Type Type`

                - `"anthropic"Anthropic`

              - `required string Version`

            - `class BetaManagedAgentsCustomSkill:`

              A resolved user-created custom skill.

              - `required string SkillID`

              - `required Type Type`

                - `"custom"Custom`

              - `required string Version`

          - `required string? System`

          - `required IReadOnlyList<Tool> Tools`

            - `class BetaManagedAgentsAgentToolset20260401:`

              - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

                - `required Boolean Enabled`

                - `required Name Name`

                  Built-in agent tool identifier.

                  - `"bash"Bash`

                  - `"edit"Edit`

                  - `"read"Read`

                  - `"write"Write`

                  - `"glob"Glob`

                  - `"grep"Grep`

                  - `"web_fetch"WebFetch`

                  - `"web_search"WebSearch`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                    - `required Type Type`

                      - `"always_allow"AlwaysAllow`

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

                    - `required Type Type`

                      - `"always_ask"AlwaysAsk`

              - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

                Resolved default configuration for agent tools.

                - `required Boolean Enabled`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required Type Type`

                - `"agent_toolset_20260401"AgentToolset20260401`

            - `class BetaManagedAgentsMcpToolset:`

              - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

                - `required Boolean Enabled`

                - `required string Name`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

                Resolved default configuration for all tools from an MCP server.

                - `required Boolean Enabled`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required string McpServerName`

              - `required Type Type`

                - `"mcp_toolset"McpToolset`

            - `class BetaManagedAgentsCustomTool:`

              A custom tool as returned in API responses.

              - `required string Description`

              - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

                JSON Schema for custom tool input parameters.

                - `IReadOnlyDictionary<string, JsonElement>? Properties`

                  JSON Schema properties defining the tool's input parameters.

                - `IReadOnlyList<string> Required`

                  List of required property names.

                - `Type Type`

                  Must be 'object' for tool input schemas.

                  - `"object"Object`

              - `required string Name`

              - `required Type Type`

                - `"custom"Custom`

          - `required Type Type`

            - `"agent"Agent`

          - `required Int Version`

        - `required Type Type`

          - `"coordinator"Coordinator`

      - `required string Name`

      - `required IReadOnlyList<Skill> Skills`

        - `class BetaManagedAgentsAnthropicSkill:`

          A resolved Anthropic-managed skill.

        - `class BetaManagedAgentsCustomSkill:`

          A resolved user-created custom skill.

      - `required string? System`

      - `required IReadOnlyList<Tool> Tools`

        - `class BetaManagedAgentsAgentToolset20260401:`

        - `class BetaManagedAgentsMcpToolset:`

        - `class BetaManagedAgentsCustomTool:`

          A custom tool as returned in API responses.

      - `required Type Type`

        - `"agent"Agent`

      - `required Int Version`

    - `IReadOnlyDictionary<string, string> Metadata`

      The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty.

    - `string? Title`

      The session's new title. Present only when the update changed it.

### Beta Managed Agents Session Requires Action

- `class BetaManagedAgentsSessionRequiresAction:`

  The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

  - `required IReadOnlyList<string> EventIds`

    The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder.

  - `required Type Type`

    - `"requires_action"RequiresAction`

### Beta Managed Agents Session Retries Exhausted

- `class BetaManagedAgentsSessionRetriesExhausted:`

  The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

  - `required Type Type`

    - `"retries_exhausted"RetriesExhausted`

### Beta Managed Agents Session Status Idle Event

- `class BetaManagedAgentsSessionStatusIdleEvent:`

  Indicates the agent has paused and is awaiting user input.

  - `required string ID`

    Unique identifier for this event.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required StopReason StopReason`

    The agent completed its turn naturally and is ready for the next user message.

    - `class BetaManagedAgentsSessionEndTurn:`

      The agent completed its turn naturally and is ready for the next user message.

      - `required Type Type`

        - `"end_turn"EndTurn`

    - `class BetaManagedAgentsSessionRequiresAction:`

      The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

      - `required IReadOnlyList<string> EventIds`

        The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder.

      - `required Type Type`

        - `"requires_action"RequiresAction`

    - `class BetaManagedAgentsSessionRetriesExhausted:`

      The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

      - `required Type Type`

        - `"retries_exhausted"RetriesExhausted`

  - `required Type Type`

    - `"session.status_idle"SessionStatusIdle`

### Beta Managed Agents Session Status Rescheduled Event

- `class BetaManagedAgentsSessionStatusRescheduledEvent:`

  Indicates the session is recovering from an error state and is rescheduled for execution.

  - `required string ID`

    Unique identifier for this event.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"session.status_rescheduled"SessionStatusRescheduled`

### Beta Managed Agents Session Status Running Event

- `class BetaManagedAgentsSessionStatusRunningEvent:`

  Indicates the session is actively running and the agent is working.

  - `required string ID`

    Unique identifier for this event.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"session.status_running"SessionStatusRunning`

### Beta Managed Agents Session Status Terminated Event

- `class BetaManagedAgentsSessionStatusTerminatedEvent:`

  Indicates the session has terminated, either due to an error or completion.

  - `required string ID`

    Unique identifier for this event.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"session.status_terminated"SessionStatusTerminated`

### Beta Managed Agents Session Thread Created Event

- `class BetaManagedAgentsSessionThreadCreatedEvent:`

  Emitted when a subagent is spawned as a new thread. Written to the parent thread's output stream so clients observing the session see child creation.

  - `required string ID`

    Unique identifier for this event.

  - `required string AgentName`

    Name of the callable agent the thread runs.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required string SessionThreadID`

    Public `sthr_` ID of the newly created thread.

  - `required Type Type`

    - `"session.thread_created"SessionThreadCreated`

### Beta Managed Agents Session Thread Status Idle Event

- `class BetaManagedAgentsSessionThreadStatusIdleEvent:`

  A session thread has yielded and is awaiting input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

  - `required string ID`

    Unique identifier for this event.

  - `required string AgentName`

    Name of the agent the thread runs.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required string SessionThreadID`

    Public sthr_ ID of the thread that went idle.

  - `required StopReason StopReason`

    The agent completed its turn naturally and is ready for the next user message.

    - `class BetaManagedAgentsSessionEndTurn:`

      The agent completed its turn naturally and is ready for the next user message.

      - `required Type Type`

        - `"end_turn"EndTurn`

    - `class BetaManagedAgentsSessionRequiresAction:`

      The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

      - `required IReadOnlyList<string> EventIds`

        The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder.

      - `required Type Type`

        - `"requires_action"RequiresAction`

    - `class BetaManagedAgentsSessionRetriesExhausted:`

      The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

      - `required Type Type`

        - `"retries_exhausted"RetriesExhausted`

  - `required Type Type`

    - `"session.thread_status_idle"SessionThreadStatusIdle`

### Beta Managed Agents Session Thread Status Rescheduled Event

- `class BetaManagedAgentsSessionThreadStatusRescheduledEvent:`

  A session thread hit a transient error and is retrying automatically. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

  - `required string ID`

    Unique identifier for this event.

  - `required string AgentName`

    Name of the agent the thread runs.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required string SessionThreadID`

    Public sthr_ ID of the thread that is retrying.

  - `required Type Type`

    - `"session.thread_status_rescheduled"SessionThreadStatusRescheduled`

### Beta Managed Agents Session Thread Status Running Event

- `class BetaManagedAgentsSessionThreadStatusRunningEvent:`

  A session thread has begun executing. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

  - `required string ID`

    Unique identifier for this event.

  - `required string AgentName`

    Name of the agent the thread runs.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required string SessionThreadID`

    Public sthr_ ID of the thread that started running.

  - `required Type Type`

    - `"session.thread_status_running"SessionThreadStatusRunning`

### Beta Managed Agents Session Thread Status Terminated Event

- `class BetaManagedAgentsSessionThreadStatusTerminatedEvent:`

  A session thread has terminated and will accept no further input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

  - `required string ID`

    Unique identifier for this event.

  - `required string AgentName`

    Name of the agent the thread runs.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required string SessionThreadID`

    Public sthr_ ID of the thread that terminated.

  - `required Type Type`

    - `"session.thread_status_terminated"SessionThreadStatusTerminated`

### Beta Managed Agents Span Model Request End Event

- `class BetaManagedAgentsSpanModelRequestEndEvent:`

  Emitted when a model request completes.

  - `required string ID`

    Unique identifier for this event.

  - `required Boolean? IsError`

    Whether the model request resulted in an error.

  - `required string ModelRequestStartID`

    The id of the corresponding `span.model_request_start` event.

  - `required BetaManagedAgentsSpanModelUsage ModelUsage`

    Token usage for a single model request.

    - `required Int CacheCreationInputTokens`

      Tokens used to create prompt cache in this request.

    - `required Int CacheReadInputTokens`

      Tokens read from prompt cache in this request.

    - `required Int InputTokens`

      Input tokens consumed by this request.

    - `required Int OutputTokens`

      Output tokens generated by this request.

    - `Speed? Speed`

      Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

      - `"standard"Standard`

      - `"fast"Fast`

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"span.model_request_end"SpanModelRequestEnd`

### Beta Managed Agents Span Model Request Start Event

- `class BetaManagedAgentsSpanModelRequestStartEvent:`

  Emitted when a model request is initiated by the agent.

  - `required string ID`

    Unique identifier for this event.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"span.model_request_start"SpanModelRequestStart`

### Beta Managed Agents Span Model Usage

- `class BetaManagedAgentsSpanModelUsage:`

  Token usage for a single model request.

  - `required Int CacheCreationInputTokens`

    Tokens used to create prompt cache in this request.

  - `required Int CacheReadInputTokens`

    Tokens read from prompt cache in this request.

  - `required Int InputTokens`

    Input tokens consumed by this request.

  - `required Int OutputTokens`

    Output tokens generated by this request.

  - `Speed? Speed`

    Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

    - `"standard"Standard`

    - `"fast"Fast`

### Beta Managed Agents Span Outcome Evaluation End Event

- `class BetaManagedAgentsSpanOutcomeEvaluationEndEvent:`

  Emitted when an outcome evaluation cycle completes. Carries the verdict and aggregate token usage. A verdict of `needs_revision` means another evaluation cycle follows; `satisfied`, `max_iterations_reached`, `failed`, or `interrupted` are terminal — no further evaluation cycles follow.

  - `required string ID`

    Unique identifier for this event.

  - `required string Explanation`

    Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why.

  - `required Int Iteration`

    0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

  - `required string OutcomeEvaluationStartID`

    The id of the corresponding `span.outcome_evaluation_start` event.

  - `required string OutcomeID`

    The `outc_` ID of the outcome being evaluated.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required string Result`

    Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress.

  - `required Type Type`

    - `"span.outcome_evaluation_end"SpanOutcomeEvaluationEnd`

  - `required BetaManagedAgentsSpanModelUsage Usage`

    Token usage for a single model request.

    - `required Int CacheCreationInputTokens`

      Tokens used to create prompt cache in this request.

    - `required Int CacheReadInputTokens`

      Tokens read from prompt cache in this request.

    - `required Int InputTokens`

      Input tokens consumed by this request.

    - `required Int OutputTokens`

      Output tokens generated by this request.

    - `Speed? Speed`

      Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

      - `"standard"Standard`

      - `"fast"Fast`

### Beta Managed Agents Span Outcome Evaluation Ongoing Event

- `class BetaManagedAgentsSpanOutcomeEvaluationOngoingEvent:`

  Periodic heartbeat emitted while an outcome evaluation cycle is in progress. Distinguishes 'evaluation is actively running' from 'evaluation is stuck' between the corresponding `span.outcome_evaluation_start` and `span.outcome_evaluation_end` events.

  - `required string ID`

    Unique identifier for this event.

  - `required Int Iteration`

    0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

  - `required string OutcomeID`

    The `outc_` ID of the outcome being evaluated.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"span.outcome_evaluation_ongoing"SpanOutcomeEvaluationOngoing`

### Beta Managed Agents Span Outcome Evaluation Start Event

- `class BetaManagedAgentsSpanOutcomeEvaluationStartEvent:`

  Emitted when an outcome evaluation cycle begins.

  - `required string ID`

    Unique identifier for this event.

  - `required Int Iteration`

    0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.

  - `required string OutcomeID`

    The `outc_` ID of the outcome being evaluated.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    - `"span.outcome_evaluation_start"SpanOutcomeEvaluationStart`

### Beta Managed Agents Stream Session Events

- `class BetaManagedAgentsStreamSessionEvents: A class that can be one of several variants.union`

  Server-sent event in the session stream.

  - `class BetaManagedAgentsUserMessageEvent:`

    A user message event in the session conversation.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Array of content blocks comprising the user message.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

        - `required string Text`

          The text content.

        - `required Type Type`

          - `"text"Text`

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

        - `required Source Source`

          Union type for image source variants.

          - `class BetaManagedAgentsBase64ImageSource:`

            Base64-encoded image data.

            - `required string Data`

              Base64-encoded image data.

            - `required string MediaType`

              MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

            - `required Type Type`

              - `"base64"Base64`

          - `class BetaManagedAgentsUrlImageSource:`

            Image referenced by URL.

            - `required Type Type`

              - `"url"Url`

            - `required string Url`

              URL of the image to fetch.

          - `class BetaManagedAgentsFileImageSource:`

            Image referenced by file ID.

            - `required string FileID`

              ID of a previously uploaded file.

            - `required Type Type`

              - `"file"File`

        - `required Type Type`

          - `"image"Image`

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `required Source Source`

          Union type for document source variants.

          - `class BetaManagedAgentsBase64DocumentSource:`

            Base64-encoded document data.

            - `required string Data`

              Base64-encoded document data.

            - `required string MediaType`

              MIME type of the document (e.g., "application/pdf").

            - `required Type Type`

              - `"base64"Base64`

          - `class BetaManagedAgentsPlainTextDocumentSource:`

            Plain text document content.

            - `required string Data`

              The plain text content.

            - `required MediaType MediaType`

              MIME type of the text content. Must be "text/plain".

              - `"text/plain"TextPlain`

            - `required Type Type`

              - `"text"Text`

          - `class BetaManagedAgentsUrlDocumentSource:`

            Document referenced by URL.

            - `required Type Type`

              - `"url"Url`

            - `required string Url`

              URL of the document to fetch.

          - `class BetaManagedAgentsFileDocumentSource:`

            Document referenced by file ID.

            - `required string FileID`

              ID of a previously uploaded file.

            - `required Type Type`

              - `"file"File`

        - `required Type Type`

          - `"document"Document`

        - `string? Context`

          Additional context about the document for the model.

        - `string? Title`

          The title of the document.

    - `required Type Type`

      - `"user.message"UserMessage`

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

  - `class BetaManagedAgentsUserInterruptEvent:`

    An interrupt event that pauses agent execution and returns control to the user.

    - `required string ID`

      Unique identifier for this event.

    - `required Type Type`

      - `"user.interrupt"UserInterrupt`

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.

  - `class BetaManagedAgentsUserToolConfirmationEvent:`

    A tool confirmation event that approves or denies a pending tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required Result Result`

      UserToolConfirmationResult enum

      - `"allow"Allow`

      - `"deny"Deny`

    - `required string ToolUseID`

      The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.tool_confirmation"UserToolConfirmation`

    - `string? DenyMessage`

      Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval.

  - `class BetaManagedAgentsUserCustomToolResultEvent:`

    Event sent by the client providing the result of a custom tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required string CustomToolUseID`

      The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.custom_tool_result"UserCustomToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

        - `required BetaManagedAgentsSearchResultCitations Citations`

          Citation settings for a search result.

          - `required Boolean Enabled`

            Whether citations are enabled for this search result.

        - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

          Array of text content blocks from the search result.

          - `required string Text`

            The text content.

          - `required Type Type`

            - `"text"Text`

        - `required string Source`

          The URL source of the search result.

        - `required string Title`

          The title of the search result.

        - `required Type Type`

          - `"search_result"SearchResult`

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`.

  - `class BetaManagedAgentsAgentCustomToolUseEvent:`

    Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string Name`

      Name of the custom tool being called.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.custom_tool_use"AgentCustomToolUse`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.custom_tool_result` event to route the result back.

  - `class BetaManagedAgentsAgentMessageEvent:`

    An agent response event in the session conversation.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<BetaManagedAgentsTextBlock> Content`

      Array of text blocks comprising the agent response.

      - `required string Text`

        The text content.

      - `required Type Type`

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.message"AgentMessage`

  - `class BetaManagedAgentsAgentThinkingEvent:`

    Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thinking"AgentThinking`

  - `class BetaManagedAgentsAgentMcpToolUseEvent:`

    Event emitted when the agent invokes a tool provided by an MCP server.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string McpServerName`

      Name of the MCP server providing the tool.

    - `required string Name`

      Name of the MCP tool being used.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.mcp_tool_use"AgentMcpToolUse`

    - `EvaluatedPermission EvaluatedPermission`

      AgentEvaluatedPermission enum

      - `"allow"Allow`

      - `"ask"Ask`

      - `"deny"Deny`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

  - `class BetaManagedAgentsAgentMcpToolResultEvent:`

    Event representing the result of an MCP tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required string McpToolUseID`

      The id of the `agent.mcp_tool_use` event this result corresponds to.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.mcp_tool_result"AgentMcpToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

  - `class BetaManagedAgentsAgentToolUseEvent:`

    Event emitted when the agent invokes a built-in agent tool.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string Name`

      Name of the agent tool being used.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.tool_use"AgentToolUse`

    - `EvaluatedPermission EvaluatedPermission`

      AgentEvaluatedPermission enum

      - `"allow"Allow`

      - `"ask"Ask`

      - `"deny"Deny`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

  - `class BetaManagedAgentsAgentToolResultEvent:`

    Event representing the result of an agent tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string ToolUseID`

      The id of the `agent.tool_use` event this result corresponds to.

    - `required Type Type`

      - `"agent.tool_result"AgentToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

  - `class BetaManagedAgentsAgentThreadMessageReceivedEvent:`

    Delivery event written to the target thread's input stream when an agent-to-agent message arrives.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Message content blocks.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

    - `required string FromSessionThreadID`

      Public `sthr_` ID of the thread that sent the message.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thread_message_received"AgentThreadMessageReceived`

    - `string? FromAgentName`

      Name of the callable agent this message came from. Absent when received from the primary agent.

  - `class BetaManagedAgentsAgentThreadMessageSentEvent:`

    Observability event emitted to the sender's output stream when an agent-to-agent message is sent.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Message content blocks.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string ToSessionThreadID`

      Public `sthr_` ID of the thread the message was sent to.

    - `required Type Type`

      - `"agent.thread_message_sent"AgentThreadMessageSent`

    - `string? ToAgentName`

      Name of the callable agent this message was sent to. Absent when sent to the primary agent.

  - `class BetaManagedAgentsAgentThreadContextCompactedEvent:`

    Indicates that context compaction (summarization) occurred during the session.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thread_context_compacted"AgentThreadContextCompacted`

  - `class BetaManagedAgentsSessionErrorEvent:`

    An error event indicating a problem occurred during session execution.

    - `required string ID`

      Unique identifier for this event.

    - `required Error Error`

      An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

      - `class BetaManagedAgentsUnknownError:`

        An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `required Type Type`

              - `"retrying"Retrying`

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `required Type Type`

              - `"exhausted"Exhausted`

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

            - `required Type Type`

              - `"terminal"Terminal`

        - `required Type Type`

          - `"unknown_error"UnknownError`

      - `class BetaManagedAgentsModelOverloadedError:`

        The model is currently overloaded. Emitted after automatic retries are exhausted.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_overloaded_error"ModelOverloadedError`

      - `class BetaManagedAgentsModelRateLimitedError:`

        The model request was rate-limited.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_rate_limited_error"ModelRateLimitedError`

      - `class BetaManagedAgentsModelRequestFailedError:`

        A model request failed for a reason other than overload or rate-limiting.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_request_failed_error"ModelRequestFailedError`

      - `class BetaManagedAgentsMcpConnectionFailedError:`

        Failed to connect to an MCP server.

        - `required string McpServerName`

          Name of the MCP server that failed to connect.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"mcp_connection_failed_error"McpConnectionFailedError`

      - `class BetaManagedAgentsMcpAuthenticationFailedError:`

        Authentication to an MCP server failed.

        - `required string McpServerName`

          Name of the MCP server that failed authentication.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"mcp_authentication_failed_error"McpAuthenticationFailedError`

      - `class BetaManagedAgentsBillingError:`

        The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"billing_error"BillingError`

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.error"SessionError`

  - `class BetaManagedAgentsSessionStatusRescheduledEvent:`

    Indicates the session is recovering from an error state and is rescheduled for execution.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_rescheduled"SessionStatusRescheduled`

  - `class BetaManagedAgentsSessionStatusRunningEvent:`

    Indicates the session is actively running and the agent is working.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_running"SessionStatusRunning`

  - `class BetaManagedAgentsSessionStatusIdleEvent:`

    Indicates the agent has paused and is awaiting user input.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required StopReason StopReason`

      The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionEndTurn:`

        The agent completed its turn naturally and is ready for the next user message.

        - `required Type Type`

          - `"end_turn"EndTurn`

      - `class BetaManagedAgentsSessionRequiresAction:`

        The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

        - `required IReadOnlyList<string> EventIds`

          The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder.

        - `required Type Type`

          - `"requires_action"RequiresAction`

      - `class BetaManagedAgentsSessionRetriesExhausted:`

        The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

        - `required Type Type`

          - `"retries_exhausted"RetriesExhausted`

    - `required Type Type`

      - `"session.status_idle"SessionStatusIdle`

  - `class BetaManagedAgentsSessionStatusTerminatedEvent:`

    Indicates the session has terminated, either due to an error or completion.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_terminated"SessionStatusTerminated`

  - `class BetaManagedAgentsSessionThreadCreatedEvent:`

    Emitted when a subagent is spawned as a new thread. Written to the parent thread's output stream so clients observing the session see child creation.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the callable agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public `sthr_` ID of the newly created thread.

    - `required Type Type`

      - `"session.thread_created"SessionThreadCreated`

  - `class BetaManagedAgentsSpanOutcomeEvaluationStartEvent:`

    Emitted when an outcome evaluation cycle begins.

    - `required string ID`

      Unique identifier for this event.

    - `required Int Iteration`

      0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.outcome_evaluation_start"SpanOutcomeEvaluationStart`

  - `class BetaManagedAgentsSpanOutcomeEvaluationEndEvent:`

    Emitted when an outcome evaluation cycle completes. Carries the verdict and aggregate token usage. A verdict of `needs_revision` means another evaluation cycle follows; `satisfied`, `max_iterations_reached`, `failed`, or `interrupted` are terminal — no further evaluation cycles follow.

    - `required string ID`

      Unique identifier for this event.

    - `required string Explanation`

      Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why.

    - `required Int Iteration`

      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

    - `required string OutcomeEvaluationStartID`

      The id of the corresponding `span.outcome_evaluation_start` event.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string Result`

      Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress.

    - `required Type Type`

      - `"span.outcome_evaluation_end"SpanOutcomeEvaluationEnd`

    - `required BetaManagedAgentsSpanModelUsage Usage`

      Token usage for a single model request.

      - `required Int CacheCreationInputTokens`

        Tokens used to create prompt cache in this request.

      - `required Int CacheReadInputTokens`

        Tokens read from prompt cache in this request.

      - `required Int InputTokens`

        Input tokens consumed by this request.

      - `required Int OutputTokens`

        Output tokens generated by this request.

      - `Speed? Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

  - `class BetaManagedAgentsSpanModelRequestStartEvent:`

    Emitted when a model request is initiated by the agent.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.model_request_start"SpanModelRequestStart`

  - `class BetaManagedAgentsSpanModelRequestEndEvent:`

    Emitted when a model request completes.

    - `required string ID`

      Unique identifier for this event.

    - `required Boolean? IsError`

      Whether the model request resulted in an error.

    - `required string ModelRequestStartID`

      The id of the corresponding `span.model_request_start` event.

    - `required BetaManagedAgentsSpanModelUsage ModelUsage`

      Token usage for a single model request.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.model_request_end"SpanModelRequestEnd`

  - `class BetaManagedAgentsSpanOutcomeEvaluationOngoingEvent:`

    Periodic heartbeat emitted while an outcome evaluation cycle is in progress. Distinguishes 'evaluation is actively running' from 'evaluation is stuck' between the corresponding `span.outcome_evaluation_start` and `span.outcome_evaluation_end` events.

    - `required string ID`

      Unique identifier for this event.

    - `required Int Iteration`

      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.outcome_evaluation_ongoing"SpanOutcomeEvaluationOngoing`

  - `class BetaManagedAgentsUserDefineOutcomeEvent:`

    Echo of a `user.define_outcome` input event. Carries the server-generated `outcome_id` that subsequent `span.outcome_evaluation_*` events reference.

    - `required string ID`

      Unique identifier for this event.

    - `required string Description`

      What the agent should produce. Copied from the input event.

    - `required Int? MaxIterations`

      Evaluate-then-revise cycles before giving up. Default 3, max 20.

    - `required string OutcomeID`

      Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Rubric Rubric`

      Rubric for grading the quality of an outcome.

      - `class BetaManagedAgentsFileRubric:`

        Rubric referenced by a file uploaded via the Files API.

        - `required string FileID`

          ID of the rubric file.

        - `required Type Type`

          - `"file"File`

      - `class BetaManagedAgentsTextRubric:`

        Rubric content provided inline as text.

        - `required string Content`

          Rubric content. Plain text or markdown — the grader treats it as freeform text.

        - `required Type Type`

          - `"text"Text`

    - `required Type Type`

      - `"user.define_outcome"UserDefineOutcome`

  - `class BetaManagedAgentsSessionDeletedEvent:`

    Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.deleted"SessionDeleted`

  - `class BetaManagedAgentsSessionThreadStatusRunningEvent:`

    A session thread has begun executing. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that started running.

    - `required Type Type`

      - `"session.thread_status_running"SessionThreadStatusRunning`

  - `class BetaManagedAgentsSessionThreadStatusIdleEvent:`

    A session thread has yielded and is awaiting input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that went idle.

    - `required StopReason StopReason`

      The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionEndTurn:`

        The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionRequiresAction:`

        The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

      - `class BetaManagedAgentsSessionRetriesExhausted:`

        The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

    - `required Type Type`

      - `"session.thread_status_idle"SessionThreadStatusIdle`

  - `class BetaManagedAgentsSessionThreadStatusTerminatedEvent:`

    A session thread has terminated and will accept no further input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that terminated.

    - `required Type Type`

      - `"session.thread_status_terminated"SessionThreadStatusTerminated`

  - `class BetaManagedAgentsUserToolResultEvent:`

    Event sent by the client providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.

    - `required string ID`

      Unique identifier for this event.

    - `required string ToolUseID`

      The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.tool_result"UserToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`.

  - `class BetaManagedAgentsSessionThreadStatusRescheduledEvent:`

    A session thread hit a transient error and is retrying automatically. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that is retrying.

    - `required Type Type`

      - `"session.thread_status_rescheduled"SessionThreadStatusRescheduled`

  - `class BetaManagedAgentsSessionUpdatedEvent:`

    Emitted when an UpdateSession request changed at least one field. Carries only the fields that changed; absent fields were not part of the update. The new configuration applies from the next turn.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.updated"SessionUpdated`

    - `BetaManagedAgentsSessionAgent? Agent`

      Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

      - `required string ID`

      - `required string? Description`

      - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

        - `required string Name`

        - `required Type Type`

          - `"url"Url`

        - `required string Url`

      - `required BetaManagedAgentsModelConfig Model`

        Model identifier and configuration.

        - `required BetaManagedAgentsModel ID`

          The model that will power your agent.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `"claude-opus-4-8"ClaudeOpus4_8`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-7"ClaudeOpus4_7`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-6"ClaudeOpus4_6`

            Most intelligent model for building agents and coding

          - `"claude-sonnet-4-6"ClaudeSonnet4_6`

            Best combination of speed and intelligence

          - `"claude-haiku-4-5"ClaudeHaiku4_5`

            Fastest model with near-frontier intelligence

          - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

            Fastest model with near-frontier intelligence

          - `"claude-opus-4-5"ClaudeOpus4_5`

            Premium model combining maximum intelligence with practical performance

          - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

            Premium model combining maximum intelligence with practical performance

          - `"claude-sonnet-4-5"ClaudeSonnet4_5`

            High-performance model for agents and coding

          - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

            High-performance model for agents and coding

        - `Speed Speed`

          Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

          - `"standard"Standard`

          - `"fast"Fast`

      - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

        Resolved coordinator topology with full agent definitions for each roster member.

        - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

          Full `agent` definitions the coordinator may spawn as session threads.

          - `required string ID`

          - `required string? Description`

          - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

            - `required string Name`

            - `required Type Type`

            - `required string Url`

          - `required BetaManagedAgentsModelConfig Model`

            Model identifier and configuration.

          - `required string Name`

          - `required IReadOnlyList<Skill> Skills`

            - `class BetaManagedAgentsAnthropicSkill:`

              A resolved Anthropic-managed skill.

              - `required string SkillID`

              - `required Type Type`

                - `"anthropic"Anthropic`

              - `required string Version`

            - `class BetaManagedAgentsCustomSkill:`

              A resolved user-created custom skill.

              - `required string SkillID`

              - `required Type Type`

                - `"custom"Custom`

              - `required string Version`

          - `required string? System`

          - `required IReadOnlyList<Tool> Tools`

            - `class BetaManagedAgentsAgentToolset20260401:`

              - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

                - `required Boolean Enabled`

                - `required Name Name`

                  Built-in agent tool identifier.

                  - `"bash"Bash`

                  - `"edit"Edit`

                  - `"read"Read`

                  - `"write"Write`

                  - `"glob"Glob`

                  - `"grep"Grep`

                  - `"web_fetch"WebFetch`

                  - `"web_search"WebSearch`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                    - `required Type Type`

                      - `"always_allow"AlwaysAllow`

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

                    - `required Type Type`

                      - `"always_ask"AlwaysAsk`

              - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

                Resolved default configuration for agent tools.

                - `required Boolean Enabled`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required Type Type`

                - `"agent_toolset_20260401"AgentToolset20260401`

            - `class BetaManagedAgentsMcpToolset:`

              - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

                - `required Boolean Enabled`

                - `required string Name`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

                Resolved default configuration for all tools from an MCP server.

                - `required Boolean Enabled`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required string McpServerName`

              - `required Type Type`

                - `"mcp_toolset"McpToolset`

            - `class BetaManagedAgentsCustomTool:`

              A custom tool as returned in API responses.

              - `required string Description`

              - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

                JSON Schema for custom tool input parameters.

                - `IReadOnlyDictionary<string, JsonElement>? Properties`

                  JSON Schema properties defining the tool's input parameters.

                - `IReadOnlyList<string> Required`

                  List of required property names.

                - `Type Type`

                  Must be 'object' for tool input schemas.

                  - `"object"Object`

              - `required string Name`

              - `required Type Type`

                - `"custom"Custom`

          - `required Type Type`

            - `"agent"Agent`

          - `required Int Version`

        - `required Type Type`

          - `"coordinator"Coordinator`

      - `required string Name`

      - `required IReadOnlyList<Skill> Skills`

        - `class BetaManagedAgentsAnthropicSkill:`

          A resolved Anthropic-managed skill.

        - `class BetaManagedAgentsCustomSkill:`

          A resolved user-created custom skill.

      - `required string? System`

      - `required IReadOnlyList<Tool> Tools`

        - `class BetaManagedAgentsAgentToolset20260401:`

        - `class BetaManagedAgentsMcpToolset:`

        - `class BetaManagedAgentsCustomTool:`

          A custom tool as returned in API responses.

      - `required Type Type`

        - `"agent"Agent`

      - `required Int Version`

    - `IReadOnlyDictionary<string, string> Metadata`

      The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty.

    - `string? Title`

      The session's new title. Present only when the update changed it.

### Beta Managed Agents Text Block

- `class BetaManagedAgentsTextBlock:`

  Regular text content.

  - `required string Text`

    The text content.

  - `required Type Type`

    - `"text"Text`

### Beta Managed Agents Text Rubric

- `class BetaManagedAgentsTextRubric:`

  Rubric content provided inline as text.

  - `required string Content`

    Rubric content. Plain text or markdown — the grader treats it as freeform text.

  - `required Type Type`

    - `"text"Text`

### Beta Managed Agents Text Rubric Params

- `class BetaManagedAgentsTextRubricParams:`

  Rubric content provided inline as text.

  - `required string Content`

    Rubric content. Plain text or markdown — the grader treats it as freeform text. Maximum 262144 characters.

  - `required Type Type`

    - `"text"Text`

### Beta Managed Agents Unknown Error

- `class BetaManagedAgentsUnknownError:`

  An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

  - `required string Message`

    Human-readable error description.

  - `required RetryStatus RetryStatus`

    What the client should do next in response to this error.

    - `class BetaManagedAgentsRetryStatusRetrying:`

      The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

      - `required Type Type`

        - `"retrying"Retrying`

    - `class BetaManagedAgentsRetryStatusExhausted:`

      This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

      - `required Type Type`

        - `"exhausted"Exhausted`

    - `class BetaManagedAgentsRetryStatusTerminal:`

      The session encountered a terminal error and will transition to `terminated` state.

      - `required Type Type`

        - `"terminal"Terminal`

  - `required Type Type`

    - `"unknown_error"UnknownError`

### Beta Managed Agents URL Document Source

- `class BetaManagedAgentsUrlDocumentSource:`

  Document referenced by URL.

  - `required Type Type`

    - `"url"Url`

  - `required string Url`

    URL of the document to fetch.

### Beta Managed Agents URL Image Source

- `class BetaManagedAgentsUrlImageSource:`

  Image referenced by URL.

  - `required Type Type`

    - `"url"Url`

  - `required string Url`

    URL of the image to fetch.

### Beta Managed Agents User Custom Tool Result Event

- `class BetaManagedAgentsUserCustomToolResultEvent:`

  Event sent by the client providing the result of a custom tool execution.

  - `required string ID`

    Unique identifier for this event.

  - `required string CustomToolUseID`

    The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

  - `required Type Type`

    - `"user.custom_tool_result"UserCustomToolResult`

  - `IReadOnlyList<Content> Content`

    The result content returned by the tool.

    - `class BetaManagedAgentsTextBlock:`

      Regular text content.

      - `required string Text`

        The text content.

      - `required Type Type`

        - `"text"Text`

    - `class BetaManagedAgentsImageBlock:`

      Image content specified directly as base64 data or as a reference via a URL.

      - `required Source Source`

        Union type for image source variants.

        - `class BetaManagedAgentsBase64ImageSource:`

          Base64-encoded image data.

          - `required string Data`

            Base64-encoded image data.

          - `required string MediaType`

            MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsUrlImageSource:`

          Image referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the image to fetch.

        - `class BetaManagedAgentsFileImageSource:`

          Image referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"image"Image`

    - `class BetaManagedAgentsDocumentBlock:`

      Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required Source Source`

        Union type for document source variants.

        - `class BetaManagedAgentsBase64DocumentSource:`

          Base64-encoded document data.

          - `required string Data`

            Base64-encoded document data.

          - `required string MediaType`

            MIME type of the document (e.g., "application/pdf").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsPlainTextDocumentSource:`

          Plain text document content.

          - `required string Data`

            The plain text content.

          - `required MediaType MediaType`

            MIME type of the text content. Must be "text/plain".

            - `"text/plain"TextPlain`

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsUrlDocumentSource:`

          Document referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the document to fetch.

        - `class BetaManagedAgentsFileDocumentSource:`

          Document referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"document"Document`

      - `string? Context`

        Additional context about the document for the model.

      - `string? Title`

        The title of the document.

    - `class BetaManagedAgentsSearchResultBlock:`

      A block containing a web search result.

      - `required BetaManagedAgentsSearchResultCitations Citations`

        Citation settings for a search result.

        - `required Boolean Enabled`

          Whether citations are enabled for this search result.

      - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

        Array of text content blocks from the search result.

        - `required string Text`

          The text content.

        - `required Type Type`

          - `"text"Text`

      - `required string Source`

        The URL source of the search result.

      - `required string Title`

        The title of the search result.

      - `required Type Type`

        - `"search_result"SearchResult`

  - `Boolean? IsError`

    Whether the tool execution resulted in an error.

  - `DateTimeOffset? ProcessedAt`

    A timestamp in RFC 3339 format

  - `string? SessionThreadID`

    Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`.

### Beta Managed Agents User Custom Tool Result Event Params

- `class BetaManagedAgentsUserCustomToolResultEventParams:`

  Parameters for providing the result of a custom tool execution.

  - `required string CustomToolUseID`

    The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

  - `required Type Type`

    - `"user.custom_tool_result"UserCustomToolResult`

  - `IReadOnlyList<Content> Content`

    The result content returned by the tool.

    - `class BetaManagedAgentsTextBlock:`

      Regular text content.

      - `required string Text`

        The text content.

      - `required Type Type`

        - `"text"Text`

    - `class BetaManagedAgentsImageBlock:`

      Image content specified directly as base64 data or as a reference via a URL.

      - `required Source Source`

        Union type for image source variants.

        - `class BetaManagedAgentsBase64ImageSource:`

          Base64-encoded image data.

          - `required string Data`

            Base64-encoded image data.

          - `required string MediaType`

            MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsUrlImageSource:`

          Image referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the image to fetch.

        - `class BetaManagedAgentsFileImageSource:`

          Image referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"image"Image`

    - `class BetaManagedAgentsDocumentBlock:`

      Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required Source Source`

        Union type for document source variants.

        - `class BetaManagedAgentsBase64DocumentSource:`

          Base64-encoded document data.

          - `required string Data`

            Base64-encoded document data.

          - `required string MediaType`

            MIME type of the document (e.g., "application/pdf").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsPlainTextDocumentSource:`

          Plain text document content.

          - `required string Data`

            The plain text content.

          - `required MediaType MediaType`

            MIME type of the text content. Must be "text/plain".

            - `"text/plain"TextPlain`

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsUrlDocumentSource:`

          Document referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the document to fetch.

        - `class BetaManagedAgentsFileDocumentSource:`

          Document referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"document"Document`

      - `string? Context`

        Additional context about the document for the model.

      - `string? Title`

        The title of the document.

    - `class BetaManagedAgentsSearchResultBlock:`

      A block containing a web search result.

      - `required BetaManagedAgentsSearchResultCitations Citations`

        Citation settings for a search result.

        - `required Boolean Enabled`

          Whether citations are enabled for this search result.

      - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

        Array of text content blocks from the search result.

        - `required string Text`

          The text content.

        - `required Type Type`

          - `"text"Text`

      - `required string Source`

        The URL source of the search result.

      - `required string Title`

        The title of the search result.

      - `required Type Type`

        - `"search_result"SearchResult`

  - `Boolean? IsError`

    Whether the tool execution resulted in an error.

### Beta Managed Agents User Define Outcome Event

- `class BetaManagedAgentsUserDefineOutcomeEvent:`

  Echo of a `user.define_outcome` input event. Carries the server-generated `outcome_id` that subsequent `span.outcome_evaluation_*` events reference.

  - `required string ID`

    Unique identifier for this event.

  - `required string Description`

    What the agent should produce. Copied from the input event.

  - `required Int? MaxIterations`

    Evaluate-then-revise cycles before giving up. Default 3, max 20.

  - `required string OutcomeID`

    Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.

  - `required DateTimeOffset ProcessedAt`

    A timestamp in RFC 3339 format

  - `required Rubric Rubric`

    Rubric for grading the quality of an outcome.

    - `class BetaManagedAgentsFileRubric:`

      Rubric referenced by a file uploaded via the Files API.

      - `required string FileID`

        ID of the rubric file.

      - `required Type Type`

        - `"file"File`

    - `class BetaManagedAgentsTextRubric:`

      Rubric content provided inline as text.

      - `required string Content`

        Rubric content. Plain text or markdown — the grader treats it as freeform text.

      - `required Type Type`

        - `"text"Text`

  - `required Type Type`

    - `"user.define_outcome"UserDefineOutcome`

### Beta Managed Agents User Define Outcome Event Params

- `class BetaManagedAgentsUserDefineOutcomeEventParams:`

  Parameters for defining an outcome the agent should work toward. The agent begins work on receipt.

  - `required string Description`

    What the agent should produce. This is the task specification.

  - `required Rubric Rubric`

    Rubric for grading the quality of an outcome.

    - `class BetaManagedAgentsFileRubricParams:`

      Rubric referenced by a file uploaded via the Files API.

      - `required string FileID`

        ID of the rubric file.

      - `required Type Type`

        - `"file"File`

    - `class BetaManagedAgentsTextRubricParams:`

      Rubric content provided inline as text.

      - `required string Content`

        Rubric content. Plain text or markdown — the grader treats it as freeform text. Maximum 262144 characters.

      - `required Type Type`

        - `"text"Text`

  - `required Type Type`

    - `"user.define_outcome"UserDefineOutcome`

  - `Int? MaxIterations`

    Eval→revision cycles before giving up. Default 3, max 20.

### Beta Managed Agents User Interrupt Event

- `class BetaManagedAgentsUserInterruptEvent:`

  An interrupt event that pauses agent execution and returns control to the user.

  - `required string ID`

    Unique identifier for this event.

  - `required Type Type`

    - `"user.interrupt"UserInterrupt`

  - `DateTimeOffset? ProcessedAt`

    A timestamp in RFC 3339 format

  - `string? SessionThreadID`

    If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.

### Beta Managed Agents User Interrupt Event Params

- `class BetaManagedAgentsUserInterruptEventParams:`

  Parameters for sending an interrupt to pause the agent.

  - `required Type Type`

    - `"user.interrupt"UserInterrupt`

  - `string? SessionThreadID`

    If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.

### Beta Managed Agents User Message Event

- `class BetaManagedAgentsUserMessageEvent:`

  A user message event in the session conversation.

  - `required string ID`

    Unique identifier for this event.

  - `required IReadOnlyList<Content> Content`

    Array of content blocks comprising the user message.

    - `class BetaManagedAgentsTextBlock:`

      Regular text content.

      - `required string Text`

        The text content.

      - `required Type Type`

        - `"text"Text`

    - `class BetaManagedAgentsImageBlock:`

      Image content specified directly as base64 data or as a reference via a URL.

      - `required Source Source`

        Union type for image source variants.

        - `class BetaManagedAgentsBase64ImageSource:`

          Base64-encoded image data.

          - `required string Data`

            Base64-encoded image data.

          - `required string MediaType`

            MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsUrlImageSource:`

          Image referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the image to fetch.

        - `class BetaManagedAgentsFileImageSource:`

          Image referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"image"Image`

    - `class BetaManagedAgentsDocumentBlock:`

      Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required Source Source`

        Union type for document source variants.

        - `class BetaManagedAgentsBase64DocumentSource:`

          Base64-encoded document data.

          - `required string Data`

            Base64-encoded document data.

          - `required string MediaType`

            MIME type of the document (e.g., "application/pdf").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsPlainTextDocumentSource:`

          Plain text document content.

          - `required string Data`

            The plain text content.

          - `required MediaType MediaType`

            MIME type of the text content. Must be "text/plain".

            - `"text/plain"TextPlain`

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsUrlDocumentSource:`

          Document referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the document to fetch.

        - `class BetaManagedAgentsFileDocumentSource:`

          Document referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"document"Document`

      - `string? Context`

        Additional context about the document for the model.

      - `string? Title`

        The title of the document.

  - `required Type Type`

    - `"user.message"UserMessage`

  - `DateTimeOffset? ProcessedAt`

    A timestamp in RFC 3339 format

### Beta Managed Agents User Message Event Params

- `class BetaManagedAgentsUserMessageEventParams:`

  Parameters for sending a user message to the session.

  - `required IReadOnlyList<Content> Content`

    Array of content blocks for the user message.

    - `class BetaManagedAgentsTextBlock:`

      Regular text content.

      - `required string Text`

        The text content.

      - `required Type Type`

        - `"text"Text`

    - `class BetaManagedAgentsImageBlock:`

      Image content specified directly as base64 data or as a reference via a URL.

      - `required Source Source`

        Union type for image source variants.

        - `class BetaManagedAgentsBase64ImageSource:`

          Base64-encoded image data.

          - `required string Data`

            Base64-encoded image data.

          - `required string MediaType`

            MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsUrlImageSource:`

          Image referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the image to fetch.

        - `class BetaManagedAgentsFileImageSource:`

          Image referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"image"Image`

    - `class BetaManagedAgentsDocumentBlock:`

      Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required Source Source`

        Union type for document source variants.

        - `class BetaManagedAgentsBase64DocumentSource:`

          Base64-encoded document data.

          - `required string Data`

            Base64-encoded document data.

          - `required string MediaType`

            MIME type of the document (e.g., "application/pdf").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsPlainTextDocumentSource:`

          Plain text document content.

          - `required string Data`

            The plain text content.

          - `required MediaType MediaType`

            MIME type of the text content. Must be "text/plain".

            - `"text/plain"TextPlain`

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsUrlDocumentSource:`

          Document referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the document to fetch.

        - `class BetaManagedAgentsFileDocumentSource:`

          Document referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"document"Document`

      - `string? Context`

        Additional context about the document for the model.

      - `string? Title`

        The title of the document.

  - `required Type Type`

    - `"user.message"UserMessage`

### Beta Managed Agents User Tool Confirmation Event

- `class BetaManagedAgentsUserToolConfirmationEvent:`

  A tool confirmation event that approves or denies a pending tool execution.

  - `required string ID`

    Unique identifier for this event.

  - `required Result Result`

    UserToolConfirmationResult enum

    - `"allow"Allow`

    - `"deny"Deny`

  - `required string ToolUseID`

    The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

  - `required Type Type`

    - `"user.tool_confirmation"UserToolConfirmation`

  - `string? DenyMessage`

    Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

  - `DateTimeOffset? ProcessedAt`

    A timestamp in RFC 3339 format

  - `string? SessionThreadID`

    When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval.

### Beta Managed Agents User Tool Confirmation Event Params

- `class BetaManagedAgentsUserToolConfirmationEventParams:`

  Parameters for confirming or denying a tool execution request.

  - `required Result Result`

    UserToolConfirmationResult enum

    - `"allow"Allow`

    - `"deny"Deny`

  - `required string ToolUseID`

    The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

  - `required Type Type`

    - `"user.tool_confirmation"UserToolConfirmation`

  - `string? DenyMessage`

    Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

### Beta Managed Agents User Tool Result Event Params

- `class BetaManagedAgentsUserToolResultEventParams:`

  Parameters for providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.

  - `required string ToolUseID`

    The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

  - `required Type Type`

    - `"user.tool_result"UserToolResult`

  - `IReadOnlyList<Content> Content`

    The result content returned by the tool.

    - `class BetaManagedAgentsTextBlock:`

      Regular text content.

      - `required string Text`

        The text content.

      - `required Type Type`

        - `"text"Text`

    - `class BetaManagedAgentsImageBlock:`

      Image content specified directly as base64 data or as a reference via a URL.

      - `required Source Source`

        Union type for image source variants.

        - `class BetaManagedAgentsBase64ImageSource:`

          Base64-encoded image data.

          - `required string Data`

            Base64-encoded image data.

          - `required string MediaType`

            MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsUrlImageSource:`

          Image referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the image to fetch.

        - `class BetaManagedAgentsFileImageSource:`

          Image referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"image"Image`

    - `class BetaManagedAgentsDocumentBlock:`

      Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required Source Source`

        Union type for document source variants.

        - `class BetaManagedAgentsBase64DocumentSource:`

          Base64-encoded document data.

          - `required string Data`

            Base64-encoded document data.

          - `required string MediaType`

            MIME type of the document (e.g., "application/pdf").

          - `required Type Type`

            - `"base64"Base64`

        - `class BetaManagedAgentsPlainTextDocumentSource:`

          Plain text document content.

          - `required string Data`

            The plain text content.

          - `required MediaType MediaType`

            MIME type of the text content. Must be "text/plain".

            - `"text/plain"TextPlain`

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsUrlDocumentSource:`

          Document referenced by URL.

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

            URL of the document to fetch.

        - `class BetaManagedAgentsFileDocumentSource:`

          Document referenced by file ID.

          - `required string FileID`

            ID of a previously uploaded file.

          - `required Type Type`

            - `"file"File`

      - `required Type Type`

        - `"document"Document`

      - `string? Context`

        Additional context about the document for the model.

      - `string? Title`

        The title of the document.

    - `class BetaManagedAgentsSearchResultBlock:`

      A block containing a web search result.

      - `required BetaManagedAgentsSearchResultCitations Citations`

        Citation settings for a search result.

        - `required Boolean Enabled`

          Whether citations are enabled for this search result.

      - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

        Array of text content blocks from the search result.

        - `required string Text`

          The text content.

        - `required Type Type`

          - `"text"Text`

      - `required string Source`

        The URL source of the search result.

      - `required string Title`

        The title of the search result.

      - `required Type Type`

        - `"search_result"SearchResult`

  - `Boolean? IsError`

    Whether the tool execution resulted in an error.

# Resources

## Add Session Resource

`BetaManagedAgentsFileResource Beta.Sessions.Resources.Add(ResourceAddParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/sessions/{session_id}/resources`

Add Session Resource

### Parameters

- `ResourceAddParams parameters`

  - `required string sessionID`

    Path param: Path parameter session_id

  - `required string fileID`

    Body param: ID of a previously uploaded file.

  - `required Type type`

    Body param

    - `"file"File`

  - `string? mountPath`

    Body param: Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsFileResource:`

  - `required string ID`

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string FileID`

  - `required string MountPath`

  - `required Type Type`

    - `"file"File`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

### Example

```csharp
ResourceAddParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7",
    FileID = "file_011CNha8iCJcU1wXNR6q4V8w",
    Type = Type.File,
};

var betaManagedAgentsFileResource = await client.Beta.Sessions.Resources.Add(parameters);

Console.WriteLine(betaManagedAgentsFileResource);
```

#### Response

```json
{
  "id": "sesrsc_011CZkZBJq5dWxk9fVLNcPht",
  "created_at": "2026-03-15T10:00:00Z",
  "file_id": "file_011CNha8iCJcU1wXNR6q4V8w",
  "mount_path": "/uploads/receipt.pdf",
  "type": "file",
  "updated_at": "2026-03-15T10:00:00Z"
}
```

## List Session Resources

`ResourceListPageResponse Beta.Sessions.Resources.List(ResourceListParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/sessions/{session_id}/resources`

List Session Resources

### Parameters

- `ResourceListParams parameters`

  - `required string sessionID`

    Path param: Path parameter session_id

  - `Int limit`

    Query param: Maximum number of resources to return per page (max 1000). If omitted, returns all resources.

  - `string page`

    Query param: Opaque cursor from a previous response's next_page field.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class ResourceListPageResponse:`

  Paginated list of resources attached to a session.

  - `required IReadOnlyList<BetaManagedAgentsSessionResource> Data`

    Resources for the session, ordered by `created_at`.

    - `class BetaManagedAgentsGitHubRepositoryResource:`

      - `required string ID`

      - `required DateTimeOffset CreatedAt`

        A timestamp in RFC 3339 format

      - `required string MountPath`

      - `required Type Type`

        - `"github_repository"GitHubRepository`

      - `required DateTimeOffset UpdatedAt`

        A timestamp in RFC 3339 format

      - `required string Url`

      - `Checkout? Checkout`

        - `class BetaManagedAgentsBranchCheckout:`

          - `required string Name`

            Branch name to check out.

          - `required Type Type`

            - `"branch"Branch`

        - `class BetaManagedAgentsCommitCheckout:`

          - `required string Sha`

            Full commit SHA to check out.

          - `required Type Type`

            - `"commit"Commit`

    - `class BetaManagedAgentsFileResource:`

      - `required string ID`

      - `required DateTimeOffset CreatedAt`

        A timestamp in RFC 3339 format

      - `required string FileID`

      - `required string MountPath`

      - `required Type Type`

        - `"file"File`

      - `required DateTimeOffset UpdatedAt`

        A timestamp in RFC 3339 format

    - `class BetaManagedAgentsMemoryStoreResource:`

      A memory store attached to an agent session.

      - `required string MemoryStoreID`

        The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

      - `required Type Type`

        - `"memory_store"MemoryStore`

      - `Access? Access`

        Access mode for an attached memory store.

        - `"read_write"ReadWrite`

        - `"read_only"ReadOnly`

      - `string Description`

        Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.

      - `string? Instructions`

        Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

      - `string? MountPath`

        Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.

      - `string? Name`

        Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.

  - `string? NextPage`

    Opaque cursor for the next page. Null when no more results.

### Example

```csharp
ResourceListParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7"
};

var page = await client.Beta.Sessions.Resources.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "sesrsc_011CZkZBJq5dWxk9fVLNcPht",
      "created_at": "2026-03-15T10:00:00Z",
      "file_id": "file_011CNha8iCJcU1wXNR6q4V8w",
      "mount_path": "/uploads/receipt.pdf",
      "type": "file",
      "updated_at": "2026-03-15T10:00:00Z"
    },
    {
      "id": "sesrsc_011CZkZCKr6eXyl0gWMOdQiu",
      "created_at": "2026-03-15T10:00:00Z",
      "mount_path": "/workspace/example-repo",
      "type": "github_repository",
      "updated_at": "2026-03-15T10:00:00Z",
      "url": "https://github.com/example-org/example-repo",
      "checkout": {
        "name": "main",
        "type": "branch"
      }
    }
  ],
  "next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo="
}
```

## Get Session Resource

`ResourceRetrieveResponse Beta.Sessions.Resources.Retrieve(ResourceRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/sessions/{session_id}/resources/{resource_id}`

Get Session Resource

### Parameters

- `ResourceRetrieveParams parameters`

  - `required string sessionID`

    Path param: Path parameter session_id

  - `required string resourceID`

    Path param: Path parameter resource_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class ResourceRetrieveResponse: A class that can be one of several variants.union`

  The requested session resource.

  - `class BetaManagedAgentsGitHubRepositoryResource:`

    - `required string ID`

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string MountPath`

    - `required Type Type`

      - `"github_repository"GitHubRepository`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

    - `required string Url`

    - `Checkout? Checkout`

      - `class BetaManagedAgentsBranchCheckout:`

        - `required string Name`

          Branch name to check out.

        - `required Type Type`

          - `"branch"Branch`

      - `class BetaManagedAgentsCommitCheckout:`

        - `required string Sha`

          Full commit SHA to check out.

        - `required Type Type`

          - `"commit"Commit`

  - `class BetaManagedAgentsFileResource:`

    - `required string ID`

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string FileID`

    - `required string MountPath`

    - `required Type Type`

      - `"file"File`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

  - `class BetaManagedAgentsMemoryStoreResource:`

    A memory store attached to an agent session.

    - `required string MemoryStoreID`

      The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

    - `required Type Type`

      - `"memory_store"MemoryStore`

    - `Access? Access`

      Access mode for an attached memory store.

      - `"read_write"ReadWrite`

      - `"read_only"ReadOnly`

    - `string Description`

      Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.

    - `string? Instructions`

      Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

    - `string? MountPath`

      Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.

    - `string? Name`

      Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.

### Example

```csharp
ResourceRetrieveParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7",
    ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht",
};

var resource = await client.Beta.Sessions.Resources.Retrieve(parameters);

Console.WriteLine(resource);
```

#### Response

```json
{
  "id": "sesrsc_011CZkZCKr6eXyl0gWMOdQiu",
  "created_at": "2026-03-15T10:00:00Z",
  "mount_path": "/workspace/example-repo",
  "type": "github_repository",
  "updated_at": "2026-03-15T10:00:00Z",
  "url": "https://github.com/example-org/example-repo",
  "checkout": {
    "name": "main",
    "type": "branch"
  }
}
```

## Update Session Resource

`ResourceUpdateResponse Beta.Sessions.Resources.Update(ResourceUpdateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/sessions/{session_id}/resources/{resource_id}`

Update Session Resource

### Parameters

- `ResourceUpdateParams parameters`

  - `required string sessionID`

    Path param: Path parameter session_id

  - `required string resourceID`

    Path param: Path parameter resource_id

  - `required string authorizationToken`

    Body param: New authorization token for the resource. Currently only `github_repository` resources support token rotation.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class ResourceUpdateResponse: A class that can be one of several variants.union`

  The updated session resource.

  - `class BetaManagedAgentsGitHubRepositoryResource:`

    - `required string ID`

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string MountPath`

    - `required Type Type`

      - `"github_repository"GitHubRepository`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

    - `required string Url`

    - `Checkout? Checkout`

      - `class BetaManagedAgentsBranchCheckout:`

        - `required string Name`

          Branch name to check out.

        - `required Type Type`

          - `"branch"Branch`

      - `class BetaManagedAgentsCommitCheckout:`

        - `required string Sha`

          Full commit SHA to check out.

        - `required Type Type`

          - `"commit"Commit`

  - `class BetaManagedAgentsFileResource:`

    - `required string ID`

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string FileID`

    - `required string MountPath`

    - `required Type Type`

      - `"file"File`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

  - `class BetaManagedAgentsMemoryStoreResource:`

    A memory store attached to an agent session.

    - `required string MemoryStoreID`

      The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

    - `required Type Type`

      - `"memory_store"MemoryStore`

    - `Access? Access`

      Access mode for an attached memory store.

      - `"read_write"ReadWrite`

      - `"read_only"ReadOnly`

    - `string Description`

      Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.

    - `string? Instructions`

      Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

    - `string? MountPath`

      Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.

    - `string? Name`

      Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.

### Example

```csharp
ResourceUpdateParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7",
    ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht",
    AuthorizationToken = "ghp_exampletoken",
};

var resource = await client.Beta.Sessions.Resources.Update(parameters);

Console.WriteLine(resource);
```

#### Response

```json
{
  "id": "sesrsc_011CZkZCKr6eXyl0gWMOdQiu",
  "created_at": "2026-03-15T10:00:00Z",
  "mount_path": "/workspace/example-repo",
  "type": "github_repository",
  "updated_at": "2026-03-15T10:00:00Z",
  "url": "https://github.com/example-org/example-repo",
  "checkout": {
    "name": "main",
    "type": "branch"
  }
}
```

## Delete Session Resource

`BetaManagedAgentsDeleteSessionResource Beta.Sessions.Resources.Delete(ResourceDeleteParamsparameters, CancellationTokencancellationToken = default)`

**delete** `/v1/sessions/{session_id}/resources/{resource_id}`

Delete Session Resource

### Parameters

- `ResourceDeleteParams parameters`

  - `required string sessionID`

    Path param: Path parameter session_id

  - `required string resourceID`

    Path param: Path parameter resource_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsDeleteSessionResource:`

  Confirmation of resource deletion.

  - `required string ID`

  - `required Type Type`

    - `"session_resource_deleted"SessionResourceDeleted`

### Example

```csharp
ResourceDeleteParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7",
    ResourceID = "sesrsc_011CZkZBJq5dWxk9fVLNcPht",
};

var betaManagedAgentsDeleteSessionResource = await client.Beta.Sessions.Resources.Delete(parameters);

Console.WriteLine(betaManagedAgentsDeleteSessionResource);
```

#### Response

```json
{
  "id": "sesrsc_011CZkZBJq5dWxk9fVLNcPht",
  "type": "session_resource_deleted"
}
```

## Domain Types

### Beta Managed Agents Delete Session Resource

- `class BetaManagedAgentsDeleteSessionResource:`

  Confirmation of resource deletion.

  - `required string ID`

  - `required Type Type`

    - `"session_resource_deleted"SessionResourceDeleted`

### Beta Managed Agents File Resource

- `class BetaManagedAgentsFileResource:`

  - `required string ID`

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string FileID`

  - `required string MountPath`

  - `required Type Type`

    - `"file"File`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

### Beta Managed Agents GitHub Repository Resource

- `class BetaManagedAgentsGitHubRepositoryResource:`

  - `required string ID`

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string MountPath`

  - `required Type Type`

    - `"github_repository"GitHubRepository`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required string Url`

  - `Checkout? Checkout`

    - `class BetaManagedAgentsBranchCheckout:`

      - `required string Name`

        Branch name to check out.

      - `required Type Type`

        - `"branch"Branch`

    - `class BetaManagedAgentsCommitCheckout:`

      - `required string Sha`

        Full commit SHA to check out.

      - `required Type Type`

        - `"commit"Commit`

### Beta Managed Agents Memory Store Resource

- `class BetaManagedAgentsMemoryStoreResource:`

  A memory store attached to an agent session.

  - `required string MemoryStoreID`

    The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

  - `required Type Type`

    - `"memory_store"MemoryStore`

  - `Access? Access`

    Access mode for an attached memory store.

    - `"read_write"ReadWrite`

    - `"read_only"ReadOnly`

  - `string Description`

    Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.

  - `string? Instructions`

    Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

  - `string? MountPath`

    Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.

  - `string? Name`

    Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.

### Beta Managed Agents Session Resource

- `class BetaManagedAgentsSessionResource: A class that can be one of several variants.union`

  A memory store attached to an agent session.

  - `class BetaManagedAgentsGitHubRepositoryResource:`

    - `required string ID`

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string MountPath`

    - `required Type Type`

      - `"github_repository"GitHubRepository`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

    - `required string Url`

    - `Checkout? Checkout`

      - `class BetaManagedAgentsBranchCheckout:`

        - `required string Name`

          Branch name to check out.

        - `required Type Type`

          - `"branch"Branch`

      - `class BetaManagedAgentsCommitCheckout:`

        - `required string Sha`

          Full commit SHA to check out.

        - `required Type Type`

          - `"commit"Commit`

  - `class BetaManagedAgentsFileResource:`

    - `required string ID`

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string FileID`

    - `required string MountPath`

    - `required Type Type`

      - `"file"File`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

  - `class BetaManagedAgentsMemoryStoreResource:`

    A memory store attached to an agent session.

    - `required string MemoryStoreID`

      The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

    - `required Type Type`

      - `"memory_store"MemoryStore`

    - `Access? Access`

      Access mode for an attached memory store.

      - `"read_write"ReadWrite`

      - `"read_only"ReadOnly`

    - `string Description`

      Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.

    - `string? Instructions`

      Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

    - `string? MountPath`

      Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.

    - `string? Name`

      Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.

# Threads

## List Session Threads

`ThreadListPageResponse Beta.Sessions.Threads.List(ThreadListParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/sessions/{session_id}/threads`

List Session Threads

### Parameters

- `ThreadListParams parameters`

  - `required string sessionID`

    Path param: Path parameter session_id

  - `Int limit`

    Query param: Maximum results per page. Defaults to 1000.

  - `string page`

    Query param: Opaque pagination cursor from a previous response's next_page. Forward-only.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class ThreadListPageResponse:`

  Paginated list of threads within a `session`.

  - `IReadOnlyList<BetaManagedAgentsSessionThread> Data`

    Threads in the session, primary first then children in spawn order.

    - `required string ID`

      Unique identifier for this thread.

    - `required BetaManagedAgentsSessionThreadAgent Agent`

      Resolved `agent` definition for a single `session_thread`. Snapshot of the agent at thread creation time. The multiagent roster is not repeated here; read it from `Session.agent`.

      - `required string ID`

      - `required string? Description`

      - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

        - `required string Name`

        - `required Type Type`

          - `"url"Url`

        - `required string Url`

      - `required BetaManagedAgentsModelConfig Model`

        Model identifier and configuration.

        - `required BetaManagedAgentsModel ID`

          The model that will power your agent.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `"claude-opus-4-8"ClaudeOpus4_8`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-7"ClaudeOpus4_7`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-6"ClaudeOpus4_6`

            Most intelligent model for building agents and coding

          - `"claude-sonnet-4-6"ClaudeSonnet4_6`

            Best combination of speed and intelligence

          - `"claude-haiku-4-5"ClaudeHaiku4_5`

            Fastest model with near-frontier intelligence

          - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

            Fastest model with near-frontier intelligence

          - `"claude-opus-4-5"ClaudeOpus4_5`

            Premium model combining maximum intelligence with practical performance

          - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

            Premium model combining maximum intelligence with practical performance

          - `"claude-sonnet-4-5"ClaudeSonnet4_5`

            High-performance model for agents and coding

          - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

            High-performance model for agents and coding

        - `Speed Speed`

          Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

          - `"standard"Standard`

          - `"fast"Fast`

      - `required string Name`

      - `required IReadOnlyList<Skill> Skills`

        - `class BetaManagedAgentsAnthropicSkill:`

          A resolved Anthropic-managed skill.

          - `required string SkillID`

          - `required Type Type`

            - `"anthropic"Anthropic`

          - `required string Version`

        - `class BetaManagedAgentsCustomSkill:`

          A resolved user-created custom skill.

          - `required string SkillID`

          - `required Type Type`

            - `"custom"Custom`

          - `required string Version`

      - `required string? System`

      - `required IReadOnlyList<Tool> Tools`

        - `class BetaManagedAgentsAgentToolset20260401:`

          - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

            - `required Boolean Enabled`

            - `required Name Name`

              Built-in agent tool identifier.

              - `"bash"Bash`

              - `"edit"Edit`

              - `"read"Read`

              - `"write"Write`

              - `"glob"Glob`

              - `"grep"Grep`

              - `"web_fetch"WebFetch`

              - `"web_search"WebSearch`

            - `required PermissionPolicy PermissionPolicy`

              Permission policy for tool execution.

              - `class BetaManagedAgentsAlwaysAllowPolicy:`

                Tool calls are automatically approved without user confirmation.

                - `required Type Type`

                  - `"always_allow"AlwaysAllow`

              - `class BetaManagedAgentsAlwaysAskPolicy:`

                Tool calls require user confirmation before execution.

                - `required Type Type`

                  - `"always_ask"AlwaysAsk`

          - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

            Resolved default configuration for agent tools.

            - `required Boolean Enabled`

            - `required PermissionPolicy PermissionPolicy`

              Permission policy for tool execution.

              - `class BetaManagedAgentsAlwaysAllowPolicy:`

                Tool calls are automatically approved without user confirmation.

              - `class BetaManagedAgentsAlwaysAskPolicy:`

                Tool calls require user confirmation before execution.

          - `required Type Type`

            - `"agent_toolset_20260401"AgentToolset20260401`

        - `class BetaManagedAgentsMcpToolset:`

          - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

            - `required Boolean Enabled`

            - `required string Name`

            - `required PermissionPolicy PermissionPolicy`

              Permission policy for tool execution.

              - `class BetaManagedAgentsAlwaysAllowPolicy:`

                Tool calls are automatically approved without user confirmation.

              - `class BetaManagedAgentsAlwaysAskPolicy:`

                Tool calls require user confirmation before execution.

          - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

            Resolved default configuration for all tools from an MCP server.

            - `required Boolean Enabled`

            - `required PermissionPolicy PermissionPolicy`

              Permission policy for tool execution.

              - `class BetaManagedAgentsAlwaysAllowPolicy:`

                Tool calls are automatically approved without user confirmation.

              - `class BetaManagedAgentsAlwaysAskPolicy:`

                Tool calls require user confirmation before execution.

          - `required string McpServerName`

          - `required Type Type`

            - `"mcp_toolset"McpToolset`

        - `class BetaManagedAgentsCustomTool:`

          A custom tool as returned in API responses.

          - `required string Description`

          - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

            JSON Schema for custom tool input parameters.

            - `IReadOnlyDictionary<string, JsonElement>? Properties`

              JSON Schema properties defining the tool's input parameters.

            - `IReadOnlyList<string> Required`

              List of required property names.

            - `Type Type`

              Must be 'object' for tool input schemas.

              - `"object"Object`

          - `required string Name`

          - `required Type Type`

            - `"custom"Custom`

      - `required Type Type`

        - `"agent"Agent`

      - `required Int Version`

    - `required DateTimeOffset? ArchivedAt`

      A timestamp in RFC 3339 format

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string? ParentThreadID`

      Parent thread that spawned this thread. Null for the primary thread.

    - `required string SessionID`

      The session this thread belongs to.

    - `required BetaManagedAgentsSessionThreadStats? Stats`

      Timing statistics for a session thread.

      - `Double ActiveSeconds`

        Cumulative time in seconds the thread spent actively running. Excludes idle time.

      - `Double DurationSeconds`

        Elapsed time since thread creation in seconds. For archived threads, frozen at the final update.

      - `Double StartupSeconds`

        Time in seconds for the thread to begin running. Zero for child threads, which start immediately.

    - `required BetaManagedAgentsSessionThreadStatus Status`

      SessionThreadStatus enum

      - `"running"Running`

      - `"idle"Idle`

      - `"rescheduling"Rescheduling`

      - `"terminated"Terminated`

    - `required Type Type`

      - `"session_thread"SessionThread`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

    - `required BetaManagedAgentsSessionThreadUsage? Usage`

      Cumulative token usage for a session thread across all turns.

      - `BetaManagedAgentsCacheCreationUsage CacheCreation`

        Prompt-cache creation token usage broken down by cache lifetime.

        - `Int Ephemeral1hInputTokens`

          Tokens used to create 1-hour ephemeral cache entries.

        - `Int Ephemeral5mInputTokens`

          Tokens used to create 5-minute ephemeral cache entries.

      - `Int CacheReadInputTokens`

        Total tokens read from prompt cache.

      - `Int InputTokens`

        Total input tokens consumed across all turns.

      - `Int OutputTokens`

        Total output tokens generated across all turns.

  - `string? NextPage`

    Opaque cursor for the next page. Null when no more results.

### Example

```csharp
ThreadListParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7"
};

var page = await client.Beta.Sessions.Threads.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "sthr_011CZkZVWa6oIjw0rgXZpnBt",
      "agent": {
        "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
        "description": "A focused research subagent.",
        "mcp_servers": [
          {
            "name": "example-mcp",
            "type": "url",
            "url": "https://example-server.modelcontextprotocol.io/sse"
          }
        ],
        "model": {
          "id": "claude-sonnet-4-6",
          "speed": "standard"
        },
        "name": "Researcher",
        "skills": [
          {
            "skill_id": "xlsx",
            "type": "anthropic",
            "version": "1"
          }
        ],
        "system": "You are a research subagent that gathers and summarises sources for the coordinating agent.",
        "tools": [
          {
            "configs": [
              {
                "enabled": true,
                "name": "bash",
                "permission_policy": {
                  "type": "always_allow"
                }
              }
            ],
            "default_config": {
              "enabled": true,
              "permission_policy": {
                "type": "always_ask"
              }
            },
            "type": "agent_toolset_20260401"
          }
        ],
        "type": "agent",
        "version": 1
      },
      "archived_at": null,
      "created_at": "2026-03-15T10:00:00Z",
      "parent_thread_id": null,
      "session_id": "sesn_011CZkZAtmR3yMPDzynEDxu7",
      "stats": {
        "active_seconds": 0,
        "duration_seconds": 0,
        "startup_seconds": 0
      },
      "status": "idle",
      "type": "session_thread",
      "updated_at": "2026-03-15T10:00:00Z",
      "usage": {
        "cache_creation": {
          "ephemeral_1h_input_tokens": 0,
          "ephemeral_5m_input_tokens": 0
        },
        "cache_read_input_tokens": 0,
        "input_tokens": 0,
        "output_tokens": 0
      }
    }
  ],
  "next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo="
}
```

## Get Session Thread

`BetaManagedAgentsSessionThread Beta.Sessions.Threads.Retrieve(ThreadRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/sessions/{session_id}/threads/{thread_id}`

Get Session Thread

### Parameters

- `ThreadRetrieveParams parameters`

  - `required string sessionID`

    Path param: Path parameter session_id

  - `required string threadID`

    Path param: Path parameter thread_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsSessionThread:`

  An execution thread within a `session`. Each session has one primary thread plus zero or more child threads spawned by the coordinator.

  - `required string ID`

    Unique identifier for this thread.

  - `required BetaManagedAgentsSessionThreadAgent Agent`

    Resolved `agent` definition for a single `session_thread`. Snapshot of the agent at thread creation time. The multiagent roster is not repeated here; read it from `Session.agent`.

    - `required string ID`

    - `required string? Description`

    - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

      - `required string Name`

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

    - `required BetaManagedAgentsModelConfig Model`

      Model identifier and configuration.

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

    - `required string Name`

    - `required IReadOnlyList<Skill> Skills`

      - `class BetaManagedAgentsAnthropicSkill:`

        A resolved Anthropic-managed skill.

        - `required string SkillID`

        - `required Type Type`

          - `"anthropic"Anthropic`

        - `required string Version`

      - `class BetaManagedAgentsCustomSkill:`

        A resolved user-created custom skill.

        - `required string SkillID`

        - `required Type Type`

          - `"custom"Custom`

        - `required string Version`

    - `required string? System`

    - `required IReadOnlyList<Tool> Tools`

      - `class BetaManagedAgentsAgentToolset20260401:`

        - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

          - `required Boolean Enabled`

          - `required Name Name`

            Built-in agent tool identifier.

            - `"bash"Bash`

            - `"edit"Edit`

            - `"read"Read`

            - `"write"Write`

            - `"glob"Glob`

            - `"grep"Grep`

            - `"web_fetch"WebFetch`

            - `"web_search"WebSearch`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

              - `required Type Type`

                - `"always_allow"AlwaysAllow`

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

              - `required Type Type`

                - `"always_ask"AlwaysAsk`

        - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

          Resolved default configuration for agent tools.

          - `required Boolean Enabled`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required Type Type`

          - `"agent_toolset_20260401"AgentToolset20260401`

      - `class BetaManagedAgentsMcpToolset:`

        - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

          - `required Boolean Enabled`

          - `required string Name`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

          Resolved default configuration for all tools from an MCP server.

          - `required Boolean Enabled`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required string McpServerName`

        - `required Type Type`

          - `"mcp_toolset"McpToolset`

      - `class BetaManagedAgentsCustomTool:`

        A custom tool as returned in API responses.

        - `required string Description`

        - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

          JSON Schema for custom tool input parameters.

          - `IReadOnlyDictionary<string, JsonElement>? Properties`

            JSON Schema properties defining the tool's input parameters.

          - `IReadOnlyList<string> Required`

            List of required property names.

          - `Type Type`

            Must be 'object' for tool input schemas.

            - `"object"Object`

        - `required string Name`

        - `required Type Type`

          - `"custom"Custom`

    - `required Type Type`

      - `"agent"Agent`

    - `required Int Version`

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string? ParentThreadID`

    Parent thread that spawned this thread. Null for the primary thread.

  - `required string SessionID`

    The session this thread belongs to.

  - `required BetaManagedAgentsSessionThreadStats? Stats`

    Timing statistics for a session thread.

    - `Double ActiveSeconds`

      Cumulative time in seconds the thread spent actively running. Excludes idle time.

    - `Double DurationSeconds`

      Elapsed time since thread creation in seconds. For archived threads, frozen at the final update.

    - `Double StartupSeconds`

      Time in seconds for the thread to begin running. Zero for child threads, which start immediately.

  - `required BetaManagedAgentsSessionThreadStatus Status`

    SessionThreadStatus enum

    - `"running"Running`

    - `"idle"Idle`

    - `"rescheduling"Rescheduling`

    - `"terminated"Terminated`

  - `required Type Type`

    - `"session_thread"SessionThread`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required BetaManagedAgentsSessionThreadUsage? Usage`

    Cumulative token usage for a session thread across all turns.

    - `BetaManagedAgentsCacheCreationUsage CacheCreation`

      Prompt-cache creation token usage broken down by cache lifetime.

      - `Int Ephemeral1hInputTokens`

        Tokens used to create 1-hour ephemeral cache entries.

      - `Int Ephemeral5mInputTokens`

        Tokens used to create 5-minute ephemeral cache entries.

    - `Int CacheReadInputTokens`

      Total tokens read from prompt cache.

    - `Int InputTokens`

      Total input tokens consumed across all turns.

    - `Int OutputTokens`

      Total output tokens generated across all turns.

### Example

```csharp
ThreadRetrieveParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7",
    ThreadID = "sthr_011CZkZVWa6oIjw0rgXZpnBt",
};

var betaManagedAgentsSessionThread = await client.Beta.Sessions.Threads.Retrieve(parameters);

Console.WriteLine(betaManagedAgentsSessionThread);
```

#### Response

```json
{
  "id": "sthr_011CZkZVWa6oIjw0rgXZpnBt",
  "agent": {
    "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
    "description": "A focused research subagent.",
    "mcp_servers": [
      {
        "name": "example-mcp",
        "type": "url",
        "url": "https://example-server.modelcontextprotocol.io/sse"
      }
    ],
    "model": {
      "id": "claude-sonnet-4-6",
      "speed": "standard"
    },
    "name": "Researcher",
    "skills": [
      {
        "skill_id": "xlsx",
        "type": "anthropic",
        "version": "1"
      }
    ],
    "system": "You are a research subagent that gathers and summarises sources for the coordinating agent.",
    "tools": [
      {
        "configs": [
          {
            "enabled": true,
            "name": "bash",
            "permission_policy": {
              "type": "always_allow"
            }
          }
        ],
        "default_config": {
          "enabled": true,
          "permission_policy": {
            "type": "always_ask"
          }
        },
        "type": "agent_toolset_20260401"
      }
    ],
    "type": "agent",
    "version": 1
  },
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "parent_thread_id": null,
  "session_id": "sesn_011CZkZAtmR3yMPDzynEDxu7",
  "stats": {
    "active_seconds": 0,
    "duration_seconds": 0,
    "startup_seconds": 0
  },
  "status": "idle",
  "type": "session_thread",
  "updated_at": "2026-03-15T10:00:00Z",
  "usage": {
    "cache_creation": {
      "ephemeral_1h_input_tokens": 0,
      "ephemeral_5m_input_tokens": 0
    },
    "cache_read_input_tokens": 0,
    "input_tokens": 0,
    "output_tokens": 0
  }
}
```

## Archive Session Thread

`BetaManagedAgentsSessionThread Beta.Sessions.Threads.Archive(ThreadArchiveParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/sessions/{session_id}/threads/{thread_id}/archive`

Archive Session Thread

### Parameters

- `ThreadArchiveParams parameters`

  - `required string sessionID`

    Path param: Path parameter session_id

  - `required string threadID`

    Path param: Path parameter thread_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsSessionThread:`

  An execution thread within a `session`. Each session has one primary thread plus zero or more child threads spawned by the coordinator.

  - `required string ID`

    Unique identifier for this thread.

  - `required BetaManagedAgentsSessionThreadAgent Agent`

    Resolved `agent` definition for a single `session_thread`. Snapshot of the agent at thread creation time. The multiagent roster is not repeated here; read it from `Session.agent`.

    - `required string ID`

    - `required string? Description`

    - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

      - `required string Name`

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

    - `required BetaManagedAgentsModelConfig Model`

      Model identifier and configuration.

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

    - `required string Name`

    - `required IReadOnlyList<Skill> Skills`

      - `class BetaManagedAgentsAnthropicSkill:`

        A resolved Anthropic-managed skill.

        - `required string SkillID`

        - `required Type Type`

          - `"anthropic"Anthropic`

        - `required string Version`

      - `class BetaManagedAgentsCustomSkill:`

        A resolved user-created custom skill.

        - `required string SkillID`

        - `required Type Type`

          - `"custom"Custom`

        - `required string Version`

    - `required string? System`

    - `required IReadOnlyList<Tool> Tools`

      - `class BetaManagedAgentsAgentToolset20260401:`

        - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

          - `required Boolean Enabled`

          - `required Name Name`

            Built-in agent tool identifier.

            - `"bash"Bash`

            - `"edit"Edit`

            - `"read"Read`

            - `"write"Write`

            - `"glob"Glob`

            - `"grep"Grep`

            - `"web_fetch"WebFetch`

            - `"web_search"WebSearch`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

              - `required Type Type`

                - `"always_allow"AlwaysAllow`

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

              - `required Type Type`

                - `"always_ask"AlwaysAsk`

        - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

          Resolved default configuration for agent tools.

          - `required Boolean Enabled`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required Type Type`

          - `"agent_toolset_20260401"AgentToolset20260401`

      - `class BetaManagedAgentsMcpToolset:`

        - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

          - `required Boolean Enabled`

          - `required string Name`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

          Resolved default configuration for all tools from an MCP server.

          - `required Boolean Enabled`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required string McpServerName`

        - `required Type Type`

          - `"mcp_toolset"McpToolset`

      - `class BetaManagedAgentsCustomTool:`

        A custom tool as returned in API responses.

        - `required string Description`

        - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

          JSON Schema for custom tool input parameters.

          - `IReadOnlyDictionary<string, JsonElement>? Properties`

            JSON Schema properties defining the tool's input parameters.

          - `IReadOnlyList<string> Required`

            List of required property names.

          - `Type Type`

            Must be 'object' for tool input schemas.

            - `"object"Object`

        - `required string Name`

        - `required Type Type`

          - `"custom"Custom`

    - `required Type Type`

      - `"agent"Agent`

    - `required Int Version`

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string? ParentThreadID`

    Parent thread that spawned this thread. Null for the primary thread.

  - `required string SessionID`

    The session this thread belongs to.

  - `required BetaManagedAgentsSessionThreadStats? Stats`

    Timing statistics for a session thread.

    - `Double ActiveSeconds`

      Cumulative time in seconds the thread spent actively running. Excludes idle time.

    - `Double DurationSeconds`

      Elapsed time since thread creation in seconds. For archived threads, frozen at the final update.

    - `Double StartupSeconds`

      Time in seconds for the thread to begin running. Zero for child threads, which start immediately.

  - `required BetaManagedAgentsSessionThreadStatus Status`

    SessionThreadStatus enum

    - `"running"Running`

    - `"idle"Idle`

    - `"rescheduling"Rescheduling`

    - `"terminated"Terminated`

  - `required Type Type`

    - `"session_thread"SessionThread`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required BetaManagedAgentsSessionThreadUsage? Usage`

    Cumulative token usage for a session thread across all turns.

    - `BetaManagedAgentsCacheCreationUsage CacheCreation`

      Prompt-cache creation token usage broken down by cache lifetime.

      - `Int Ephemeral1hInputTokens`

        Tokens used to create 1-hour ephemeral cache entries.

      - `Int Ephemeral5mInputTokens`

        Tokens used to create 5-minute ephemeral cache entries.

    - `Int CacheReadInputTokens`

      Total tokens read from prompt cache.

    - `Int InputTokens`

      Total input tokens consumed across all turns.

    - `Int OutputTokens`

      Total output tokens generated across all turns.

### Example

```csharp
ThreadArchiveParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7",
    ThreadID = "sthr_011CZkZVWa6oIjw0rgXZpnBt",
};

var betaManagedAgentsSessionThread = await client.Beta.Sessions.Threads.Archive(parameters);

Console.WriteLine(betaManagedAgentsSessionThread);
```

#### Response

```json
{
  "id": "sthr_011CZkZVWa6oIjw0rgXZpnBt",
  "agent": {
    "id": "agent_011CZkYqphY8vELVzwCUpqiQ",
    "description": "A focused research subagent.",
    "mcp_servers": [
      {
        "name": "example-mcp",
        "type": "url",
        "url": "https://example-server.modelcontextprotocol.io/sse"
      }
    ],
    "model": {
      "id": "claude-sonnet-4-6",
      "speed": "standard"
    },
    "name": "Researcher",
    "skills": [
      {
        "skill_id": "xlsx",
        "type": "anthropic",
        "version": "1"
      }
    ],
    "system": "You are a research subagent that gathers and summarises sources for the coordinating agent.",
    "tools": [
      {
        "configs": [
          {
            "enabled": true,
            "name": "bash",
            "permission_policy": {
              "type": "always_allow"
            }
          }
        ],
        "default_config": {
          "enabled": true,
          "permission_policy": {
            "type": "always_ask"
          }
        },
        "type": "agent_toolset_20260401"
      }
    ],
    "type": "agent",
    "version": 1
  },
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "parent_thread_id": null,
  "session_id": "sesn_011CZkZAtmR3yMPDzynEDxu7",
  "stats": {
    "active_seconds": 0,
    "duration_seconds": 0,
    "startup_seconds": 0
  },
  "status": "idle",
  "type": "session_thread",
  "updated_at": "2026-03-15T10:00:00Z",
  "usage": {
    "cache_creation": {
      "ephemeral_1h_input_tokens": 0,
      "ephemeral_5m_input_tokens": 0
    },
    "cache_read_input_tokens": 0,
    "input_tokens": 0,
    "output_tokens": 0
  }
}
```

## Domain Types

### Beta Managed Agents Session Thread

- `class BetaManagedAgentsSessionThread:`

  An execution thread within a `session`. Each session has one primary thread plus zero or more child threads spawned by the coordinator.

  - `required string ID`

    Unique identifier for this thread.

  - `required BetaManagedAgentsSessionThreadAgent Agent`

    Resolved `agent` definition for a single `session_thread`. Snapshot of the agent at thread creation time. The multiagent roster is not repeated here; read it from `Session.agent`.

    - `required string ID`

    - `required string? Description`

    - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

      - `required string Name`

      - `required Type Type`

        - `"url"Url`

      - `required string Url`

    - `required BetaManagedAgentsModelConfig Model`

      Model identifier and configuration.

      - `required BetaManagedAgentsModel ID`

        The model that will power your agent.

        See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

        - `"claude-opus-4-8"ClaudeOpus4_8`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-7"ClaudeOpus4_7`

          Frontier intelligence for long-running agents and coding

        - `"claude-opus-4-6"ClaudeOpus4_6`

          Most intelligent model for building agents and coding

        - `"claude-sonnet-4-6"ClaudeSonnet4_6`

          Best combination of speed and intelligence

        - `"claude-haiku-4-5"ClaudeHaiku4_5`

          Fastest model with near-frontier intelligence

        - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

          Fastest model with near-frontier intelligence

        - `"claude-opus-4-5"ClaudeOpus4_5`

          Premium model combining maximum intelligence with practical performance

        - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

          Premium model combining maximum intelligence with practical performance

        - `"claude-sonnet-4-5"ClaudeSonnet4_5`

          High-performance model for agents and coding

        - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

          High-performance model for agents and coding

      - `Speed Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

    - `required string Name`

    - `required IReadOnlyList<Skill> Skills`

      - `class BetaManagedAgentsAnthropicSkill:`

        A resolved Anthropic-managed skill.

        - `required string SkillID`

        - `required Type Type`

          - `"anthropic"Anthropic`

        - `required string Version`

      - `class BetaManagedAgentsCustomSkill:`

        A resolved user-created custom skill.

        - `required string SkillID`

        - `required Type Type`

          - `"custom"Custom`

        - `required string Version`

    - `required string? System`

    - `required IReadOnlyList<Tool> Tools`

      - `class BetaManagedAgentsAgentToolset20260401:`

        - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

          - `required Boolean Enabled`

          - `required Name Name`

            Built-in agent tool identifier.

            - `"bash"Bash`

            - `"edit"Edit`

            - `"read"Read`

            - `"write"Write`

            - `"glob"Glob`

            - `"grep"Grep`

            - `"web_fetch"WebFetch`

            - `"web_search"WebSearch`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

              - `required Type Type`

                - `"always_allow"AlwaysAllow`

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

              - `required Type Type`

                - `"always_ask"AlwaysAsk`

        - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

          Resolved default configuration for agent tools.

          - `required Boolean Enabled`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required Type Type`

          - `"agent_toolset_20260401"AgentToolset20260401`

      - `class BetaManagedAgentsMcpToolset:`

        - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

          - `required Boolean Enabled`

          - `required string Name`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

          Resolved default configuration for all tools from an MCP server.

          - `required Boolean Enabled`

          - `required PermissionPolicy PermissionPolicy`

            Permission policy for tool execution.

            - `class BetaManagedAgentsAlwaysAllowPolicy:`

              Tool calls are automatically approved without user confirmation.

            - `class BetaManagedAgentsAlwaysAskPolicy:`

              Tool calls require user confirmation before execution.

        - `required string McpServerName`

        - `required Type Type`

          - `"mcp_toolset"McpToolset`

      - `class BetaManagedAgentsCustomTool:`

        A custom tool as returned in API responses.

        - `required string Description`

        - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

          JSON Schema for custom tool input parameters.

          - `IReadOnlyDictionary<string, JsonElement>? Properties`

            JSON Schema properties defining the tool's input parameters.

          - `IReadOnlyList<string> Required`

            List of required property names.

          - `Type Type`

            Must be 'object' for tool input schemas.

            - `"object"Object`

        - `required string Name`

        - `required Type Type`

          - `"custom"Custom`

    - `required Type Type`

      - `"agent"Agent`

    - `required Int Version`

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string? ParentThreadID`

    Parent thread that spawned this thread. Null for the primary thread.

  - `required string SessionID`

    The session this thread belongs to.

  - `required BetaManagedAgentsSessionThreadStats? Stats`

    Timing statistics for a session thread.

    - `Double ActiveSeconds`

      Cumulative time in seconds the thread spent actively running. Excludes idle time.

    - `Double DurationSeconds`

      Elapsed time since thread creation in seconds. For archived threads, frozen at the final update.

    - `Double StartupSeconds`

      Time in seconds for the thread to begin running. Zero for child threads, which start immediately.

  - `required BetaManagedAgentsSessionThreadStatus Status`

    SessionThreadStatus enum

    - `"running"Running`

    - `"idle"Idle`

    - `"rescheduling"Rescheduling`

    - `"terminated"Terminated`

  - `required Type Type`

    - `"session_thread"SessionThread`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required BetaManagedAgentsSessionThreadUsage? Usage`

    Cumulative token usage for a session thread across all turns.

    - `BetaManagedAgentsCacheCreationUsage CacheCreation`

      Prompt-cache creation token usage broken down by cache lifetime.

      - `Int Ephemeral1hInputTokens`

        Tokens used to create 1-hour ephemeral cache entries.

      - `Int Ephemeral5mInputTokens`

        Tokens used to create 5-minute ephemeral cache entries.

    - `Int CacheReadInputTokens`

      Total tokens read from prompt cache.

    - `Int InputTokens`

      Total input tokens consumed across all turns.

    - `Int OutputTokens`

      Total output tokens generated across all turns.

### Beta Managed Agents Session Thread Stats

- `class BetaManagedAgentsSessionThreadStats:`

  Timing statistics for a session thread.

  - `Double ActiveSeconds`

    Cumulative time in seconds the thread spent actively running. Excludes idle time.

  - `Double DurationSeconds`

    Elapsed time since thread creation in seconds. For archived threads, frozen at the final update.

  - `Double StartupSeconds`

    Time in seconds for the thread to begin running. Zero for child threads, which start immediately.

### Beta Managed Agents Session Thread Status

- `enum BetaManagedAgentsSessionThreadStatus:`

  SessionThreadStatus enum

  - `"running"Running`

  - `"idle"Idle`

  - `"rescheduling"Rescheduling`

  - `"terminated"Terminated`

### Beta Managed Agents Session Thread Usage

- `class BetaManagedAgentsSessionThreadUsage:`

  Cumulative token usage for a session thread across all turns.

  - `BetaManagedAgentsCacheCreationUsage CacheCreation`

    Prompt-cache creation token usage broken down by cache lifetime.

    - `Int Ephemeral1hInputTokens`

      Tokens used to create 1-hour ephemeral cache entries.

    - `Int Ephemeral5mInputTokens`

      Tokens used to create 5-minute ephemeral cache entries.

  - `Int CacheReadInputTokens`

    Total tokens read from prompt cache.

  - `Int InputTokens`

    Total input tokens consumed across all turns.

  - `Int OutputTokens`

    Total output tokens generated across all turns.

### Beta Managed Agents Stream Session Thread Events

- `class BetaManagedAgentsStreamSessionThreadEvents: A class that can be one of several variants.union`

  Server-sent event in a single thread's stream.

  - `class BetaManagedAgentsUserMessageEvent:`

    A user message event in the session conversation.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Array of content blocks comprising the user message.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

        - `required string Text`

          The text content.

        - `required Type Type`

          - `"text"Text`

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

        - `required Source Source`

          Union type for image source variants.

          - `class BetaManagedAgentsBase64ImageSource:`

            Base64-encoded image data.

            - `required string Data`

              Base64-encoded image data.

            - `required string MediaType`

              MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

            - `required Type Type`

              - `"base64"Base64`

          - `class BetaManagedAgentsUrlImageSource:`

            Image referenced by URL.

            - `required Type Type`

              - `"url"Url`

            - `required string Url`

              URL of the image to fetch.

          - `class BetaManagedAgentsFileImageSource:`

            Image referenced by file ID.

            - `required string FileID`

              ID of a previously uploaded file.

            - `required Type Type`

              - `"file"File`

        - `required Type Type`

          - `"image"Image`

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `required Source Source`

          Union type for document source variants.

          - `class BetaManagedAgentsBase64DocumentSource:`

            Base64-encoded document data.

            - `required string Data`

              Base64-encoded document data.

            - `required string MediaType`

              MIME type of the document (e.g., "application/pdf").

            - `required Type Type`

              - `"base64"Base64`

          - `class BetaManagedAgentsPlainTextDocumentSource:`

            Plain text document content.

            - `required string Data`

              The plain text content.

            - `required MediaType MediaType`

              MIME type of the text content. Must be "text/plain".

              - `"text/plain"TextPlain`

            - `required Type Type`

              - `"text"Text`

          - `class BetaManagedAgentsUrlDocumentSource:`

            Document referenced by URL.

            - `required Type Type`

              - `"url"Url`

            - `required string Url`

              URL of the document to fetch.

          - `class BetaManagedAgentsFileDocumentSource:`

            Document referenced by file ID.

            - `required string FileID`

              ID of a previously uploaded file.

            - `required Type Type`

              - `"file"File`

        - `required Type Type`

          - `"document"Document`

        - `string? Context`

          Additional context about the document for the model.

        - `string? Title`

          The title of the document.

    - `required Type Type`

      - `"user.message"UserMessage`

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

  - `class BetaManagedAgentsUserInterruptEvent:`

    An interrupt event that pauses agent execution and returns control to the user.

    - `required string ID`

      Unique identifier for this event.

    - `required Type Type`

      - `"user.interrupt"UserInterrupt`

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.

  - `class BetaManagedAgentsUserToolConfirmationEvent:`

    A tool confirmation event that approves or denies a pending tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required Result Result`

      UserToolConfirmationResult enum

      - `"allow"Allow`

      - `"deny"Deny`

    - `required string ToolUseID`

      The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.tool_confirmation"UserToolConfirmation`

    - `string? DenyMessage`

      Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval.

  - `class BetaManagedAgentsUserCustomToolResultEvent:`

    Event sent by the client providing the result of a custom tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required string CustomToolUseID`

      The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.custom_tool_result"UserCustomToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

        - `required BetaManagedAgentsSearchResultCitations Citations`

          Citation settings for a search result.

          - `required Boolean Enabled`

            Whether citations are enabled for this search result.

        - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

          Array of text content blocks from the search result.

          - `required string Text`

            The text content.

          - `required Type Type`

            - `"text"Text`

        - `required string Source`

          The URL source of the search result.

        - `required string Title`

          The title of the search result.

        - `required Type Type`

          - `"search_result"SearchResult`

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`.

  - `class BetaManagedAgentsAgentCustomToolUseEvent:`

    Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string Name`

      Name of the custom tool being called.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.custom_tool_use"AgentCustomToolUse`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.custom_tool_result` event to route the result back.

  - `class BetaManagedAgentsAgentMessageEvent:`

    An agent response event in the session conversation.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<BetaManagedAgentsTextBlock> Content`

      Array of text blocks comprising the agent response.

      - `required string Text`

        The text content.

      - `required Type Type`

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.message"AgentMessage`

  - `class BetaManagedAgentsAgentThinkingEvent:`

    Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thinking"AgentThinking`

  - `class BetaManagedAgentsAgentMcpToolUseEvent:`

    Event emitted when the agent invokes a tool provided by an MCP server.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string McpServerName`

      Name of the MCP server providing the tool.

    - `required string Name`

      Name of the MCP tool being used.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.mcp_tool_use"AgentMcpToolUse`

    - `EvaluatedPermission EvaluatedPermission`

      AgentEvaluatedPermission enum

      - `"allow"Allow`

      - `"ask"Ask`

      - `"deny"Deny`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

  - `class BetaManagedAgentsAgentMcpToolResultEvent:`

    Event representing the result of an MCP tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required string McpToolUseID`

      The id of the `agent.mcp_tool_use` event this result corresponds to.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.mcp_tool_result"AgentMcpToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

  - `class BetaManagedAgentsAgentToolUseEvent:`

    Event emitted when the agent invokes a built-in agent tool.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string Name`

      Name of the agent tool being used.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.tool_use"AgentToolUse`

    - `EvaluatedPermission EvaluatedPermission`

      AgentEvaluatedPermission enum

      - `"allow"Allow`

      - `"ask"Ask`

      - `"deny"Deny`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

  - `class BetaManagedAgentsAgentToolResultEvent:`

    Event representing the result of an agent tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string ToolUseID`

      The id of the `agent.tool_use` event this result corresponds to.

    - `required Type Type`

      - `"agent.tool_result"AgentToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

  - `class BetaManagedAgentsAgentThreadMessageReceivedEvent:`

    Delivery event written to the target thread's input stream when an agent-to-agent message arrives.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Message content blocks.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

    - `required string FromSessionThreadID`

      Public `sthr_` ID of the thread that sent the message.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thread_message_received"AgentThreadMessageReceived`

    - `string? FromAgentName`

      Name of the callable agent this message came from. Absent when received from the primary agent.

  - `class BetaManagedAgentsAgentThreadMessageSentEvent:`

    Observability event emitted to the sender's output stream when an agent-to-agent message is sent.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Message content blocks.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string ToSessionThreadID`

      Public `sthr_` ID of the thread the message was sent to.

    - `required Type Type`

      - `"agent.thread_message_sent"AgentThreadMessageSent`

    - `string? ToAgentName`

      Name of the callable agent this message was sent to. Absent when sent to the primary agent.

  - `class BetaManagedAgentsAgentThreadContextCompactedEvent:`

    Indicates that context compaction (summarization) occurred during the session.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thread_context_compacted"AgentThreadContextCompacted`

  - `class BetaManagedAgentsSessionErrorEvent:`

    An error event indicating a problem occurred during session execution.

    - `required string ID`

      Unique identifier for this event.

    - `required Error Error`

      An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

      - `class BetaManagedAgentsUnknownError:`

        An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `required Type Type`

              - `"retrying"Retrying`

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `required Type Type`

              - `"exhausted"Exhausted`

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

            - `required Type Type`

              - `"terminal"Terminal`

        - `required Type Type`

          - `"unknown_error"UnknownError`

      - `class BetaManagedAgentsModelOverloadedError:`

        The model is currently overloaded. Emitted after automatic retries are exhausted.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_overloaded_error"ModelOverloadedError`

      - `class BetaManagedAgentsModelRateLimitedError:`

        The model request was rate-limited.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_rate_limited_error"ModelRateLimitedError`

      - `class BetaManagedAgentsModelRequestFailedError:`

        A model request failed for a reason other than overload or rate-limiting.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_request_failed_error"ModelRequestFailedError`

      - `class BetaManagedAgentsMcpConnectionFailedError:`

        Failed to connect to an MCP server.

        - `required string McpServerName`

          Name of the MCP server that failed to connect.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"mcp_connection_failed_error"McpConnectionFailedError`

      - `class BetaManagedAgentsMcpAuthenticationFailedError:`

        Authentication to an MCP server failed.

        - `required string McpServerName`

          Name of the MCP server that failed authentication.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"mcp_authentication_failed_error"McpAuthenticationFailedError`

      - `class BetaManagedAgentsBillingError:`

        The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"billing_error"BillingError`

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.error"SessionError`

  - `class BetaManagedAgentsSessionStatusRescheduledEvent:`

    Indicates the session is recovering from an error state and is rescheduled for execution.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_rescheduled"SessionStatusRescheduled`

  - `class BetaManagedAgentsSessionStatusRunningEvent:`

    Indicates the session is actively running and the agent is working.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_running"SessionStatusRunning`

  - `class BetaManagedAgentsSessionStatusIdleEvent:`

    Indicates the agent has paused and is awaiting user input.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required StopReason StopReason`

      The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionEndTurn:`

        The agent completed its turn naturally and is ready for the next user message.

        - `required Type Type`

          - `"end_turn"EndTurn`

      - `class BetaManagedAgentsSessionRequiresAction:`

        The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

        - `required IReadOnlyList<string> EventIds`

          The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder.

        - `required Type Type`

          - `"requires_action"RequiresAction`

      - `class BetaManagedAgentsSessionRetriesExhausted:`

        The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

        - `required Type Type`

          - `"retries_exhausted"RetriesExhausted`

    - `required Type Type`

      - `"session.status_idle"SessionStatusIdle`

  - `class BetaManagedAgentsSessionStatusTerminatedEvent:`

    Indicates the session has terminated, either due to an error or completion.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_terminated"SessionStatusTerminated`

  - `class BetaManagedAgentsSessionThreadCreatedEvent:`

    Emitted when a subagent is spawned as a new thread. Written to the parent thread's output stream so clients observing the session see child creation.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the callable agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public `sthr_` ID of the newly created thread.

    - `required Type Type`

      - `"session.thread_created"SessionThreadCreated`

  - `class BetaManagedAgentsSpanOutcomeEvaluationStartEvent:`

    Emitted when an outcome evaluation cycle begins.

    - `required string ID`

      Unique identifier for this event.

    - `required Int Iteration`

      0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.outcome_evaluation_start"SpanOutcomeEvaluationStart`

  - `class BetaManagedAgentsSpanOutcomeEvaluationEndEvent:`

    Emitted when an outcome evaluation cycle completes. Carries the verdict and aggregate token usage. A verdict of `needs_revision` means another evaluation cycle follows; `satisfied`, `max_iterations_reached`, `failed`, or `interrupted` are terminal — no further evaluation cycles follow.

    - `required string ID`

      Unique identifier for this event.

    - `required string Explanation`

      Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why.

    - `required Int Iteration`

      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

    - `required string OutcomeEvaluationStartID`

      The id of the corresponding `span.outcome_evaluation_start` event.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string Result`

      Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress.

    - `required Type Type`

      - `"span.outcome_evaluation_end"SpanOutcomeEvaluationEnd`

    - `required BetaManagedAgentsSpanModelUsage Usage`

      Token usage for a single model request.

      - `required Int CacheCreationInputTokens`

        Tokens used to create prompt cache in this request.

      - `required Int CacheReadInputTokens`

        Tokens read from prompt cache in this request.

      - `required Int InputTokens`

        Input tokens consumed by this request.

      - `required Int OutputTokens`

        Output tokens generated by this request.

      - `Speed? Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

  - `class BetaManagedAgentsSpanModelRequestStartEvent:`

    Emitted when a model request is initiated by the agent.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.model_request_start"SpanModelRequestStart`

  - `class BetaManagedAgentsSpanModelRequestEndEvent:`

    Emitted when a model request completes.

    - `required string ID`

      Unique identifier for this event.

    - `required Boolean? IsError`

      Whether the model request resulted in an error.

    - `required string ModelRequestStartID`

      The id of the corresponding `span.model_request_start` event.

    - `required BetaManagedAgentsSpanModelUsage ModelUsage`

      Token usage for a single model request.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.model_request_end"SpanModelRequestEnd`

  - `class BetaManagedAgentsSpanOutcomeEvaluationOngoingEvent:`

    Periodic heartbeat emitted while an outcome evaluation cycle is in progress. Distinguishes 'evaluation is actively running' from 'evaluation is stuck' between the corresponding `span.outcome_evaluation_start` and `span.outcome_evaluation_end` events.

    - `required string ID`

      Unique identifier for this event.

    - `required Int Iteration`

      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.outcome_evaluation_ongoing"SpanOutcomeEvaluationOngoing`

  - `class BetaManagedAgentsUserDefineOutcomeEvent:`

    Echo of a `user.define_outcome` input event. Carries the server-generated `outcome_id` that subsequent `span.outcome_evaluation_*` events reference.

    - `required string ID`

      Unique identifier for this event.

    - `required string Description`

      What the agent should produce. Copied from the input event.

    - `required Int? MaxIterations`

      Evaluate-then-revise cycles before giving up. Default 3, max 20.

    - `required string OutcomeID`

      Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Rubric Rubric`

      Rubric for grading the quality of an outcome.

      - `class BetaManagedAgentsFileRubric:`

        Rubric referenced by a file uploaded via the Files API.

        - `required string FileID`

          ID of the rubric file.

        - `required Type Type`

          - `"file"File`

      - `class BetaManagedAgentsTextRubric:`

        Rubric content provided inline as text.

        - `required string Content`

          Rubric content. Plain text or markdown — the grader treats it as freeform text.

        - `required Type Type`

          - `"text"Text`

    - `required Type Type`

      - `"user.define_outcome"UserDefineOutcome`

  - `class BetaManagedAgentsSessionDeletedEvent:`

    Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.deleted"SessionDeleted`

  - `class BetaManagedAgentsSessionThreadStatusRunningEvent:`

    A session thread has begun executing. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that started running.

    - `required Type Type`

      - `"session.thread_status_running"SessionThreadStatusRunning`

  - `class BetaManagedAgentsSessionThreadStatusIdleEvent:`

    A session thread has yielded and is awaiting input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that went idle.

    - `required StopReason StopReason`

      The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionEndTurn:`

        The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionRequiresAction:`

        The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

      - `class BetaManagedAgentsSessionRetriesExhausted:`

        The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

    - `required Type Type`

      - `"session.thread_status_idle"SessionThreadStatusIdle`

  - `class BetaManagedAgentsSessionThreadStatusTerminatedEvent:`

    A session thread has terminated and will accept no further input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that terminated.

    - `required Type Type`

      - `"session.thread_status_terminated"SessionThreadStatusTerminated`

  - `class BetaManagedAgentsUserToolResultEvent:`

    Event sent by the client providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.

    - `required string ID`

      Unique identifier for this event.

    - `required string ToolUseID`

      The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.tool_result"UserToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`.

  - `class BetaManagedAgentsSessionThreadStatusRescheduledEvent:`

    A session thread hit a transient error and is retrying automatically. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that is retrying.

    - `required Type Type`

      - `"session.thread_status_rescheduled"SessionThreadStatusRescheduled`

  - `class BetaManagedAgentsSessionUpdatedEvent:`

    Emitted when an UpdateSession request changed at least one field. Carries only the fields that changed; absent fields were not part of the update. The new configuration applies from the next turn.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.updated"SessionUpdated`

    - `BetaManagedAgentsSessionAgent? Agent`

      Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

      - `required string ID`

      - `required string? Description`

      - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

        - `required string Name`

        - `required Type Type`

          - `"url"Url`

        - `required string Url`

      - `required BetaManagedAgentsModelConfig Model`

        Model identifier and configuration.

        - `required BetaManagedAgentsModel ID`

          The model that will power your agent.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `"claude-opus-4-8"ClaudeOpus4_8`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-7"ClaudeOpus4_7`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-6"ClaudeOpus4_6`

            Most intelligent model for building agents and coding

          - `"claude-sonnet-4-6"ClaudeSonnet4_6`

            Best combination of speed and intelligence

          - `"claude-haiku-4-5"ClaudeHaiku4_5`

            Fastest model with near-frontier intelligence

          - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

            Fastest model with near-frontier intelligence

          - `"claude-opus-4-5"ClaudeOpus4_5`

            Premium model combining maximum intelligence with practical performance

          - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

            Premium model combining maximum intelligence with practical performance

          - `"claude-sonnet-4-5"ClaudeSonnet4_5`

            High-performance model for agents and coding

          - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

            High-performance model for agents and coding

        - `Speed Speed`

          Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

          - `"standard"Standard`

          - `"fast"Fast`

      - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

        Resolved coordinator topology with full agent definitions for each roster member.

        - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

          Full `agent` definitions the coordinator may spawn as session threads.

          - `required string ID`

          - `required string? Description`

          - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

            - `required string Name`

            - `required Type Type`

            - `required string Url`

          - `required BetaManagedAgentsModelConfig Model`

            Model identifier and configuration.

          - `required string Name`

          - `required IReadOnlyList<Skill> Skills`

            - `class BetaManagedAgentsAnthropicSkill:`

              A resolved Anthropic-managed skill.

              - `required string SkillID`

              - `required Type Type`

                - `"anthropic"Anthropic`

              - `required string Version`

            - `class BetaManagedAgentsCustomSkill:`

              A resolved user-created custom skill.

              - `required string SkillID`

              - `required Type Type`

                - `"custom"Custom`

              - `required string Version`

          - `required string? System`

          - `required IReadOnlyList<Tool> Tools`

            - `class BetaManagedAgentsAgentToolset20260401:`

              - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

                - `required Boolean Enabled`

                - `required Name Name`

                  Built-in agent tool identifier.

                  - `"bash"Bash`

                  - `"edit"Edit`

                  - `"read"Read`

                  - `"write"Write`

                  - `"glob"Glob`

                  - `"grep"Grep`

                  - `"web_fetch"WebFetch`

                  - `"web_search"WebSearch`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                    - `required Type Type`

                      - `"always_allow"AlwaysAllow`

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

                    - `required Type Type`

                      - `"always_ask"AlwaysAsk`

              - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

                Resolved default configuration for agent tools.

                - `required Boolean Enabled`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required Type Type`

                - `"agent_toolset_20260401"AgentToolset20260401`

            - `class BetaManagedAgentsMcpToolset:`

              - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

                - `required Boolean Enabled`

                - `required string Name`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

                Resolved default configuration for all tools from an MCP server.

                - `required Boolean Enabled`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required string McpServerName`

              - `required Type Type`

                - `"mcp_toolset"McpToolset`

            - `class BetaManagedAgentsCustomTool:`

              A custom tool as returned in API responses.

              - `required string Description`

              - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

                JSON Schema for custom tool input parameters.

                - `IReadOnlyDictionary<string, JsonElement>? Properties`

                  JSON Schema properties defining the tool's input parameters.

                - `IReadOnlyList<string> Required`

                  List of required property names.

                - `Type Type`

                  Must be 'object' for tool input schemas.

                  - `"object"Object`

              - `required string Name`

              - `required Type Type`

                - `"custom"Custom`

          - `required Type Type`

            - `"agent"Agent`

          - `required Int Version`

        - `required Type Type`

          - `"coordinator"Coordinator`

      - `required string Name`

      - `required IReadOnlyList<Skill> Skills`

        - `class BetaManagedAgentsAnthropicSkill:`

          A resolved Anthropic-managed skill.

        - `class BetaManagedAgentsCustomSkill:`

          A resolved user-created custom skill.

      - `required string? System`

      - `required IReadOnlyList<Tool> Tools`

        - `class BetaManagedAgentsAgentToolset20260401:`

        - `class BetaManagedAgentsMcpToolset:`

        - `class BetaManagedAgentsCustomTool:`

          A custom tool as returned in API responses.

      - `required Type Type`

        - `"agent"Agent`

      - `required Int Version`

    - `IReadOnlyDictionary<string, string> Metadata`

      The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty.

    - `string? Title`

      The session's new title. Present only when the update changed it.

# Events

## List Session Thread Events

`EventListPageResponse Beta.Sessions.Threads.Events.List(EventListParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/sessions/{session_id}/threads/{thread_id}/events`

List Session Thread Events

### Parameters

- `EventListParams parameters`

  - `required string sessionID`

    Path param: Path parameter session_id

  - `required string threadID`

    Path param: Path parameter thread_id

  - `Int limit`

    Query param: Query parameter for limit

  - `string page`

    Query param: Query parameter for page

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class EventListPageResponse:`

  Paginated list of events for a single thread within a `session`.

  - `IReadOnlyList<BetaManagedAgentsSessionEvent> Data`

    Events for the thread, ordered by `created_at`.

    - `class BetaManagedAgentsUserMessageEvent:`

      A user message event in the session conversation.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyList<Content> Content`

        Array of content blocks comprising the user message.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

          - `required string Text`

            The text content.

          - `required Type Type`

            - `"text"Text`

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

          - `required Source Source`

            Union type for image source variants.

            - `class BetaManagedAgentsBase64ImageSource:`

              Base64-encoded image data.

              - `required string Data`

                Base64-encoded image data.

              - `required string MediaType`

                MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

              - `required Type Type`

                - `"base64"Base64`

            - `class BetaManagedAgentsUrlImageSource:`

              Image referenced by URL.

              - `required Type Type`

                - `"url"Url`

              - `required string Url`

                URL of the image to fetch.

            - `class BetaManagedAgentsFileImageSource:`

              Image referenced by file ID.

              - `required string FileID`

                ID of a previously uploaded file.

              - `required Type Type`

                - `"file"File`

          - `required Type Type`

            - `"image"Image`

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

          - `required Source Source`

            Union type for document source variants.

            - `class BetaManagedAgentsBase64DocumentSource:`

              Base64-encoded document data.

              - `required string Data`

                Base64-encoded document data.

              - `required string MediaType`

                MIME type of the document (e.g., "application/pdf").

              - `required Type Type`

                - `"base64"Base64`

            - `class BetaManagedAgentsPlainTextDocumentSource:`

              Plain text document content.

              - `required string Data`

                The plain text content.

              - `required MediaType MediaType`

                MIME type of the text content. Must be "text/plain".

                - `"text/plain"TextPlain`

              - `required Type Type`

                - `"text"Text`

            - `class BetaManagedAgentsUrlDocumentSource:`

              Document referenced by URL.

              - `required Type Type`

                - `"url"Url`

              - `required string Url`

                URL of the document to fetch.

            - `class BetaManagedAgentsFileDocumentSource:`

              Document referenced by file ID.

              - `required string FileID`

                ID of a previously uploaded file.

              - `required Type Type`

                - `"file"File`

          - `required Type Type`

            - `"document"Document`

          - `string? Context`

            Additional context about the document for the model.

          - `string? Title`

            The title of the document.

      - `required Type Type`

        - `"user.message"UserMessage`

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

    - `class BetaManagedAgentsUserInterruptEvent:`

      An interrupt event that pauses agent execution and returns control to the user.

      - `required string ID`

        Unique identifier for this event.

      - `required Type Type`

        - `"user.interrupt"UserInterrupt`

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.

    - `class BetaManagedAgentsUserToolConfirmationEvent:`

      A tool confirmation event that approves or denies a pending tool execution.

      - `required string ID`

        Unique identifier for this event.

      - `required Result Result`

        UserToolConfirmationResult enum

        - `"allow"Allow`

        - `"deny"Deny`

      - `required string ToolUseID`

        The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.tool_confirmation"UserToolConfirmation`

      - `string? DenyMessage`

        Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval.

    - `class BetaManagedAgentsUserCustomToolResultEvent:`

      Event sent by the client providing the result of a custom tool execution.

      - `required string ID`

        Unique identifier for this event.

      - `required string CustomToolUseID`

        The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.custom_tool_result"UserCustomToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

          - `required BetaManagedAgentsSearchResultCitations Citations`

            Citation settings for a search result.

            - `required Boolean Enabled`

              Whether citations are enabled for this search result.

          - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

            Array of text content blocks from the search result.

            - `required string Text`

              The text content.

            - `required Type Type`

              - `"text"Text`

          - `required string Source`

            The URL source of the search result.

          - `required string Title`

            The title of the search result.

          - `required Type Type`

            - `"search_result"SearchResult`

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`.

    - `class BetaManagedAgentsAgentCustomToolUseEvent:`

      Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyDictionary<string, JsonElement> Input`

        Input parameters for the tool call.

      - `required string Name`

        Name of the custom tool being called.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.custom_tool_use"AgentCustomToolUse`

      - `string? SessionThreadID`

        When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.custom_tool_result` event to route the result back.

    - `class BetaManagedAgentsAgentMessageEvent:`

      An agent response event in the session conversation.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyList<BetaManagedAgentsTextBlock> Content`

        Array of text blocks comprising the agent response.

        - `required string Text`

          The text content.

        - `required Type Type`

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.message"AgentMessage`

    - `class BetaManagedAgentsAgentThinkingEvent:`

      Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.thinking"AgentThinking`

    - `class BetaManagedAgentsAgentMcpToolUseEvent:`

      Event emitted when the agent invokes a tool provided by an MCP server.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyDictionary<string, JsonElement> Input`

        Input parameters for the tool call.

      - `required string McpServerName`

        Name of the MCP server providing the tool.

      - `required string Name`

        Name of the MCP tool being used.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.mcp_tool_use"AgentMcpToolUse`

      - `EvaluatedPermission EvaluatedPermission`

        AgentEvaluatedPermission enum

        - `"allow"Allow`

        - `"ask"Ask`

        - `"deny"Deny`

      - `string? SessionThreadID`

        When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

    - `class BetaManagedAgentsAgentMcpToolResultEvent:`

      Event representing the result of an MCP tool execution.

      - `required string ID`

        Unique identifier for this event.

      - `required string McpToolUseID`

        The id of the `agent.mcp_tool_use` event this result corresponds to.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.mcp_tool_result"AgentMcpToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

    - `class BetaManagedAgentsAgentToolUseEvent:`

      Event emitted when the agent invokes a built-in agent tool.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyDictionary<string, JsonElement> Input`

        Input parameters for the tool call.

      - `required string Name`

        Name of the agent tool being used.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.tool_use"AgentToolUse`

      - `EvaluatedPermission EvaluatedPermission`

        AgentEvaluatedPermission enum

        - `"allow"Allow`

        - `"ask"Ask`

        - `"deny"Deny`

      - `string? SessionThreadID`

        When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

    - `class BetaManagedAgentsAgentToolResultEvent:`

      Event representing the result of an agent tool execution.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string ToolUseID`

        The id of the `agent.tool_use` event this result corresponds to.

      - `required Type Type`

        - `"agent.tool_result"AgentToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

    - `class BetaManagedAgentsAgentThreadMessageReceivedEvent:`

      Delivery event written to the target thread's input stream when an agent-to-agent message arrives.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyList<Content> Content`

        Message content blocks.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required string FromSessionThreadID`

        Public `sthr_` ID of the thread that sent the message.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.thread_message_received"AgentThreadMessageReceived`

      - `string? FromAgentName`

        Name of the callable agent this message came from. Absent when received from the primary agent.

    - `class BetaManagedAgentsAgentThreadMessageSentEvent:`

      Observability event emitted to the sender's output stream when an agent-to-agent message is sent.

      - `required string ID`

        Unique identifier for this event.

      - `required IReadOnlyList<Content> Content`

        Message content blocks.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string ToSessionThreadID`

        Public `sthr_` ID of the thread the message was sent to.

      - `required Type Type`

        - `"agent.thread_message_sent"AgentThreadMessageSent`

      - `string? ToAgentName`

        Name of the callable agent this message was sent to. Absent when sent to the primary agent.

    - `class BetaManagedAgentsAgentThreadContextCompactedEvent:`

      Indicates that context compaction (summarization) occurred during the session.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"agent.thread_context_compacted"AgentThreadContextCompacted`

    - `class BetaManagedAgentsSessionErrorEvent:`

      An error event indicating a problem occurred during session execution.

      - `required string ID`

        Unique identifier for this event.

      - `required Error Error`

        An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

        - `class BetaManagedAgentsUnknownError:`

          An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

              - `required Type Type`

                - `"retrying"Retrying`

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

              - `required Type Type`

                - `"exhausted"Exhausted`

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

              - `required Type Type`

                - `"terminal"Terminal`

          - `required Type Type`

            - `"unknown_error"UnknownError`

        - `class BetaManagedAgentsModelOverloadedError:`

          The model is currently overloaded. Emitted after automatic retries are exhausted.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

          - `required Type Type`

            - `"model_overloaded_error"ModelOverloadedError`

        - `class BetaManagedAgentsModelRateLimitedError:`

          The model request was rate-limited.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

          - `required Type Type`

            - `"model_rate_limited_error"ModelRateLimitedError`

        - `class BetaManagedAgentsModelRequestFailedError:`

          A model request failed for a reason other than overload or rate-limiting.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

          - `required Type Type`

            - `"model_request_failed_error"ModelRequestFailedError`

        - `class BetaManagedAgentsMcpConnectionFailedError:`

          Failed to connect to an MCP server.

          - `required string McpServerName`

            Name of the MCP server that failed to connect.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

          - `required Type Type`

            - `"mcp_connection_failed_error"McpConnectionFailedError`

        - `class BetaManagedAgentsMcpAuthenticationFailedError:`

          Authentication to an MCP server failed.

          - `required string McpServerName`

            Name of the MCP server that failed authentication.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

          - `required Type Type`

            - `"mcp_authentication_failed_error"McpAuthenticationFailedError`

        - `class BetaManagedAgentsBillingError:`

          The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state.

          - `required string Message`

            Human-readable error description.

          - `required RetryStatus RetryStatus`

            What the client should do next in response to this error.

            - `class BetaManagedAgentsRetryStatusRetrying:`

              The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `class BetaManagedAgentsRetryStatusExhausted:`

              This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `class BetaManagedAgentsRetryStatusTerminal:`

              The session encountered a terminal error and will transition to `terminated` state.

          - `required Type Type`

            - `"billing_error"BillingError`

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"session.error"SessionError`

    - `class BetaManagedAgentsSessionStatusRescheduledEvent:`

      Indicates the session is recovering from an error state and is rescheduled for execution.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"session.status_rescheduled"SessionStatusRescheduled`

    - `class BetaManagedAgentsSessionStatusRunningEvent:`

      Indicates the session is actively running and the agent is working.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"session.status_running"SessionStatusRunning`

    - `class BetaManagedAgentsSessionStatusIdleEvent:`

      Indicates the agent has paused and is awaiting user input.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required StopReason StopReason`

        The agent completed its turn naturally and is ready for the next user message.

        - `class BetaManagedAgentsSessionEndTurn:`

          The agent completed its turn naturally and is ready for the next user message.

          - `required Type Type`

            - `"end_turn"EndTurn`

        - `class BetaManagedAgentsSessionRequiresAction:`

          The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

          - `required IReadOnlyList<string> EventIds`

            The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder.

          - `required Type Type`

            - `"requires_action"RequiresAction`

        - `class BetaManagedAgentsSessionRetriesExhausted:`

          The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

          - `required Type Type`

            - `"retries_exhausted"RetriesExhausted`

      - `required Type Type`

        - `"session.status_idle"SessionStatusIdle`

    - `class BetaManagedAgentsSessionStatusTerminatedEvent:`

      Indicates the session has terminated, either due to an error or completion.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"session.status_terminated"SessionStatusTerminated`

    - `class BetaManagedAgentsSessionThreadCreatedEvent:`

      Emitted when a subagent is spawned as a new thread. Written to the parent thread's output stream so clients observing the session see child creation.

      - `required string ID`

        Unique identifier for this event.

      - `required string AgentName`

        Name of the callable agent the thread runs.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string SessionThreadID`

        Public `sthr_` ID of the newly created thread.

      - `required Type Type`

        - `"session.thread_created"SessionThreadCreated`

    - `class BetaManagedAgentsSpanOutcomeEvaluationStartEvent:`

      Emitted when an outcome evaluation cycle begins.

      - `required string ID`

        Unique identifier for this event.

      - `required Int Iteration`

        0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.

      - `required string OutcomeID`

        The `outc_` ID of the outcome being evaluated.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"span.outcome_evaluation_start"SpanOutcomeEvaluationStart`

    - `class BetaManagedAgentsSpanOutcomeEvaluationEndEvent:`

      Emitted when an outcome evaluation cycle completes. Carries the verdict and aggregate token usage. A verdict of `needs_revision` means another evaluation cycle follows; `satisfied`, `max_iterations_reached`, `failed`, or `interrupted` are terminal — no further evaluation cycles follow.

      - `required string ID`

        Unique identifier for this event.

      - `required string Explanation`

        Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why.

      - `required Int Iteration`

        0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

      - `required string OutcomeEvaluationStartID`

        The id of the corresponding `span.outcome_evaluation_start` event.

      - `required string OutcomeID`

        The `outc_` ID of the outcome being evaluated.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string Result`

        Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress.

      - `required Type Type`

        - `"span.outcome_evaluation_end"SpanOutcomeEvaluationEnd`

      - `required BetaManagedAgentsSpanModelUsage Usage`

        Token usage for a single model request.

        - `required Int CacheCreationInputTokens`

          Tokens used to create prompt cache in this request.

        - `required Int CacheReadInputTokens`

          Tokens read from prompt cache in this request.

        - `required Int InputTokens`

          Input tokens consumed by this request.

        - `required Int OutputTokens`

          Output tokens generated by this request.

        - `Speed? Speed`

          Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

          - `"standard"Standard`

          - `"fast"Fast`

    - `class BetaManagedAgentsSpanModelRequestStartEvent:`

      Emitted when a model request is initiated by the agent.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"span.model_request_start"SpanModelRequestStart`

    - `class BetaManagedAgentsSpanModelRequestEndEvent:`

      Emitted when a model request completes.

      - `required string ID`

        Unique identifier for this event.

      - `required Boolean? IsError`

        Whether the model request resulted in an error.

      - `required string ModelRequestStartID`

        The id of the corresponding `span.model_request_start` event.

      - `required BetaManagedAgentsSpanModelUsage ModelUsage`

        Token usage for a single model request.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"span.model_request_end"SpanModelRequestEnd`

    - `class BetaManagedAgentsSpanOutcomeEvaluationOngoingEvent:`

      Periodic heartbeat emitted while an outcome evaluation cycle is in progress. Distinguishes 'evaluation is actively running' from 'evaluation is stuck' between the corresponding `span.outcome_evaluation_start` and `span.outcome_evaluation_end` events.

      - `required string ID`

        Unique identifier for this event.

      - `required Int Iteration`

        0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

      - `required string OutcomeID`

        The `outc_` ID of the outcome being evaluated.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"span.outcome_evaluation_ongoing"SpanOutcomeEvaluationOngoing`

    - `class BetaManagedAgentsUserDefineOutcomeEvent:`

      Echo of a `user.define_outcome` input event. Carries the server-generated `outcome_id` that subsequent `span.outcome_evaluation_*` events reference.

      - `required string ID`

        Unique identifier for this event.

      - `required string Description`

        What the agent should produce. Copied from the input event.

      - `required Int? MaxIterations`

        Evaluate-then-revise cycles before giving up. Default 3, max 20.

      - `required string OutcomeID`

        Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Rubric Rubric`

        Rubric for grading the quality of an outcome.

        - `class BetaManagedAgentsFileRubric:`

          Rubric referenced by a file uploaded via the Files API.

          - `required string FileID`

            ID of the rubric file.

          - `required Type Type`

            - `"file"File`

        - `class BetaManagedAgentsTextRubric:`

          Rubric content provided inline as text.

          - `required string Content`

            Rubric content. Plain text or markdown — the grader treats it as freeform text.

          - `required Type Type`

            - `"text"Text`

      - `required Type Type`

        - `"user.define_outcome"UserDefineOutcome`

    - `class BetaManagedAgentsSessionDeletedEvent:`

      Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"session.deleted"SessionDeleted`

    - `class BetaManagedAgentsSessionThreadStatusRunningEvent:`

      A session thread has begun executing. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

      - `required string ID`

        Unique identifier for this event.

      - `required string AgentName`

        Name of the agent the thread runs.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string SessionThreadID`

        Public sthr_ ID of the thread that started running.

      - `required Type Type`

        - `"session.thread_status_running"SessionThreadStatusRunning`

    - `class BetaManagedAgentsSessionThreadStatusIdleEvent:`

      A session thread has yielded and is awaiting input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

      - `required string ID`

        Unique identifier for this event.

      - `required string AgentName`

        Name of the agent the thread runs.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string SessionThreadID`

        Public sthr_ ID of the thread that went idle.

      - `required StopReason StopReason`

        The agent completed its turn naturally and is ready for the next user message.

        - `class BetaManagedAgentsSessionEndTurn:`

          The agent completed its turn naturally and is ready for the next user message.

        - `class BetaManagedAgentsSessionRequiresAction:`

          The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

        - `class BetaManagedAgentsSessionRetriesExhausted:`

          The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

      - `required Type Type`

        - `"session.thread_status_idle"SessionThreadStatusIdle`

    - `class BetaManagedAgentsSessionThreadStatusTerminatedEvent:`

      A session thread has terminated and will accept no further input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

      - `required string ID`

        Unique identifier for this event.

      - `required string AgentName`

        Name of the agent the thread runs.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string SessionThreadID`

        Public sthr_ ID of the thread that terminated.

      - `required Type Type`

        - `"session.thread_status_terminated"SessionThreadStatusTerminated`

    - `class BetaManagedAgentsUserToolResultEvent:`

      Event sent by the client providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.

      - `required string ID`

        Unique identifier for this event.

      - `required string ToolUseID`

        The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

      - `required Type Type`

        - `"user.tool_result"UserToolResult`

      - `IReadOnlyList<Content> Content`

        The result content returned by the tool.

        - `class BetaManagedAgentsTextBlock:`

          Regular text content.

        - `class BetaManagedAgentsImageBlock:`

          Image content specified directly as base64 data or as a reference via a URL.

        - `class BetaManagedAgentsDocumentBlock:`

          Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `class BetaManagedAgentsSearchResultBlock:`

          A block containing a web search result.

      - `Boolean? IsError`

        Whether the tool execution resulted in an error.

      - `DateTimeOffset? ProcessedAt`

        A timestamp in RFC 3339 format

      - `string? SessionThreadID`

        Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`.

    - `class BetaManagedAgentsSessionThreadStatusRescheduledEvent:`

      A session thread hit a transient error and is retrying automatically. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

      - `required string ID`

        Unique identifier for this event.

      - `required string AgentName`

        Name of the agent the thread runs.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required string SessionThreadID`

        Public sthr_ ID of the thread that is retrying.

      - `required Type Type`

        - `"session.thread_status_rescheduled"SessionThreadStatusRescheduled`

    - `class BetaManagedAgentsSessionUpdatedEvent:`

      Emitted when an UpdateSession request changed at least one field. Carries only the fields that changed; absent fields were not part of the update. The new configuration applies from the next turn.

      - `required string ID`

        Unique identifier for this event.

      - `required DateTimeOffset ProcessedAt`

        A timestamp in RFC 3339 format

      - `required Type Type`

        - `"session.updated"SessionUpdated`

      - `BetaManagedAgentsSessionAgent? Agent`

        Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

        - `required string ID`

        - `required string? Description`

        - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

          - `required string Name`

          - `required Type Type`

            - `"url"Url`

          - `required string Url`

        - `required BetaManagedAgentsModelConfig Model`

          Model identifier and configuration.

          - `required BetaManagedAgentsModel ID`

            The model that will power your agent.

            See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

            - `"claude-opus-4-8"ClaudeOpus4_8`

              Frontier intelligence for long-running agents and coding

            - `"claude-opus-4-7"ClaudeOpus4_7`

              Frontier intelligence for long-running agents and coding

            - `"claude-opus-4-6"ClaudeOpus4_6`

              Most intelligent model for building agents and coding

            - `"claude-sonnet-4-6"ClaudeSonnet4_6`

              Best combination of speed and intelligence

            - `"claude-haiku-4-5"ClaudeHaiku4_5`

              Fastest model with near-frontier intelligence

            - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

              Fastest model with near-frontier intelligence

            - `"claude-opus-4-5"ClaudeOpus4_5`

              Premium model combining maximum intelligence with practical performance

            - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

              Premium model combining maximum intelligence with practical performance

            - `"claude-sonnet-4-5"ClaudeSonnet4_5`

              High-performance model for agents and coding

            - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

              High-performance model for agents and coding

          - `Speed Speed`

            Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

            - `"standard"Standard`

            - `"fast"Fast`

        - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

          Resolved coordinator topology with full agent definitions for each roster member.

          - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

            Full `agent` definitions the coordinator may spawn as session threads.

            - `required string ID`

            - `required string? Description`

            - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

              - `required string Name`

              - `required Type Type`

              - `required string Url`

            - `required BetaManagedAgentsModelConfig Model`

              Model identifier and configuration.

            - `required string Name`

            - `required IReadOnlyList<Skill> Skills`

              - `class BetaManagedAgentsAnthropicSkill:`

                A resolved Anthropic-managed skill.

                - `required string SkillID`

                - `required Type Type`

                  - `"anthropic"Anthropic`

                - `required string Version`

              - `class BetaManagedAgentsCustomSkill:`

                A resolved user-created custom skill.

                - `required string SkillID`

                - `required Type Type`

                  - `"custom"Custom`

                - `required string Version`

            - `required string? System`

            - `required IReadOnlyList<Tool> Tools`

              - `class BetaManagedAgentsAgentToolset20260401:`

                - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

                  - `required Boolean Enabled`

                  - `required Name Name`

                    Built-in agent tool identifier.

                    - `"bash"Bash`

                    - `"edit"Edit`

                    - `"read"Read`

                    - `"write"Write`

                    - `"glob"Glob`

                    - `"grep"Grep`

                    - `"web_fetch"WebFetch`

                    - `"web_search"WebSearch`

                  - `required PermissionPolicy PermissionPolicy`

                    Permission policy for tool execution.

                    - `class BetaManagedAgentsAlwaysAllowPolicy:`

                      Tool calls are automatically approved without user confirmation.

                      - `required Type Type`

                        - `"always_allow"AlwaysAllow`

                    - `class BetaManagedAgentsAlwaysAskPolicy:`

                      Tool calls require user confirmation before execution.

                      - `required Type Type`

                        - `"always_ask"AlwaysAsk`

                - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

                  Resolved default configuration for agent tools.

                  - `required Boolean Enabled`

                  - `required PermissionPolicy PermissionPolicy`

                    Permission policy for tool execution.

                    - `class BetaManagedAgentsAlwaysAllowPolicy:`

                      Tool calls are automatically approved without user confirmation.

                    - `class BetaManagedAgentsAlwaysAskPolicy:`

                      Tool calls require user confirmation before execution.

                - `required Type Type`

                  - `"agent_toolset_20260401"AgentToolset20260401`

              - `class BetaManagedAgentsMcpToolset:`

                - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

                  - `required Boolean Enabled`

                  - `required string Name`

                  - `required PermissionPolicy PermissionPolicy`

                    Permission policy for tool execution.

                    - `class BetaManagedAgentsAlwaysAllowPolicy:`

                      Tool calls are automatically approved without user confirmation.

                    - `class BetaManagedAgentsAlwaysAskPolicy:`

                      Tool calls require user confirmation before execution.

                - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

                  Resolved default configuration for all tools from an MCP server.

                  - `required Boolean Enabled`

                  - `required PermissionPolicy PermissionPolicy`

                    Permission policy for tool execution.

                    - `class BetaManagedAgentsAlwaysAllowPolicy:`

                      Tool calls are automatically approved without user confirmation.

                    - `class BetaManagedAgentsAlwaysAskPolicy:`

                      Tool calls require user confirmation before execution.

                - `required string McpServerName`

                - `required Type Type`

                  - `"mcp_toolset"McpToolset`

              - `class BetaManagedAgentsCustomTool:`

                A custom tool as returned in API responses.

                - `required string Description`

                - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

                  JSON Schema for custom tool input parameters.

                  - `IReadOnlyDictionary<string, JsonElement>? Properties`

                    JSON Schema properties defining the tool's input parameters.

                  - `IReadOnlyList<string> Required`

                    List of required property names.

                  - `Type Type`

                    Must be 'object' for tool input schemas.

                    - `"object"Object`

                - `required string Name`

                - `required Type Type`

                  - `"custom"Custom`

            - `required Type Type`

              - `"agent"Agent`

            - `required Int Version`

          - `required Type Type`

            - `"coordinator"Coordinator`

        - `required string Name`

        - `required IReadOnlyList<Skill> Skills`

          - `class BetaManagedAgentsAnthropicSkill:`

            A resolved Anthropic-managed skill.

          - `class BetaManagedAgentsCustomSkill:`

            A resolved user-created custom skill.

        - `required string? System`

        - `required IReadOnlyList<Tool> Tools`

          - `class BetaManagedAgentsAgentToolset20260401:`

          - `class BetaManagedAgentsMcpToolset:`

          - `class BetaManagedAgentsCustomTool:`

            A custom tool as returned in API responses.

        - `required Type Type`

          - `"agent"Agent`

        - `required Int Version`

      - `IReadOnlyDictionary<string, string> Metadata`

        The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty.

      - `string? Title`

        The session's new title. Present only when the update changed it.

  - `string? NextPage`

    Opaque cursor for the next page. Null when no more results.

### Example

```csharp
EventListParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7",
    ThreadID = "sthr_011CZkZVWa6oIjw0rgXZpnBt",
};

var page = await client.Beta.Sessions.Threads.Events.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "sevt_011CZkZGOp0iBcp4kaQSihUmy",
      "content": [
        {
          "text": "Where is my order #1234?",
          "type": "text"
        }
      ],
      "type": "user.message",
      "processed_at": "2026-03-15T10:00:00Z"
    }
  ],
  "next_page": "next_page"
}
```

## Stream Session Thread Events

`BetaManagedAgentsStreamSessionThreadEvents Beta.Sessions.Threads.Events.StreamStreaming(EventStreamParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/sessions/{session_id}/threads/{thread_id}/stream`

Stream Session Thread Events

### Parameters

- `EventStreamParams parameters`

  - `required string sessionID`

    Path param: Path parameter session_id

  - `required string threadID`

    Path param: Path parameter thread_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsStreamSessionThreadEvents: A class that can be one of several variants.union`

  Server-sent event in a single thread's stream.

  - `class BetaManagedAgentsUserMessageEvent:`

    A user message event in the session conversation.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Array of content blocks comprising the user message.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

        - `required string Text`

          The text content.

        - `required Type Type`

          - `"text"Text`

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

        - `required Source Source`

          Union type for image source variants.

          - `class BetaManagedAgentsBase64ImageSource:`

            Base64-encoded image data.

            - `required string Data`

              Base64-encoded image data.

            - `required string MediaType`

              MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

            - `required Type Type`

              - `"base64"Base64`

          - `class BetaManagedAgentsUrlImageSource:`

            Image referenced by URL.

            - `required Type Type`

              - `"url"Url`

            - `required string Url`

              URL of the image to fetch.

          - `class BetaManagedAgentsFileImageSource:`

            Image referenced by file ID.

            - `required string FileID`

              ID of a previously uploaded file.

            - `required Type Type`

              - `"file"File`

        - `required Type Type`

          - `"image"Image`

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

        - `required Source Source`

          Union type for document source variants.

          - `class BetaManagedAgentsBase64DocumentSource:`

            Base64-encoded document data.

            - `required string Data`

              Base64-encoded document data.

            - `required string MediaType`

              MIME type of the document (e.g., "application/pdf").

            - `required Type Type`

              - `"base64"Base64`

          - `class BetaManagedAgentsPlainTextDocumentSource:`

            Plain text document content.

            - `required string Data`

              The plain text content.

            - `required MediaType MediaType`

              MIME type of the text content. Must be "text/plain".

              - `"text/plain"TextPlain`

            - `required Type Type`

              - `"text"Text`

          - `class BetaManagedAgentsUrlDocumentSource:`

            Document referenced by URL.

            - `required Type Type`

              - `"url"Url`

            - `required string Url`

              URL of the document to fetch.

          - `class BetaManagedAgentsFileDocumentSource:`

            Document referenced by file ID.

            - `required string FileID`

              ID of a previously uploaded file.

            - `required Type Type`

              - `"file"File`

        - `required Type Type`

          - `"document"Document`

        - `string? Context`

          Additional context about the document for the model.

        - `string? Title`

          The title of the document.

    - `required Type Type`

      - `"user.message"UserMessage`

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

  - `class BetaManagedAgentsUserInterruptEvent:`

    An interrupt event that pauses agent execution and returns control to the user.

    - `required string ID`

      Unique identifier for this event.

    - `required Type Type`

      - `"user.interrupt"UserInterrupt`

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.

  - `class BetaManagedAgentsUserToolConfirmationEvent:`

    A tool confirmation event that approves or denies a pending tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required Result Result`

      UserToolConfirmationResult enum

      - `"allow"Allow`

      - `"deny"Deny`

    - `required string ToolUseID`

      The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.tool_confirmation"UserToolConfirmation`

    - `string? DenyMessage`

      Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval.

  - `class BetaManagedAgentsUserCustomToolResultEvent:`

    Event sent by the client providing the result of a custom tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required string CustomToolUseID`

      The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.custom_tool_result"UserCustomToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

        - `required BetaManagedAgentsSearchResultCitations Citations`

          Citation settings for a search result.

          - `required Boolean Enabled`

            Whether citations are enabled for this search result.

        - `required IReadOnlyList<BetaManagedAgentsSearchResultContent> Content`

          Array of text content blocks from the search result.

          - `required string Text`

            The text content.

          - `required Type Type`

            - `"text"Text`

        - `required string Source`

          The URL source of the search result.

        - `required string Title`

          The title of the search result.

        - `required Type Type`

          - `"search_result"SearchResult`

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`.

  - `class BetaManagedAgentsAgentCustomToolUseEvent:`

    Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string Name`

      Name of the custom tool being called.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.custom_tool_use"AgentCustomToolUse`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.custom_tool_result` event to route the result back.

  - `class BetaManagedAgentsAgentMessageEvent:`

    An agent response event in the session conversation.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<BetaManagedAgentsTextBlock> Content`

      Array of text blocks comprising the agent response.

      - `required string Text`

        The text content.

      - `required Type Type`

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.message"AgentMessage`

  - `class BetaManagedAgentsAgentThinkingEvent:`

    Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thinking"AgentThinking`

  - `class BetaManagedAgentsAgentMcpToolUseEvent:`

    Event emitted when the agent invokes a tool provided by an MCP server.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string McpServerName`

      Name of the MCP server providing the tool.

    - `required string Name`

      Name of the MCP tool being used.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.mcp_tool_use"AgentMcpToolUse`

    - `EvaluatedPermission EvaluatedPermission`

      AgentEvaluatedPermission enum

      - `"allow"Allow`

      - `"ask"Ask`

      - `"deny"Deny`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

  - `class BetaManagedAgentsAgentMcpToolResultEvent:`

    Event representing the result of an MCP tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required string McpToolUseID`

      The id of the `agent.mcp_tool_use` event this result corresponds to.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.mcp_tool_result"AgentMcpToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

  - `class BetaManagedAgentsAgentToolUseEvent:`

    Event emitted when the agent invokes a built-in agent tool.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyDictionary<string, JsonElement> Input`

      Input parameters for the tool call.

    - `required string Name`

      Name of the agent tool being used.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.tool_use"AgentToolUse`

    - `EvaluatedPermission EvaluatedPermission`

      AgentEvaluatedPermission enum

      - `"allow"Allow`

      - `"ask"Ask`

      - `"deny"Deny`

    - `string? SessionThreadID`

      When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back.

  - `class BetaManagedAgentsAgentToolResultEvent:`

    Event representing the result of an agent tool execution.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string ToolUseID`

      The id of the `agent.tool_use` event this result corresponds to.

    - `required Type Type`

      - `"agent.tool_result"AgentToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

  - `class BetaManagedAgentsAgentThreadMessageReceivedEvent:`

    Delivery event written to the target thread's input stream when an agent-to-agent message arrives.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Message content blocks.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

    - `required string FromSessionThreadID`

      Public `sthr_` ID of the thread that sent the message.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thread_message_received"AgentThreadMessageReceived`

    - `string? FromAgentName`

      Name of the callable agent this message came from. Absent when received from the primary agent.

  - `class BetaManagedAgentsAgentThreadMessageSentEvent:`

    Observability event emitted to the sender's output stream when an agent-to-agent message is sent.

    - `required string ID`

      Unique identifier for this event.

    - `required IReadOnlyList<Content> Content`

      Message content blocks.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string ToSessionThreadID`

      Public `sthr_` ID of the thread the message was sent to.

    - `required Type Type`

      - `"agent.thread_message_sent"AgentThreadMessageSent`

    - `string? ToAgentName`

      Name of the callable agent this message was sent to. Absent when sent to the primary agent.

  - `class BetaManagedAgentsAgentThreadContextCompactedEvent:`

    Indicates that context compaction (summarization) occurred during the session.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"agent.thread_context_compacted"AgentThreadContextCompacted`

  - `class BetaManagedAgentsSessionErrorEvent:`

    An error event indicating a problem occurred during session execution.

    - `required string ID`

      Unique identifier for this event.

    - `required Error Error`

      An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

      - `class BetaManagedAgentsUnknownError:`

        An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

            - `required Type Type`

              - `"retrying"Retrying`

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

            - `required Type Type`

              - `"exhausted"Exhausted`

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

            - `required Type Type`

              - `"terminal"Terminal`

        - `required Type Type`

          - `"unknown_error"UnknownError`

      - `class BetaManagedAgentsModelOverloadedError:`

        The model is currently overloaded. Emitted after automatic retries are exhausted.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_overloaded_error"ModelOverloadedError`

      - `class BetaManagedAgentsModelRateLimitedError:`

        The model request was rate-limited.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_rate_limited_error"ModelRateLimitedError`

      - `class BetaManagedAgentsModelRequestFailedError:`

        A model request failed for a reason other than overload or rate-limiting.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"model_request_failed_error"ModelRequestFailedError`

      - `class BetaManagedAgentsMcpConnectionFailedError:`

        Failed to connect to an MCP server.

        - `required string McpServerName`

          Name of the MCP server that failed to connect.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"mcp_connection_failed_error"McpConnectionFailedError`

      - `class BetaManagedAgentsMcpAuthenticationFailedError:`

        Authentication to an MCP server failed.

        - `required string McpServerName`

          Name of the MCP server that failed authentication.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"mcp_authentication_failed_error"McpAuthenticationFailedError`

      - `class BetaManagedAgentsBillingError:`

        The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state.

        - `required string Message`

          Human-readable error description.

        - `required RetryStatus RetryStatus`

          What the client should do next in response to this error.

          - `class BetaManagedAgentsRetryStatusRetrying:`

            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.

          - `class BetaManagedAgentsRetryStatusExhausted:`

            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.

          - `class BetaManagedAgentsRetryStatusTerminal:`

            The session encountered a terminal error and will transition to `terminated` state.

        - `required Type Type`

          - `"billing_error"BillingError`

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.error"SessionError`

  - `class BetaManagedAgentsSessionStatusRescheduledEvent:`

    Indicates the session is recovering from an error state and is rescheduled for execution.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_rescheduled"SessionStatusRescheduled`

  - `class BetaManagedAgentsSessionStatusRunningEvent:`

    Indicates the session is actively running and the agent is working.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_running"SessionStatusRunning`

  - `class BetaManagedAgentsSessionStatusIdleEvent:`

    Indicates the agent has paused and is awaiting user input.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required StopReason StopReason`

      The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionEndTurn:`

        The agent completed its turn naturally and is ready for the next user message.

        - `required Type Type`

          - `"end_turn"EndTurn`

      - `class BetaManagedAgentsSessionRequiresAction:`

        The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

        - `required IReadOnlyList<string> EventIds`

          The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder.

        - `required Type Type`

          - `"requires_action"RequiresAction`

      - `class BetaManagedAgentsSessionRetriesExhausted:`

        The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

        - `required Type Type`

          - `"retries_exhausted"RetriesExhausted`

    - `required Type Type`

      - `"session.status_idle"SessionStatusIdle`

  - `class BetaManagedAgentsSessionStatusTerminatedEvent:`

    Indicates the session has terminated, either due to an error or completion.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.status_terminated"SessionStatusTerminated`

  - `class BetaManagedAgentsSessionThreadCreatedEvent:`

    Emitted when a subagent is spawned as a new thread. Written to the parent thread's output stream so clients observing the session see child creation.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the callable agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public `sthr_` ID of the newly created thread.

    - `required Type Type`

      - `"session.thread_created"SessionThreadCreated`

  - `class BetaManagedAgentsSpanOutcomeEvaluationStartEvent:`

    Emitted when an outcome evaluation cycle begins.

    - `required string ID`

      Unique identifier for this event.

    - `required Int Iteration`

      0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.outcome_evaluation_start"SpanOutcomeEvaluationStart`

  - `class BetaManagedAgentsSpanOutcomeEvaluationEndEvent:`

    Emitted when an outcome evaluation cycle completes. Carries the verdict and aggregate token usage. A verdict of `needs_revision` means another evaluation cycle follows; `satisfied`, `max_iterations_reached`, `failed`, or `interrupted` are terminal — no further evaluation cycles follow.

    - `required string ID`

      Unique identifier for this event.

    - `required string Explanation`

      Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why.

    - `required Int Iteration`

      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

    - `required string OutcomeEvaluationStartID`

      The id of the corresponding `span.outcome_evaluation_start` event.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string Result`

      Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress.

    - `required Type Type`

      - `"span.outcome_evaluation_end"SpanOutcomeEvaluationEnd`

    - `required BetaManagedAgentsSpanModelUsage Usage`

      Token usage for a single model request.

      - `required Int CacheCreationInputTokens`

        Tokens used to create prompt cache in this request.

      - `required Int CacheReadInputTokens`

        Tokens read from prompt cache in this request.

      - `required Int InputTokens`

        Input tokens consumed by this request.

      - `required Int OutputTokens`

        Output tokens generated by this request.

      - `Speed? Speed`

        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

        - `"standard"Standard`

        - `"fast"Fast`

  - `class BetaManagedAgentsSpanModelRequestStartEvent:`

    Emitted when a model request is initiated by the agent.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.model_request_start"SpanModelRequestStart`

  - `class BetaManagedAgentsSpanModelRequestEndEvent:`

    Emitted when a model request completes.

    - `required string ID`

      Unique identifier for this event.

    - `required Boolean? IsError`

      Whether the model request resulted in an error.

    - `required string ModelRequestStartID`

      The id of the corresponding `span.model_request_start` event.

    - `required BetaManagedAgentsSpanModelUsage ModelUsage`

      Token usage for a single model request.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.model_request_end"SpanModelRequestEnd`

  - `class BetaManagedAgentsSpanOutcomeEvaluationOngoingEvent:`

    Periodic heartbeat emitted while an outcome evaluation cycle is in progress. Distinguishes 'evaluation is actively running' from 'evaluation is stuck' between the corresponding `span.outcome_evaluation_start` and `span.outcome_evaluation_end` events.

    - `required string ID`

      Unique identifier for this event.

    - `required Int Iteration`

      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

    - `required string OutcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"span.outcome_evaluation_ongoing"SpanOutcomeEvaluationOngoing`

  - `class BetaManagedAgentsUserDefineOutcomeEvent:`

    Echo of a `user.define_outcome` input event. Carries the server-generated `outcome_id` that subsequent `span.outcome_evaluation_*` events reference.

    - `required string ID`

      Unique identifier for this event.

    - `required string Description`

      What the agent should produce. Copied from the input event.

    - `required Int? MaxIterations`

      Evaluate-then-revise cycles before giving up. Default 3, max 20.

    - `required string OutcomeID`

      Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Rubric Rubric`

      Rubric for grading the quality of an outcome.

      - `class BetaManagedAgentsFileRubric:`

        Rubric referenced by a file uploaded via the Files API.

        - `required string FileID`

          ID of the rubric file.

        - `required Type Type`

          - `"file"File`

      - `class BetaManagedAgentsTextRubric:`

        Rubric content provided inline as text.

        - `required string Content`

          Rubric content. Plain text or markdown — the grader treats it as freeform text.

        - `required Type Type`

          - `"text"Text`

    - `required Type Type`

      - `"user.define_outcome"UserDefineOutcome`

  - `class BetaManagedAgentsSessionDeletedEvent:`

    Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.deleted"SessionDeleted`

  - `class BetaManagedAgentsSessionThreadStatusRunningEvent:`

    A session thread has begun executing. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that started running.

    - `required Type Type`

      - `"session.thread_status_running"SessionThreadStatusRunning`

  - `class BetaManagedAgentsSessionThreadStatusIdleEvent:`

    A session thread has yielded and is awaiting input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that went idle.

    - `required StopReason StopReason`

      The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionEndTurn:`

        The agent completed its turn naturally and is ready for the next user message.

      - `class BetaManagedAgentsSessionRequiresAction:`

        The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.

      - `class BetaManagedAgentsSessionRetriesExhausted:`

        The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).

    - `required Type Type`

      - `"session.thread_status_idle"SessionThreadStatusIdle`

  - `class BetaManagedAgentsSessionThreadStatusTerminatedEvent:`

    A session thread has terminated and will accept no further input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that terminated.

    - `required Type Type`

      - `"session.thread_status_terminated"SessionThreadStatusTerminated`

  - `class BetaManagedAgentsUserToolResultEvent:`

    Event sent by the client providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.

    - `required string ID`

      Unique identifier for this event.

    - `required string ToolUseID`

      The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `required Type Type`

      - `"user.tool_result"UserToolResult`

    - `IReadOnlyList<Content> Content`

      The result content returned by the tool.

      - `class BetaManagedAgentsTextBlock:`

        Regular text content.

      - `class BetaManagedAgentsImageBlock:`

        Image content specified directly as base64 data or as a reference via a URL.

      - `class BetaManagedAgentsDocumentBlock:`

        Document content, either specified directly as base64 data, as text, or as a reference via a URL.

      - `class BetaManagedAgentsSearchResultBlock:`

        A block containing a web search result.

    - `Boolean? IsError`

      Whether the tool execution resulted in an error.

    - `DateTimeOffset? ProcessedAt`

      A timestamp in RFC 3339 format

    - `string? SessionThreadID`

      Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`.

  - `class BetaManagedAgentsSessionThreadStatusRescheduledEvent:`

    A session thread hit a transient error and is retrying automatically. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.

    - `required string ID`

      Unique identifier for this event.

    - `required string AgentName`

      Name of the agent the thread runs.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required string SessionThreadID`

      Public sthr_ ID of the thread that is retrying.

    - `required Type Type`

      - `"session.thread_status_rescheduled"SessionThreadStatusRescheduled`

  - `class BetaManagedAgentsSessionUpdatedEvent:`

    Emitted when an UpdateSession request changed at least one field. Carries only the fields that changed; absent fields were not part of the update. The new configuration applies from the next turn.

    - `required string ID`

      Unique identifier for this event.

    - `required DateTimeOffset ProcessedAt`

      A timestamp in RFC 3339 format

    - `required Type Type`

      - `"session.updated"SessionUpdated`

    - `BetaManagedAgentsSessionAgent? Agent`

      Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.

      - `required string ID`

      - `required string? Description`

      - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

        - `required string Name`

        - `required Type Type`

          - `"url"Url`

        - `required string Url`

      - `required BetaManagedAgentsModelConfig Model`

        Model identifier and configuration.

        - `required BetaManagedAgentsModel ID`

          The model that will power your agent.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `"claude-opus-4-8"ClaudeOpus4_8`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-7"ClaudeOpus4_7`

            Frontier intelligence for long-running agents and coding

          - `"claude-opus-4-6"ClaudeOpus4_6`

            Most intelligent model for building agents and coding

          - `"claude-sonnet-4-6"ClaudeSonnet4_6`

            Best combination of speed and intelligence

          - `"claude-haiku-4-5"ClaudeHaiku4_5`

            Fastest model with near-frontier intelligence

          - `"claude-haiku-4-5-20251001"ClaudeHaiku4_5_20251001`

            Fastest model with near-frontier intelligence

          - `"claude-opus-4-5"ClaudeOpus4_5`

            Premium model combining maximum intelligence with practical performance

          - `"claude-opus-4-5-20251101"ClaudeOpus4_5_20251101`

            Premium model combining maximum intelligence with practical performance

          - `"claude-sonnet-4-5"ClaudeSonnet4_5`

            High-performance model for agents and coding

          - `"claude-sonnet-4-5-20250929"ClaudeSonnet4_5_20250929`

            High-performance model for agents and coding

        - `Speed Speed`

          Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.

          - `"standard"Standard`

          - `"fast"Fast`

      - `required BetaManagedAgentsSessionMultiagentCoordinator? Multiagent`

        Resolved coordinator topology with full agent definitions for each roster member.

        - `required IReadOnlyList<BetaManagedAgentsSessionThreadAgent> Agents`

          Full `agent` definitions the coordinator may spawn as session threads.

          - `required string ID`

          - `required string? Description`

          - `required IReadOnlyList<BetaManagedAgentsMcpServerUrlDefinition> McpServers`

            - `required string Name`

            - `required Type Type`

            - `required string Url`

          - `required BetaManagedAgentsModelConfig Model`

            Model identifier and configuration.

          - `required string Name`

          - `required IReadOnlyList<Skill> Skills`

            - `class BetaManagedAgentsAnthropicSkill:`

              A resolved Anthropic-managed skill.

              - `required string SkillID`

              - `required Type Type`

                - `"anthropic"Anthropic`

              - `required string Version`

            - `class BetaManagedAgentsCustomSkill:`

              A resolved user-created custom skill.

              - `required string SkillID`

              - `required Type Type`

                - `"custom"Custom`

              - `required string Version`

          - `required string? System`

          - `required IReadOnlyList<Tool> Tools`

            - `class BetaManagedAgentsAgentToolset20260401:`

              - `required IReadOnlyList<BetaManagedAgentsAgentToolConfig> Configs`

                - `required Boolean Enabled`

                - `required Name Name`

                  Built-in agent tool identifier.

                  - `"bash"Bash`

                  - `"edit"Edit`

                  - `"read"Read`

                  - `"write"Write`

                  - `"glob"Glob`

                  - `"grep"Grep`

                  - `"web_fetch"WebFetch`

                  - `"web_search"WebSearch`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                    - `required Type Type`

                      - `"always_allow"AlwaysAllow`

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

                    - `required Type Type`

                      - `"always_ask"AlwaysAsk`

              - `required BetaManagedAgentsAgentToolsetDefaultConfig DefaultConfig`

                Resolved default configuration for agent tools.

                - `required Boolean Enabled`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required Type Type`

                - `"agent_toolset_20260401"AgentToolset20260401`

            - `class BetaManagedAgentsMcpToolset:`

              - `required IReadOnlyList<BetaManagedAgentsMcpToolConfig> Configs`

                - `required Boolean Enabled`

                - `required string Name`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required BetaManagedAgentsMcpToolsetDefaultConfig DefaultConfig`

                Resolved default configuration for all tools from an MCP server.

                - `required Boolean Enabled`

                - `required PermissionPolicy PermissionPolicy`

                  Permission policy for tool execution.

                  - `class BetaManagedAgentsAlwaysAllowPolicy:`

                    Tool calls are automatically approved without user confirmation.

                  - `class BetaManagedAgentsAlwaysAskPolicy:`

                    Tool calls require user confirmation before execution.

              - `required string McpServerName`

              - `required Type Type`

                - `"mcp_toolset"McpToolset`

            - `class BetaManagedAgentsCustomTool:`

              A custom tool as returned in API responses.

              - `required string Description`

              - `required BetaManagedAgentsCustomToolInputSchema InputSchema`

                JSON Schema for custom tool input parameters.

                - `IReadOnlyDictionary<string, JsonElement>? Properties`

                  JSON Schema properties defining the tool's input parameters.

                - `IReadOnlyList<string> Required`

                  List of required property names.

                - `Type Type`

                  Must be 'object' for tool input schemas.

                  - `"object"Object`

              - `required string Name`

              - `required Type Type`

                - `"custom"Custom`

          - `required Type Type`

            - `"agent"Agent`

          - `required Int Version`

        - `required Type Type`

          - `"coordinator"Coordinator`

      - `required string Name`

      - `required IReadOnlyList<Skill> Skills`

        - `class BetaManagedAgentsAnthropicSkill:`

          A resolved Anthropic-managed skill.

        - `class BetaManagedAgentsCustomSkill:`

          A resolved user-created custom skill.

      - `required string? System`

      - `required IReadOnlyList<Tool> Tools`

        - `class BetaManagedAgentsAgentToolset20260401:`

        - `class BetaManagedAgentsMcpToolset:`

        - `class BetaManagedAgentsCustomTool:`

          A custom tool as returned in API responses.

      - `required Type Type`

        - `"agent"Agent`

      - `required Int Version`

    - `IReadOnlyDictionary<string, string> Metadata`

      The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty.

    - `string? Title`

      The session's new title. Present only when the update changed it.

### Example

```csharp
EventStreamParams parameters = new()
{
    SessionID = "sesn_011CZkZAtmR3yMPDzynEDxu7",
    ThreadID = "sthr_011CZkZVWa6oIjw0rgXZpnBt",
};

await foreach (var betaManagedAgentsStreamSessionThreadEvents in client.Beta.Sessions.Threads.Events.StreamStreaming(parameters))
{
    Console.WriteLine(betaManagedAgentsStreamSessionThreadEvents);
}
```

#### Response

```json
{
  "id": "sevt_011CZkZGOp0iBcp4kaQSihUmy",
  "content": [
    {
      "text": "Where is my order #1234?",
      "type": "text"
    }
  ],
  "type": "user.message",
  "processed_at": "2026-03-15T10:00:00Z"
}
```

# Vaults

## Create Vault

`BetaManagedAgentsVault Beta.Vaults.Create(VaultCreateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/vaults`

Create Vault

### Parameters

- `VaultCreateParams parameters`

  - `required string displayName`

    Body param: Human-readable name for the vault. 1-255 characters.

  - `IReadOnlyDictionary<string, string> metadata`

    Body param: Arbitrary key-value metadata to attach to the vault. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsVault:`

  A vault that stores credentials for use by agents during sessions.

  - `required string ID`

    Unique identifier for the vault.

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string DisplayName`

    Human-readable name for the vault.

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata attached to the vault.

  - `required Type Type`

    - `"vault"Vault`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

### Example

```csharp
VaultCreateParams parameters = new() { DisplayName = "Example vault" };

var betaManagedAgentsVault = await client.Beta.Vaults.Create(parameters);

Console.WriteLine(betaManagedAgentsVault);
```

#### Response

```json
{
  "id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "display_name": "Example vault",
  "metadata": {
    "environment": "production"
  },
  "type": "vault",
  "updated_at": "2026-03-15T10:00:00Z"
}
```

## List Vaults

`VaultListPageResponse Beta.Vaults.List(VaultListParams?parameters, CancellationTokencancellationToken = default)`

**get** `/v1/vaults`

List Vaults

### Parameters

- `VaultListParams parameters`

  - `Boolean includeArchived`

    Query param: Whether to include archived vaults in the results.

  - `Int limit`

    Query param: Maximum number of vaults to return per page. Defaults to 20, maximum 100.

  - `string page`

    Query param: Opaque pagination token from a previous `list_vaults` response.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class VaultListPageResponse:`

  Response containing a paginated list of vaults.

  - `IReadOnlyList<BetaManagedAgentsVault> Data`

    List of vaults.

    - `required string ID`

      Unique identifier for the vault.

    - `required DateTimeOffset? ArchivedAt`

      A timestamp in RFC 3339 format

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string DisplayName`

      Human-readable name for the vault.

    - `required IReadOnlyDictionary<string, string> Metadata`

      Arbitrary key-value metadata attached to the vault.

    - `required Type Type`

      - `"vault"Vault`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

  - `string? NextPage`

    Pagination token for the next page, or null if no more results.

### Example

```csharp
VaultListParams parameters = new();

var page = await client.Beta.Vaults.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
      "archived_at": null,
      "created_at": "2026-03-15T10:00:00Z",
      "display_name": "Example vault",
      "metadata": {
        "environment": "production"
      },
      "type": "vault",
      "updated_at": "2026-03-15T10:00:00Z"
    }
  ],
  "next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo="
}
```

## Get Vault

`BetaManagedAgentsVault Beta.Vaults.Retrieve(VaultRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/vaults/{vault_id}`

Get Vault

### Parameters

- `VaultRetrieveParams parameters`

  - `required string vaultID`

    Path parameter vault_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsVault:`

  A vault that stores credentials for use by agents during sessions.

  - `required string ID`

    Unique identifier for the vault.

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string DisplayName`

    Human-readable name for the vault.

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata attached to the vault.

  - `required Type Type`

    - `"vault"Vault`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

### Example

```csharp
VaultRetrieveParams parameters = new()
{
    VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv"
};

var betaManagedAgentsVault = await client.Beta.Vaults.Retrieve(parameters);

Console.WriteLine(betaManagedAgentsVault);
```

#### Response

```json
{
  "id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "display_name": "Example vault",
  "metadata": {
    "environment": "production"
  },
  "type": "vault",
  "updated_at": "2026-03-15T10:00:00Z"
}
```

## Update Vault

`BetaManagedAgentsVault Beta.Vaults.Update(VaultUpdateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/vaults/{vault_id}`

Update Vault

### Parameters

- `VaultUpdateParams parameters`

  - `required string vaultID`

    Path param: Path parameter vault_id

  - `string? displayName`

    Body param: Updated human-readable name for the vault. 1-255 characters.

  - `IReadOnlyDictionary<string, string>? metadata`

    Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsVault:`

  A vault that stores credentials for use by agents during sessions.

  - `required string ID`

    Unique identifier for the vault.

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string DisplayName`

    Human-readable name for the vault.

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata attached to the vault.

  - `required Type Type`

    - `"vault"Vault`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

### Example

```csharp
VaultUpdateParams parameters = new()
{
    VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv"
};

var betaManagedAgentsVault = await client.Beta.Vaults.Update(parameters);

Console.WriteLine(betaManagedAgentsVault);
```

#### Response

```json
{
  "id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "display_name": "Example vault",
  "metadata": {
    "environment": "production"
  },
  "type": "vault",
  "updated_at": "2026-03-15T10:00:00Z"
}
```

## Delete Vault

`BetaManagedAgentsDeletedVault Beta.Vaults.Delete(VaultDeleteParamsparameters, CancellationTokencancellationToken = default)`

**delete** `/v1/vaults/{vault_id}`

Delete Vault

### Parameters

- `VaultDeleteParams parameters`

  - `required string vaultID`

    Path parameter vault_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsDeletedVault:`

  Confirmation of a deleted vault.

  - `required string ID`

    Unique identifier of the deleted vault.

  - `required Type Type`

    - `"vault_deleted"VaultDeleted`

### Example

```csharp
VaultDeleteParams parameters = new()
{
    VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv"
};

var betaManagedAgentsDeletedVault = await client.Beta.Vaults.Delete(parameters);

Console.WriteLine(betaManagedAgentsDeletedVault);
```

#### Response

```json
{
  "id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
  "type": "vault_deleted"
}
```

## Archive Vault

`BetaManagedAgentsVault Beta.Vaults.Archive(VaultArchiveParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/vaults/{vault_id}/archive`

Archive Vault

### Parameters

- `VaultArchiveParams parameters`

  - `required string vaultID`

    Path parameter vault_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsVault:`

  A vault that stores credentials for use by agents during sessions.

  - `required string ID`

    Unique identifier for the vault.

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string DisplayName`

    Human-readable name for the vault.

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata attached to the vault.

  - `required Type Type`

    - `"vault"Vault`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

### Example

```csharp
VaultArchiveParams parameters = new()
{
    VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv"
};

var betaManagedAgentsVault = await client.Beta.Vaults.Archive(parameters);

Console.WriteLine(betaManagedAgentsVault);
```

#### Response

```json
{
  "id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
  "archived_at": null,
  "created_at": "2026-03-15T10:00:00Z",
  "display_name": "Example vault",
  "metadata": {
    "environment": "production"
  },
  "type": "vault",
  "updated_at": "2026-03-15T10:00:00Z"
}
```

## Domain Types

### Beta Managed Agents Deleted Vault

- `class BetaManagedAgentsDeletedVault:`

  Confirmation of a deleted vault.

  - `required string ID`

    Unique identifier of the deleted vault.

  - `required Type Type`

    - `"vault_deleted"VaultDeleted`

### Beta Managed Agents Vault

- `class BetaManagedAgentsVault:`

  A vault that stores credentials for use by agents during sessions.

  - `required string ID`

    Unique identifier for the vault.

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string DisplayName`

    Human-readable name for the vault.

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata attached to the vault.

  - `required Type Type`

    - `"vault"Vault`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

# Credentials

## Create Credential

`BetaManagedAgentsCredential Beta.Vaults.Credentials.Create(CredentialCreateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/vaults/{vault_id}/credentials`

Create Credential

### Parameters

- `CredentialCreateParams parameters`

  - `required string vaultID`

    Path param: Path parameter vault_id

  - `required Auth auth`

    Body param: Authentication details for creating a credential.

    - `class BetaManagedAgentsMcpOAuthCreateParams:`

      Parameters for creating an MCP OAuth credential.

      - `required string AccessToken`

        OAuth access token.

      - `required string McpServerUrl`

        URL of the MCP server this credential authenticates against.

      - `required Type Type`

        - `"mcp_oauth"McpOAuth`

      - `DateTimeOffset? ExpiresAt`

        A timestamp in RFC 3339 format

      - `BetaManagedAgentsMcpOAuthRefreshParams? Refresh`

        OAuth refresh token parameters for creating a credential with refresh support.

        - `required string ClientID`

          OAuth client ID.

        - `required string RefreshToken`

          OAuth refresh token.

        - `required string TokenEndpoint`

          Token endpoint URL used to refresh the access token.

        - `required TokenEndpointAuth TokenEndpointAuth`

          Token endpoint requires no client authentication.

          - `class BetaManagedAgentsTokenEndpointAuthNoneParam:`

            Token endpoint requires no client authentication.

            - `required Type Type`

              - `"none"None`

          - `class BetaManagedAgentsTokenEndpointAuthBasicParam:`

            Token endpoint uses HTTP Basic authentication with client credentials.

            - `required string ClientSecret`

              OAuth client secret.

            - `required Type Type`

              - `"client_secret_basic"ClientSecretBasic`

          - `class BetaManagedAgentsTokenEndpointAuthPostParam:`

            Token endpoint uses POST body authentication with client credentials.

            - `required string ClientSecret`

              OAuth client secret.

            - `required Type Type`

              - `"client_secret_post"ClientSecretPost`

        - `string? Resource`

          OAuth resource indicator.

        - `string? Scope`

          OAuth scope for the refresh request.

    - `class BetaManagedAgentsStaticBearerCreateParams:`

      Parameters for creating a static bearer token credential.

      - `required string Token`

        Static bearer token value.

      - `required string McpServerUrl`

        URL of the MCP server this credential authenticates against.

      - `required Type Type`

        - `"static_bearer"StaticBearer`

  - `string? displayName`

    Body param: Human-readable name for the credential. Up to 255 characters.

  - `IReadOnlyDictionary<string, string> metadata`

    Body param: Arbitrary key-value metadata to attach to the credential. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsCredential:`

  A credential stored in a vault. Sensitive fields are never returned in responses.

  - `required string ID`

    Unique identifier for the credential.

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required Auth Auth`

    Authentication details for a credential.

    - `class BetaManagedAgentsMcpOAuthAuthResponse:`

      OAuth credential details for an MCP server.

      - `required string McpServerUrl`

        URL of the MCP server this credential authenticates against.

      - `required Type Type`

        - `"mcp_oauth"McpOAuth`

      - `DateTimeOffset? ExpiresAt`

        A timestamp in RFC 3339 format

      - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh`

        OAuth refresh token configuration returned in credential responses.

        - `required string ClientID`

          OAuth client ID.

        - `required string TokenEndpoint`

          Token endpoint URL used to refresh the access token.

        - `required TokenEndpointAuth TokenEndpointAuth`

          Token endpoint requires no client authentication.

          - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:`

            Token endpoint requires no client authentication.

            - `required Type Type`

              - `"none"None`

          - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:`

            Token endpoint uses HTTP Basic authentication with client credentials.

            - `required Type Type`

              - `"client_secret_basic"ClientSecretBasic`

          - `class BetaManagedAgentsTokenEndpointAuthPostResponse:`

            Token endpoint uses POST body authentication with client credentials.

            - `required Type Type`

              - `"client_secret_post"ClientSecretPost`

        - `string? Resource`

          OAuth resource indicator.

        - `string? Scope`

          OAuth scope for the refresh request.

    - `class BetaManagedAgentsStaticBearerAuthResponse:`

      Static bearer token credential details for an MCP server.

      - `required string McpServerUrl`

        URL of the MCP server this credential authenticates against.

      - `required Type Type`

        - `"static_bearer"StaticBearer`

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata attached to the credential.

  - `required Type Type`

    - `"vault_credential"VaultCredential`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required string VaultID`

    Identifier of the vault this credential belongs to.

  - `string? DisplayName`

    Human-readable name for the credential.

### Example

```csharp
CredentialCreateParams parameters = new()
{
    VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv",
    Auth = new BetaManagedAgentsStaticBearerCreateParams()
    {
        Token = "bearer_exampletoken",
        McpServerUrl = "https://example-server.modelcontextprotocol.io/sse",
        Type = Type.StaticBearer,
    },
};

var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Create(parameters);

Console.WriteLine(betaManagedAgentsCredential);
```

#### Response

```json
{
  "id": "vcrd_011CZkZEMt8gZan2iYOQfSkw",
  "archived_at": null,
  "auth": {
    "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse",
    "type": "static_bearer"
  },
  "created_at": "2026-03-15T10:00:00Z",
  "metadata": {
    "environment": "production"
  },
  "type": "vault_credential",
  "updated_at": "2026-03-15T10:00:00Z",
  "vault_id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
  "display_name": "Example credential"
}
```

## List Credentials

`CredentialListPageResponse Beta.Vaults.Credentials.List(CredentialListParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/vaults/{vault_id}/credentials`

List Credentials

### Parameters

- `CredentialListParams parameters`

  - `required string vaultID`

    Path param: Path parameter vault_id

  - `Boolean includeArchived`

    Query param: Whether to include archived credentials in the results.

  - `Int limit`

    Query param: Maximum number of credentials to return per page. Defaults to 20, maximum 100.

  - `string page`

    Query param: Opaque pagination token from a previous `list_credentials` response.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class CredentialListPageResponse:`

  Response containing a paginated list of credentials.

  - `IReadOnlyList<BetaManagedAgentsCredential> Data`

    List of credentials.

    - `required string ID`

      Unique identifier for the credential.

    - `required DateTimeOffset? ArchivedAt`

      A timestamp in RFC 3339 format

    - `required Auth Auth`

      Authentication details for a credential.

      - `class BetaManagedAgentsMcpOAuthAuthResponse:`

        OAuth credential details for an MCP server.

        - `required string McpServerUrl`

          URL of the MCP server this credential authenticates against.

        - `required Type Type`

          - `"mcp_oauth"McpOAuth`

        - `DateTimeOffset? ExpiresAt`

          A timestamp in RFC 3339 format

        - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh`

          OAuth refresh token configuration returned in credential responses.

          - `required string ClientID`

            OAuth client ID.

          - `required string TokenEndpoint`

            Token endpoint URL used to refresh the access token.

          - `required TokenEndpointAuth TokenEndpointAuth`

            Token endpoint requires no client authentication.

            - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:`

              Token endpoint requires no client authentication.

              - `required Type Type`

                - `"none"None`

            - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:`

              Token endpoint uses HTTP Basic authentication with client credentials.

              - `required Type Type`

                - `"client_secret_basic"ClientSecretBasic`

            - `class BetaManagedAgentsTokenEndpointAuthPostResponse:`

              Token endpoint uses POST body authentication with client credentials.

              - `required Type Type`

                - `"client_secret_post"ClientSecretPost`

          - `string? Resource`

            OAuth resource indicator.

          - `string? Scope`

            OAuth scope for the refresh request.

      - `class BetaManagedAgentsStaticBearerAuthResponse:`

        Static bearer token credential details for an MCP server.

        - `required string McpServerUrl`

          URL of the MCP server this credential authenticates against.

        - `required Type Type`

          - `"static_bearer"StaticBearer`

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required IReadOnlyDictionary<string, string> Metadata`

      Arbitrary key-value metadata attached to the credential.

    - `required Type Type`

      - `"vault_credential"VaultCredential`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

    - `required string VaultID`

      Identifier of the vault this credential belongs to.

    - `string? DisplayName`

      Human-readable name for the credential.

  - `string? NextPage`

    Pagination token for the next page, or null if no more results.

### Example

```csharp
CredentialListParams parameters = new()
{
    VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv"
};

var page = await client.Beta.Vaults.Credentials.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "vcrd_011CZkZEMt8gZan2iYOQfSkw",
      "archived_at": null,
      "auth": {
        "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse",
        "type": "static_bearer"
      },
      "created_at": "2026-03-15T10:00:00Z",
      "metadata": {
        "environment": "production"
      },
      "type": "vault_credential",
      "updated_at": "2026-03-15T10:00:00Z",
      "vault_id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
      "display_name": "Example credential"
    }
  ],
  "next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo="
}
```

## Get Credential

`BetaManagedAgentsCredential Beta.Vaults.Credentials.Retrieve(CredentialRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/vaults/{vault_id}/credentials/{credential_id}`

Get Credential

### Parameters

- `CredentialRetrieveParams parameters`

  - `required string vaultID`

    Path param: Path parameter vault_id

  - `required string credentialID`

    Path param: Path parameter credential_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsCredential:`

  A credential stored in a vault. Sensitive fields are never returned in responses.

  - `required string ID`

    Unique identifier for the credential.

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required Auth Auth`

    Authentication details for a credential.

    - `class BetaManagedAgentsMcpOAuthAuthResponse:`

      OAuth credential details for an MCP server.

      - `required string McpServerUrl`

        URL of the MCP server this credential authenticates against.

      - `required Type Type`

        - `"mcp_oauth"McpOAuth`

      - `DateTimeOffset? ExpiresAt`

        A timestamp in RFC 3339 format

      - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh`

        OAuth refresh token configuration returned in credential responses.

        - `required string ClientID`

          OAuth client ID.

        - `required string TokenEndpoint`

          Token endpoint URL used to refresh the access token.

        - `required TokenEndpointAuth TokenEndpointAuth`

          Token endpoint requires no client authentication.

          - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:`

            Token endpoint requires no client authentication.

            - `required Type Type`

              - `"none"None`

          - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:`

            Token endpoint uses HTTP Basic authentication with client credentials.

            - `required Type Type`

              - `"client_secret_basic"ClientSecretBasic`

          - `class BetaManagedAgentsTokenEndpointAuthPostResponse:`

            Token endpoint uses POST body authentication with client credentials.

            - `required Type Type`

              - `"client_secret_post"ClientSecretPost`

        - `string? Resource`

          OAuth resource indicator.

        - `string? Scope`

          OAuth scope for the refresh request.

    - `class BetaManagedAgentsStaticBearerAuthResponse:`

      Static bearer token credential details for an MCP server.

      - `required string McpServerUrl`

        URL of the MCP server this credential authenticates against.

      - `required Type Type`

        - `"static_bearer"StaticBearer`

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata attached to the credential.

  - `required Type Type`

    - `"vault_credential"VaultCredential`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required string VaultID`

    Identifier of the vault this credential belongs to.

  - `string? DisplayName`

    Human-readable name for the credential.

### Example

```csharp
CredentialRetrieveParams parameters = new()
{
    VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv",
    CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw",
};

var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Retrieve(parameters);

Console.WriteLine(betaManagedAgentsCredential);
```

#### Response

```json
{
  "id": "vcrd_011CZkZEMt8gZan2iYOQfSkw",
  "archived_at": null,
  "auth": {
    "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse",
    "type": "static_bearer"
  },
  "created_at": "2026-03-15T10:00:00Z",
  "metadata": {
    "environment": "production"
  },
  "type": "vault_credential",
  "updated_at": "2026-03-15T10:00:00Z",
  "vault_id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
  "display_name": "Example credential"
}
```

## Update Credential

`BetaManagedAgentsCredential Beta.Vaults.Credentials.Update(CredentialUpdateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/vaults/{vault_id}/credentials/{credential_id}`

Update Credential

### Parameters

- `CredentialUpdateParams parameters`

  - `required string vaultID`

    Path param: Path parameter vault_id

  - `required string credentialID`

    Path param: Path parameter credential_id

  - `Auth auth`

    Body param: Updated authentication details for a credential.

    - `class BetaManagedAgentsMcpOAuthUpdateParams:`

      Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable.

      - `required Type Type`

        - `"mcp_oauth"McpOAuth`

      - `string? AccessToken`

        Updated OAuth access token.

      - `DateTimeOffset? ExpiresAt`

        A timestamp in RFC 3339 format

      - `BetaManagedAgentsMcpOAuthRefreshUpdateParams? Refresh`

        Parameters for updating OAuth refresh token configuration.

        - `string? RefreshToken`

          Updated OAuth refresh token.

        - `string? Scope`

          Updated OAuth scope for the refresh request.

        - `TokenEndpointAuth TokenEndpointAuth`

          Updated HTTP Basic authentication parameters for the token endpoint.

          - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:`

            Updated HTTP Basic authentication parameters for the token endpoint.

            - `required Type Type`

              - `"client_secret_basic"ClientSecretBasic`

            - `string? ClientSecret`

              Updated OAuth client secret.

          - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:`

            Updated POST body authentication parameters for the token endpoint.

            - `required Type Type`

              - `"client_secret_post"ClientSecretPost`

            - `string? ClientSecret`

              Updated OAuth client secret.

    - `class BetaManagedAgentsStaticBearerUpdateParams:`

      Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable.

      - `required Type Type`

        - `"static_bearer"StaticBearer`

      - `string? Token`

        Updated static bearer token value.

  - `string? displayName`

    Body param: Updated human-readable name for the credential. 1-255 characters.

  - `IReadOnlyDictionary<string, string>? metadata`

    Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsCredential:`

  A credential stored in a vault. Sensitive fields are never returned in responses.

  - `required string ID`

    Unique identifier for the credential.

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required Auth Auth`

    Authentication details for a credential.

    - `class BetaManagedAgentsMcpOAuthAuthResponse:`

      OAuth credential details for an MCP server.

      - `required string McpServerUrl`

        URL of the MCP server this credential authenticates against.

      - `required Type Type`

        - `"mcp_oauth"McpOAuth`

      - `DateTimeOffset? ExpiresAt`

        A timestamp in RFC 3339 format

      - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh`

        OAuth refresh token configuration returned in credential responses.

        - `required string ClientID`

          OAuth client ID.

        - `required string TokenEndpoint`

          Token endpoint URL used to refresh the access token.

        - `required TokenEndpointAuth TokenEndpointAuth`

          Token endpoint requires no client authentication.

          - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:`

            Token endpoint requires no client authentication.

            - `required Type Type`

              - `"none"None`

          - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:`

            Token endpoint uses HTTP Basic authentication with client credentials.

            - `required Type Type`

              - `"client_secret_basic"ClientSecretBasic`

          - `class BetaManagedAgentsTokenEndpointAuthPostResponse:`

            Token endpoint uses POST body authentication with client credentials.

            - `required Type Type`

              - `"client_secret_post"ClientSecretPost`

        - `string? Resource`

          OAuth resource indicator.

        - `string? Scope`

          OAuth scope for the refresh request.

    - `class BetaManagedAgentsStaticBearerAuthResponse:`

      Static bearer token credential details for an MCP server.

      - `required string McpServerUrl`

        URL of the MCP server this credential authenticates against.

      - `required Type Type`

        - `"static_bearer"StaticBearer`

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata attached to the credential.

  - `required Type Type`

    - `"vault_credential"VaultCredential`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required string VaultID`

    Identifier of the vault this credential belongs to.

  - `string? DisplayName`

    Human-readable name for the credential.

### Example

```csharp
CredentialUpdateParams parameters = new()
{
    VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv",
    CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw",
};

var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Update(parameters);

Console.WriteLine(betaManagedAgentsCredential);
```

#### Response

```json
{
  "id": "vcrd_011CZkZEMt8gZan2iYOQfSkw",
  "archived_at": null,
  "auth": {
    "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse",
    "type": "static_bearer"
  },
  "created_at": "2026-03-15T10:00:00Z",
  "metadata": {
    "environment": "production"
  },
  "type": "vault_credential",
  "updated_at": "2026-03-15T10:00:00Z",
  "vault_id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
  "display_name": "Example credential"
}
```

## Delete Credential

`BetaManagedAgentsDeletedCredential Beta.Vaults.Credentials.Delete(CredentialDeleteParamsparameters, CancellationTokencancellationToken = default)`

**delete** `/v1/vaults/{vault_id}/credentials/{credential_id}`

Delete Credential

### Parameters

- `CredentialDeleteParams parameters`

  - `required string vaultID`

    Path param: Path parameter vault_id

  - `required string credentialID`

    Path param: Path parameter credential_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsDeletedCredential:`

  Confirmation of a deleted credential.

  - `required string ID`

    Unique identifier of the deleted credential.

  - `required Type Type`

    - `"vault_credential_deleted"VaultCredentialDeleted`

### Example

```csharp
CredentialDeleteParams parameters = new()
{
    VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv",
    CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw",
};

var betaManagedAgentsDeletedCredential = await client.Beta.Vaults.Credentials.Delete(parameters);

Console.WriteLine(betaManagedAgentsDeletedCredential);
```

#### Response

```json
{
  "id": "vcrd_011CZkZEMt8gZan2iYOQfSkw",
  "type": "vault_credential_deleted"
}
```

## Archive Credential

`BetaManagedAgentsCredential Beta.Vaults.Credentials.Archive(CredentialArchiveParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/archive`

Archive Credential

### Parameters

- `CredentialArchiveParams parameters`

  - `required string vaultID`

    Path param: Path parameter vault_id

  - `required string credentialID`

    Path param: Path parameter credential_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsCredential:`

  A credential stored in a vault. Sensitive fields are never returned in responses.

  - `required string ID`

    Unique identifier for the credential.

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required Auth Auth`

    Authentication details for a credential.

    - `class BetaManagedAgentsMcpOAuthAuthResponse:`

      OAuth credential details for an MCP server.

      - `required string McpServerUrl`

        URL of the MCP server this credential authenticates against.

      - `required Type Type`

        - `"mcp_oauth"McpOAuth`

      - `DateTimeOffset? ExpiresAt`

        A timestamp in RFC 3339 format

      - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh`

        OAuth refresh token configuration returned in credential responses.

        - `required string ClientID`

          OAuth client ID.

        - `required string TokenEndpoint`

          Token endpoint URL used to refresh the access token.

        - `required TokenEndpointAuth TokenEndpointAuth`

          Token endpoint requires no client authentication.

          - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:`

            Token endpoint requires no client authentication.

            - `required Type Type`

              - `"none"None`

          - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:`

            Token endpoint uses HTTP Basic authentication with client credentials.

            - `required Type Type`

              - `"client_secret_basic"ClientSecretBasic`

          - `class BetaManagedAgentsTokenEndpointAuthPostResponse:`

            Token endpoint uses POST body authentication with client credentials.

            - `required Type Type`

              - `"client_secret_post"ClientSecretPost`

        - `string? Resource`

          OAuth resource indicator.

        - `string? Scope`

          OAuth scope for the refresh request.

    - `class BetaManagedAgentsStaticBearerAuthResponse:`

      Static bearer token credential details for an MCP server.

      - `required string McpServerUrl`

        URL of the MCP server this credential authenticates against.

      - `required Type Type`

        - `"static_bearer"StaticBearer`

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata attached to the credential.

  - `required Type Type`

    - `"vault_credential"VaultCredential`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required string VaultID`

    Identifier of the vault this credential belongs to.

  - `string? DisplayName`

    Human-readable name for the credential.

### Example

```csharp
CredentialArchiveParams parameters = new()
{
    VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv",
    CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw",
};

var betaManagedAgentsCredential = await client.Beta.Vaults.Credentials.Archive(parameters);

Console.WriteLine(betaManagedAgentsCredential);
```

#### Response

```json
{
  "id": "vcrd_011CZkZEMt8gZan2iYOQfSkw",
  "archived_at": null,
  "auth": {
    "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse",
    "type": "static_bearer"
  },
  "created_at": "2026-03-15T10:00:00Z",
  "metadata": {
    "environment": "production"
  },
  "type": "vault_credential",
  "updated_at": "2026-03-15T10:00:00Z",
  "vault_id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
  "display_name": "Example credential"
}
```

## Validate Credential

`BetaManagedAgentsCredentialValidation Beta.Vaults.Credentials.McpOAuthValidate(CredentialMcpOAuthValidateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/vaults/{vault_id}/credentials/{credential_id}/mcp_oauth_validate`

Validate Credential

### Parameters

- `CredentialMcpOAuthValidateParams parameters`

  - `required string vaultID`

    Path param: Path parameter vault_id

  - `required string credentialID`

    Path param: Path parameter credential_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsCredentialValidation:`

  Result of live-probing a credential against its configured MCP server.

  - `required string CredentialID`

    Unique identifier of the credential that was validated.

  - `required Boolean HasRefreshToken`

    Whether the credential has a refresh token configured.

  - `required BetaManagedAgentsMcpProbe? McpProbe`

    The failing step of an MCP validation probe.

    - `required BetaManagedAgentsRefreshHttpResponse? HttpResponse`

      An HTTP response captured during a credential validation probe.

      - `required string Body`

        Response body. May be truncated and has sensitive values scrubbed.

      - `required Boolean BodyTruncated`

        Whether `body` was truncated.

      - `required string ContentType`

        Value of the `Content-Type` response header.

      - `required Int StatusCode`

        HTTP status code.

    - `required string Method`

      The MCP method that failed (for example `initialize` or `tools/list`).

  - `required BetaManagedAgentsRefreshObject? Refresh`

    Outcome of a refresh-token exchange attempted during credential validation.

    - `required BetaManagedAgentsRefreshHttpResponse? HttpResponse`

      An HTTP response captured during a credential validation probe.

    - `required Status Status`

      Outcome of a refresh-token exchange attempted during credential validation.

      - `"succeeded"Succeeded`

      - `"failed"Failed`

      - `"connect_error"ConnectError`

      - `"no_refresh_token"NoRefreshToken`

  - `required BetaManagedAgentsCredentialValidationStatus Status`

    Overall verdict of a credential validation probe.

    - `"valid"Valid`

    - `"invalid"Invalid`

    - `"unknown"Unknown`

  - `required Type Type`

    - `"vault_credential_validation"VaultCredentialValidation`

  - `required DateTimeOffset ValidatedAt`

    A timestamp in RFC 3339 format

  - `required string VaultID`

    Identifier of the vault containing the credential.

### Example

```csharp
CredentialMcpOAuthValidateParams parameters = new()
{
    VaultID = "vlt_011CZkZDLs7fYzm1hXNPeRjv",
    CredentialID = "vcrd_011CZkZEMt8gZan2iYOQfSkw",
};

var betaManagedAgentsCredentialValidation = await client.Beta.Vaults.Credentials.McpOAuthValidate(parameters);

Console.WriteLine(betaManagedAgentsCredentialValidation);
```

#### Response

```json
{
  "credential_id": "vcrd_011CZkZEMt8gZan2iYOQfSkw",
  "has_refresh_token": true,
  "mcp_probe": {
    "http_response": {
      "body": "body",
      "body_truncated": true,
      "content_type": "content_type",
      "status_code": 0
    },
    "method": "method"
  },
  "refresh": {
    "http_response": {
      "body": "body",
      "body_truncated": true,
      "content_type": "content_type",
      "status_code": 0
    },
    "status": "succeeded"
  },
  "status": "valid",
  "type": "vault_credential_validation",
  "validated_at": "2026-03-15T10:00:00Z",
  "vault_id": "vlt_011CZkZDLs7fYzm1hXNPeRjv"
}
```

## Domain Types

### Beta Managed Agents Credential

- `class BetaManagedAgentsCredential:`

  A credential stored in a vault. Sensitive fields are never returned in responses.

  - `required string ID`

    Unique identifier for the credential.

  - `required DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `required Auth Auth`

    Authentication details for a credential.

    - `class BetaManagedAgentsMcpOAuthAuthResponse:`

      OAuth credential details for an MCP server.

      - `required string McpServerUrl`

        URL of the MCP server this credential authenticates against.

      - `required Type Type`

        - `"mcp_oauth"McpOAuth`

      - `DateTimeOffset? ExpiresAt`

        A timestamp in RFC 3339 format

      - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh`

        OAuth refresh token configuration returned in credential responses.

        - `required string ClientID`

          OAuth client ID.

        - `required string TokenEndpoint`

          Token endpoint URL used to refresh the access token.

        - `required TokenEndpointAuth TokenEndpointAuth`

          Token endpoint requires no client authentication.

          - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:`

            Token endpoint requires no client authentication.

            - `required Type Type`

              - `"none"None`

          - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:`

            Token endpoint uses HTTP Basic authentication with client credentials.

            - `required Type Type`

              - `"client_secret_basic"ClientSecretBasic`

          - `class BetaManagedAgentsTokenEndpointAuthPostResponse:`

            Token endpoint uses POST body authentication with client credentials.

            - `required Type Type`

              - `"client_secret_post"ClientSecretPost`

        - `string? Resource`

          OAuth resource indicator.

        - `string? Scope`

          OAuth scope for the refresh request.

    - `class BetaManagedAgentsStaticBearerAuthResponse:`

      Static bearer token credential details for an MCP server.

      - `required string McpServerUrl`

        URL of the MCP server this credential authenticates against.

      - `required Type Type`

        - `"static_bearer"StaticBearer`

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata attached to the credential.

  - `required Type Type`

    - `"vault_credential"VaultCredential`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `required string VaultID`

    Identifier of the vault this credential belongs to.

  - `string? DisplayName`

    Human-readable name for the credential.

### Beta Managed Agents Credential Validation

- `class BetaManagedAgentsCredentialValidation:`

  Result of live-probing a credential against its configured MCP server.

  - `required string CredentialID`

    Unique identifier of the credential that was validated.

  - `required Boolean HasRefreshToken`

    Whether the credential has a refresh token configured.

  - `required BetaManagedAgentsMcpProbe? McpProbe`

    The failing step of an MCP validation probe.

    - `required BetaManagedAgentsRefreshHttpResponse? HttpResponse`

      An HTTP response captured during a credential validation probe.

      - `required string Body`

        Response body. May be truncated and has sensitive values scrubbed.

      - `required Boolean BodyTruncated`

        Whether `body` was truncated.

      - `required string ContentType`

        Value of the `Content-Type` response header.

      - `required Int StatusCode`

        HTTP status code.

    - `required string Method`

      The MCP method that failed (for example `initialize` or `tools/list`).

  - `required BetaManagedAgentsRefreshObject? Refresh`

    Outcome of a refresh-token exchange attempted during credential validation.

    - `required BetaManagedAgentsRefreshHttpResponse? HttpResponse`

      An HTTP response captured during a credential validation probe.

    - `required Status Status`

      Outcome of a refresh-token exchange attempted during credential validation.

      - `"succeeded"Succeeded`

      - `"failed"Failed`

      - `"connect_error"ConnectError`

      - `"no_refresh_token"NoRefreshToken`

  - `required BetaManagedAgentsCredentialValidationStatus Status`

    Overall verdict of a credential validation probe.

    - `"valid"Valid`

    - `"invalid"Invalid`

    - `"unknown"Unknown`

  - `required Type Type`

    - `"vault_credential_validation"VaultCredentialValidation`

  - `required DateTimeOffset ValidatedAt`

    A timestamp in RFC 3339 format

  - `required string VaultID`

    Identifier of the vault containing the credential.

### Beta Managed Agents Credential Validation Status

- `enum BetaManagedAgentsCredentialValidationStatus:`

  Overall verdict of a credential validation probe.

  - `"valid"Valid`

  - `"invalid"Invalid`

  - `"unknown"Unknown`

### Beta Managed Agents Deleted Credential

- `class BetaManagedAgentsDeletedCredential:`

  Confirmation of a deleted credential.

  - `required string ID`

    Unique identifier of the deleted credential.

  - `required Type Type`

    - `"vault_credential_deleted"VaultCredentialDeleted`

### Beta Managed Agents MCP OAuth Auth Response

- `class BetaManagedAgentsMcpOAuthAuthResponse:`

  OAuth credential details for an MCP server.

  - `required string McpServerUrl`

    URL of the MCP server this credential authenticates against.

  - `required Type Type`

    - `"mcp_oauth"McpOAuth`

  - `DateTimeOffset? ExpiresAt`

    A timestamp in RFC 3339 format

  - `BetaManagedAgentsMcpOAuthRefreshResponse? Refresh`

    OAuth refresh token configuration returned in credential responses.

    - `required string ClientID`

      OAuth client ID.

    - `required string TokenEndpoint`

      Token endpoint URL used to refresh the access token.

    - `required TokenEndpointAuth TokenEndpointAuth`

      Token endpoint requires no client authentication.

      - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:`

        Token endpoint requires no client authentication.

        - `required Type Type`

          - `"none"None`

      - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:`

        Token endpoint uses HTTP Basic authentication with client credentials.

        - `required Type Type`

          - `"client_secret_basic"ClientSecretBasic`

      - `class BetaManagedAgentsTokenEndpointAuthPostResponse:`

        Token endpoint uses POST body authentication with client credentials.

        - `required Type Type`

          - `"client_secret_post"ClientSecretPost`

    - `string? Resource`

      OAuth resource indicator.

    - `string? Scope`

      OAuth scope for the refresh request.

### Beta Managed Agents MCP OAuth Create Params

- `class BetaManagedAgentsMcpOAuthCreateParams:`

  Parameters for creating an MCP OAuth credential.

  - `required string AccessToken`

    OAuth access token.

  - `required string McpServerUrl`

    URL of the MCP server this credential authenticates against.

  - `required Type Type`

    - `"mcp_oauth"McpOAuth`

  - `DateTimeOffset? ExpiresAt`

    A timestamp in RFC 3339 format

  - `BetaManagedAgentsMcpOAuthRefreshParams? Refresh`

    OAuth refresh token parameters for creating a credential with refresh support.

    - `required string ClientID`

      OAuth client ID.

    - `required string RefreshToken`

      OAuth refresh token.

    - `required string TokenEndpoint`

      Token endpoint URL used to refresh the access token.

    - `required TokenEndpointAuth TokenEndpointAuth`

      Token endpoint requires no client authentication.

      - `class BetaManagedAgentsTokenEndpointAuthNoneParam:`

        Token endpoint requires no client authentication.

        - `required Type Type`

          - `"none"None`

      - `class BetaManagedAgentsTokenEndpointAuthBasicParam:`

        Token endpoint uses HTTP Basic authentication with client credentials.

        - `required string ClientSecret`

          OAuth client secret.

        - `required Type Type`

          - `"client_secret_basic"ClientSecretBasic`

      - `class BetaManagedAgentsTokenEndpointAuthPostParam:`

        Token endpoint uses POST body authentication with client credentials.

        - `required string ClientSecret`

          OAuth client secret.

        - `required Type Type`

          - `"client_secret_post"ClientSecretPost`

    - `string? Resource`

      OAuth resource indicator.

    - `string? Scope`

      OAuth scope for the refresh request.

### Beta Managed Agents MCP OAuth Refresh Params

- `class BetaManagedAgentsMcpOAuthRefreshParams:`

  OAuth refresh token parameters for creating a credential with refresh support.

  - `required string ClientID`

    OAuth client ID.

  - `required string RefreshToken`

    OAuth refresh token.

  - `required string TokenEndpoint`

    Token endpoint URL used to refresh the access token.

  - `required TokenEndpointAuth TokenEndpointAuth`

    Token endpoint requires no client authentication.

    - `class BetaManagedAgentsTokenEndpointAuthNoneParam:`

      Token endpoint requires no client authentication.

      - `required Type Type`

        - `"none"None`

    - `class BetaManagedAgentsTokenEndpointAuthBasicParam:`

      Token endpoint uses HTTP Basic authentication with client credentials.

      - `required string ClientSecret`

        OAuth client secret.

      - `required Type Type`

        - `"client_secret_basic"ClientSecretBasic`

    - `class BetaManagedAgentsTokenEndpointAuthPostParam:`

      Token endpoint uses POST body authentication with client credentials.

      - `required string ClientSecret`

        OAuth client secret.

      - `required Type Type`

        - `"client_secret_post"ClientSecretPost`

  - `string? Resource`

    OAuth resource indicator.

  - `string? Scope`

    OAuth scope for the refresh request.

### Beta Managed Agents MCP OAuth Refresh Response

- `class BetaManagedAgentsMcpOAuthRefreshResponse:`

  OAuth refresh token configuration returned in credential responses.

  - `required string ClientID`

    OAuth client ID.

  - `required string TokenEndpoint`

    Token endpoint URL used to refresh the access token.

  - `required TokenEndpointAuth TokenEndpointAuth`

    Token endpoint requires no client authentication.

    - `class BetaManagedAgentsTokenEndpointAuthNoneResponse:`

      Token endpoint requires no client authentication.

      - `required Type Type`

        - `"none"None`

    - `class BetaManagedAgentsTokenEndpointAuthBasicResponse:`

      Token endpoint uses HTTP Basic authentication with client credentials.

      - `required Type Type`

        - `"client_secret_basic"ClientSecretBasic`

    - `class BetaManagedAgentsTokenEndpointAuthPostResponse:`

      Token endpoint uses POST body authentication with client credentials.

      - `required Type Type`

        - `"client_secret_post"ClientSecretPost`

  - `string? Resource`

    OAuth resource indicator.

  - `string? Scope`

    OAuth scope for the refresh request.

### Beta Managed Agents MCP OAuth Refresh Update Params

- `class BetaManagedAgentsMcpOAuthRefreshUpdateParams:`

  Parameters for updating OAuth refresh token configuration.

  - `string? RefreshToken`

    Updated OAuth refresh token.

  - `string? Scope`

    Updated OAuth scope for the refresh request.

  - `TokenEndpointAuth TokenEndpointAuth`

    Updated HTTP Basic authentication parameters for the token endpoint.

    - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:`

      Updated HTTP Basic authentication parameters for the token endpoint.

      - `required Type Type`

        - `"client_secret_basic"ClientSecretBasic`

      - `string? ClientSecret`

        Updated OAuth client secret.

    - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:`

      Updated POST body authentication parameters for the token endpoint.

      - `required Type Type`

        - `"client_secret_post"ClientSecretPost`

      - `string? ClientSecret`

        Updated OAuth client secret.

### Beta Managed Agents MCP OAuth Update Params

- `class BetaManagedAgentsMcpOAuthUpdateParams:`

  Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable.

  - `required Type Type`

    - `"mcp_oauth"McpOAuth`

  - `string? AccessToken`

    Updated OAuth access token.

  - `DateTimeOffset? ExpiresAt`

    A timestamp in RFC 3339 format

  - `BetaManagedAgentsMcpOAuthRefreshUpdateParams? Refresh`

    Parameters for updating OAuth refresh token configuration.

    - `string? RefreshToken`

      Updated OAuth refresh token.

    - `string? Scope`

      Updated OAuth scope for the refresh request.

    - `TokenEndpointAuth TokenEndpointAuth`

      Updated HTTP Basic authentication parameters for the token endpoint.

      - `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:`

        Updated HTTP Basic authentication parameters for the token endpoint.

        - `required Type Type`

          - `"client_secret_basic"ClientSecretBasic`

        - `string? ClientSecret`

          Updated OAuth client secret.

      - `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:`

        Updated POST body authentication parameters for the token endpoint.

        - `required Type Type`

          - `"client_secret_post"ClientSecretPost`

        - `string? ClientSecret`

          Updated OAuth client secret.

### Beta Managed Agents MCP Probe

- `class BetaManagedAgentsMcpProbe:`

  The failing step of an MCP validation probe.

  - `required BetaManagedAgentsRefreshHttpResponse? HttpResponse`

    An HTTP response captured during a credential validation probe.

    - `required string Body`

      Response body. May be truncated and has sensitive values scrubbed.

    - `required Boolean BodyTruncated`

      Whether `body` was truncated.

    - `required string ContentType`

      Value of the `Content-Type` response header.

    - `required Int StatusCode`

      HTTP status code.

  - `required string Method`

    The MCP method that failed (for example `initialize` or `tools/list`).

### Beta Managed Agents Refresh HTTP Response

- `class BetaManagedAgentsRefreshHttpResponse:`

  An HTTP response captured during a credential validation probe.

  - `required string Body`

    Response body. May be truncated and has sensitive values scrubbed.

  - `required Boolean BodyTruncated`

    Whether `body` was truncated.

  - `required string ContentType`

    Value of the `Content-Type` response header.

  - `required Int StatusCode`

    HTTP status code.

### Beta Managed Agents Refresh Object

- `class BetaManagedAgentsRefreshObject:`

  Outcome of a refresh-token exchange attempted during credential validation.

  - `required BetaManagedAgentsRefreshHttpResponse? HttpResponse`

    An HTTP response captured during a credential validation probe.

    - `required string Body`

      Response body. May be truncated and has sensitive values scrubbed.

    - `required Boolean BodyTruncated`

      Whether `body` was truncated.

    - `required string ContentType`

      Value of the `Content-Type` response header.

    - `required Int StatusCode`

      HTTP status code.

  - `required Status Status`

    Outcome of a refresh-token exchange attempted during credential validation.

    - `"succeeded"Succeeded`

    - `"failed"Failed`

    - `"connect_error"ConnectError`

    - `"no_refresh_token"NoRefreshToken`

### Beta Managed Agents Static Bearer Auth Response

- `class BetaManagedAgentsStaticBearerAuthResponse:`

  Static bearer token credential details for an MCP server.

  - `required string McpServerUrl`

    URL of the MCP server this credential authenticates against.

  - `required Type Type`

    - `"static_bearer"StaticBearer`

### Beta Managed Agents Static Bearer Create Params

- `class BetaManagedAgentsStaticBearerCreateParams:`

  Parameters for creating a static bearer token credential.

  - `required string Token`

    Static bearer token value.

  - `required string McpServerUrl`

    URL of the MCP server this credential authenticates against.

  - `required Type Type`

    - `"static_bearer"StaticBearer`

### Beta Managed Agents Static Bearer Update Params

- `class BetaManagedAgentsStaticBearerUpdateParams:`

  Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable.

  - `required Type Type`

    - `"static_bearer"StaticBearer`

  - `string? Token`

    Updated static bearer token value.

### Beta Managed Agents Token Endpoint Auth Basic Param

- `class BetaManagedAgentsTokenEndpointAuthBasicParam:`

  Token endpoint uses HTTP Basic authentication with client credentials.

  - `required string ClientSecret`

    OAuth client secret.

  - `required Type Type`

    - `"client_secret_basic"ClientSecretBasic`

### Beta Managed Agents Token Endpoint Auth Basic Response

- `class BetaManagedAgentsTokenEndpointAuthBasicResponse:`

  Token endpoint uses HTTP Basic authentication with client credentials.

  - `required Type Type`

    - `"client_secret_basic"ClientSecretBasic`

### Beta Managed Agents Token Endpoint Auth Basic Update Param

- `class BetaManagedAgentsTokenEndpointAuthBasicUpdateParam:`

  Updated HTTP Basic authentication parameters for the token endpoint.

  - `required Type Type`

    - `"client_secret_basic"ClientSecretBasic`

  - `string? ClientSecret`

    Updated OAuth client secret.

### Beta Managed Agents Token Endpoint Auth None Param

- `class BetaManagedAgentsTokenEndpointAuthNoneParam:`

  Token endpoint requires no client authentication.

  - `required Type Type`

    - `"none"None`

### Beta Managed Agents Token Endpoint Auth None Response

- `class BetaManagedAgentsTokenEndpointAuthNoneResponse:`

  Token endpoint requires no client authentication.

  - `required Type Type`

    - `"none"None`

### Beta Managed Agents Token Endpoint Auth Post Param

- `class BetaManagedAgentsTokenEndpointAuthPostParam:`

  Token endpoint uses POST body authentication with client credentials.

  - `required string ClientSecret`

    OAuth client secret.

  - `required Type Type`

    - `"client_secret_post"ClientSecretPost`

### Beta Managed Agents Token Endpoint Auth Post Response

- `class BetaManagedAgentsTokenEndpointAuthPostResponse:`

  Token endpoint uses POST body authentication with client credentials.

  - `required Type Type`

    - `"client_secret_post"ClientSecretPost`

### Beta Managed Agents Token Endpoint Auth Post Update Param

- `class BetaManagedAgentsTokenEndpointAuthPostUpdateParam:`

  Updated POST body authentication parameters for the token endpoint.

  - `required Type Type`

    - `"client_secret_post"ClientSecretPost`

  - `string? ClientSecret`

    Updated OAuth client secret.

# Memory Stores

## Create a memory store

`BetaManagedAgentsMemoryStore Beta.MemoryStores.Create(MemoryStoreCreateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/memory_stores`

Create a memory store

### Parameters

- `MemoryStoreCreateParams parameters`

  - `required string name`

    Body param: Human-readable name for the store. Required; 1–255 characters; no control characters. The mount-path slug under `/mnt/memory/` is derived from this name (lowercased, non-alphanumeric runs collapsed to a hyphen). Names need not be unique within a workspace.

  - `string description`

    Body param: Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent.

  - `IReadOnlyDictionary<string, string> metadata`

    Body param: Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Not visible to the agent.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsMemoryStore:`

  A `memory_store`: a named container for agent memories, scoped to a workspace. Attach a store to a session via `resources[]` to mount it as a directory the agent can read and write.

  - `required string ID`

    Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls.

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string Name`

    Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name.

  - `required Type Type`

    - `"memory_store"MemoryStore`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `string Description`

    Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset.

  - `IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable.

### Example

```csharp
MemoryStoreCreateParams parameters = new() { Name = "x" };

var betaManagedAgentsMemoryStore = await client.Beta.MemoryStores.Create(parameters);

Console.WriteLine(betaManagedAgentsMemoryStore);
```

#### Response

```json
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "name": "name",
  "type": "memory_store",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "archived_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "metadata": {
    "foo": "string"
  }
}
```

## List memory stores

`MemoryStoreListPageResponse Beta.MemoryStores.List(MemoryStoreListParams?parameters, CancellationTokencancellationToken = default)`

**get** `/v1/memory_stores`

List memory stores

### Parameters

- `MemoryStoreListParams parameters`

  - `DateTimeOffset createdAtGte`

    Query param: Return only stores whose `created_at` is at or after this time (inclusive). Sent on the wire as `created_at[gte]`.

  - `DateTimeOffset createdAtLte`

    Query param: Return only stores whose `created_at` is at or before this time (inclusive). Sent on the wire as `created_at[lte]`.

  - `Boolean includeArchived`

    Query param: When `true`, archived stores are included in the results. Defaults to `false` (archived stores are excluded).

  - `Int limit`

    Query param: Maximum number of stores to return per page. Must be between 1 and 100. Defaults to 20 when omitted.

  - `string page`

    Query param: Opaque pagination cursor (a `page_...` value). Pass the `next_page` value from a previous response to fetch the next page; omit for the first page.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class MemoryStoreListPageResponse:`

  A page of `memory_store` results, ordered by `created_at` descending (newest first).

  - `IReadOnlyList<BetaManagedAgentsMemoryStore> Data`

    Memory stores on this page, newest first. Empty when there are no stores matching the filters.

    - `required string ID`

      Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls.

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string Name`

      Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name.

    - `required Type Type`

      - `"memory_store"MemoryStore`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

    - `DateTimeOffset? ArchivedAt`

      A timestamp in RFC 3339 format

    - `string Description`

      Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset.

    - `IReadOnlyDictionary<string, string> Metadata`

      Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable.

  - `string? NextPage`

    Opaque cursor for the next page (a `page_...` value). Pass as `page` on the next request. `null` when there are no more results.

### Example

```csharp
MemoryStoreListParams parameters = new();

var page = await client.Beta.MemoryStores.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "name": "name",
      "type": "memory_store",
      "updated_at": "2019-12-27T18:11:19.117Z",
      "archived_at": "2019-12-27T18:11:19.117Z",
      "description": "description",
      "metadata": {
        "foo": "string"
      }
    }
  ],
  "next_page": "next_page"
}
```

## Retrieve a memory store

`BetaManagedAgentsMemoryStore Beta.MemoryStores.Retrieve(MemoryStoreRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/memory_stores/{memory_store_id}`

Retrieve a memory store

### Parameters

- `MemoryStoreRetrieveParams parameters`

  - `required string memoryStoreID`

    Path parameter memory_store_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsMemoryStore:`

  A `memory_store`: a named container for agent memories, scoped to a workspace. Attach a store to a session via `resources[]` to mount it as a directory the agent can read and write.

  - `required string ID`

    Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls.

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string Name`

    Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name.

  - `required Type Type`

    - `"memory_store"MemoryStore`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `string Description`

    Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset.

  - `IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable.

### Example

```csharp
MemoryStoreRetrieveParams parameters = new()
{
    MemoryStoreID = "memory_store_id"
};

var betaManagedAgentsMemoryStore = await client.Beta.MemoryStores.Retrieve(parameters);

Console.WriteLine(betaManagedAgentsMemoryStore);
```

#### Response

```json
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "name": "name",
  "type": "memory_store",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "archived_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "metadata": {
    "foo": "string"
  }
}
```

## Update a memory store

`BetaManagedAgentsMemoryStore Beta.MemoryStores.Update(MemoryStoreUpdateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/memory_stores/{memory_store_id}`

Update a memory store

### Parameters

- `MemoryStoreUpdateParams parameters`

  - `required string memoryStoreID`

    Path param: Path parameter memory_store_id

  - `string? description`

    Body param: New description for the store, up to 1024 characters. Pass an empty string to clear it.

  - `IReadOnlyDictionary<string, string>? metadata`

    Body param: Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars.

  - `string? name`

    Body param: New human-readable name for the store. 1–255 characters; no control characters. Renaming changes the slug used for the store's `mount_path` in sessions created after the update.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsMemoryStore:`

  A `memory_store`: a named container for agent memories, scoped to a workspace. Attach a store to a session via `resources[]` to mount it as a directory the agent can read and write.

  - `required string ID`

    Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls.

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string Name`

    Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name.

  - `required Type Type`

    - `"memory_store"MemoryStore`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `string Description`

    Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset.

  - `IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable.

### Example

```csharp
MemoryStoreUpdateParams parameters = new()
{
    MemoryStoreID = "memory_store_id"
};

var betaManagedAgentsMemoryStore = await client.Beta.MemoryStores.Update(parameters);

Console.WriteLine(betaManagedAgentsMemoryStore);
```

#### Response

```json
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "name": "name",
  "type": "memory_store",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "archived_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "metadata": {
    "foo": "string"
  }
}
```

## Delete a memory store

`BetaManagedAgentsDeletedMemoryStore Beta.MemoryStores.Delete(MemoryStoreDeleteParamsparameters, CancellationTokencancellationToken = default)`

**delete** `/v1/memory_stores/{memory_store_id}`

Delete a memory store

### Parameters

- `MemoryStoreDeleteParams parameters`

  - `required string memoryStoreID`

    Path parameter memory_store_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsDeletedMemoryStore:`

  Confirmation that a `memory_store` was deleted.

  - `required string ID`

    ID of the deleted memory store (a `memstore_...` identifier). The store and all its memories and versions are no longer retrievable.

  - `required Type Type`

    - `"memory_store_deleted"MemoryStoreDeleted`

### Example

```csharp
MemoryStoreDeleteParams parameters = new()
{
    MemoryStoreID = "memory_store_id"
};

var betaManagedAgentsDeletedMemoryStore = await client.Beta.MemoryStores.Delete(parameters);

Console.WriteLine(betaManagedAgentsDeletedMemoryStore);
```

#### Response

```json
{
  "id": "id",
  "type": "memory_store_deleted"
}
```

## Archive a memory store

`BetaManagedAgentsMemoryStore Beta.MemoryStores.Archive(MemoryStoreArchiveParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/memory_stores/{memory_store_id}/archive`

Archive a memory store

### Parameters

- `MemoryStoreArchiveParams parameters`

  - `required string memoryStoreID`

    Path parameter memory_store_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsMemoryStore:`

  A `memory_store`: a named container for agent memories, scoped to a workspace. Attach a store to a session via `resources[]` to mount it as a directory the agent can read and write.

  - `required string ID`

    Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls.

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string Name`

    Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name.

  - `required Type Type`

    - `"memory_store"MemoryStore`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `string Description`

    Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset.

  - `IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable.

### Example

```csharp
MemoryStoreArchiveParams parameters = new()
{
    MemoryStoreID = "memory_store_id"
};

var betaManagedAgentsMemoryStore = await client.Beta.MemoryStores.Archive(parameters);

Console.WriteLine(betaManagedAgentsMemoryStore);
```

#### Response

```json
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "name": "name",
  "type": "memory_store",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "archived_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "metadata": {
    "foo": "string"
  }
}
```

## Domain Types

### Beta Managed Agents Deleted Memory Store

- `class BetaManagedAgentsDeletedMemoryStore:`

  Confirmation that a `memory_store` was deleted.

  - `required string ID`

    ID of the deleted memory store (a `memstore_...` identifier). The store and all its memories and versions are no longer retrievable.

  - `required Type Type`

    - `"memory_store_deleted"MemoryStoreDeleted`

### Beta Managed Agents Memory Store

- `class BetaManagedAgentsMemoryStore:`

  A `memory_store`: a named container for agent memories, scoped to a workspace. Attach a store to a session via `resources[]` to mount it as a directory the agent can read and write.

  - `required string ID`

    Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls.

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string Name`

    Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name.

  - `required Type Type`

    - `"memory_store"MemoryStore`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `DateTimeOffset? ArchivedAt`

    A timestamp in RFC 3339 format

  - `string Description`

    Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset.

  - `IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable.

# Memories

## Create a memory

`BetaManagedAgentsMemory Beta.MemoryStores.Memories.Create(MemoryCreateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/memory_stores/{memory_store_id}/memories`

Create a memory

### Parameters

- `MemoryCreateParams parameters`

  - `required string memoryStoreID`

    Path param: Path parameter memory_store_id

  - `required string? content`

    Body param: UTF-8 text content for the new memory. Maximum 100 kB (102,400 bytes). Required; pass `""` explicitly to create an empty memory.

  - `required string path`

    Body param: Hierarchical path for the new memory, e.g. `/projects/foo/notes.md`. Must start with `/`, contain at least one non-empty segment, and be at most 1,024 bytes. Must not contain empty segments, `.` or `..` segments, control or format characters, and must be NFC-normalized. Paths are case-sensitive.

  - `BetaManagedAgentsMemoryView view`

    Query param: Query parameter for view

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsMemory:`

  A `memory` object: a single text document at a hierarchical path inside a memory store. The `content` field is populated when `view=full` and `null` when `view=basic`; the `content_size_bytes` and `content_sha256` fields are always populated so sync clients can diff without fetching content. Memories are addressed by their `mem_...` ID; the path is the create key and can be changed via update.

  - `required string ID`

    Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory.

  - `required string ContentSha256`

    Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`.

  - `required Int ContentSizeBytes`

    Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`.

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string MemoryStoreID`

    ID of the memory store this memory belongs to (a `memstore_...` value).

  - `required string MemoryVersionID`

    ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the full history via [List memory versions](/docs/en/api/beta/memory_stores/memory_versions/list).

  - `required string Path`

    Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes.

  - `required Type Type`

    - `"memory"Memory`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `string? Content`

    The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes).

### Example

```csharp
MemoryCreateParams parameters = new()
{
    MemoryStoreID = "memory_store_id",
    Content = "content",
    Path = "xx",
};

var betaManagedAgentsMemory = await client.Beta.MemoryStores.Memories.Create(parameters);

Console.WriteLine(betaManagedAgentsMemory);
```

#### Response

```json
{
  "id": "id",
  "content_sha256": "content_sha256",
  "content_size_bytes": 0,
  "created_at": "2019-12-27T18:11:19.117Z",
  "memory_store_id": "memory_store_id",
  "memory_version_id": "memory_version_id",
  "path": "path",
  "type": "memory",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "content": "content"
}
```

## List memories

`MemoryListPageResponse Beta.MemoryStores.Memories.List(MemoryListParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/memory_stores/{memory_store_id}/memories`

List memories

### Parameters

- `MemoryListParams parameters`

  - `required string memoryStoreID`

    Path param: Path parameter memory_store_id

  - `Int depth`

    Query param: Query parameter for depth

  - `Int limit`

    Query param: Query parameter for limit

  - `Order order`

    Query param: Query parameter for order

    - `"asc"Asc`

    - `"desc"Desc`

  - `string orderBy`

    Query param: Query parameter for order_by

  - `string page`

    Query param: Query parameter for page

  - `string pathPrefix`

    Query param: Optional path prefix filter (raw string-prefix match; include a trailing slash for directory-scoped lists). This value appears in request URLs. Do not include secrets or personally identifiable information.

  - `BetaManagedAgentsMemoryView view`

    Query param: Query parameter for view

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class MemoryListPageResponse:`

  Response payload for [List memories](/docs/en/api/beta/memory_stores/memories/list).

  - `IReadOnlyList<BetaManagedAgentsMemoryListItem> Data`

    One page of results. Each item is either a `memory` object or, when `depth` was set, a `memory_prefix` rollup marker. Items appear in the requested `order_by`/`order`.

    - `class BetaManagedAgentsMemory:`

      A `memory` object: a single text document at a hierarchical path inside a memory store. The `content` field is populated when `view=full` and `null` when `view=basic`; the `content_size_bytes` and `content_sha256` fields are always populated so sync clients can diff without fetching content. Memories are addressed by their `mem_...` ID; the path is the create key and can be changed via update.

      - `required string ID`

        Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory.

      - `required string ContentSha256`

        Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`.

      - `required Int ContentSizeBytes`

        Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`.

      - `required DateTimeOffset CreatedAt`

        A timestamp in RFC 3339 format

      - `required string MemoryStoreID`

        ID of the memory store this memory belongs to (a `memstore_...` value).

      - `required string MemoryVersionID`

        ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the full history via [List memory versions](/docs/en/api/beta/memory_stores/memory_versions/list).

      - `required string Path`

        Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes.

      - `required Type Type`

        - `"memory"Memory`

      - `required DateTimeOffset UpdatedAt`

        A timestamp in RFC 3339 format

      - `string? Content`

        The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes).

    - `class BetaManagedAgentsMemoryPrefix:`

      A rolled-up directory marker returned by [List memories](/docs/en/api/beta/memory_stores/memories/list) when `depth` is set. Indicates that one or more memories exist deeper than the requested depth under this prefix. This is a list-time rollup, not a stored resource; it has no ID and no lifecycle. Each prefix counts toward the page `limit` and interleaves with `memory` items in path order.

      - `required string Path`

        The rolled-up path prefix, including a trailing `/` (e.g. `/projects/foo/`). Pass this value as `path_prefix` on a subsequent list call to drill into the directory.

      - `required Type Type`

        - `"memory_prefix"MemoryPrefix`

  - `string? NextPage`

    Opaque cursor for the next page (a `page_...` value), or `null` if there are no more results. Pass as `page` on the next request.

### Example

```csharp
MemoryListParams parameters = new() { MemoryStoreID = "memory_store_id" };

var page = await client.Beta.MemoryStores.Memories.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "content_sha256": "content_sha256",
      "content_size_bytes": 0,
      "created_at": "2019-12-27T18:11:19.117Z",
      "memory_store_id": "memory_store_id",
      "memory_version_id": "memory_version_id",
      "path": "path",
      "type": "memory",
      "updated_at": "2019-12-27T18:11:19.117Z",
      "content": "content"
    }
  ],
  "next_page": "next_page"
}
```

## Retrieve a memory

`BetaManagedAgentsMemory Beta.MemoryStores.Memories.Retrieve(MemoryRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/memory_stores/{memory_store_id}/memories/{memory_id}`

Retrieve a memory

### Parameters

- `MemoryRetrieveParams parameters`

  - `required string memoryStoreID`

    Path param: Path parameter memory_store_id

  - `required string memoryID`

    Path param: Path parameter memory_id

  - `BetaManagedAgentsMemoryView view`

    Query param: Query parameter for view

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsMemory:`

  A `memory` object: a single text document at a hierarchical path inside a memory store. The `content` field is populated when `view=full` and `null` when `view=basic`; the `content_size_bytes` and `content_sha256` fields are always populated so sync clients can diff without fetching content. Memories are addressed by their `mem_...` ID; the path is the create key and can be changed via update.

  - `required string ID`

    Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory.

  - `required string ContentSha256`

    Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`.

  - `required Int ContentSizeBytes`

    Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`.

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string MemoryStoreID`

    ID of the memory store this memory belongs to (a `memstore_...` value).

  - `required string MemoryVersionID`

    ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the full history via [List memory versions](/docs/en/api/beta/memory_stores/memory_versions/list).

  - `required string Path`

    Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes.

  - `required Type Type`

    - `"memory"Memory`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `string? Content`

    The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes).

### Example

```csharp
MemoryRetrieveParams parameters = new()
{
    MemoryStoreID = "memory_store_id",
    MemoryID = "memory_id",
};

var betaManagedAgentsMemory = await client.Beta.MemoryStores.Memories.Retrieve(parameters);

Console.WriteLine(betaManagedAgentsMemory);
```

#### Response

```json
{
  "id": "id",
  "content_sha256": "content_sha256",
  "content_size_bytes": 0,
  "created_at": "2019-12-27T18:11:19.117Z",
  "memory_store_id": "memory_store_id",
  "memory_version_id": "memory_version_id",
  "path": "path",
  "type": "memory",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "content": "content"
}
```

## Update a memory

`BetaManagedAgentsMemory Beta.MemoryStores.Memories.Update(MemoryUpdateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/memory_stores/{memory_store_id}/memories/{memory_id}`

Update a memory

### Parameters

- `MemoryUpdateParams parameters`

  - `required string memoryStoreID`

    Path param: Path parameter memory_store_id

  - `required string memoryID`

    Path param: Path parameter memory_id

  - `BetaManagedAgentsMemoryView view`

    Query param: Query parameter for view

  - `string? content`

    Body param: New UTF-8 text content for the memory. Maximum 100 kB (102,400 bytes). Omit to leave the content unchanged (e.g., for a rename-only update).

  - `string? path`

    Body param: New path for the memory (a rename). Must start with `/`, contain at least one non-empty segment, and be at most 1,024 bytes. Must not contain empty segments, `.` or `..` segments, control or format characters, and must be NFC-normalized. Paths are case-sensitive. The memory's `id` is preserved across renames. Omit to leave the path unchanged.

  - `BetaManagedAgentsPrecondition precondition`

    Body param: Optimistic-concurrency precondition: the update applies only if the memory's stored `content_sha256` equals the supplied value. On mismatch, the request returns `memory_precondition_failed_error` (HTTP 409); re-read the memory and retry against the fresh state. If the precondition fails but the stored state already exactly matches the requested `content` and `path`, the server returns 200 instead of 409.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsMemory:`

  A `memory` object: a single text document at a hierarchical path inside a memory store. The `content` field is populated when `view=full` and `null` when `view=basic`; the `content_size_bytes` and `content_sha256` fields are always populated so sync clients can diff without fetching content. Memories are addressed by their `mem_...` ID; the path is the create key and can be changed via update.

  - `required string ID`

    Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory.

  - `required string ContentSha256`

    Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`.

  - `required Int ContentSizeBytes`

    Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`.

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string MemoryStoreID`

    ID of the memory store this memory belongs to (a `memstore_...` value).

  - `required string MemoryVersionID`

    ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the full history via [List memory versions](/docs/en/api/beta/memory_stores/memory_versions/list).

  - `required string Path`

    Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes.

  - `required Type Type`

    - `"memory"Memory`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `string? Content`

    The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes).

### Example

```csharp
MemoryUpdateParams parameters = new()
{
    MemoryStoreID = "memory_store_id",
    MemoryID = "memory_id",
};

var betaManagedAgentsMemory = await client.Beta.MemoryStores.Memories.Update(parameters);

Console.WriteLine(betaManagedAgentsMemory);
```

#### Response

```json
{
  "id": "id",
  "content_sha256": "content_sha256",
  "content_size_bytes": 0,
  "created_at": "2019-12-27T18:11:19.117Z",
  "memory_store_id": "memory_store_id",
  "memory_version_id": "memory_version_id",
  "path": "path",
  "type": "memory",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "content": "content"
}
```

## Delete a memory

`BetaManagedAgentsDeletedMemory Beta.MemoryStores.Memories.Delete(MemoryDeleteParamsparameters, CancellationTokencancellationToken = default)`

**delete** `/v1/memory_stores/{memory_store_id}/memories/{memory_id}`

Delete a memory

### Parameters

- `MemoryDeleteParams parameters`

  - `required string memoryStoreID`

    Path param: Path parameter memory_store_id

  - `required string memoryID`

    Path param: Path parameter memory_id

  - `string expectedContentSha256`

    Query param: Query parameter for expected_content_sha256

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsDeletedMemory:`

  Tombstone returned by [Delete a memory](/docs/en/api/beta/memory_stores/memories/delete). The memory's version history persists and remains listable via [List memory versions](/docs/en/api/beta/memory_stores/memory_versions/list) until the store itself is deleted.

  - `required string ID`

    ID of the deleted memory (a `mem_...` value).

  - `required Type Type`

    - `"memory_deleted"MemoryDeleted`

### Example

```csharp
MemoryDeleteParams parameters = new()
{
    MemoryStoreID = "memory_store_id",
    MemoryID = "memory_id",
};

var betaManagedAgentsDeletedMemory = await client.Beta.MemoryStores.Memories.Delete(parameters);

Console.WriteLine(betaManagedAgentsDeletedMemory);
```

#### Response

```json
{
  "id": "id",
  "type": "memory_deleted"
}
```

## Domain Types

### Beta Managed Agents Conflict Error

- `class BetaManagedAgentsConflictError:`

  - `required Type Type`

    - `"conflict_error"ConflictError`

  - `string Message`

### Beta Managed Agents Content Sha256 Precondition

- `class BetaManagedAgentsContentSha256Precondition:`

  Optimistic-concurrency precondition: the update applies only if the memory's stored `content_sha256` equals the supplied value. On mismatch, the request returns `memory_precondition_failed_error` (HTTP 409); re-read the memory and retry against the fresh state. If the precondition fails but the stored state already exactly matches the requested `content` and `path`, the server returns 200 instead of 409.

  - `required Type Type`

    - `"content_sha256"ContentSha256`

  - `string ContentSha256`

    Expected `content_sha256` of the stored memory (64 lowercase hexadecimal characters). Typically the `content_sha256` returned by a prior read or list call. Because the server applies no content normalization, clients can also compute this locally as the SHA-256 of the UTF-8 content bytes.

### Beta Managed Agents Deleted Memory

- `class BetaManagedAgentsDeletedMemory:`

  Tombstone returned by [Delete a memory](/docs/en/api/beta/memory_stores/memories/delete). The memory's version history persists and remains listable via [List memory versions](/docs/en/api/beta/memory_stores/memory_versions/list) until the store itself is deleted.

  - `required string ID`

    ID of the deleted memory (a `mem_...` value).

  - `required Type Type`

    - `"memory_deleted"MemoryDeleted`

### Beta Managed Agents Error

- `class BetaManagedAgentsError: A class that can be one of several variants.union`

  - `class BetaInvalidRequestError:`

    - `required string Message`

    - `JsonElement Type "invalid_request_error"constant`

  - `class BetaAuthenticationError:`

    - `required string Message`

    - `JsonElement Type "authentication_error"constant`

  - `class BetaBillingError:`

    - `required string Message`

    - `JsonElement Type "billing_error"constant`

  - `class BetaPermissionError:`

    - `required string Message`

    - `JsonElement Type "permission_error"constant`

  - `class BetaNotFoundError:`

    - `required string Message`

    - `JsonElement Type "not_found_error"constant`

  - `class BetaRateLimitError:`

    - `required string Message`

    - `JsonElement Type "rate_limit_error"constant`

  - `class BetaGatewayTimeoutError:`

    - `required string Message`

    - `JsonElement Type "timeout_error"constant`

  - `class BetaApiError:`

    - `required string Message`

    - `JsonElement Type "api_error"constant`

  - `class BetaOverloadedError:`

    - `required string Message`

    - `JsonElement Type "overloaded_error"constant`

  - `class BetaManagedAgentsMemoryPreconditionFailedError:`

    - `required Type Type`

      - `"memory_precondition_failed_error"MemoryPreconditionFailedError`

    - `string Message`

  - `class BetaManagedAgentsMemoryPathConflictError:`

    - `required Type Type`

      - `"memory_path_conflict_error"MemoryPathConflictError`

    - `string ConflictingMemoryID`

    - `string ConflictingPath`

    - `string Message`

  - `class BetaManagedAgentsConflictError:`

    - `required Type Type`

      - `"conflict_error"ConflictError`

    - `string Message`

### Beta Managed Agents Memory

- `class BetaManagedAgentsMemory:`

  A `memory` object: a single text document at a hierarchical path inside a memory store. The `content` field is populated when `view=full` and `null` when `view=basic`; the `content_size_bytes` and `content_sha256` fields are always populated so sync clients can diff without fetching content. Memories are addressed by their `mem_...` ID; the path is the create key and can be changed via update.

  - `required string ID`

    Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory.

  - `required string ContentSha256`

    Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`.

  - `required Int ContentSizeBytes`

    Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`.

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string MemoryStoreID`

    ID of the memory store this memory belongs to (a `memstore_...` value).

  - `required string MemoryVersionID`

    ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the full history via [List memory versions](/docs/en/api/beta/memory_stores/memory_versions/list).

  - `required string Path`

    Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes.

  - `required Type Type`

    - `"memory"Memory`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `string? Content`

    The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes).

### Beta Managed Agents Memory List Item

- `class BetaManagedAgentsMemoryListItem: A class that can be one of several variants.union`

  One item in a [List memories](/docs/en/api/beta/memory_stores/memories/list) response: either a `memory` object or, when `depth` is set, a `memory_prefix` rollup marker.

  - `class BetaManagedAgentsMemory:`

    A `memory` object: a single text document at a hierarchical path inside a memory store. The `content` field is populated when `view=full` and `null` when `view=basic`; the `content_size_bytes` and `content_sha256` fields are always populated so sync clients can diff without fetching content. Memories are addressed by their `mem_...` ID; the path is the create key and can be changed via update.

    - `required string ID`

      Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory.

    - `required string ContentSha256`

      Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`.

    - `required Int ContentSizeBytes`

      Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`.

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string MemoryStoreID`

      ID of the memory store this memory belongs to (a `memstore_...` value).

    - `required string MemoryVersionID`

      ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the full history via [List memory versions](/docs/en/api/beta/memory_stores/memory_versions/list).

    - `required string Path`

      Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes.

    - `required Type Type`

      - `"memory"Memory`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

    - `string? Content`

      The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes).

  - `class BetaManagedAgentsMemoryPrefix:`

    A rolled-up directory marker returned by [List memories](/docs/en/api/beta/memory_stores/memories/list) when `depth` is set. Indicates that one or more memories exist deeper than the requested depth under this prefix. This is a list-time rollup, not a stored resource; it has no ID and no lifecycle. Each prefix counts toward the page `limit` and interleaves with `memory` items in path order.

    - `required string Path`

      The rolled-up path prefix, including a trailing `/` (e.g. `/projects/foo/`). Pass this value as `path_prefix` on a subsequent list call to drill into the directory.

    - `required Type Type`

      - `"memory_prefix"MemoryPrefix`

### Beta Managed Agents Memory Path Conflict Error

- `class BetaManagedAgentsMemoryPathConflictError:`

  - `required Type Type`

    - `"memory_path_conflict_error"MemoryPathConflictError`

  - `string ConflictingMemoryID`

  - `string ConflictingPath`

  - `string Message`

### Beta Managed Agents Memory Precondition Failed Error

- `class BetaManagedAgentsMemoryPreconditionFailedError:`

  - `required Type Type`

    - `"memory_precondition_failed_error"MemoryPreconditionFailedError`

  - `string Message`

### Beta Managed Agents Memory Prefix

- `class BetaManagedAgentsMemoryPrefix:`

  A rolled-up directory marker returned by [List memories](/docs/en/api/beta/memory_stores/memories/list) when `depth` is set. Indicates that one or more memories exist deeper than the requested depth under this prefix. This is a list-time rollup, not a stored resource; it has no ID and no lifecycle. Each prefix counts toward the page `limit` and interleaves with `memory` items in path order.

  - `required string Path`

    The rolled-up path prefix, including a trailing `/` (e.g. `/projects/foo/`). Pass this value as `path_prefix` on a subsequent list call to drill into the directory.

  - `required Type Type`

    - `"memory_prefix"MemoryPrefix`

### Beta Managed Agents Memory View

- `enum BetaManagedAgentsMemoryView:`

  Selects which projection of a `memory` or `memory_version` the server returns. `basic` returns the object with `content` set to `null`; `full` populates `content`. When omitted, the default is endpoint-specific: retrieve operations default to `full`; list, create, and update operations default to `basic`. Listing with `view=full` caps `limit` at 20.

  - `"basic"Basic`

  - `"full"Full`

### Beta Managed Agents Precondition

- `class BetaManagedAgentsPrecondition:`

  Optimistic-concurrency precondition: the update applies only if the memory's stored `content_sha256` equals the supplied value. On mismatch, the request returns `memory_precondition_failed_error` (HTTP 409); re-read the memory and retry against the fresh state. If the precondition fails but the stored state already exactly matches the requested `content` and `path`, the server returns 200 instead of 409.

  - `required Type Type`

    - `"content_sha256"ContentSha256`

  - `string ContentSha256`

    Expected `content_sha256` of the stored memory (64 lowercase hexadecimal characters). Typically the `content_sha256` returned by a prior read or list call. Because the server applies no content normalization, clients can also compute this locally as the SHA-256 of the UTF-8 content bytes.

# Memory Versions

## List memory versions

`MemoryVersionListPageResponse Beta.MemoryStores.MemoryVersions.List(MemoryVersionListParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/memory_stores/{memory_store_id}/memory_versions`

List memory versions

### Parameters

- `MemoryVersionListParams parameters`

  - `required string memoryStoreID`

    Path param: Path parameter memory_store_id

  - `string apiKeyID`

    Query param: Query parameter for api_key_id

  - `DateTimeOffset createdAtGte`

    Query param: Return versions created at or after this time (inclusive).

  - `DateTimeOffset createdAtLte`

    Query param: Return versions created at or before this time (inclusive).

  - `Int limit`

    Query param: Query parameter for limit

  - `string memoryID`

    Query param: Query parameter for memory_id

  - `BetaManagedAgentsMemoryVersionOperation operation`

    Query param: Query parameter for operation

  - `string page`

    Query param: Query parameter for page

  - `string sessionID`

    Query param: Query parameter for session_id

  - `BetaManagedAgentsMemoryView view`

    Query param: Query parameter for view

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class MemoryVersionListPageResponse:`

  Response payload for [List memory versions](/docs/en/api/beta/memory_stores/memory_versions/list).

  - `IReadOnlyList<BetaManagedAgentsMemoryVersion> Data`

    One page of `memory_version` objects, ordered by `created_at` descending (newest first), with `id` as tiebreak.

    - `required string ID`

      Unique identifier for this version (a `memver_...` value).

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required string MemoryID`

      ID of the memory this version snapshots (a `mem_...` value). Remains valid after the memory is deleted; pass it as `memory_id` to [List memory versions](/docs/en/api/beta/memory_stores/memory_versions/list) to retrieve the full lineage including the `deleted` row.

    - `required string MemoryStoreID`

      ID of the memory store this version belongs to (a `memstore_...` value).

    - `required BetaManagedAgentsMemoryVersionOperation Operation`

      The kind of mutation a `memory_version` records. Every non-no-op mutation to a memory appends exactly one version row with one of these values.

      - `"created"Created`

      - `"modified"Modified`

      - `"deleted"Deleted`

    - `required Type Type`

      - `"memory_version"MemoryVersion`

    - `string? Content`

      The memory's UTF-8 text content as of this version. `null` when `view=basic`, when `operation` is `deleted`, or when `redacted_at` is set.

    - `string? ContentSha256`

      Lowercase hex SHA-256 digest of `content` as of this version (64 characters). `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.

    - `Int? ContentSizeBytes`

      Size of `content` in bytes as of this version. `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.

    - `BetaManagedAgentsActor CreatedBy`

      Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/docs/en/api/sessions-retrieve).

      - `class BetaManagedAgentsSessionActor:`

        Attribution for a write made by an agent during a session, through the mounted filesystem at `/mnt/memory/`.

        - `required string SessionID`

          ID of the session that performed the write (a `sesn_...` value). Look up the session via [Retrieve a session](/docs/en/api/sessions-retrieve) for further provenance.

        - `required Type Type`

          - `"session_actor"SessionActor`

      - `class BetaManagedAgentsApiActor:`

        Attribution for a write made directly via the public API (outside of any session).

        - `required string ApiKeyID`

          ID of the API key that performed the write. This identifies the key, not the secret.

        - `required Type Type`

          - `"api_actor"ApiActor`

      - `class BetaManagedAgentsUserActor:`

        Attribution for a write made by a human user through the Anthropic Console.

        - `required Type Type`

          - `"user_actor"UserActor`

        - `required string UserID`

          ID of the user who performed the write (a `user_...` value).

    - `string? Path`

      The memory's path at the time of this write. `null` if and only if `redacted_at` is set.

    - `DateTimeOffset? RedactedAt`

      A timestamp in RFC 3339 format

    - `BetaManagedAgentsActor RedactedBy`

      Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/docs/en/api/sessions-retrieve).

  - `string? NextPage`

    Opaque cursor for the next page (a `page_...` value), or `null` if there are no more results. Pass as `page` on the next request.

### Example

```csharp
MemoryVersionListParams parameters = new()
{
    MemoryStoreID = "memory_store_id"
};

var page = await client.Beta.MemoryStores.MemoryVersions.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "memory_id": "memory_id",
      "memory_store_id": "memory_store_id",
      "operation": "created",
      "type": "memory_version",
      "content": "content",
      "content_sha256": "content_sha256",
      "content_size_bytes": 0,
      "created_by": {
        "session_id": "x",
        "type": "session_actor"
      },
      "path": "path",
      "redacted_at": "2019-12-27T18:11:19.117Z",
      "redacted_by": {
        "session_id": "x",
        "type": "session_actor"
      }
    }
  ],
  "next_page": "next_page"
}
```

## Retrieve a memory version

`BetaManagedAgentsMemoryVersion Beta.MemoryStores.MemoryVersions.Retrieve(MemoryVersionRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/memory_stores/{memory_store_id}/memory_versions/{memory_version_id}`

Retrieve a memory version

### Parameters

- `MemoryVersionRetrieveParams parameters`

  - `required string memoryStoreID`

    Path param: Path parameter memory_store_id

  - `required string memoryVersionID`

    Path param: Path parameter memory_version_id

  - `BetaManagedAgentsMemoryView view`

    Query param: Query parameter for view

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsMemoryVersion:`

  A `memory_version` object: one immutable, attributed row in a memory's append-only history. Every non-no-op mutation to a memory produces a new version. Versions belong to the store (not the individual memory) and persist after the memory is deleted. Retrieving a redacted version returns 200 with `content`, `path`, `content_size_bytes`, and `content_sha256` set to `null`; branch on `redacted_at`, not HTTP status.

  - `required string ID`

    Unique identifier for this version (a `memver_...` value).

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string MemoryID`

    ID of the memory this version snapshots (a `mem_...` value). Remains valid after the memory is deleted; pass it as `memory_id` to [List memory versions](/docs/en/api/beta/memory_stores/memory_versions/list) to retrieve the full lineage including the `deleted` row.

  - `required string MemoryStoreID`

    ID of the memory store this version belongs to (a `memstore_...` value).

  - `required BetaManagedAgentsMemoryVersionOperation Operation`

    The kind of mutation a `memory_version` records. Every non-no-op mutation to a memory appends exactly one version row with one of these values.

    - `"created"Created`

    - `"modified"Modified`

    - `"deleted"Deleted`

  - `required Type Type`

    - `"memory_version"MemoryVersion`

  - `string? Content`

    The memory's UTF-8 text content as of this version. `null` when `view=basic`, when `operation` is `deleted`, or when `redacted_at` is set.

  - `string? ContentSha256`

    Lowercase hex SHA-256 digest of `content` as of this version (64 characters). `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.

  - `Int? ContentSizeBytes`

    Size of `content` in bytes as of this version. `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.

  - `BetaManagedAgentsActor CreatedBy`

    Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/docs/en/api/sessions-retrieve).

    - `class BetaManagedAgentsSessionActor:`

      Attribution for a write made by an agent during a session, through the mounted filesystem at `/mnt/memory/`.

      - `required string SessionID`

        ID of the session that performed the write (a `sesn_...` value). Look up the session via [Retrieve a session](/docs/en/api/sessions-retrieve) for further provenance.

      - `required Type Type`

        - `"session_actor"SessionActor`

    - `class BetaManagedAgentsApiActor:`

      Attribution for a write made directly via the public API (outside of any session).

      - `required string ApiKeyID`

        ID of the API key that performed the write. This identifies the key, not the secret.

      - `required Type Type`

        - `"api_actor"ApiActor`

    - `class BetaManagedAgentsUserActor:`

      Attribution for a write made by a human user through the Anthropic Console.

      - `required Type Type`

        - `"user_actor"UserActor`

      - `required string UserID`

        ID of the user who performed the write (a `user_...` value).

  - `string? Path`

    The memory's path at the time of this write. `null` if and only if `redacted_at` is set.

  - `DateTimeOffset? RedactedAt`

    A timestamp in RFC 3339 format

  - `BetaManagedAgentsActor RedactedBy`

    Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/docs/en/api/sessions-retrieve).

### Example

```csharp
MemoryVersionRetrieveParams parameters = new()
{
    MemoryStoreID = "memory_store_id",
    MemoryVersionID = "memory_version_id",
};

var betaManagedAgentsMemoryVersion = await client.Beta.MemoryStores.MemoryVersions.Retrieve(parameters);

Console.WriteLine(betaManagedAgentsMemoryVersion);
```

#### Response

```json
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "memory_id": "memory_id",
  "memory_store_id": "memory_store_id",
  "operation": "created",
  "type": "memory_version",
  "content": "content",
  "content_sha256": "content_sha256",
  "content_size_bytes": 0,
  "created_by": {
    "session_id": "x",
    "type": "session_actor"
  },
  "path": "path",
  "redacted_at": "2019-12-27T18:11:19.117Z",
  "redacted_by": {
    "session_id": "x",
    "type": "session_actor"
  }
}
```

## Redact a memory version

`BetaManagedAgentsMemoryVersion Beta.MemoryStores.MemoryVersions.Redact(MemoryVersionRedactParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/memory_stores/{memory_store_id}/memory_versions/{memory_version_id}/redact`

Redact a memory version

### Parameters

- `MemoryVersionRedactParams parameters`

  - `required string memoryStoreID`

    Path param: Path parameter memory_store_id

  - `required string memoryVersionID`

    Path param: Path parameter memory_version_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaManagedAgentsMemoryVersion:`

  A `memory_version` object: one immutable, attributed row in a memory's append-only history. Every non-no-op mutation to a memory produces a new version. Versions belong to the store (not the individual memory) and persist after the memory is deleted. Retrieving a redacted version returns 200 with `content`, `path`, `content_size_bytes`, and `content_sha256` set to `null`; branch on `redacted_at`, not HTTP status.

  - `required string ID`

    Unique identifier for this version (a `memver_...` value).

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string MemoryID`

    ID of the memory this version snapshots (a `mem_...` value). Remains valid after the memory is deleted; pass it as `memory_id` to [List memory versions](/docs/en/api/beta/memory_stores/memory_versions/list) to retrieve the full lineage including the `deleted` row.

  - `required string MemoryStoreID`

    ID of the memory store this version belongs to (a `memstore_...` value).

  - `required BetaManagedAgentsMemoryVersionOperation Operation`

    The kind of mutation a `memory_version` records. Every non-no-op mutation to a memory appends exactly one version row with one of these values.

    - `"created"Created`

    - `"modified"Modified`

    - `"deleted"Deleted`

  - `required Type Type`

    - `"memory_version"MemoryVersion`

  - `string? Content`

    The memory's UTF-8 text content as of this version. `null` when `view=basic`, when `operation` is `deleted`, or when `redacted_at` is set.

  - `string? ContentSha256`

    Lowercase hex SHA-256 digest of `content` as of this version (64 characters). `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.

  - `Int? ContentSizeBytes`

    Size of `content` in bytes as of this version. `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.

  - `BetaManagedAgentsActor CreatedBy`

    Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/docs/en/api/sessions-retrieve).

    - `class BetaManagedAgentsSessionActor:`

      Attribution for a write made by an agent during a session, through the mounted filesystem at `/mnt/memory/`.

      - `required string SessionID`

        ID of the session that performed the write (a `sesn_...` value). Look up the session via [Retrieve a session](/docs/en/api/sessions-retrieve) for further provenance.

      - `required Type Type`

        - `"session_actor"SessionActor`

    - `class BetaManagedAgentsApiActor:`

      Attribution for a write made directly via the public API (outside of any session).

      - `required string ApiKeyID`

        ID of the API key that performed the write. This identifies the key, not the secret.

      - `required Type Type`

        - `"api_actor"ApiActor`

    - `class BetaManagedAgentsUserActor:`

      Attribution for a write made by a human user through the Anthropic Console.

      - `required Type Type`

        - `"user_actor"UserActor`

      - `required string UserID`

        ID of the user who performed the write (a `user_...` value).

  - `string? Path`

    The memory's path at the time of this write. `null` if and only if `redacted_at` is set.

  - `DateTimeOffset? RedactedAt`

    A timestamp in RFC 3339 format

  - `BetaManagedAgentsActor RedactedBy`

    Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/docs/en/api/sessions-retrieve).

### Example

```csharp
MemoryVersionRedactParams parameters = new()
{
    MemoryStoreID = "memory_store_id",
    MemoryVersionID = "memory_version_id",
};

var betaManagedAgentsMemoryVersion = await client.Beta.MemoryStores.MemoryVersions.Redact(parameters);

Console.WriteLine(betaManagedAgentsMemoryVersion);
```

#### Response

```json
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "memory_id": "memory_id",
  "memory_store_id": "memory_store_id",
  "operation": "created",
  "type": "memory_version",
  "content": "content",
  "content_sha256": "content_sha256",
  "content_size_bytes": 0,
  "created_by": {
    "session_id": "x",
    "type": "session_actor"
  },
  "path": "path",
  "redacted_at": "2019-12-27T18:11:19.117Z",
  "redacted_by": {
    "session_id": "x",
    "type": "session_actor"
  }
}
```

## Domain Types

### Beta Managed Agents Actor

- `class BetaManagedAgentsActor: A class that can be one of several variants.union`

  Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/docs/en/api/sessions-retrieve).

  - `class BetaManagedAgentsSessionActor:`

    Attribution for a write made by an agent during a session, through the mounted filesystem at `/mnt/memory/`.

    - `required string SessionID`

      ID of the session that performed the write (a `sesn_...` value). Look up the session via [Retrieve a session](/docs/en/api/sessions-retrieve) for further provenance.

    - `required Type Type`

      - `"session_actor"SessionActor`

  - `class BetaManagedAgentsApiActor:`

    Attribution for a write made directly via the public API (outside of any session).

    - `required string ApiKeyID`

      ID of the API key that performed the write. This identifies the key, not the secret.

    - `required Type Type`

      - `"api_actor"ApiActor`

  - `class BetaManagedAgentsUserActor:`

    Attribution for a write made by a human user through the Anthropic Console.

    - `required Type Type`

      - `"user_actor"UserActor`

    - `required string UserID`

      ID of the user who performed the write (a `user_...` value).

### Beta Managed Agents API Actor

- `class BetaManagedAgentsApiActor:`

  Attribution for a write made directly via the public API (outside of any session).

  - `required string ApiKeyID`

    ID of the API key that performed the write. This identifies the key, not the secret.

  - `required Type Type`

    - `"api_actor"ApiActor`

### Beta Managed Agents Memory Version

- `class BetaManagedAgentsMemoryVersion:`

  A `memory_version` object: one immutable, attributed row in a memory's append-only history. Every non-no-op mutation to a memory produces a new version. Versions belong to the store (not the individual memory) and persist after the memory is deleted. Retrieving a redacted version returns 200 with `content`, `path`, `content_size_bytes`, and `content_sha256` set to `null`; branch on `redacted_at`, not HTTP status.

  - `required string ID`

    Unique identifier for this version (a `memver_...` value).

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required string MemoryID`

    ID of the memory this version snapshots (a `mem_...` value). Remains valid after the memory is deleted; pass it as `memory_id` to [List memory versions](/docs/en/api/beta/memory_stores/memory_versions/list) to retrieve the full lineage including the `deleted` row.

  - `required string MemoryStoreID`

    ID of the memory store this version belongs to (a `memstore_...` value).

  - `required BetaManagedAgentsMemoryVersionOperation Operation`

    The kind of mutation a `memory_version` records. Every non-no-op mutation to a memory appends exactly one version row with one of these values.

    - `"created"Created`

    - `"modified"Modified`

    - `"deleted"Deleted`

  - `required Type Type`

    - `"memory_version"MemoryVersion`

  - `string? Content`

    The memory's UTF-8 text content as of this version. `null` when `view=basic`, when `operation` is `deleted`, or when `redacted_at` is set.

  - `string? ContentSha256`

    Lowercase hex SHA-256 digest of `content` as of this version (64 characters). `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.

  - `Int? ContentSizeBytes`

    Size of `content` in bytes as of this version. `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.

  - `BetaManagedAgentsActor CreatedBy`

    Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/docs/en/api/sessions-retrieve).

    - `class BetaManagedAgentsSessionActor:`

      Attribution for a write made by an agent during a session, through the mounted filesystem at `/mnt/memory/`.

      - `required string SessionID`

        ID of the session that performed the write (a `sesn_...` value). Look up the session via [Retrieve a session](/docs/en/api/sessions-retrieve) for further provenance.

      - `required Type Type`

        - `"session_actor"SessionActor`

    - `class BetaManagedAgentsApiActor:`

      Attribution for a write made directly via the public API (outside of any session).

      - `required string ApiKeyID`

        ID of the API key that performed the write. This identifies the key, not the secret.

      - `required Type Type`

        - `"api_actor"ApiActor`

    - `class BetaManagedAgentsUserActor:`

      Attribution for a write made by a human user through the Anthropic Console.

      - `required Type Type`

        - `"user_actor"UserActor`

      - `required string UserID`

        ID of the user who performed the write (a `user_...` value).

  - `string? Path`

    The memory's path at the time of this write. `null` if and only if `redacted_at` is set.

  - `DateTimeOffset? RedactedAt`

    A timestamp in RFC 3339 format

  - `BetaManagedAgentsActor RedactedBy`

    Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/docs/en/api/sessions-retrieve).

### Beta Managed Agents Memory Version Operation

- `enum BetaManagedAgentsMemoryVersionOperation:`

  The kind of mutation a `memory_version` records. Every non-no-op mutation to a memory appends exactly one version row with one of these values.

  - `"created"Created`

  - `"modified"Modified`

  - `"deleted"Deleted`

### Beta Managed Agents Session Actor

- `class BetaManagedAgentsSessionActor:`

  Attribution for a write made by an agent during a session, through the mounted filesystem at `/mnt/memory/`.

  - `required string SessionID`

    ID of the session that performed the write (a `sesn_...` value). Look up the session via [Retrieve a session](/docs/en/api/sessions-retrieve) for further provenance.

  - `required Type Type`

    - `"session_actor"SessionActor`

### Beta Managed Agents User Actor

- `class BetaManagedAgentsUserActor:`

  Attribution for a write made by a human user through the Anthropic Console.

  - `required Type Type`

    - `"user_actor"UserActor`

  - `required string UserID`

    ID of the user who performed the write (a `user_...` value).

# Files

## Upload File

`FileMetadata Beta.Files.Upload(FileUploadParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/files`

Upload File

### Parameters

- `FileUploadParams parameters`

  - `required string file`

    Body param: The file to upload

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class FileMetadata:`

  - `required string ID`

    Unique object identifier.

    The format and length of IDs may change over time.

  - `required DateTimeOffset CreatedAt`

    RFC 3339 datetime string representing when the file was created.

  - `required string Filename`

    Original filename of the uploaded file.

  - `required string MimeType`

    MIME type of the file.

  - `required Long SizeBytes`

    Size of the file in bytes.

  - `JsonElement Type "file"constant`

    Object type.

    For files, this is always `"file"`.

  - `Boolean Downloadable`

    Whether the file can be downloaded.

  - `BetaFileScope? Scope`

    The scope of this file, indicating the context in which it was created (e.g., a session).

    - `required string ID`

      The ID of the scoping resource (e.g., the session ID).

    - `JsonElement Type "session"constant`

      The type of scope (e.g., `"session"`).

### Example

```csharp
FileUploadParams parameters = new()
{
    File = Encoding.UTF8.GetBytes("Example data")
};

var fileMetadata = await client.Beta.Files.Upload(parameters);

Console.WriteLine(fileMetadata);
```

#### Response

```json
{
  "id": "file_011CNha8iCJcU1wXNR6q4V8w",
  "created_at": "2025-04-15T18:37:24.100435Z",
  "filename": "document.pdf",
  "mime_type": "application/pdf",
  "size_bytes": 102400,
  "type": "file",
  "downloadable": false,
  "scope": {
    "id": "id",
    "type": "session"
  }
}
```

## List Files

`FileListPageResponse Beta.Files.List(FileListParams?parameters, CancellationTokencancellationToken = default)`

**get** `/v1/files`

List Files

### Parameters

- `FileListParams parameters`

  - `string afterID`

    Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.

  - `string beforeID`

    Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.

  - `Long limit`

    Query param: Number of items to return per page.

    Defaults to `20`. Ranges from `1` to `1000`.

  - `string scopeID`

    Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID).

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class FileListPageResponse:`

  - `required IReadOnlyList<FileMetadata> Data`

    List of file metadata objects.

    - `required string ID`

      Unique object identifier.

      The format and length of IDs may change over time.

    - `required DateTimeOffset CreatedAt`

      RFC 3339 datetime string representing when the file was created.

    - `required string Filename`

      Original filename of the uploaded file.

    - `required string MimeType`

      MIME type of the file.

    - `required Long SizeBytes`

      Size of the file in bytes.

    - `JsonElement Type "file"constant`

      Object type.

      For files, this is always `"file"`.

    - `Boolean Downloadable`

      Whether the file can be downloaded.

    - `BetaFileScope? Scope`

      The scope of this file, indicating the context in which it was created (e.g., a session).

      - `required string ID`

        The ID of the scoping resource (e.g., the session ID).

      - `JsonElement Type "session"constant`

        The type of scope (e.g., `"session"`).

  - `string? FirstID`

    ID of the first file in this page of results.

  - `Boolean HasMore`

    Whether there are more results available.

  - `string? LastID`

    ID of the last file in this page of results.

### Example

```csharp
FileListParams parameters = new();

var page = await client.Beta.Files.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "file_011CNha8iCJcU1wXNR6q4V8w",
      "created_at": "2025-04-15T18:37:24.100435Z",
      "filename": "document.pdf",
      "mime_type": "application/pdf",
      "size_bytes": 102400,
      "type": "file",
      "downloadable": false,
      "scope": {
        "id": "id",
        "type": "session"
      }
    }
  ],
  "first_id": "file_011CNha8iCJcU1wXNR6q4V8w",
  "has_more": true,
  "last_id": "file_013Zva2CMHLNnXjNJJKqJ2EF"
}
```

## Download File

`HttpResponse Beta.Files.Download(FileDownloadParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/files/{file_id}/content`

Download File

### Parameters

- `FileDownloadParams parameters`

  - `required string fileID`

    ID of the File.

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Example

```csharp
FileDownloadParams parameters = new() { FileID = "file_id" };

var response = await client.Beta.Files.Download(parameters);

Console.WriteLine(response);
```

## Get File Metadata

`FileMetadata Beta.Files.RetrieveMetadata(FileRetrieveMetadataParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/files/{file_id}`

Get File Metadata

### Parameters

- `FileRetrieveMetadataParams parameters`

  - `required string fileID`

    ID of the File.

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class FileMetadata:`

  - `required string ID`

    Unique object identifier.

    The format and length of IDs may change over time.

  - `required DateTimeOffset CreatedAt`

    RFC 3339 datetime string representing when the file was created.

  - `required string Filename`

    Original filename of the uploaded file.

  - `required string MimeType`

    MIME type of the file.

  - `required Long SizeBytes`

    Size of the file in bytes.

  - `JsonElement Type "file"constant`

    Object type.

    For files, this is always `"file"`.

  - `Boolean Downloadable`

    Whether the file can be downloaded.

  - `BetaFileScope? Scope`

    The scope of this file, indicating the context in which it was created (e.g., a session).

    - `required string ID`

      The ID of the scoping resource (e.g., the session ID).

    - `JsonElement Type "session"constant`

      The type of scope (e.g., `"session"`).

### Example

```csharp
FileRetrieveMetadataParams parameters = new() { FileID = "file_id" };

var fileMetadata = await client.Beta.Files.RetrieveMetadata(parameters);

Console.WriteLine(fileMetadata);
```

#### Response

```json
{
  "id": "file_011CNha8iCJcU1wXNR6q4V8w",
  "created_at": "2025-04-15T18:37:24.100435Z",
  "filename": "document.pdf",
  "mime_type": "application/pdf",
  "size_bytes": 102400,
  "type": "file",
  "downloadable": false,
  "scope": {
    "id": "id",
    "type": "session"
  }
}
```

## Delete File

`DeletedFile Beta.Files.Delete(FileDeleteParamsparameters, CancellationTokencancellationToken = default)`

**delete** `/v1/files/{file_id}`

Delete File

### Parameters

- `FileDeleteParams parameters`

  - `required string fileID`

    ID of the File.

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class DeletedFile:`

  - `required string ID`

    ID of the deleted file.

  - `Type Type`

    Deleted object type.

    For file deletion, this is always `"file_deleted"`.

    - `"file_deleted"FileDeleted`

### Example

```csharp
FileDeleteParams parameters = new() { FileID = "file_id" };

var deletedFile = await client.Beta.Files.Delete(parameters);

Console.WriteLine(deletedFile);
```

#### Response

```json
{
  "id": "file_011CNha8iCJcU1wXNR6q4V8w",
  "type": "file_deleted"
}
```

## Domain Types

### Beta File Scope

- `class BetaFileScope:`

  - `required string ID`

    The ID of the scoping resource (e.g., the session ID).

  - `JsonElement Type "session"constant`

    The type of scope (e.g., `"session"`).

### Deleted File

- `class DeletedFile:`

  - `required string ID`

    ID of the deleted file.

  - `Type Type`

    Deleted object type.

    For file deletion, this is always `"file_deleted"`.

    - `"file_deleted"FileDeleted`

### File Metadata

- `class FileMetadata:`

  - `required string ID`

    Unique object identifier.

    The format and length of IDs may change over time.

  - `required DateTimeOffset CreatedAt`

    RFC 3339 datetime string representing when the file was created.

  - `required string Filename`

    Original filename of the uploaded file.

  - `required string MimeType`

    MIME type of the file.

  - `required Long SizeBytes`

    Size of the file in bytes.

  - `JsonElement Type "file"constant`

    Object type.

    For files, this is always `"file"`.

  - `Boolean Downloadable`

    Whether the file can be downloaded.

  - `BetaFileScope? Scope`

    The scope of this file, indicating the context in which it was created (e.g., a session).

    - `required string ID`

      The ID of the scoping resource (e.g., the session ID).

    - `JsonElement Type "session"constant`

      The type of scope (e.g., `"session"`).

# Skills

## Create Skill

`SkillCreateResponse Beta.Skills.Create(SkillCreateParams?parameters, CancellationTokencancellationToken = default)`

**post** `/v1/skills`

Create Skill

### Parameters

- `SkillCreateParams parameters`

  - `string? displayTitle`

    Body param: Display title for the skill.

    This is a human-readable label that is not included in the prompt sent to the model.

  - `IReadOnlyList<string>? files`

    Body param: Files to upload for the skill.

    All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class SkillCreateResponse:`

  - `required string ID`

    Unique identifier for the skill.

    The format and length of IDs may change over time.

  - `required string CreatedAt`

    ISO 8601 timestamp of when the skill was created.

  - `required string? DisplayTitle`

    Display title for the skill.

    This is a human-readable label that is not included in the prompt sent to the model.

  - `required string? LatestVersion`

    The latest version identifier for the skill.

    This represents the most recent version of the skill that has been created.

  - `required string Source`

    Source of the skill.

    This may be one of the following values:

    * `"custom"`: the skill was created by a user
    * `"anthropic"`: the skill was created by Anthropic

  - `required string Type`

    Object type.

    For Skills, this is always `"skill"`.

  - `required string UpdatedAt`

    ISO 8601 timestamp of when the skill was last updated.

### Example

```csharp
SkillCreateParams parameters = new();

var skill = await client.Beta.Skills.Create(parameters);

Console.WriteLine(skill);
```

#### Response

```json
{
  "id": "skill_01JAbcdefghijklmnopqrstuvw",
  "created_at": "2024-10-30T23:58:27.427722Z",
  "display_title": "My Custom Skill",
  "latest_version": "1759178010641129",
  "source": "custom",
  "type": "type",
  "updated_at": "2024-10-30T23:58:27.427722Z"
}
```

## List Skills

`SkillListPageResponse Beta.Skills.List(SkillListParams?parameters, CancellationTokencancellationToken = default)`

**get** `/v1/skills`

List Skills

### Parameters

- `SkillListParams parameters`

  - `Long limit`

    Query param: Number of results to return per page.

    Maximum value is 100. Defaults to 20.

  - `string? page`

    Query param: Pagination token for fetching a specific page of results.

    Pass the value from a previous response's `next_page` field to get the next page of results.

  - `string? source`

    Query param: Filter skills by source.

    If provided, only skills from the specified source will be returned:

    * `"custom"`: only return user-created skills
    * `"anthropic"`: only return Anthropic-created skills

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class SkillListPageResponse:`

  - `required IReadOnlyList<SkillListResponse> Data`

    List of skills.

    - `required string ID`

      Unique identifier for the skill.

      The format and length of IDs may change over time.

    - `required string CreatedAt`

      ISO 8601 timestamp of when the skill was created.

    - `required string? DisplayTitle`

      Display title for the skill.

      This is a human-readable label that is not included in the prompt sent to the model.

    - `required string? LatestVersion`

      The latest version identifier for the skill.

      This represents the most recent version of the skill that has been created.

    - `required string Source`

      Source of the skill.

      This may be one of the following values:

      * `"custom"`: the skill was created by a user
      * `"anthropic"`: the skill was created by Anthropic

    - `required string Type`

      Object type.

      For Skills, this is always `"skill"`.

    - `required string UpdatedAt`

      ISO 8601 timestamp of when the skill was last updated.

  - `required Boolean HasMore`

    Whether there are more results available.

    If `true`, there are additional results that can be fetched using the `next_page` token.

  - `required string? NextPage`

    Token for fetching the next page of results.

    If `null`, there are no more results available. Pass this value to the `page_token` parameter in the next request to get the next page.

### Example

```csharp
SkillListParams parameters = new();

var page = await client.Beta.Skills.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "skill_01JAbcdefghijklmnopqrstuvw",
      "created_at": "2024-10-30T23:58:27.427722Z",
      "display_title": "My Custom Skill",
      "latest_version": "1759178010641129",
      "source": "custom",
      "type": "type",
      "updated_at": "2024-10-30T23:58:27.427722Z"
    }
  ],
  "has_more": true,
  "next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo="
}
```

## Get Skill

`SkillRetrieveResponse Beta.Skills.Retrieve(SkillRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/skills/{skill_id}`

Get Skill

### Parameters

- `SkillRetrieveParams parameters`

  - `required string skillID`

    Unique identifier for the skill.

    The format and length of IDs may change over time.

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class SkillRetrieveResponse:`

  - `required string ID`

    Unique identifier for the skill.

    The format and length of IDs may change over time.

  - `required string CreatedAt`

    ISO 8601 timestamp of when the skill was created.

  - `required string? DisplayTitle`

    Display title for the skill.

    This is a human-readable label that is not included in the prompt sent to the model.

  - `required string? LatestVersion`

    The latest version identifier for the skill.

    This represents the most recent version of the skill that has been created.

  - `required string Source`

    Source of the skill.

    This may be one of the following values:

    * `"custom"`: the skill was created by a user
    * `"anthropic"`: the skill was created by Anthropic

  - `required string Type`

    Object type.

    For Skills, this is always `"skill"`.

  - `required string UpdatedAt`

    ISO 8601 timestamp of when the skill was last updated.

### Example

```csharp
SkillRetrieveParams parameters = new() { SkillID = "skill_id" };

var skill = await client.Beta.Skills.Retrieve(parameters);

Console.WriteLine(skill);
```

#### Response

```json
{
  "id": "skill_01JAbcdefghijklmnopqrstuvw",
  "created_at": "2024-10-30T23:58:27.427722Z",
  "display_title": "My Custom Skill",
  "latest_version": "1759178010641129",
  "source": "custom",
  "type": "type",
  "updated_at": "2024-10-30T23:58:27.427722Z"
}
```

## Delete Skill

`SkillDeleteResponse Beta.Skills.Delete(SkillDeleteParamsparameters, CancellationTokencancellationToken = default)`

**delete** `/v1/skills/{skill_id}`

Delete Skill

### Parameters

- `SkillDeleteParams parameters`

  - `required string skillID`

    Unique identifier for the skill.

    The format and length of IDs may change over time.

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class SkillDeleteResponse:`

  - `required string ID`

    Unique identifier for the skill.

    The format and length of IDs may change over time.

  - `required string Type`

    Deleted object type.

    For Skills, this is always `"skill_deleted"`.

### Example

```csharp
SkillDeleteParams parameters = new() { SkillID = "skill_id" };

var skill = await client.Beta.Skills.Delete(parameters);

Console.WriteLine(skill);
```

#### Response

```json
{
  "id": "skill_01JAbcdefghijklmnopqrstuvw",
  "type": "type"
}
```

# Versions

## Create Skill Version

`VersionCreateResponse Beta.Skills.Versions.Create(VersionCreateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/skills/{skill_id}/versions`

Create Skill Version

### Parameters

- `VersionCreateParams parameters`

  - `required string skillID`

    Path param: Unique identifier for the skill.

    The format and length of IDs may change over time.

  - `IReadOnlyList<string>? files`

    Body param: Files to upload for the skill.

    All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class VersionCreateResponse:`

  - `required string ID`

    Unique identifier for the skill version.

    The format and length of IDs may change over time.

  - `required string CreatedAt`

    ISO 8601 timestamp of when the skill version was created.

  - `required string Description`

    Description of the skill version.

    This is extracted from the SKILL.md file in the skill upload.

  - `required string Directory`

    Directory name of the skill version.

    This is the top-level directory name that was extracted from the uploaded files.

  - `required string Name`

    Human-readable name of the skill version.

    This is extracted from the SKILL.md file in the skill upload.

  - `required string SkillID`

    Identifier for the skill that this version belongs to.

  - `required string Type`

    Object type.

    For Skill Versions, this is always `"skill_version"`.

  - `required string Version`

    Version identifier for the skill.

    Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").

### Example

```csharp
VersionCreateParams parameters = new() { SkillID = "skill_id" };

var version = await client.Beta.Skills.Versions.Create(parameters);

Console.WriteLine(version);
```

#### Response

```json
{
  "id": "skillver_01JAbcdefghijklmnopqrstuvw",
  "created_at": "2024-10-30T23:58:27.427722Z",
  "description": "A custom skill for doing something useful",
  "directory": "my-skill",
  "name": "my-skill",
  "skill_id": "skill_01JAbcdefghijklmnopqrstuvw",
  "type": "type",
  "version": "1759178010641129"
}
```

## List Skill Versions

`VersionListPageResponse Beta.Skills.Versions.List(VersionListParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/skills/{skill_id}/versions`

List Skill Versions

### Parameters

- `VersionListParams parameters`

  - `required string skillID`

    Path param: Unique identifier for the skill.

    The format and length of IDs may change over time.

  - `Long? limit`

    Query param: Number of items to return per page.

    Defaults to `20`. Ranges from `1` to `1000`.

  - `string? page`

    Query param: Optionally set to the `next_page` token from the previous response.

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class VersionListPageResponse:`

  - `required IReadOnlyList<VersionListResponse> Data`

    List of skill versions.

    - `required string ID`

      Unique identifier for the skill version.

      The format and length of IDs may change over time.

    - `required string CreatedAt`

      ISO 8601 timestamp of when the skill version was created.

    - `required string Description`

      Description of the skill version.

      This is extracted from the SKILL.md file in the skill upload.

    - `required string Directory`

      Directory name of the skill version.

      This is the top-level directory name that was extracted from the uploaded files.

    - `required string Name`

      Human-readable name of the skill version.

      This is extracted from the SKILL.md file in the skill upload.

    - `required string SkillID`

      Identifier for the skill that this version belongs to.

    - `required string Type`

      Object type.

      For Skill Versions, this is always `"skill_version"`.

    - `required string Version`

      Version identifier for the skill.

      Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").

  - `required Boolean HasMore`

    Indicates if there are more results in the requested page direction.

  - `required string? NextPage`

    Token to provide in as `page` in the subsequent request to retrieve the next page of data.

### Example

```csharp
VersionListParams parameters = new() { SkillID = "skill_id" };

var page = await client.Beta.Skills.Versions.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "skillver_01JAbcdefghijklmnopqrstuvw",
      "created_at": "2024-10-30T23:58:27.427722Z",
      "description": "A custom skill for doing something useful",
      "directory": "my-skill",
      "name": "my-skill",
      "skill_id": "skill_01JAbcdefghijklmnopqrstuvw",
      "type": "type",
      "version": "1759178010641129"
    }
  ],
  "has_more": true,
  "next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo="
}
```

## Download Skill Version Content

`HttpResponse Beta.Skills.Versions.Download(VersionDownloadParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/skills/{skill_id}/versions/{version}/content`

Download a skill version's content as a zip archive.

### Parameters

- `VersionDownloadParams parameters`

  - `required string skillID`

    Path param: Unique identifier for the skill.

    The format and length of IDs may change over time.

  - `required string version`

    Path param: Version identifier for the skill.

    Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Example

```csharp
VersionDownloadParams parameters = new()
{
    SkillID = "skill_id",
    Version = "version",
};

var response = await client.Beta.Skills.Versions.Download(parameters);

Console.WriteLine(response);
```

## Get Skill Version

`VersionRetrieveResponse Beta.Skills.Versions.Retrieve(VersionRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/skills/{skill_id}/versions/{version}`

Get Skill Version

### Parameters

- `VersionRetrieveParams parameters`

  - `required string skillID`

    Path param: Unique identifier for the skill.

    The format and length of IDs may change over time.

  - `required string version`

    Path param: Version identifier for the skill.

    Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class VersionRetrieveResponse:`

  - `required string ID`

    Unique identifier for the skill version.

    The format and length of IDs may change over time.

  - `required string CreatedAt`

    ISO 8601 timestamp of when the skill version was created.

  - `required string Description`

    Description of the skill version.

    This is extracted from the SKILL.md file in the skill upload.

  - `required string Directory`

    Directory name of the skill version.

    This is the top-level directory name that was extracted from the uploaded files.

  - `required string Name`

    Human-readable name of the skill version.

    This is extracted from the SKILL.md file in the skill upload.

  - `required string SkillID`

    Identifier for the skill that this version belongs to.

  - `required string Type`

    Object type.

    For Skill Versions, this is always `"skill_version"`.

  - `required string Version`

    Version identifier for the skill.

    Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").

### Example

```csharp
VersionRetrieveParams parameters = new()
{
    SkillID = "skill_id",
    Version = "version",
};

var version = await client.Beta.Skills.Versions.Retrieve(parameters);

Console.WriteLine(version);
```

#### Response

```json
{
  "id": "skillver_01JAbcdefghijklmnopqrstuvw",
  "created_at": "2024-10-30T23:58:27.427722Z",
  "description": "A custom skill for doing something useful",
  "directory": "my-skill",
  "name": "my-skill",
  "skill_id": "skill_01JAbcdefghijklmnopqrstuvw",
  "type": "type",
  "version": "1759178010641129"
}
```

## Delete Skill Version

`VersionDeleteResponse Beta.Skills.Versions.Delete(VersionDeleteParamsparameters, CancellationTokencancellationToken = default)`

**delete** `/v1/skills/{skill_id}/versions/{version}`

Delete Skill Version

### Parameters

- `VersionDeleteParams parameters`

  - `required string skillID`

    Path param: Unique identifier for the skill.

    The format and length of IDs may change over time.

  - `required string version`

    Path param: Version identifier for the skill.

    Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class VersionDeleteResponse:`

  - `required string ID`

    Version identifier for the skill.

    Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").

  - `required string Type`

    Deleted object type.

    For Skill Versions, this is always `"skill_version_deleted"`.

### Example

```csharp
VersionDeleteParams parameters = new()
{
    SkillID = "skill_id",
    Version = "version",
};

var version = await client.Beta.Skills.Versions.Delete(parameters);

Console.WriteLine(version);
```

#### Response

```json
{
  "id": "1759178010641129",
  "type": "type"
}
```

# User Profiles

## Create User Profile

`BetaUserProfile Beta.UserProfiles.Create(UserProfileCreateParams?parameters, CancellationTokencancellationToken = default)`

**post** `/v1/user_profiles`

Create User Profile

### Parameters

- `UserProfileCreateParams parameters`

  - `string? externalID`

    Body param: Platform's own identifier for this user. Not enforced unique. Maximum 255 characters.

  - `IReadOnlyDictionary<string, string> metadata`

    Body param: Free-form key-value data to attach to this user profile. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. Values must be non-empty strings.

  - `string? name`

    Body param: Display name of the entity this profile represents. Required when relationship is `resold` (the resold-to company's name); optional otherwise. Maximum 255 characters.

  - `Relationship relationship`

    Body param: How the entity behind a user profile relates to the platform that owns the API key. `external`: an individual end-user of the platform. `resold`: a company the platform resells Claude access to. `internal`: the platform's own usage.

    - `"external"External`

    - `"resold"Resold`

    - `"internal"Internal`

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaUserProfile:`

  - `required string ID`

    Unique identifier for this user profile, prefixed `uprof_`.

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

  - `required Relationship Relationship`

    How the entity behind a user profile relates to the platform that owns the API key. `external`: an individual end-user of the platform. `resold`: a company the platform resells Claude access to. `internal`: the platform's own usage.

    - `"external"External`

    - `"resold"Resold`

    - `"internal"Internal`

  - `required IReadOnlyDictionary<string, BetaUserProfileTrustGrant> TrustGrants`

    Trust grants for this profile, keyed by grant name. Key omitted when no grant is active or in flight.

    - `required Status Status`

      Status of the trust grant.

      - `"active"Active`

      - `"pending"Pending`

      - `"rejected"Rejected`

  - `required Type Type`

    Object type. Always `user_profile`.

    - `"user_profile"UserProfile`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `string? ExternalID`

    Platform's own identifier for this user. Not enforced unique.

  - `string? Name`

    Display name of the entity this profile represents. For `resold` this is the resold-to company's name.

### Example

```csharp
UserProfileCreateParams parameters = new();

var betaUserProfile = await client.Beta.UserProfiles.Create(parameters);

Console.WriteLine(betaUserProfile);
```

#### Response

```json
{
  "id": "uprof_011CZkZCu8hGbp5mYRQgUmz9",
  "created_at": "2026-03-15T10:00:00Z",
  "metadata": {},
  "relationship": "external",
  "trust_grants": {
    "cyber": {
      "status": "active"
    }
  },
  "type": "user_profile",
  "updated_at": "2026-03-15T10:00:00Z",
  "external_id": "user_12345",
  "name": "Example User"
}
```

## List User Profiles

`UserProfileListPageResponse Beta.UserProfiles.List(UserProfileListParams?parameters, CancellationTokencancellationToken = default)`

**get** `/v1/user_profiles`

List User Profiles

### Parameters

- `UserProfileListParams parameters`

  - `Int limit`

    Query param: Query parameter for limit

  - `Order order`

    Query param: Query parameter for order

    - `"asc"Asc`

    - `"desc"Desc`

  - `string page`

    Query param: Query parameter for page

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class UserProfileListPageResponse:`

  - `required IReadOnlyList<BetaUserProfile> Data`

    User profiles on this page.

    - `required string ID`

      Unique identifier for this user profile, prefixed `uprof_`.

    - `required DateTimeOffset CreatedAt`

      A timestamp in RFC 3339 format

    - `required IReadOnlyDictionary<string, string> Metadata`

      Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

    - `required Relationship Relationship`

      How the entity behind a user profile relates to the platform that owns the API key. `external`: an individual end-user of the platform. `resold`: a company the platform resells Claude access to. `internal`: the platform's own usage.

      - `"external"External`

      - `"resold"Resold`

      - `"internal"Internal`

    - `required IReadOnlyDictionary<string, BetaUserProfileTrustGrant> TrustGrants`

      Trust grants for this profile, keyed by grant name. Key omitted when no grant is active or in flight.

      - `required Status Status`

        Status of the trust grant.

        - `"active"Active`

        - `"pending"Pending`

        - `"rejected"Rejected`

    - `required Type Type`

      Object type. Always `user_profile`.

      - `"user_profile"UserProfile`

    - `required DateTimeOffset UpdatedAt`

      A timestamp in RFC 3339 format

    - `string? ExternalID`

      Platform's own identifier for this user. Not enforced unique.

    - `string? Name`

      Display name of the entity this profile represents. For `resold` this is the resold-to company's name.

  - `required string? NextPage`

    Cursor for the next page, or `null` when there are no more results.

### Example

```csharp
UserProfileListParams parameters = new();

var page = await client.Beta.UserProfiles.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "data": [
    {
      "id": "uprof_011CZkZCu8hGbp5mYRQgUmz9",
      "created_at": "2026-03-15T10:00:00Z",
      "metadata": {},
      "relationship": "external",
      "trust_grants": {
        "cyber": {
          "status": "active"
        }
      },
      "type": "user_profile",
      "updated_at": "2026-03-15T10:00:00Z",
      "external_id": "user_12345",
      "name": "Example User"
    }
  ],
  "next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo="
}
```

## Get User Profile

`BetaUserProfile Beta.UserProfiles.Retrieve(UserProfileRetrieveParamsparameters, CancellationTokencancellationToken = default)`

**get** `/v1/user_profiles/{user_profile_id}`

Get User Profile

### Parameters

- `UserProfileRetrieveParams parameters`

  - `required string userProfileID`

    Path parameter user_profile_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaUserProfile:`

  - `required string ID`

    Unique identifier for this user profile, prefixed `uprof_`.

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

  - `required Relationship Relationship`

    How the entity behind a user profile relates to the platform that owns the API key. `external`: an individual end-user of the platform. `resold`: a company the platform resells Claude access to. `internal`: the platform's own usage.

    - `"external"External`

    - `"resold"Resold`

    - `"internal"Internal`

  - `required IReadOnlyDictionary<string, BetaUserProfileTrustGrant> TrustGrants`

    Trust grants for this profile, keyed by grant name. Key omitted when no grant is active or in flight.

    - `required Status Status`

      Status of the trust grant.

      - `"active"Active`

      - `"pending"Pending`

      - `"rejected"Rejected`

  - `required Type Type`

    Object type. Always `user_profile`.

    - `"user_profile"UserProfile`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `string? ExternalID`

    Platform's own identifier for this user. Not enforced unique.

  - `string? Name`

    Display name of the entity this profile represents. For `resold` this is the resold-to company's name.

### Example

```csharp
UserProfileRetrieveParams parameters = new()
{
    UserProfileID = "uprof_011CZkZCu8hGbp5mYRQgUmz9"
};

var betaUserProfile = await client.Beta.UserProfiles.Retrieve(parameters);

Console.WriteLine(betaUserProfile);
```

#### Response

```json
{
  "id": "uprof_011CZkZCu8hGbp5mYRQgUmz9",
  "created_at": "2026-03-15T10:00:00Z",
  "metadata": {},
  "relationship": "external",
  "trust_grants": {
    "cyber": {
      "status": "active"
    }
  },
  "type": "user_profile",
  "updated_at": "2026-03-15T10:00:00Z",
  "external_id": "user_12345",
  "name": "Example User"
}
```

## Update User Profile

`BetaUserProfile Beta.UserProfiles.Update(UserProfileUpdateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/user_profiles/{user_profile_id}`

Update User Profile

### Parameters

- `UserProfileUpdateParams parameters`

  - `required string userProfileID`

    Path param: Path parameter user_profile_id

  - `string? externalID`

    Body param: If present, replaces the stored external_id. Omit to leave unchanged. Maximum 255 characters.

  - `IReadOnlyDictionary<string, string> metadata`

    Body param: Key-value pairs to merge into the stored metadata. Keys provided overwrite existing values. To remove a key, set its value to an empty string. Keys not provided are left unchanged. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters.

  - `string? name`

    Body param: If present, replaces the stored name. Omit to leave unchanged. Maximum 255 characters.

  - `Relationship? relationship`

    Body param: How the entity behind a user profile relates to the platform that owns the API key. `external`: an individual end-user of the platform. `resold`: a company the platform resells Claude access to. `internal`: the platform's own usage.

    - `"external"External`

    - `"resold"Resold`

    - `"internal"Internal`

  - `IReadOnlyList<AnthropicBeta> betas`

    Header param: Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaUserProfile:`

  - `required string ID`

    Unique identifier for this user profile, prefixed `uprof_`.

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

  - `required Relationship Relationship`

    How the entity behind a user profile relates to the platform that owns the API key. `external`: an individual end-user of the platform. `resold`: a company the platform resells Claude access to. `internal`: the platform's own usage.

    - `"external"External`

    - `"resold"Resold`

    - `"internal"Internal`

  - `required IReadOnlyDictionary<string, BetaUserProfileTrustGrant> TrustGrants`

    Trust grants for this profile, keyed by grant name. Key omitted when no grant is active or in flight.

    - `required Status Status`

      Status of the trust grant.

      - `"active"Active`

      - `"pending"Pending`

      - `"rejected"Rejected`

  - `required Type Type`

    Object type. Always `user_profile`.

    - `"user_profile"UserProfile`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `string? ExternalID`

    Platform's own identifier for this user. Not enforced unique.

  - `string? Name`

    Display name of the entity this profile represents. For `resold` this is the resold-to company's name.

### Example

```csharp
UserProfileUpdateParams parameters = new()
{
    UserProfileID = "uprof_011CZkZCu8hGbp5mYRQgUmz9"
};

var betaUserProfile = await client.Beta.UserProfiles.Update(parameters);

Console.WriteLine(betaUserProfile);
```

#### Response

```json
{
  "id": "uprof_011CZkZCu8hGbp5mYRQgUmz9",
  "created_at": "2026-03-15T10:00:00Z",
  "metadata": {},
  "relationship": "external",
  "trust_grants": {
    "cyber": {
      "status": "active"
    }
  },
  "type": "user_profile",
  "updated_at": "2026-03-15T10:00:00Z",
  "external_id": "user_12345",
  "name": "Example User"
}
```

## Create Enrollment URL

`BetaUserProfileEnrollmentUrl Beta.UserProfiles.CreateEnrollmentUrl(UserProfileCreateEnrollmentUrlParamsparameters, CancellationTokencancellationToken = default)`

**post** `/v1/user_profiles/{user_profile_id}/enrollment_url`

Create Enrollment URL

### Parameters

- `UserProfileCreateEnrollmentUrlParams parameters`

  - `required string userProfileID`

    Path parameter user_profile_id

  - `IReadOnlyList<AnthropicBeta> betas`

    Optional header to specify the beta version(s) you want to use.

    - `"message-batches-2024-09-24"MessageBatches2024_09_24`

    - `"prompt-caching-2024-07-31"PromptCaching2024_07_31`

    - `"computer-use-2024-10-22"ComputerUse2024_10_22`

    - `"computer-use-2025-01-24"ComputerUse2025_01_24`

    - `"pdfs-2024-09-25"Pdfs2024_09_25`

    - `"token-counting-2024-11-01"TokenCounting2024_11_01`

    - `"token-efficient-tools-2025-02-19"TokenEfficientTools2025_02_19`

    - `"output-128k-2025-02-19"Output128k2025_02_19`

    - `"files-api-2025-04-14"FilesApi2025_04_14`

    - `"mcp-client-2025-04-04"McpClient2025_04_04`

    - `"mcp-client-2025-11-20"McpClient2025_11_20`

    - `"dev-full-thinking-2025-05-14"DevFullThinking2025_05_14`

    - `"interleaved-thinking-2025-05-14"InterleavedThinking2025_05_14`

    - `"code-execution-2025-05-22"CodeExecution2025_05_22`

    - `"extended-cache-ttl-2025-04-11"ExtendedCacheTtl2025_04_11`

    - `"context-1m-2025-08-07"Context1m2025_08_07`

    - `"context-management-2025-06-27"ContextManagement2025_06_27`

    - `"model-context-window-exceeded-2025-08-26"ModelContextWindowExceeded2025_08_26`

    - `"skills-2025-10-02"Skills2025_10_02`

    - `"fast-mode-2026-02-01"FastMode2026_02_01`

    - `"output-300k-2026-03-24"Output300k2026_03_24`

    - `"user-profiles-2026-03-24"UserProfiles2026_03_24`

    - `"advisor-tool-2026-03-01"AdvisorTool2026_03_01`

    - `"managed-agents-2026-04-01"ManagedAgents2026_04_01`

    - `"cache-diagnosis-2026-04-07"CacheDiagnosis2026_04_07`

    - `"thinking-token-count-2026-05-13"ThinkingTokenCount2026_05_13`

### Returns

- `class BetaUserProfileEnrollmentUrl:`

  - `required DateTimeOffset ExpiresAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    Object type. Always `enrollment_url`.

    - `"enrollment_url"EnrollmentUrl`

  - `required string Url`

    Enrollment URL to send to the end user. Valid until `expires_at`.

### Example

```csharp
UserProfileCreateEnrollmentUrlParams parameters = new()
{
    UserProfileID = "uprof_011CZkZCu8hGbp5mYRQgUmz9"
};

var betaUserProfileEnrollmentUrl = await client.Beta.UserProfiles.CreateEnrollmentUrl(parameters);

Console.WriteLine(betaUserProfileEnrollmentUrl);
```

#### Response

```json
{
  "expires_at": "2026-03-15T10:15:00Z",
  "type": "enrollment_url",
  "url": "https://platform.claude.com/user-profiles/enrollment/M3J0bGJxZ2ppMnptbnB1"
}
```

## Domain Types

### Beta User Profile

- `class BetaUserProfile:`

  - `required string ID`

    Unique identifier for this user profile, prefixed `uprof_`.

  - `required DateTimeOffset CreatedAt`

    A timestamp in RFC 3339 format

  - `required IReadOnlyDictionary<string, string> Metadata`

    Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

  - `required Relationship Relationship`

    How the entity behind a user profile relates to the platform that owns the API key. `external`: an individual end-user of the platform. `resold`: a company the platform resells Claude access to. `internal`: the platform's own usage.

    - `"external"External`

    - `"resold"Resold`

    - `"internal"Internal`

  - `required IReadOnlyDictionary<string, BetaUserProfileTrustGrant> TrustGrants`

    Trust grants for this profile, keyed by grant name. Key omitted when no grant is active or in flight.

    - `required Status Status`

      Status of the trust grant.

      - `"active"Active`

      - `"pending"Pending`

      - `"rejected"Rejected`

  - `required Type Type`

    Object type. Always `user_profile`.

    - `"user_profile"UserProfile`

  - `required DateTimeOffset UpdatedAt`

    A timestamp in RFC 3339 format

  - `string? ExternalID`

    Platform's own identifier for this user. Not enforced unique.

  - `string? Name`

    Display name of the entity this profile represents. For `resold` this is the resold-to company's name.

### Beta User Profile Enrollment URL

- `class BetaUserProfileEnrollmentUrl:`

  - `required DateTimeOffset ExpiresAt`

    A timestamp in RFC 3339 format

  - `required Type Type`

    Object type. Always `enrollment_url`.

    - `"enrollment_url"EnrollmentUrl`

  - `required string Url`

    Enrollment URL to send to the end user. Valid until `expires_at`.

### Beta User Profile Trust Grant

- `class BetaUserProfileTrustGrant:`

  - `required Status Status`

    Status of the trust grant.

    - `"active"Active`

    - `"pending"Pending`

    - `"rejected"Rejected`

# Webhooks

## Domain Types

### Beta Webhook Event

- `class BetaWebhookEvent:`

  - `required string ID`

    Unique event identifier for idempotency.

  - `required DateTimeOffset CreatedAt`

    RFC 3339 timestamp when the event occurred.

  - `required BetaWebhookEventData Data`

    - `class BetaWebhookSessionCreatedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.created"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionPendingEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.pending"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionRunningEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.running"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionIdledEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.idled"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionRequiresActionEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.requires_action"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionArchivedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.archived"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionDeletedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.deleted"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionStatusRescheduledEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.status_rescheduled"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionStatusRunStartedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.status_run_started"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionStatusIdledEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.status_idled"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionStatusTerminatedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.status_terminated"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionThreadCreatedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.thread_created"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionThreadIdledEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.thread_idled"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionThreadTerminatedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.thread_terminated"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionOutcomeEvaluationEndedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.outcome_evaluation_ended"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookVaultCreatedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault.created"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookVaultArchivedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault.archived"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookVaultDeletedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault.deleted"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookVaultCredentialCreatedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault_credential.created"constant`

      - `required string VaultID`

        ID of the vault that owns this credential.

      - `required string WorkspaceID`

    - `class BetaWebhookVaultCredentialArchivedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault_credential.archived"constant`

      - `required string VaultID`

        ID of the vault that owns this credential.

      - `required string WorkspaceID`

    - `class BetaWebhookVaultCredentialDeletedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault_credential.deleted"constant`

      - `required string VaultID`

        ID of the vault that owns this credential.

      - `required string WorkspaceID`

    - `class BetaWebhookVaultCredentialRefreshFailedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault_credential.refresh_failed"constant`

      - `required string VaultID`

        ID of the vault that owns this credential.

      - `required string WorkspaceID`

  - `JsonElement Type "event"constant`

    Object type. Always `event` for webhook payloads.

### Beta Webhook Event Data

- `class BetaWebhookEventData: A class that can be one of several variants.union`

  - `class BetaWebhookSessionCreatedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.created"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionPendingEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.pending"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionRunningEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.running"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionIdledEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.idled"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionRequiresActionEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.requires_action"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionArchivedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.archived"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionDeletedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.deleted"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionStatusRescheduledEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.status_rescheduled"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionStatusRunStartedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.status_run_started"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionStatusIdledEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.status_idled"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionStatusTerminatedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.status_terminated"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionThreadCreatedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.thread_created"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionThreadIdledEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.thread_idled"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionThreadTerminatedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.thread_terminated"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookSessionOutcomeEvaluationEndedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "session.outcome_evaluation_ended"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookVaultCreatedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "vault.created"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookVaultArchivedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "vault.archived"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookVaultDeletedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "vault.deleted"constant`

    - `required string WorkspaceID`

  - `class BetaWebhookVaultCredentialCreatedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "vault_credential.created"constant`

    - `required string VaultID`

      ID of the vault that owns this credential.

    - `required string WorkspaceID`

  - `class BetaWebhookVaultCredentialArchivedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "vault_credential.archived"constant`

    - `required string VaultID`

      ID of the vault that owns this credential.

    - `required string WorkspaceID`

  - `class BetaWebhookVaultCredentialDeletedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "vault_credential.deleted"constant`

    - `required string VaultID`

      ID of the vault that owns this credential.

    - `required string WorkspaceID`

  - `class BetaWebhookVaultCredentialRefreshFailedEventData:`

    - `required string ID`

      ID of the resource that triggered the event.

    - `required string OrganizationID`

    - `JsonElement Type "vault_credential.refresh_failed"constant`

    - `required string VaultID`

      ID of the vault that owns this credential.

    - `required string WorkspaceID`

### Beta Webhook Session Archived Event Data

- `class BetaWebhookSessionArchivedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.archived"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Created Event Data

- `class BetaWebhookSessionCreatedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.created"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Deleted Event Data

- `class BetaWebhookSessionDeletedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.deleted"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Idled Event Data

- `class BetaWebhookSessionIdledEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.idled"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Outcome Evaluation Ended Event Data

- `class BetaWebhookSessionOutcomeEvaluationEndedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.outcome_evaluation_ended"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Pending Event Data

- `class BetaWebhookSessionPendingEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.pending"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Requires Action Event Data

- `class BetaWebhookSessionRequiresActionEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.requires_action"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Running Event Data

- `class BetaWebhookSessionRunningEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.running"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Status Idled Event Data

- `class BetaWebhookSessionStatusIdledEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.status_idled"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Status Rescheduled Event Data

- `class BetaWebhookSessionStatusRescheduledEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.status_rescheduled"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Status Run Started Event Data

- `class BetaWebhookSessionStatusRunStartedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.status_run_started"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Status Terminated Event Data

- `class BetaWebhookSessionStatusTerminatedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.status_terminated"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Thread Created Event Data

- `class BetaWebhookSessionThreadCreatedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.thread_created"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Thread Idled Event Data

- `class BetaWebhookSessionThreadIdledEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.thread_idled"constant`

  - `required string WorkspaceID`

### Beta Webhook Session Thread Terminated Event Data

- `class BetaWebhookSessionThreadTerminatedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "session.thread_terminated"constant`

  - `required string WorkspaceID`

### Beta Webhook Vault Archived Event Data

- `class BetaWebhookVaultArchivedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "vault.archived"constant`

  - `required string WorkspaceID`

### Beta Webhook Vault Created Event Data

- `class BetaWebhookVaultCreatedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "vault.created"constant`

  - `required string WorkspaceID`

### Beta Webhook Vault Credential Archived Event Data

- `class BetaWebhookVaultCredentialArchivedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "vault_credential.archived"constant`

  - `required string VaultID`

    ID of the vault that owns this credential.

  - `required string WorkspaceID`

### Beta Webhook Vault Credential Created Event Data

- `class BetaWebhookVaultCredentialCreatedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "vault_credential.created"constant`

  - `required string VaultID`

    ID of the vault that owns this credential.

  - `required string WorkspaceID`

### Beta Webhook Vault Credential Deleted Event Data

- `class BetaWebhookVaultCredentialDeletedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "vault_credential.deleted"constant`

  - `required string VaultID`

    ID of the vault that owns this credential.

  - `required string WorkspaceID`

### Beta Webhook Vault Credential Refresh Failed Event Data

- `class BetaWebhookVaultCredentialRefreshFailedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "vault_credential.refresh_failed"constant`

  - `required string VaultID`

    ID of the vault that owns this credential.

  - `required string WorkspaceID`

### Beta Webhook Vault Deleted Event Data

- `class BetaWebhookVaultDeletedEventData:`

  - `required string ID`

    ID of the resource that triggered the event.

  - `required string OrganizationID`

  - `JsonElement Type "vault.deleted"constant`

  - `required string WorkspaceID`

### Unwrap Webhook Event

- `class UnwrapWebhookEvent:`

  - `required string ID`

    Unique event identifier for idempotency.

  - `required DateTimeOffset CreatedAt`

    RFC 3339 timestamp when the event occurred.

  - `required BetaWebhookEventData Data`

    - `class BetaWebhookSessionCreatedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.created"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionPendingEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.pending"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionRunningEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.running"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionIdledEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.idled"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionRequiresActionEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.requires_action"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionArchivedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.archived"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionDeletedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.deleted"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionStatusRescheduledEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.status_rescheduled"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionStatusRunStartedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.status_run_started"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionStatusIdledEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.status_idled"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionStatusTerminatedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.status_terminated"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionThreadCreatedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.thread_created"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionThreadIdledEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.thread_idled"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionThreadTerminatedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.thread_terminated"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookSessionOutcomeEvaluationEndedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "session.outcome_evaluation_ended"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookVaultCreatedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault.created"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookVaultArchivedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault.archived"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookVaultDeletedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault.deleted"constant`

      - `required string WorkspaceID`

    - `class BetaWebhookVaultCredentialCreatedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault_credential.created"constant`

      - `required string VaultID`

        ID of the vault that owns this credential.

      - `required string WorkspaceID`

    - `class BetaWebhookVaultCredentialArchivedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault_credential.archived"constant`

      - `required string VaultID`

        ID of the vault that owns this credential.

      - `required string WorkspaceID`

    - `class BetaWebhookVaultCredentialDeletedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault_credential.deleted"constant`

      - `required string VaultID`

        ID of the vault that owns this credential.

      - `required string WorkspaceID`

    - `class BetaWebhookVaultCredentialRefreshFailedEventData:`

      - `required string ID`

        ID of the resource that triggered the event.

      - `required string OrganizationID`

      - `JsonElement Type "vault_credential.refresh_failed"constant`

      - `required string VaultID`

        ID of the vault that owns this credential.

      - `required string WorkspaceID`

  - `JsonElement Type "event"constant`

    Object type. Always `event` for webhook payloads.
