AI & LLM

AI Agent Run Trace JSON Example

A JSON example of an AI agent execution trace — includes the goal, ordered steps with thoughts, tool calls, observations, and the final answer. Copy-ready for agent logging and debugging.

{
  "runId": "run_3Hg8Tz1Qa9",
  "agent": "support-assistant",
  "goal": "Find the status of order ord_77F2K9 and tell the customer.",
  "status": "completed",
  "steps": [
    {
      "index": 0,
      "thought": "I need to look up the order by its id.",
      "action": {
        "tool": "get_order",
        "input": {
          "order_id": "ord_77F2K9"
        }
      },
      "observation": {
        "status": "shipped",
        "carrier": "Delhivery",
        "eta": "2025-05-22"
      }
    },
    {
      "index": 1,
      "thought": "I have the status; I can answer the customer now.",
      "action": {
        "tool": "final_answer",
        "input": {
          "text": "Your order has shipped via Delhivery and arrives by May 22."
        }
      },
      "observation": null
    }
  ],
  "finalAnswer": "Your order has shipped via Delhivery and arrives by May 22.",
  "usage": {
    "totalTokens": 1284,
    "toolCalls": 1,
    "durationMs": 2310
  },
  "startedAt": "2025-05-20T14:22:00Z",
  "finishedAt": "2025-05-20T14:22:02Z"
}

Field Reference

runIdrequiredstringUnique id for this agent run; used to correlate logs and traces
goalrequiredstringThe task the agent was asked to accomplish
statusrequiredstringRun outcome: running, completed, failed, or cancelled
stepsrequiredarray<object>Ordered reasoning steps; each pairs a thought, an action, and an observation (ReAct style)
steps[].action.toolrequiredstringName of the tool invoked in this step
steps[].observationoptionalobject | nullResult returned by the tool, fed back into the next step
usageoptionalobjectAggregate metrics — tokens, tool-call count, and wall-clock duration

Variants

Failed runA trace where a tool errored and the agent stopped.
{
  "runId": "run_9Lp2Wq7Rx",
  "agent": "support-assistant",
  "goal": "Refund order ord_unknown.",
  "status": "failed",
  "steps": [
    {
      "index": 0,
      "thought": "Look up the order before refunding.",
      "action": {
        "tool": "get_order",
        "input": {
          "order_id": "ord_unknown"
        }
      },
      "observation": {
        "error": "ORDER_NOT_FOUND",
        "message": "No order with that id."
      }
    }
  ],
  "error": "Could not complete goal: order not found.",
  "finishedAt": "2025-05-20T15:01:00Z"
}

Common Use Cases

  • Logging and replaying agent runs for debugging and evaluation
  • Displaying an agent's chain-of-thought and tool steps in a UI
  • Auditing which tools an agent called and how many tokens it spent
ai agentagentstracetool callingobservabilityllm

Validate or format this JSON

One click loads this exact example into the tool — no copy-paste needed. Format it, validate it, explore the tree, or generate TypeScript types instantly.

Frequently Asked Questions

ReAct (Reason + Act) interleaves a 'thought' (the model's reasoning), an 'action' (a tool call), and an 'observation' (the tool's result). The agent loops through these until it calls a final_answer action. Storing each step makes runs debuggable and reproducible.

For short runs, a single document is convenient. For long-running or high-volume agents, stream each step as its own event (keyed by runId) so you can tail progress in real time and avoid rewriting a growing blob — the same approach observability tools like OpenTelemetry use.

Capturing the reasoning makes failures explainable: you can see why the agent chose a tool or went off-track. For privacy and cost you may redact or truncate thoughts in production, but they're invaluable during development and evaluation.

Related JSON Examples