Table of Contents

The agentic log

"The agentic log" is the pair of event streams that describe what your coding agents actually did. Every scenario in this documentation begins by naming the pattern to look for in one of them.

UsageEvent — one LLM API call

A UsageEvent is the canonical record of a single call made by a coding agent. Identity is a strict hierarchy, and provider/model are opaque strings (no vendor-specific parsing).

Field Meaning
OrgId, RepoId, ProjectId Who and where the call belongs to. RepoId is a stable hash of the git remote.
SessionId, TaskId, TurnSeq, CallId The agent's own structure: a session contains tasks, a task contains turns, a turn contains calls.
PullRequestId, CommitSha Join fields filled by a caller hint or by VCS enrichment.
Provider, Model e.g. anthropic / claude-sonnet-4-20250514.
Tokens Input, output, cache-read and cache-write counts.
Cost USD cost for the call, computed by the caller or SDK.
LatencyMs, TurnCount Round-trip latency and how many agent turns the call covered.
ToolCalls Each tool name, count, and duration the agent used in the call.
Thinking Whether extended thinking was on, and at what budget.
Outcome Success, error, abandoned, etc.
CaptureLevel MetadataOnly by default; Redacted adds prompt/response summaries.
CustomMetadata Your own key-value tags.

Ingestion is idempotent per org: IdempotencyKey must be unique, so a retried batch never double-counts.

AugmentationEvent — one change the SDK made

An AugmentationEvent is the transparency ledger. It records an augmentation the SDK applied to a real call, correlated by CallId:

Field Meaning
ActionType The kind of change (model downgrade, context reduction, cache placement, …).
BeforeValue, AfterValue Human-readable before/after, e.g. claude-opus-4 → claude-sonnet-4.
Reason Why it was applied.
PolicyVersionId, DetectorId Which policy or detector authorised it.
AppliedAt When.

This is what makes an optimization auditable: for every call that was changed, there is a row that says what changed and why.

What the log can tell you

Because identity, cost, tokens, tools, thinking and outcome are all on the same record, the log can answer questions a provider invoice cannot:

  • Which project is driving spend, and which session inside it?
  • Is a call expensive because of input size, output size, cache misses, or retries?
  • Did a model upgrade actually help, or did it just move cost around?
  • Which tools are never called, and which are called on every turn?
  • Which turn is the one where context exploded?

The detectors in Detectors are the codified versions of those questions. The scenarios in Scenarios show the setup each one implies.