Get one step of a session's trace in full
PreviewRead one step of a session’s trace in full: tool input and output, the model request and response, and its raw events.
/v1/sessions/{session_id}/trace/turns/{turn}/steps/{step}See authentication for credentials and permissions.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Prefixed public identifier
Prefixed public identifier
Prefixed public identifier
Query Parameters
Section titled “Query Parameters”Return payloads whole, however large.
Responses
200Success
Success
Everything about one step, for the inspector.
object
Raw events of the step, in sequence order.
An event in the session log.
object
Payload, when small enough to inline.
Event identifier.
Sequence in the session event log.
Size of the serialized payload.
When the event happened.
Event type, such as tool.call_completed.
The request of a model call: what changed since the previous call.
object
Messages sent in the call.
Messages before this index were already in the previous call.
The new messages, at most 50.
One message of a model request.
object
The whole message, when asked for and within the limit.
Position in the request.
Start of the message text.
Role as handed to the provider driver: system, user, assistant
or tool. Stored messages say agent and tool_result; each driver
then maps these four onto its own wire format.
Size of the serialized message.
Start of the system prompt.
How the call’s tool list changed; absent when it did not.
object
Tools that became callable.
Tools fixed when this call started a new tool epoch (the first call, or the first after a model switch or compaction).
Tools whose definition changed, such as a searched tool’s full schema.
Tools no longer callable.
Tools offered in the call.
Token usage of the call, split by prompt cache.
object
Prompt tokens written to the provider’s cache.
Prompt tokens read from the provider’s cache.
Set when this call lost most of the prompt prefix the previous model call had cached.
object
Seconds between the end of the previous call and the start of this one.
How many of those this call did not read back.
Prompt tokens the previous call left in the cache (read plus written).
Likely cause, the first difference found: model_changed,
tools_changed, system_changed, history_changed, expired (idle
longer than the cache retention), or unknown.
Estimated index of the last message inside the cached prefix: the
cache-read share of the prompt laid over the messages by size. -1
when only the tools fit; absent when nothing was read from cache.
A long prompt sent with caching off that neither read nor wrote the cache: turning on prompt caching would likely make calls like it cheaper.
Prompt tokens neither read from nor written to the cache.
Completion tokens.
How prompt caching was requested, such as auto or
anthropic_cache_control; absent when caching was off.
The step itself.
object
Session a spawn_agent call started.
Wall time of the step; absent while running.
Last event sequence of the step.
Prompt tokens of a model call.
model, answer, tool, approval, agent or send.
Model that served the call, for model steps.
Tool name, or model for model calls.
What the model said alongside this call (model calls and answers).
Start relative to the turn’s start.
Completion tokens of a model call.
Tool calls this model call asked for.
Short result or error.
Retries a model call made before it succeeded or gave up.
Time spent waiting between those retries.
First event sequence of the step.
When the step started.
running, success, error or cancelled.
Per-turn step number, 1-based.
What the call acted on, from the tool’s narration.
Tool call identifier, for tool steps.
Turn the step belongs to.
Example
{ "events": [ { "id": "event_01a124cd8a1b7f02a5c4e6d1b2f3a4c5", "sequence": 14, "size_bytes": 512, "type": "tool.started" } ], "input": { "size_bytes": 221, "truncated": false }, "output": { "size_bytes": 221, "truncated": false }, "request": { "message_count": 14, "new_from": 12, "new_messages": [ { "index": 12, "role": "tool", "size_bytes": 244 } ], "tool_changes": { "baseline_tools": 9 }, "tool_count": 9, "usage": { "cache_creation_tokens": 0, "cache_read_tokens": 12529, "cache_reset": { "idle_seconds": 42, "lost_tokens": 18420, "previous_cached_tokens": 18420, "reason": "tools_changed" }, "cached_through": 11, "input_tokens": 10295, "output_tokens": 197, "prompt_cache": "auto" } }, "step": { "duration_ms": 269, "end_sequence": 21, "kind": "tool", "model": "gpt-6.1-sol", "name": "bash", "offset_ms": 3010, "retry_attempts": 3, "retry_wait_ms": 42000, "start_sequence": 14, "status": "success", "step": 2, "tool_call_id": "call_PzDcvnFaUll8os3tPhWj", "turn": 1240 }}