Skip to content

Understanding the Audit Trail

Every task processed by Kernel Service generates a complete audit trail. This is critical for:

  • Debugging — see exactly what the agent did and why
  • Compliance — immutable record of all AI actions
  • Cost tracking — token usage and cost per task
  • ROI measurement — correlate agent actions with business outcomes

Audit Trail Structure

Task
└── Run (one execution attempt)
├── Step 1: reasoning (LLM call)
├── Step 2: tool_call (rol.leads.get)
├── Step 3: tool_call (rol.clients.get)
├── Step 4: reasoning (LLM processes results)
├── Step 5: tool_call (rol.messages.draft_email)
└── Step 6: reasoning (final output)

Step Types

TypeDescription
reasoningLLM thinking/generating — includes model used, tokens, cost
tool_callTool invocation — includes input, output, latency
errorSomething went wrong — includes error message

Metrics

Each task includes aggregate metrics:

{
"metrics": {
"total_input_tokens": 2507,
"total_output_tokens": 693,
"total_cost_cents": 0.05,
"model_used": "gemini-2.0-flash",
"elapsed_ms": 6709,
"step_count": 5
}
}

Viewing Audit Trails

Terminal window
# Get a task with full audit trail
curl https://api.kernelservice.com/api/v1/tasks/{task_id} \
-H "X-Tenant-ID: $TENANT_ID" \
-H "X-API-Key: $API_KEY"