How to Join AI Agent Traces to Artifacts and Evidence
An agent trace can contain every event and still fail to answer the only question that matters:
Which execution produced this artifact, from which inputs, under which policy?
Most agent observability stops too early. It records a model request, a tool call, a command exit code, perhaps a final answer. These records are useful, but they remain separate timelines. The model says it changed a file. The shell says a command succeeded. Git shows a diff. Nothing proves that these three facts belong to one causal chain.
The missing mechanism is not more logging. It is a trace join: a small set of stable identifiers that connects reasoning boundaries, effects, and artifacts without pretending to expose private model reasoning.
Three timelines, one execution
A production agent usually creates at least three kinds of history:
| Timeline | Typical records | What it cannot prove alone |
|---|---|---|
| Decision | model turn, selected tool, evaluator verdict | what actually changed |
| Execution | process, tool call, HTTP request, exit status | why the action was selected |
| Artifact | patch, file hash, commit, report, checkpoint | which run and policy produced it |
OpenTelemetry gives distributed systems a rigorous model for traces and spans. W3C PROV supplies a vocabulary for entities, activities, agents, and derivation. Agent runtimes need the operational bridge between them: IDs that survive the transition from an observed activity to a durable result.
IOSM CLI already treats runs as artifact-producing work: orchestration state, checkpoints, events, and reports live under .iosm/, while cycles retain baselines and evidence. That architecture points in the right direction. The next observability step is to make the joins explicit enough that another tool can traverse them.
The trace-join envelope
I would keep the core object deliberately small:
{
"run_id": "run_01J...",
"span_id": "tool_7f2...",
"parent_span_id": "turn_18a...",
"subject": {
"type": "workspace",
"base_revision": "git:4af3..."
},
"activity": {
"type": "apply_patch",
"tool": "apply_patch",
"policy_digest": "sha256:9bc1..."
},
"inputs": [
{"uri": "repo:src/auth.ts", "digest": "sha256:31d8..."}
],
"outputs": [
{"uri": "repo:src/auth.ts", "digest": "sha256:a802..."},
{"uri": "artifact:test-report.json", "digest": "sha256:e552..."}
],
"status": "succeeded",
"observed_at": "2026-07-13T11:30:00Z"
}
This is not a transcript. It does not claim to preserve hidden reasoning. It records an observable activity and binds it to immutable identities where possible.
The fields create four joins:
- Run join — all work belonging to one controlled attempt.
- Causal join — a tool span points to the turn or orchestration node that authorized it.
- State join — the activity names the revision it expected before execution.
- Provenance join — inputs and outputs identify the artifacts consumed and generated.
A trace viewer can now move from a failed test to the patch that preceded it, from that patch to the tool invocation, and from the invocation to the policy digest that allowed it. A report can link to evidence instead of copying prose about evidence.
Why correlation IDs are not enough
A single correlation_id groups records. It does not describe derivation.
If two parallel agents read revision A, produce patches B and C, and an orchestrator merges them into D, one shared ID tells us they belong together. It cannot tell us whether D derives from both patches, whether one patch was discarded, or whether the merge ran against a different base.
The artifact graph should say it directly:
revision:A
├─ activity:agent-1 ─> patch:B
├─ activity:agent-2 ─> patch:C
└─ activity:merge(B,C) ─> revision:D
This is where provenance becomes more useful than a flat audit log. The system can ask graph questions:
- Which outputs depend on a revoked input?
- Did this report describe the revision that was actually tested?
- Which tool effects occurred after the last checkpoint?
- Can the final claim be reached from a successful evaluator artifact?
Those are engineering questions, not dashboard decoration.
Join at boundaries, not everywhere
The mechanism fails if instrumentation becomes a demand to hash every token and serialize every internal object. That creates cost without trustworthy semantics.
I would join only at boundaries where identity or authority changes:
- model turn → proposed action;
- policy decision → permitted tool call;
- tool call → external effect;
- workspace revision → patch or checkpoint;
- evaluator run → verdict artifact;
- orchestration node → delegated child run;
- final claim → supporting evidence.
This boundary rule also keeps the design compatible with sampling. OpenTelemetry systems may sample spans; artifact provenance cannot silently disappear with sampled telemetry. Therefore the runtime should separate two retention classes:
- diagnostic telemetry may be sampled and expired;
- decision provenance required to validate an artifact must be durable.
The identifiers can join both classes, but their retention contracts are different.
A validation rule for claims
Once joins exist, a runtime can enforce a useful invariant:
A claim marked
verifiedmust resolve to at least one evaluator artifact, and that artifact must resolve to the exact subject revision.
In pseudocode:
claim
-> evidence_ref
-> evaluator_output(status = pass)
-> tested_subject.digest
== final_subject.digest
If the chain breaks, the claim is not necessarily false. It is unresolved. That distinction prevents a common agent failure: a test ran successfully, then another edit changed the workspace, yet the final answer still presents the earlier test as proof of the later state.
This complements the evaluation promotion pipeline: promotion decides when a test becomes a durable regression obligation; trace joins prove which exact revision satisfied it. It also strengthens agent change sets: a change-set hash identifies what was approved, while provenance shows how the resulting revision was produced and checked. And it fits the broader argument that an AI engineering runtime must own execution semantics rather than delegate them to the model.
What this model does not prove
A provenance envelope cannot prove that an evaluator is correct, that a policy is wise, or that a model selected the best action. Signed garbage is still garbage. A complete trace can describe a bad process perfectly.
It also does not make arbitrary shell effects reversible. If an agent calls an external system without an idempotency key or compensation path, provenance improves diagnosis but not recovery.
The narrower claim is still valuable: stable joins make the relationship between actions, state, evidence, and outputs machine-checkable. They turn “the agent says it tested the change” into a navigable graph with explicit missing edges.
Observability should terminate in an artifact
Traditional tracing asks where time went. Agent tracing must also ask where authority and evidence went.
That requires more than spans. It requires a join between ephemeral execution and durable engineering state.
My rule is simple:
If a final artifact cannot point back to the exact execution that produced and validated it, the trace is incomplete—no matter how many events it contains.
The goal is not surveillance of the model. The goal is a system in which every important output has a lineage that software, not faith, can inspect.
Sources
- IOSM CLI README: controlled execution, checkpoints, orchestration artifacts, and cycle evidence
- OpenTelemetry Trace specification
- W3C PROV overview and provenance data model family
For the complementary part of this workflow, see How to Verify Provenance Closure in AI Agent Decisions.