---
title: Stream Session Thread Events
url: https://platform.claude.com/docs/en/api/php/beta/sessions/threads/events/stream
---

# Stream Session Thread Events

`$client->beta->sessions->threads->events->streamStream(string threadID, string sessionID, ?list<BetaManagedAgentsDeltaType> eventDeltas, ?list<AnthropicBeta> betas, ?string workspaceID): BaseStream<ManagedAgentsStreamSessionThreadEvents>`

**GET** `/v1/sessions/{session_id}/threads/{thread_id}/stream`

Stream Session Thread Events

## Parameters

- `sessionID: string` (path parameter)

- `threadID: string` (path parameter)

- `eventDeltas?: optional list<BetaManagedAgentsDeltaType>` (query parameter)

  When set, this connection also receives streaming deltas (`event_start`, `event_delta`) while an event is being produced, before the event itself arrives. Deltas are best-effort; when the final event is produced it carries the complete content. A model request that ends early (an error or interrupt) produces no final event — its terminal `span.model_request_end` closes the preview. Accepts one or more event types to preview and may be repeated: `agent.message` streams `content_delta` fragments; `agent.thinking` is start-only — a signal that the agent has begun extended thinking, concluded by the `agent.thinking` event itself. Only previews of the requested event types are sent.

- `betas?: optional list<AnthropicBeta>` (header parameter)

  This endpoint is in beta: requests must send `managed-agents-2026-04-01` in this header.

- `workspaceID?: optional string` (header parameter)

  Optional header to select the Workspace for this request. The value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).

  Only needed for credentials that can act on more than one Workspace. A credential that belongs to a specific Workspace may omit it; if sent, it must match that Workspace.

## Returns

- `class ManagedAgentsStreamSessionThreadEvents`

  - `class ManagedAgentsUserMessageEvent`

    - `"user.message" type`

    - `string id`

      Unique identifier for this event.

    - `list<Content> content`

      Array of content blocks comprising the user message.

    - `?\Datetime processedAt`

      Timestamp when the agent finished processing this message.

  - `class ManagedAgentsUserInterruptEvent`

    - `"user.interrupt" type`

    - `string id`

      Unique identifier for this event.

    - `?\Datetime processedAt`

      Timestamp when the interrupt was processed.

    - `?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 ManagedAgentsUserToolConfirmationEvent`

    - `"user.tool_confirmation" type`

    - `string id`

      Unique identifier for this event.

    - `Result result`

      The confirmation result: 'allow' or 'deny'.

    - `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?sdk_languages=php#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `?string denyMessage`

      Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

    - `?\Datetime processedAt`

      Timestamp when the confirmation was processed.

    - `?string sessionThreadID`

      Set by the server to the subagent thread this confirmation was routed to. Omitted when it was routed to the primary thread.

  - `class ManagedAgentsUserCustomToolResultEvent`

    - `"user.custom_tool_result" type`

    - `string id`

      Unique identifier for this event.

    - `string customToolUseID`

      The id of the `agent.custom_tool_use` event this result corresponds to. It is also listed in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list?sdk_languages=php#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `?list<Content> content`

      The result content returned by the tool.

    - `?bool isError`

      Whether the tool execution resulted in an error.

    - `?\Datetime processedAt`

      Timestamp when this result was processed.

    - `?string sessionThreadID`

      Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread.

  - `class ManagedAgentsAgentCustomToolUseEvent`

    - `"agent.custom_tool_use" type`

    - `string id`

      Unique identifier for this event.

    - `array<string,mixed> input`

      Input parameters for the tool call.

    - `string name`

      Name of the custom tool being called.

    - `\Datetime processedAt`

      Timestamp when this tool use was processed.

    - `?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. Informational only: the server routes the matching `user.custom_tool_result` by `custom_tool_use_id`, so clients do not send it back.

  - `class ManagedAgentsAgentMessageEvent`

    - `"agent.message" type`

    - `string id`

      Unique identifier for this event.

    - `list<Content> content`

      Array of text blocks comprising the agent response.

    - `\Datetime processedAt`

      Timestamp when this response was generated.

  - `class ManagedAgentsAgentThinkingEvent`

    - `"agent.thinking" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp when this thinking was produced.

  - `class ManagedAgentsAgentMCPToolUseEvent`

    - `"agent.mcp_tool_use" type`

    - `string id`

      Unique identifier for this event.

    - `array<string,mixed> input`

      Input parameters for the tool call.

    - `string mcpServerName`

      Name of the MCP server providing the tool.

    - `string name`

      Name of the MCP tool being used.

    - `\Datetime processedAt`

      Timestamp when this event was processed.

    - `?ManagedAgentsAgentEvaluatedPermission evaluatedPermission`

      The evaluated permission policy for this tool invocation.

    - `?ManagedAgentsAgentToolEvaluation evaluation`

      Which resolved permission_policy produced evaluated_permission: always_allow, always_ask, or auto (with the server's per-invocation judgement). Absent only when the server refused the call before any policy applied (for example, the named tool is not enabled in the session); such a refusal has evaluated_permission deny. An event recorded before this field existed reads as the arm its evaluated_permission implies (always_allow for allow, always_ask for ask).

    - `?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. Informational only: the server routes the matching `user.tool_confirmation` by `tool_use_id`, so clients do not send it back.

  - `class ManagedAgentsAgentMCPToolResultEvent`

    - `"agent.mcp_tool_result" type`

    - `string id`

      Unique identifier for this event.

    - `string mcpToolUseID`

      The id of the `agent.mcp_tool_use` event this result corresponds to.

    - `\Datetime processedAt`

      Timestamp when this event was processed.

    - `?list<Content> content`

      The result content returned by the tool.

    - `?bool isError`

      Whether the tool execution resulted in an error.

  - `class ManagedAgentsAgentToolUseEvent`

    - `"agent.tool_use" type`

    - `string id`

      Unique identifier for this event.

    - `array<string,mixed> input`

      Input parameters for the tool call.

    - `string name`

      Name of the agent tool being used.

    - `\Datetime processedAt`

      Timestamp when this event was processed.

    - `?ManagedAgentsAgentEvaluatedPermission evaluatedPermission`

      The evaluated permission policy for this tool invocation.

    - `?ManagedAgentsAgentToolEvaluation evaluation`

      Which resolved permission_policy produced evaluated_permission: always_allow, always_ask, or auto (with the server's per-invocation judgement). Absent only when the server refused the call before any policy applied (for example, the named tool is not enabled in the session); such a refusal has evaluated_permission deny. An event recorded before this field existed reads as the arm its evaluated_permission implies (always_allow for allow, always_ask for ask).

    - `?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. Informational only: the server routes the matching `user.tool_confirmation` or `user.tool_result` by `tool_use_id`, so clients do not send it back.

  - `class ManagedAgentsAgentToolResultEvent`

    - `"agent.tool_result" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp when this event was processed.

    - `string toolUseID`

      The id of the `agent.tool_use` event this result corresponds to.

    - `?list<Content> content`

      The result content returned by the tool.

    - `?bool isError`

      Whether the tool execution resulted in an error.

  - `class ManagedAgentsAgentThreadMessageReceivedEvent`

    - `"agent.thread_message_received" type`

    - `string id`

      Unique identifier for this event.

    - `list<Content> content`

      Message content blocks.

    - `string fromSessionThreadID`

      Public `sthr_` ID of the thread that sent the message.

    - `\Datetime processedAt`

      Timestamp when the message was received.

    - `?string fromAgentName`

      Name of the callable agent this message came from. Absent when received from the primary agent.

  - `class ManagedAgentsAgentThreadMessageSentEvent`

    - `"agent.thread_message_sent" type`

    - `string id`

      Unique identifier for this event.

    - `list<Content> content`

      Message content blocks.

    - `\Datetime processedAt`

      Timestamp when the message was sent.

    - `string toSessionThreadID`

      Public `sthr_` ID of the thread the message was sent to.

    - `?string toAgentName`

      Name of the callable agent this message was sent to. Absent when sent to the primary agent.

  - `class ManagedAgentsAgentThreadContextCompactedEvent`

    - `"agent.thread_context_compacted" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp when compaction was processed.

  - `class ManagedAgentsSessionErrorEvent`

    - `"session.error" type`

    - `string id`

      Unique identifier for this event.

    - `Error error`

    - `\Datetime processedAt`

      Timestamp when the error occurred.

  - `class ManagedAgentsSessionStatusRescheduledEvent`

    - `"session.status_rescheduled" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp of status change.

  - `class ManagedAgentsSessionStatusRunningEvent`

    - `"session.status_running" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp of status change.

  - `class ManagedAgentsSessionStatusIdleEvent`

    - `"session.status_idle" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp of status change.

    - `?ManagedAgentsSessionRefusalStopDetails stopDetails`

      Structured information about why the session stopped. `null` when there is nothing more to report.

    - `StopReason stopReason`

  - `class ManagedAgentsSessionStatusTerminatedEvent`

    - `"session.status_terminated" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp of status change.

  - `class ManagedAgentsSessionThreadCreatedEvent`

    - `"session.thread_created" type`

    - `string id`

      Unique identifier for this event.

    - `string agentName`

      Name of the callable agent the thread runs.

    - `\Datetime processedAt`

      Timestamp when the thread was created.

    - `string sessionThreadID`

      Public `sthr_` ID of the newly created thread.

    - `?string workflowRunID`

      Identifier of the workflow run that created the thread, or `null` for any other thread.

  - `class ManagedAgentsSpanOutcomeEvaluationStartEvent`

    - `"span.outcome_evaluation_start" type`

    - `string id`

      Unique identifier for this event.

    - `int iteration`

      0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.

    - `string outcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `\Datetime processedAt`

      Timestamp when outcome evaluation started.

  - `class ManagedAgentsSpanOutcomeEvaluationEndEvent`

    - `"span.outcome_evaluation_end" type`

    - `string id`

      Unique identifier for this event.

    - `string explanation`

      Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why.

    - `int iteration`

      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

    - `string outcomeEvaluationStartID`

      The id of the corresponding `span.outcome_evaluation_start` event.

    - `string outcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `\Datetime processedAt`

      Timestamp when outcome evaluation ended.

    - `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.

    - `ManagedAgentsSpanModelUsage usage`

      Aggregate token usage for this evaluation cycle. Sums across all grader model requests within the cycle.

  - `class ManagedAgentsSpanModelRequestStartEvent`

    - `"span.model_request_start" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp when the model request started.

  - `class ManagedAgentsSpanModelRequestEndEvent`

    - `"span.model_request_end" type`

    - `string id`

      Unique identifier for this event.

    - `?bool isError`

      Whether the model request resulted in an error.

    - `string modelRequestStartID`

      The id of the corresponding `span.model_request_start` event.

    - `ManagedAgentsSpanModelUsage modelUsage`

      Token usage for this model request.

    - `\Datetime processedAt`

      Timestamp when the model request completed.

  - `class ManagedAgentsSpanOutcomeEvaluationOngoingEvent`

    - `"span.outcome_evaluation_ongoing" type`

    - `string id`

      Unique identifier for this event.

    - `int iteration`

      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.

    - `string outcomeID`

      The `outc_` ID of the outcome being evaluated.

    - `\Datetime processedAt`

      Timestamp when this heartbeat was emitted.

  - `class ManagedAgentsUserDefineOutcomeEvent`

    - `"user.define_outcome" type`

    - `string id`

      Unique identifier for this event.

    - `string description`

      What the agent should produce. Copied from the input event.

    - `?int maxIterations`

      Evaluate-then-revise cycles before giving up. Default 3, max 20.

    - `string outcomeID`

      Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.

    - `\Datetime processedAt`

      Timestamp when the outcome was accepted.

    - `Rubric rubric`

      How to grade the outcome. File rubrics are currently resolved to their text content; clients should handle both variants.

  - `class ManagedAgentsSessionDeletedEvent`

    - `"session.deleted" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp when the session was deleted.

  - `class ManagedAgentsSessionThreadStatusRunningEvent`

    - `"session.thread_status_running" type`

    - `string id`

      Unique identifier for this event.

    - `string agentName`

      Name of the agent the thread runs.

    - `\Datetime processedAt`

      Timestamp of the status transition.

    - `string sessionThreadID`

      Public sthr_ ID of the thread that started running.

  - `class ManagedAgentsSessionThreadStatusIdleEvent`

    - `"session.thread_status_idle" type`

    - `string id`

      Unique identifier for this event.

    - `string agentName`

      Name of the agent the thread runs.

    - `\Datetime processedAt`

      Timestamp of the status transition.

    - `string sessionThreadID`

      Public sthr_ ID of the thread that went idle.

    - `?ManagedAgentsSessionRefusalStopDetails stopDetails`

      Structured information about why the thread stopped. `null` when there is nothing more to report.

    - `StopReason stopReason`

  - `class ManagedAgentsSessionThreadStatusTerminatedEvent`

    - `"session.thread_status_terminated" type`

    - `string id`

      Unique identifier for this event.

    - `string agentName`

      Name of the agent the thread runs.

    - `\Datetime processedAt`

      Timestamp of the status transition.

    - `string sessionThreadID`

      Public sthr_ ID of the thread that terminated.

  - `class BetaManagedAgentsUserToolResultEvent`

    - `"user.tool_result" type`

    - `string id`

      Unique identifier for this event.

    - `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?sdk_languages=php#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.

    - `?list<Content> content`

      The result content returned by the tool.

    - `?bool isError`

      Whether the tool execution resulted in an error.

    - `?\Datetime processedAt`

      Timestamp when this result was processed.

    - `?string sessionThreadID`

      Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread.

  - `class ManagedAgentsSessionThreadStatusRescheduledEvent`

    - `"session.thread_status_rescheduled" type`

    - `string id`

      Unique identifier for this event.

    - `string agentName`

      Name of the agent the thread runs.

    - `\Datetime processedAt`

      Timestamp of the status transition.

    - `string sessionThreadID`

      Public sthr_ ID of the thread that is retrying.

  - `class BetaManagedAgentsSessionUpdatedEvent`

    - `"session.updated" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp when the update was applied.

    - `?BetaManagedAgentsSessionAgent agent`

      The session's effective agent configuration after the update. Present only when the update changed `agent` (tools or mcp_servers); when present it is the full materialised snapshot, not a diff.

    - `?BetaManagedAgentsBudgetLimit budget`

      The session's budget after the update: the new budget when set or replaced, or null when the update removed it. Present only when the update changed the budget.

    - `?array<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.

  - `class BetaManagedAgentsStartEvent`

    - `"event_start" type`

    - `BetaManagedAgentsStartEventPreview event`

      The previewed event's type and id. The event type determines which delta types the preview's event_delta events carry: agent.message events stream content_delta fragments; agent.thinking previews are start-only — no deltas follow, and the buffered agent.thinking with the same id concludes them.

  - `class BetaManagedAgentsDeltaEvent`

    - `"event_delta" type`

    - `BetaManagedAgentsDeltaContent delta`

      One fragment of the previewed event. The delta type is named for the previewed event's field it streams into: agent.message events stream content_delta fragments, each a partial element of the content array.

    - `string eventID`

      The id of the event being previewed. Matches event.id on the corresponding event_start and the buffered event that reconciles the preview.

  - `class BetaManagedAgentsSystemMessageEvent`

    - `"system.message" type`

    - `string id`

      Unique identifier for this event.

    - `list<BetaManagedAgentsSystemContentBlock> content`

      System content blocks. Text-only.

    - `?\Datetime processedAt`

      Timestamp when this system message was processed.

  - `class BetaManagedAgentsSessionUsageEvent`

    - `"session.usage" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp when the snapshot was taken.

    - `ManagedAgentsSessionUsageSnapshot usage`

      The session's cumulative usage at the snapshot time.

    - `?BetaManagedAgentsBudgetLimit budget`

      The session's configured budget at the snapshot time, or null when the session has no budget.

  - `class ManagedAgentsWorkflowRunCreatedEvent`

    - `"workflow_run.created" type`

    - `string id`

      Unique identifier for this event.

    - `?string description`

      Description that the agent gave the run, passed on as written, or `null` if it gave none.

    - `string name`

      Name that the agent gave the run, passed on as written, or a name that the server assigned.

    - `list<ManagedAgentsWorkflowRunPhase> phases`

      The phases that the run's plan declares, in the plan's order. Can be empty.

    - `\Datetime processedAt`

      Timestamp when this event was processed.

    - `string workflowRunID`

      Identifier of the run. The same value is on all of the run's `workflow_run.*` events.

  - `class ManagedAgentsWorkflowRunStatusEndedEvent`

    - `"workflow_run.status_ended" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp when this event was processed.

    - `ManagedAgentsWorkflowRunResult result`

      How the run ended.

    - `string workflowRunID`

      Identifier of the run. The same value is on all of the run's `workflow_run.*` events.

  - `class ManagedAgentsWorkflowRunPhaseStartedEvent`

    - `"workflow_run.phase_started" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp when this event was processed.

    - `string workflowRunID`

      Identifier of the run. The same value is on all of the run's `workflow_run.*` events.

    - `string workflowRunPhaseID`

      Identifier of the phase, as in `phases` on the run's `workflow_run.created` event.

  - `class ManagedAgentsWorkflowRunPhaseEndedEvent`

    - `"workflow_run.phase_ended" type`

    - `string id`

      Unique identifier for this event.

    - `string phaseStartedID`

      Identifier of the `workflow_run.phase_started` event that opened the phase.

    - `\Datetime processedAt`

      Timestamp when this event was processed.

    - `string workflowRunID`

      Identifier of the run. The same value is on all of the run's `workflow_run.*` events.

    - `string workflowRunPhaseID`

      Identifier of the phase, as in `phases` on the run's `workflow_run.created` event.

  - `class ManagedAgentsWorkflowRunStatusRunningEvent`

    - `"workflow_run.status_running" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp when this event was processed.

    - `string workflowRunID`

      Identifier of the run. The same value is on all of the run's `workflow_run.*` events.

  - `class ManagedAgentsWorkflowRunStatusIdleEvent`

    - `"workflow_run.status_idle" type`

    - `string id`

      Unique identifier for this event.

    - `\Datetime processedAt`

      Timestamp when this event was processed.

    - `string workflowRunID`

      Identifier of the run. The same value is on all of the run's `workflow_run.*` events.

  - `class ManagedAgentsWorkflowRunErrorEvent`

    - `"workflow_run.error" type`

    - `string id`

      Unique identifier for this event.

    - `ManagedAgentsWorkflowRunError error`

      Why the run did not finish, or was not created.

    - `\Datetime processedAt`

      Timestamp when this event was processed.

    - `?string workflowRunID`

      Identifier of the run that met the error, or `null` when the error kept a run from being created.

## Example

```php
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Anthropic\Client;
use Anthropic\Beta\AnthropicBeta;
use Anthropic\Beta\Sessions\BetaManagedAgentsDeltaType;

$client = new Client(apiKey: 'my-anthropic-api-key');

$betaManagedAgentsStreamSessionThreadEvents = $client
  ->beta
  ->sessions
  ->threads
  ->events
  ->streamStream(
  'sthr_011CZkZVWa6oJjw1rgXZpnBt',
  sessionID: 'sesn_011CZkZAtmR3yMPDzynEDxu7',
  eventDeltas: [BetaManagedAgentsDeltaType::AGENT_MESSAGE],
  betas: [AnthropicBeta::MESSAGE_BATCHES_2024_09_24],
  workspaceID: 'wrkspc_011CZkZaBF1tNoB5wlCeusgy',
);

var_dump($betaManagedAgentsStreamSessionThreadEvents);
```

### Response (200)

```json
{
  "id": "sevt_011CZkZGPp1iBcp4kaQSihUm",
  "content": [
    {
      "text": "Where is my order #1234?",
      "type": "text"
    }
  ],
  "type": "user.message",
  "processed_at": "2026-03-15T10:00:00Z"
}
```
