Trace Format

May 26, 2026 ยท View on GitHub

lessonweaver traces are JSON objects that describe one agent run. Unknown fields are ignored so producers can add metadata without breaking older readers.

Top-Level Fields

FieldRequiredTypeDescription
trace_idyesstringStable ID for this trace.
sourceyesstringProducer or agent type.
taskyesstringUser-visible task description.
eventsyesarrayOrdered list of trace events.
outcomeyesstringFinal result such as success or corrected_by_human.
metadatanoobjectForward-compatible metadata.

Reserved metadata keys include sensitivity, contains_pii, contains_secret, tenant_id, data_classification, lesson_candidate, lesson_problem, and lesson_note.

Event Fields

FieldRequiredTypeDescription
idyesstringUnique event ID within the trace.
typeyesstringOne of the valid event types below.
contentnostringHuman-readable event content.
statusnostringStatus such as success or failed.
successnobooleanTool or step success marker.
metadatanoobjectEvent-specific metadata.

Event Types

  • user_message: user input.
  • assistant_message: assistant output.
  • model_call: model invocation.
  • tool_call: tool invocation.
  • tool_result: tool result.
  • error: runtime or workflow error.
  • retry: retry step after an error.
  • human_correction: human feedback correcting agent behavior.
  • evaluation_result: automated evaluation result.
  • final_answer: final agent response.
  • workflow_step: named step in a workflow.

Examples

Human correction:

{
  "trace_id": "trace-gh-pr-review-001",
  "source": "github_coding_agent",
  "task": "Review pull request quality",
  "events": [
    {"id": "e1", "type": "user_message", "content": "Please review this PR."},
    {"id": "e2", "type": "assistant_message", "content": "Looks good from title and description."},
    {"id": "e3", "type": "human_correction", "content": "You did not inspect changed files/diff before reviewing."}
  ],
  "outcome": "corrected_by_human"
}

Failed evaluation:

{
  "trace_id": "trace-chatbot-policy-001",
  "source": "customer_chatbot",
  "task": "Answer policy refund question",
  "events": [
    {"id": "p1", "type": "user_message", "content": "Can I get a full refund after 40 days?"},
    {"id": "p2", "type": "assistant_message", "metadata": {"policy_version": "2024-09"}},
    {"id": "p3", "type": "evaluation_result", "status": "failed"}
  ],
  "outcome": "success"
}

Workflow steps:

{
  "trace_id": "trace-workflow-validation-001",
  "source": "workflow_agent",
  "task": "Run a deployment checklist with validation",
  "events": [
    {"id": "w1", "type": "workflow_step", "content": "Collected deployment steps."},
    {"id": "w2", "type": "workflow_step", "content": "Validated checklist."}
  ],
  "outcome": "success"
}