Stream Events
Call Create session first and replace the example session ID with its returned ID.
/anthropic/v1/sessions/{session_id}/events/stream◐ PartialOfficial Claude documentation ↗
Request parameters
session_idstringrequiredpath: Session ID (path or query parameter).
event_deltasarrayoptionalquery: When set, the connection also receives streaming delta events.
Returns
200
Keep the SSE connection open and send a message in another request after replacing sesn_123. Stopping the stream disconnects the subscription, not the agent. SDK 0.124.0 filters session.usage; read history for full usage. Pass event_deltas[]=agent.message to receive incremental text previews before the final event; as in the official API, agent.thinking previews are start-only.
Errors follow the Claude Managed Agents format — see error codes
Request
curl
# Call Create session first and replace the example session ID with its returned ID.
curl https://api.deepraxis.com/anthropic/v1/sessions/sesn_123/events/stream \
-H "x-api-key: $PRAXIS_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: managed-agents-2026-04-01"Python
# Call Create session first and replace the example session ID with its returned ID.
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.deepraxis.com/anthropic",
api_key="$PRAXIS_API_KEY",
)
with client.beta.sessions.events.stream("sesn_123") as stream:
for event in stream:
print(event)TypeScript
// Call Create session first and replace the example session ID with its returned ID.
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.deepraxis.com/anthropic",
apiKey: "$PRAXIS_API_KEY",
});
const stream = await client.beta.sessions.events.stream("sesn_123");
for await (const event of stream) {
console.log(event);
}Response 200
: connected
event: user.message
data: {"id":"fa9087de-7935-45fb-b675-4cc50fac7af0","type":"user.message","processed_at":null,"content":[{"type":"text","text":"你好"}]}
event: session.status_running
data: {"id":"3c47cdc8-5a6b-4ae8-adf4-1179d4843f97","type":"session.status_running","processed_at":"2026-09-26T07:16:31.027Z"}
event: user.message
data: {"id":"fa9087de-7935-45fb-b675-4cc50fac7af0","type":"user.message","processed_at":"2026-09-26T07:16:31.027Z","content":[{"type":"text","text":"你好"}]}
event: span.model_request_start
data: {"id":"mreq_bXNnXzlmMmZiYzU3LTVlOWYtNDM1ZC04NWE3LThkMTNhZDdmNDAzZQ","type":"span.model_request_start","processed_at":"2026-09-26T07:16:31.027Z"}
event: span.model_request_end
data: {"id":"7e8cf0a5-f911-49a6-b3fa-d3cf8a2f5a5a","type":"span.model_request_end","processed_at":"2026-09-26T07:16:35.522Z","model_request_start_id":"mreq_bXNnXzlmMmZiYzU3LTVlOWYtNDM1ZC04NWE3LThkMTNhZDdmNDAzZQ","is_error":null,"model_usage":{"input_tokens":36,"output_tokens":74,"cache_read_input_tokens":0,"cache_creation_input_tokens":0}}
event: agent.message
data: {"id":"8e4598fd-b451-4947-8bfe-14b8657b38ba","type":"agent.message","processed_at":"2026-09-26T07:16:35.522Z","content":[{"type":"text","text":"你好,有什么可以帮你的吗?"}]}
event: session.usage
data: {"id":"41033930-7025-4d9b-8e5b-5aab70020910","type":"session.usage","processed_at":"2026-09-26T07:16:35.522Z","usage":{"input_tokens":36,"output_tokens":74,"cache_read_input_tokens":0}}
event: session.status_idle
data: {"id":"aa79bbc8-c332-407a-a59b-b061c05e8c72","type":"session.status_idle","processed_at":"2026-09-26T07:16:35.522Z","stop_reason":{"type":"end_turn"}}
Response
HTTP 200
Server-sent events
text/event-stream — chunk / event object
No field schema is declared.