Auditing agents and workflows¶
A workflow is a fixed structure: its steps and their order are compiled before it runs, so its audit is the audit of a fixed plan and of the decisions taken at each step. An agent decides its own next step while it runs: it builds a task graph, delegates to subagents, and chooses what to put in front of a model on each call. Xratu records those choices as they are made, so an agent run is as auditable as a workflow run. This page covers what is recorded for each, and how an auditor answers "why did the agent do that".
What each records¶
flowchart TB
subgraph WF["WORKFLOW RUN"]
direction TB
FH[("Compiled workflow<br/>provenance of the execution composition")]
PE[("Primitive events<br/>every step, every transition")]
WD[("PolicyDecision per hook firing")]
FH --> PE --> WD
end
subgraph AG["AGENT RUN, in addition"]
direction TB
TG[("Task graph events<br/>task.created, claimed, completed")]
DL[("Delegation<br/>delegate primitive, pre_delegate decision")]
CC[("Context construction record<br/>per model call")]
WM[("Working memory events<br/>added, superseded, compacted")]
TG --> DL
TG --> CC
CC --> WM
end
FP{{"Run fingerprint<br/>on every record"}}
FP --> WF
FP --> AG
An agent runs inside the same kernel, under the same fingerprint and the same policy hooks, as a workflow. What an agent adds is a record of the decisions a workflow's structure would otherwise have fixed in advance.
Workflows¶
| Question | Record |
|---|---|
| Which workflow ran, exactly | The workflow provenance referenced by the project execution composition; the flow's publication, audited as flow.create or flow.update |
| Which step ran, in which order | Primitive events in the kernel journal, in journal order |
| What passed between steps | Object lineage in the journal: each output object, its hash, and the step that consumed it |
| What each rule decided at each step | PolicyDecision records, one per hook firing |
| Which sub-workflow ran | The sub-workflow's own steps under the same run and fingerprint |
The workflow's structure cannot change during a run: its compiled native execution is part of the sealed project execution composition, with the source workflow retained as provenance. See Lowering.
Agents¶
The task graph¶
The agent creates, decomposes and revises its task graph; the kernel persists
and versions it. Every change is an event in the run's journal:
task.created, task.claimed, task.started, task.blocked,
task.completed, with the actor that made it and the revision before and
after. Who was doing what, at every point in the run, is read from those
events.
Delegation¶
A subagent is started through the delegate primitive, and every delegation
passes the pre_delegate policy hook first. The record of a delegation is the
PolicyDecision for that hook, the delegation envelope naming what was
delegated and with what scope, and the delegation.started and
delegation.completed events. See
Delegation and delegation envelopes.
What the model was given¶
For every model call, the kernel seals a context construction record: each fragment placed in front of the model, with its type, its source, its revision or content hash, why it was included, its token cap, and each fragment that was left out and why. The record answers the question an audit of an agent most often asks, "what did the model see when it decided this", from state, without asking the model. Context construction is reproducible from the authoritative state the record names. See Context construction record.
Working memory and compaction¶
Working memory changes are journal events: memory.entry_added,
memory.entry_superseded, memory.entry_expired. When the kernel compacts or
refines working memory, compaction.applied or refinement.applied records
it. Compaction changes only what the agent carries forward. It never rewrites
the task graph, the event journal, the evidence, or the audit records, and
mandatory instructions are never removed by it.
The runtime journal¶
Each journal event carries its sequence, its actor, its subject with revisions before and after, its causality (the event that caused it, the task, the delegation) and an integrity digest chained to the previous event:
{
"event_id": "event-9902",
"run_id": "run-9821",
"sequence": 2,
"event_type": "task.created",
"actor": {"actor_type": "agent", "actor_id": "architecture-agent"},
"subject": {"type": "task", "id": "task-root", "revision_before": null, "revision_after": 1},
"causality": {"correlation_id": "run-9821", "causation_event_id": "event-9901", "task_id": "task-root"},
"integrity": {"previous_digest": "sha256:...", "digest": "sha256:..."},
"ownership_epoch": 4
}
The journal exists to reconstruct and continue the run; the kernel sends the records audit needs into the evidence path. Recovery reads the journal and the checkpoints, never the audit store.
Why the agent did that¶
| Question | Answered by |
|---|---|
| What was the agent working on | The task graph events up to that point |
| Who told it to | The delegation events and envelope, and the pre_delegate decision |
| What it knew | The working memory revisions it held |
| What the model saw | The context construction record for that call |
| What the model returned | The response, recorded as evidence with its hash |
| Whether it was allowed | The PolicyDecision records for the call and its effects |
| Which model version answered | The call's model route contract |
See Auditing a run end to end for the records every run shares.