API referenceObjectsagent_execution

The agent execution object

⚠️
Preview — this feature is being built; the design below is the spec.

The agent_execution object as the API returns it. Every field below appears in every response that returns this object; fields with no value are null rather than missing.

Example

{
  "id": "exec_01JC7N0Q8S2U4W6Y8A0C",
  "type": "agent_execution",
  "agent_id": "agt_01JC4R8W6Q2N9X3T5V7Y",
  "agent_name": "refund-desk",
  "agent_version": 4,
  "session_id": "sesn_01JC7M2K4P6R8T0V2X4Z",
  "state": "error",
  "started_at": "2026-11-05T10:00:01Z",
  "ended_at": "2026-11-05T10:00:19Z",
  "duration_ms": 18234,
  "error": "Tool lookup_order returned an error: order not found",
  "usage": {
    "input_tokens": 9120,
    "cached_input_tokens": 6400,
    "output_tokens": 412,
    "cost_usd": "0.0294"
  },
  "trace_count": 7,
  "input": {
    "message": "Please refund order 88123."
  },
  "output": null,
  "traces": [
    {
      "step": 2,
      "step_type": "tool_call",
      "label": "lookup_order",
      "input": {
        "order_id": "88123"
      },
      "output": {
        "error": "order not found"
      },
      "error": "order not found",
      "started_at": "2026-11-05T10:00:05Z",
      "ended_at": "2026-11-05T10:00:06Z",
      "duration_ms": 412,
      "usage": null
    }
  ],
  "traces_truncated": false
}

Fields

FieldTypeDescription
idstringUnique id of this object.
typestringThe object type, always agent_execution.
agent_idstringThe related agent.
agent_namestringSee the endpoint pages below.
agent_versionintegerSee the endpoint pages below.
session_idstringThe related session.
statestringSee the endpoint pages below.
started_atstringWhen work began.
ended_atstringSee the endpoint pages below.
duration_msintegerSee the endpoint pages below.
errorstringSet when something failed: code and message.
usageobjectTokens and cost attributed to it.
trace_countintegerSee the endpoint pages below.
inputobjectNested detail; see the endpoint pages below.
outputstring or nullSee the endpoint pages below.
tracesarrayNested detail; see the endpoint pages below.
traces_truncatedbooleanSee the endpoint pages below.

Returned by

Was this page helpful?