$ fssg build --deterministic --validate |

How to Put an AI Agent in Shadow Mode Before It Can Act

AI Engineering

An AI agent should earn authority on real work before it receives authority over real systems. The safest first production role is therefore not operator. It is observer.

Shadow mode runs the candidate agent beside the trusted path. Both receive equivalent inputs, but only the trusted path may change external state. The agent produces a decision artifact: what it would have done, with which tool, arguments, evidence and confidence. The runtime stores that artifact and compares it with the outcome that actually governed the system.

This is an old deployment idea applied to a new kind of software. Traffic mirroring and dual-run migrations already let teams expose a replacement to production inputs without immediately returning its output. The agent version needs a stricter boundary because a tool call is not merely a response. It may send a message, charge a card, delete a file or mutate a customer record.

Shadow the decision, not the side effect

A naïve implementation invokes the same tools and discards their responses. That is not shadow mode. It is duplicate execution with hidden consequences.

I separate the loop into four stages:

observe -> propose -> compare -> authorize

During shadow operation, observe, propose and compare are enabled. authorize is forced into a recorder. Every proposed effect becomes data rather than action.

{
  "run_id": "run_01J...",
  "input_id": "ticket_4812",
  "proposed_action": "issue_refund",
  "arguments": {"order_id": "A-19", "amount": "24.00"},
  "evidence_refs": ["policy:refunds:v7", "order:A-19"],
  "policy_result": "would_require_review",
  "effect_status": "suppressed"
}

The important field is not confidence. It is effect_status. A shadow result must make it impossible to confuse “the model proposed this” with “the system did this.” That distinction also belongs in the wider AI engineering runtime: generation proposes; the execution boundary decides.

Build the comparison contract first

Free-form answer similarity is a weak promotion gate. Two correct decisions may use different words; two similar answers may cause different effects. Compare typed properties instead.

For each action class, define a contract:

Property Question
eligibility Was this action allowed for this case?
target Did the agent select the same entity or destination?
parameters Which arguments must match exactly, and which allow tolerance?
evidence Did the proposal cite the required current records or policy?
abstention Did it stop when required information was missing?
escalation Did it route ambiguous or high-impact cases to the right reviewer?

A refund amount may require exact currency-aware comparison. A ticket label can use a small accepted set. A drafted reply needs rubric-based review and policy checks, not string equality. The evaluator is part of the deployment contract, not an afterthought.

Store disagreements as reviewable records. “Agent wrong” is too coarse. Useful classes include wrong action, wrong target, unsafe parameter, stale evidence, missed abstention and unnecessary escalation. These classes tell us whether to improve retrieval, policy, tool schemas, prompts or the runtime itself.

Keep inputs equivalent and effects impossible

Shadow evidence is only useful when the candidate sees the same relevant state as the trusted path. Record an immutable input envelope: request, retrieved context versions, policy version, available tool schemas and time-sensitive facts. If the human decision happened with policy v7 while the agent is replayed later against v8, the disagreement is uninterpretable unless that version difference is explicit.

There are three practical ways to feed the shadow:

  1. Synchronous fork: copy the live request to the shadow worker. This best preserves timing but adds load to the live path.
  2. Asynchronous mirror: write the input envelope to a queue and evaluate later. This isolates latency but requires careful version capture.
  3. Offline replay: run historical envelopes through the candidate. This is cheap and repeatable, but it cannot reveal every live integration or latency failure.

Start with replay, then add an asynchronous mirror, and use synchronous forking only where timing is part of the claim. Google Cloud documents request mirroring as fire-and-forget: the main backend response remains authoritative and the system does not wait for the mirror. Amazon SageMaker shadow tests similarly replicate a chosen share of requests while only the production variant responds. Those mechanisms validate serving paths; an agent harness must additionally suppress tools, credentials and outbound network routes that could create effects.

Do not rely on a prompt that says “do not act.” Give the shadow worker read-only credentials, replace mutating tools with recorders, block direct egress where possible and test that a proposed mutation leaves external state unchanged. This is the same reason I distinguish an agent, harness, workflow and runtime: authority belongs below the prompt.

Promote action classes, not the whole agent

A shadow period should end with a decision, not an indefinite dashboard. Define promotion criteria before collecting results, but do not compress everything into one average score.

Promotion can proceed by action class:

shadow all actions
  -> allow low-risk classification
  -> allow reversible drafts
  -> allow idempotent mutations behind approval
  -> keep irreversible effects shadowed

For each class, require enough representative cases, no unresolved critical disagreement, acceptable abstention behavior and a tested rollback or compensation path. The exact thresholds depend on impact and traffic; there is no honest universal percentage. A rare destructive action needs a different burden of proof from routine routing.

When authority is enabled, preserve the shadow artifact format. The proposal, policy decision, authorization and resulting effect should remain linked by identifiers. If execution can be retried, stable effect identity still matters; otherwise promotion can turn a correct proposal into a duplicate side effect. I tested that failure boundary separately in Effect IDs Before Retry, and the operational choices are mapped in the recovery guide.

What shadow mode cannot prove

Shadow mode cannot validate feedback loops that only appear after users receive the agent's output. It cannot fully test permission failures when the candidate has no write credentials. Human decisions are not perfect ground truth, and selective review can hide rare failures. Distribution shifts can also invalidate a clean comparison period.

That is why shadow mode is a migration stage, not a safety certificate. It reduces one specific uncertainty: whether the candidate can observe real inputs and produce reviewable decisions without being allowed to create consequences.

The key artifact is not a score. It is a promotion ledger: action class, observed disagreements, unresolved risks, authority granted, rollback path and review date. Once authority is explicit and divisible, “deploy the agent” stops being a leap. It becomes a sequence of reversible engineering decisions.

Sources

FACET AI CLI Terminal
facet@ai:~$