Integration guideIntermediate~20 min

Agent Tool Evidence to Causal Audit

SupportedPython 3.12+Synthetic Agent RuntimeReplayTOOL_CALL_CONTEXT + CAUSAL_AUDIT

Follow one real transaction-fraud run from parallel private tool evidence, through a fan-in risk score, to a governed counterfactual replay and an evidence-backed causal conclusion.

Last updated
Proven result EVIDENCE ALIGNED
Source decisionREVIEW · 0.90
InterventionPERTURB confidence
CounterfactualALLOW · 0.25
Observed influence+0.650

PARALLEL INPUTS · FAN-IN · GOVERNED REPLAY

Quest: trace the evidence path before drawing a causal conclusion.

Overview

Prove that a tool result changed an agent decision.

A completed trace can show that an agent called a tool. Causal Audit goes further: it authorizes one bounded intervention, asks the external runtime to replay against its frozen private evidence, and compares the observed and counterfactual outcomes. The original execution remains unchanged.

You will run

The Transaction Fraud Causal Guide Agent with parallel profile and device inputs that fan in to transaction_risk.score.

You will verify

A PERTURB intervention changes the result from REVIEW 0.90 to ALLOW 0.25 and ends as EVIDENCE_ALIGNED.

Architecture

The runtime owns payloads; Core owns the governed record.

Private execution plane

Synthetic Agent Runtime

Executes tools, freezes private evidence, applies the approved transformation, and reruns its deterministic decision logic.

Governance plane

AIGP

Stores bounded descriptors, authorizes the intervention, persists replay lineage, and classifies the observed causal effect.

profile lookup+device risktransaction risk scoreCausal Audit

Prerequisites

Prepare boundaries.

  • Python 3.12 or later, Git, and Docker Desktop.
  • A running AIGP stack with the API, replay worker, and a project-scoped operator identity.
  • A local OAuth configuration for normal Synthetic Runtime evidence ingestion.
  • A separate shared secret for the protected runtime replay endpoint.
Two credentials, two jobs: normal evidence ingestion uses the runtime's OAuth identity. The replay worker calls /replay with Authorization: Bearer <shared-secret>. Both environment variables below must contain the same secret; neither name is sent over the network.
terminal · clone and install
git clone https://github.com/Bhanuj-AI/synthetic-agent-runtime.git
cd synthetic-agent-runtime
python3.12 -m venv .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -e '.[dev]'
terminal · configure replay bearer authentication
# Use one locally generated secret in both processes. Do not commit it.
export REPLAY_SHARED_SECRET='replace-with-a-local-secret'

# Terminal 1 — Synthetic Agent Runtime
export SYNTHETIC_RUNTIME_REPLAY_AUTH_TOKEN="$REPLAY_SHARED_SECRET"

# Terminal 2 — AI Governance replay worker
export AI_GOVERNANCE_SYNTHETIC_RUNTIME_REPLAY_AUTH_TOKEN="$REPLAY_SHARED_SECRET"
export AI_GOVERNANCE_SYNTHETIC_RUNTIME_REPLAY_ENDPOINT='http://host.docker.internal:8090/replay'

Run Flow

Produce Observed Source Execution.

Start the Synthetic Agent Runtime, then execute the built-in fraud-causal-guide scenario. It sends bounded operational evidence to Core while retaining its tool inputs and outputs inside the runtime.

terminal 1 · Synthetic Agent Runtime
.venv/bin/python -m synthetic_agent_runtime serve \
  --host 127.0.0.1 \
  --port 8090
terminal 2 · execute fraud scenario
.venv/bin/python -m synthetic_agent_runtime run \
  --scenario fraud-causal-guide \
  --seed 42 \
  --duration 1
expected source outcome
Synthetic Agent Runtime run: <run-id>
External execution: sar-<run-prefix>-0000000
Core execution: <platform-execution-id>
Source decision: REVIEW
Source outcome score: 0.90

Inspect fan-in

Confirm dependency graph before intervenention.

Open the source execution in Agents Runtime. The two input calls share one tool_call_group_id and neither depends on the other. The risk score depends on both. A later claim-history observation depends on the risk score, demonstrating that a counterfactual execution can diverge from the source's downstream topology.

  1. 1customer_profile.lookupgroup: decision-inputs · no dependencies
  2. 2device_risk.lookupgroup: decision-inputs · no dependencies
  3. 3transaction_risk.scoredepends on: customer_profile.lookup, device_risk.lookup
  4. 4claim_history.lookuplater observation · depends on: transaction_risk.score

Configure policy and audit

Authorize one narrow transformation.

Start in Studio: open Agents Runtime, select the Causal Audit tab, then open Intervention Policies. Create an active policy before you create an audit. The policy is the approval boundary: it says exactly which observed tool evidence a replay worker may change and how.

  1. 1Click Create Policy. Under Select Observed Tool Evidence, choose the completed fraud source execution that the runtime printed.
  2. 2Select transaction_risk.score as the auditable tool result. Let Studio populate the tool name, evidence schema ID, and schema version from that observed descriptor; do not type a near-match.
  3. 3Set the structured JSON intervention provider and choose PERTURB. Enter the bounded control shown below, then validate and activate version 1 of the policy.
  4. 4Return to Causal Audit → Audits, create an audit for the same observed execution, and select this active policy. Submit it and keep the source execution ID handy for the Replay Management step.
Causal Audit intervention policy
Policy target
Tool name: transaction_risk.score
Evidence schema: synthetic-fraud-risk
Schema version: v1

Counterfactual controls
Provider: structured-json
Provider version: v1
Strategy: PERTURB
Field path: /confidence
Operation: NUMERIC_DELTA
Delta: -0.50
Permitted range: 0.00 to 1.00
Samples: 1

Intervention: original evidence → controlled PERTURB → replay result.

Why these policy values?

Exact tool and schema
The fraud fixture has several tool calls, but only transaction_risk.score consumes the two parallel inputs and produces the confidence used by the decision. Exact descriptor matching prevents the policy from applying to customer_profile.lookup, device_risk.lookup, or late evidence.
PERTURB, not REPLACE or NULLIFY
The question is whether a bounded reduction in the existing risk confidence changes the decision. PERTURB tests that sensitivity without inventing an alternate private payload or removing the evidence altogether.
/confidence, −0.50
The observed confidence is 0.90. A numeric delta of −0.50 produces 0.40, the approved counterfactual input used by this deterministic fixture.
0.00–1.00 range and one sample
Confidence is a normalized score, so the bounds keep the result schema-valid. One deterministic sample is enough for this tutorial; broader robustness studies should use a separately governed policy version.

Core now freezes the source descriptor and submits the replay job. The worker authenticates to the external runtime with its bearer token. The runtime validates the execution ID, tool-call ID, source evidence digest, policy and intervention identity, approved transformation, and frozen snapshot before it applies the perturbation.

Boundary and Provenance

A digest is not a private payload.

Core receives only bounded facts

  • External execution and runtime tool-call IDs
  • Safe evidence references and source digest
  • Policy identity, intervention provenance digest, and outcome score

Runtime retains private material

  • Tool inputs, outputs, and frozen evidence snapshot
  • Source outcome and private replacement evidence
  • Transformation application and digest calculation

source_evidence_digest protects the bounded original evidence reference. intervention_provenance_digest identifies the governed transformation. After replay, the runtime computes counterfactual_evidence_digest for what it actually produced. None is a reason to disclose private evidence bytes to Core.

Find the replay and result

Close the loop in Controlled Replay and Causal Audit.

Do not jump from policy creation to the result. First use the left navigation to open Replay. In Replay Management, paste the Core execution ID printed after the source run into Source execution ID. Open the controlled causal replay whose source is agent-runtime-source:<your-core-execution-id>, then select Details.

  1. 1On the replay overview, confirm EXECUTION COMPLETED and Controlled Causal Replay. This excludes ordinary historical or demo replay rows.
  2. 2Open the Audit tab. The trail should show source evidence frozen, the replay job submitted, and the replay execution succeeded.
  3. 3Use View evidence influence from the replay row, or return to Agents Runtime → Causal Audit → Audits and select the audit for this execution. Click Explain to open the Evidence influence detail.
expected governed outcome
Counterfactual decision: ALLOW
Counterfactual outcome score: 0.25
Counterfactual evidence digest: sha256:<runtime-computed-digest>
Causal classification: EVIDENCE_ALIGNED
Evidence influence: +0.650

Proven result: REVIEW 0.90 → ALLOW 0.25 · influence 0.65 · EVIDENCE_ALIGNED.

What this proves: the agent had parallel evidence, the risk score consumed it through an explicit fan-in graph, one approved change materially changed the decision, the runtime attested to its counterfactual evidence without exposing it, and Core persisted a final EVIDENCE_ALIGNED conclusion.

Continue with the runtime source.

Use the Synthetic Agent Runtime repository for configuration details, scenario source, and regression tests for this flow.

Related platform docs