# Your Agent Failed in Prod. Good Luck Reproducing It.

Tisha Chawla, Microsoft · Susheem Koul, Microsoft

AI Engineer World's Fair 2026

[Talk page](https://ai.engineer/talks/Lc8zRh9muoY-your-agent-failed-in-prod-good-luck) · [Video](https://www.youtube.com/watch?v=Lc8zRh9muoY)

## Your Agent Failed in Prod. Good Luck Reproducing It.

A successful API call can still execute the wrong trade. Recording agent boundaries turns an otherwise elusive failure into a repeatable test of the code that must stop it.

Familiarity with LLM tool calls, function inputs and outputs, and basic automated testing will help you follow the replay example.

### The production failure that disappears locally

[0:00](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=0s)

An agent calls the wrong tool or writes the wrong data in production. You retrieve the prompt from telemetry, send it to the same model, and run the workflow locally. It works. Further reruns work too. The damaging run is the one you cannot recover, so a successful retry tells you little about whether the next customer is protected. For Tisha Chawla and Susheem Koul, whose agents interact with production backends, this is a debugging problem with consequences beyond a bad answer.

Consider their broker scenario. A user asks to sell $1,000 of stock. Instead of converting that dollar amount into shares, the agent copies `1000` into the order’s quantity field. At $190 per share, the illustrated 1,000-share order sells $190,000 rather than the requested $1,000. The tool has received a valid number with the wrong meaning.

In the speaker-presented scenario, the broker returns HTTP 200 in 30 milliseconds, with zero exceptions and zero alerts. Those are scenario details, not an independently measured incident. The green dashboard accurately reports that the API accepted the request; it does not establish that the trade matched the user’s intent. **Successful execution and correct action are different properties.**

![Slide contrasts “asked: sell $1,000” with a circled red “sold: $190,000.” A green broker response shows 200 OK and FILLED.](https://ai.engineer/api/talk-essay-media/d745991dc33d504a34737d35a58a648dc04e2df50aaf9ed7f1a0529e696528e5)

Asked to sell $1,000; sold $190,000 with a green 200 OK response.

### Temperature zero does not freeze the serving system

[2:26](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=146s)

Turning temperature down to zero does not repair the dollars-to-shares mistake. Greedy decoding can consistently choose a wrong answer. Nor does greedy selection alone guarantee identical output across requests: choosing the highest-scoring token is repeatable only when the scores themselves remain the same. The talk cites engineering reports of dozens of different responses across a thousand identical-prompt runs; that observation should not be treated as a universal failure rate.

The numerical explanation separates several mechanisms:

- **Sampling versus system determinism.** An `argmax` rule specifies how to select from the logits, not how the serving system computes those logits.
- **Floating-point arithmetic.** Addition is not associative at finite precision. Different reduction orders can produce slightly different scores; if the leading tokens are sufficiently close, the winning token can change.
- **Batch composition.** The talk contrasts an isolated matrix operation under fixed conditions with a request grouped alongside changing traffic. Batch-dependent computation can change the numerical path even when the request itself is unchanged.
- **Expert capacity.** In a capacity-limited mixture-of-experts implementation, competition for an expert can change how tokens are handled. Overflow and rerouting depend on the implementation; they are not properties of every MoE model.

These mechanisms explain why controlling a request parameter is weaker than controlling the inference stack. The isolated-operation comparison also requires fixed execution conditions, rather than a guarantee across hardware, releases, or kernels.

### Recover the run instead of regenerating it

[4:51](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=291s)

For the broker, identical prose is not the engineering objective. The consequential question is whether the system executes an acceptable **state transition**. Once a bad decision has occurred, debugging needs that particular decision available again—not another attempt to persuade the model to produce it.

| Property | What it asks for | Engineering role |
| --- | --- | --- |
| Bitwise determinism | Same input, identical output | Control generation |
| Replayability | Reconstruct a recorded run | Inspect and retest execution |

Replayability changes the dependency: capture what the model actually produced, then use that captured result when investigating the failure. The speakers favor leaving room for exploratory generation because they value its creative benefits. That preference does not require every application to use randomness; the essential point is that debugging should not depend on regenerating the same answer through an uncontrolled hosted stack.

### Record semantic boundaries

[6:14](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=374s)

A network recorder cannot see every meaningful agent operation. Local retrieval, in-process tools, and memory access may never issue a network request. The useful recording surface is therefore the **boundary of each node**: what entered the operation and what left it. Those inputs and outputs preserve the meaning of a step more directly than packets do. Streaming and asynchronous execution make preserving that structure especially important.

The workflow is to annotate, record, visualize, understand, fix, replay, and verify. Recording supplies the evidence for diagnosis; replay makes that evidence usable as a test input. If all model boundaries are stubbed with their recorded outputs, the test can run offline without making model calls.

[Chronicle](https://github.com/theagentplane/chronicle) is the proof of concept used to demonstrate this approach. A boundary annotation wraps a method, whether it calls an LLM, retrieves RAG context, or executes a tool. The wrapper records the method’s input/output pair, with metadata such as the model version and code version. Together, those records form the trace.

![Editor diagram shows a LIVE boundary wrapper around place_order, captured input, function code, captured output, and an envelope stored in fixtures/traces/.](https://ai.engineer/api/talk-essay-media/a2719748a1d1ff9850f72548409d496564e8f7264998243712684b15ee043110)

A boundary wrapper captures method inputs and outputs and stores them as a trace.

The recording is an execution envelope, not a snapshot of every external system: side effects inside a boundary are not automatically captured. There is also a version distinction when following the demonstration: current Chronicle documentation uses `ReplayPlan` for stub/live selection and still lists streaming capture as planned. The demonstrated boundary mechanism should not be read as support for every streaming or asynchronous configuration.

### Find where dollars became shares

[8:05](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=485s)

The stock agent has three annotated methods. A planning LLM receives the user’s request, the `place_order` tool performs the trade, and a finalization LLM prepares the response. Recording each method gives the trace two model boundaries and one tool boundary.

In the recorded demonstration, the user requests about $1,000 of Acme stock. The planning node generates a `place_order` call with symbol Acme and quantity `1000`. The tool then sells those 1,000 units at $190 each. The trace preserves both the erroneous instruction and the tool’s execution of it; a final response alone would not expose that distinction.

The detailed node JSON adds model-version and sampling metadata alongside the inputs and outputs. Diagnosis proceeds backward from the consequential action: inspect the sell tool’s input, confirm that it received quantity `1000`, and then inspect the preceding planner node. Its output already contains the wrong quantity. The tool did not invent the number; the planner converted the user’s monetary intent into the wrong tool argument.

### Replay the bad decision against the repaired tool

[9:56](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=596s)

Locating the bad tool call does not make future model outputs controllable. The repair moves enforcement to the tool boundary: a guardrail must reject an unacceptable order even when the planner requests it. The demonstration does not specify the stock guardrail’s exact rule, so the test establishes its response to this recorded failure rather than a general trading policy.

The same boundary that records a method can substitute its recorded output during a test. This lets you hold upstream decisions fixed while executing changed code:

1. Load the trace of the failed run.
2. Enable replay and choose which boundaries to stub.
3. Stub the planning LLM so it emits the original incorrect order.
4. Run the repaired `place_order` method against that order.
5. Capture its result and assert that the order was blocked.

In the general regression strategy, unchanged nodes can all be stubbed. The essential choice is to keep the code under test live while preventing a fresh model decision from removing the failure condition.

A small Python harness expresses the assertion contract without depending on Chronicle’s entry-point syntax. Here, the tool adapter returns a dictionary with a `status` field, and the recorded planner arguments stay fixed:

```python
from copy import deepcopy
from unittest.mock import Mock


def verify_recorded_order_is_blocked(repaired_tool):
    recorded_arguments = {
        "symbol": "Acme",
        "side": "sell",
        "quantity": 1000,
    }
    planner = Mock(return_value=deepcopy(recorded_arguments))

    order = planner("Sell about $1,000 of Acme stock")
    result = repaired_tool(**order)

    assert order == recorded_arguments
    assert result["status"] == "blocked"
    return result
```

The tool still receives the bad quantity. The test succeeds because the repaired boundary refuses it, not because the planner produced a better answer. A live boundary executes real code and its side effects, so a destructive tool needs gated execution or a sandbox; replay mode itself is not a safety barrier.

The displayed replay stubs the first LLM, preserving its recorded input and output, while leaving the tool and downstream LLM live. The tool returns a blocked result and the blocked-order assertion passes. This is **selective replay**, not the fully stubbed configuration with no model calls. It verifies the repaired tool against the original bad decision while still allowing later response generation to run.

![Terminal displays cut-point test boundary results and four PASS checks: order blocked, no shares sold, agent1 stubbed, and place_order ran live.](https://ai.engineer/api/talk-essay-media/812c11325c5348ca112611ab8cf91b4be4a1a108d99275cebbea5cbfa214aa84)

Replay test blocks the order with the first agent stubbed and the tool and second agent live.

### Test enforcement and behavior separately

[12:08](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=728s)

A recorded session can become a test case, but that does not make every aspect of agent quality a deterministic assertion. The two testing approaches answer complementary questions:

| Test type | Target | Method |
| --- | --- | --- |
| Deterministic regression | Guardrails and tool logic | Recorded inputs, live changed code, assertions |
| Behavioral evaluation | Tone and trajectory quality | Assess generated behavior, potentially with an LLM judge |

For deterministic regression, recorded model outputs hold the surrounding context fixed. Stubbing every model boundary removes sampling from the test and avoids model calls and their associated inference charges; ordinary execution costs remain. Behavioral evaluation instead asks whether the agent’s generated response or chosen trajectory is appropriate. The speakers propose LLM-as-judge techniques for those more subjective assessments. A passing tool assertion protects a specific invariant, while behavioral evaluation examines the quality of the decisions and responses around it.

### Keep the execution envelope as a test case

[13:14](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=794s)

Production debugging should not depend on bitwise identity from a hosted stack you do not control. Record the variables that explain the session: the LLM version, build ID, retrieved RAG chunks, and the inputs and outputs at the relevant boundaries. A prompt is only one ingredient in the resulting action. Capturing the full execution envelope preserves the context needed to understand why that action occurred.

Use that envelope to investigate the failure, run the repaired code against it, and retain it as a regression test. The speakers’ closing recommendation is to preserve generation-time variation rather than treat temperature zero as a reliability fix; their closing QR offers Chronicle code and related articles. For the stock agent, the durable improvement is that the recorded bad order remains available to test the tool that must stop it, even if the model never generates that exact mistake again.

![Complete five-item takeaway slide: stop chasing bitwise determinism through the API; pin every variable against the session; capture the full envelope at the boundary; replay, fix, and keep the envelope as a test case; keep generation-time variation alive.](https://ai.engineer/api/talk-essay-media/988dc0647953d501538c8ebc2c9520d838a0a835f570fdf1fc39cfea0c217279)

Five takeaways cover session variables, full-envelope capture, replay, retained tests, and generation-time variation.

## Resources

- [Chronicle](https://github.com/theagentplane/chronicle) — Python tooling for recording method boundaries and testing changed code against recorded agent decisions, with examples and replay assertions.
- [Your Agent Failed in Prod. Good Luck Reproducing It.](https://dev.to/tisha/your-agent-failed-in-prod-good-luck-reproducing-it-56ci) — Tisha's extended discussion of inference variability, execution recording and complementary testing approaches.
- [You Recorded the Incident. Now Prove Your Fix Actually Works.](https://dev.to/tisha/you-recorded-the-incident-now-prove-your-fix-actually-works-2cni) — A companion walkthrough of selective replay, tool guardrails, structural assertions and trace redaction.
- [Defeating Nondeterminism in LLM Inference](https://thinkingmachines.ai/blog/defeating-nondeterminism-in-llm-inference/) — Original experiments explaining how batch-dependent numerical behavior affects greedy decoding and how batch-invariant kernels restore repeatability.
- [MegaBlocks: Efficient Sparse Training with Mixture-of-Experts](https://arxiv.org/abs/2211.15841) — Research on block-sparse MoE training that avoids dropping tokens when expert workloads vary.

## Slides

### Your agent failed in production

Tisha Chawla and Susheem Koul run agents against production backends. Their talk focuses on reproducing failures after an agent goes haywire.

[1:14](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=74s) [Title slide: Your agent failed in prod. Good luck reproducing it. Tisha Chawla and Susheem Koul, Microsoft.](https://assets.ai.engineer/sites/aiecode2025/sha256/f7b40b3298bfa3682137565763e92ae824c423ae05e9725c037fdda1099eccb5.webp)

AI Engineer
World’s Fair

Your agent failed in prod.
good luck reproducing it.

Tisha Chawla · Susheem Koul · Microsoft

### Stock sale example

The agent uses 1,000 as the share quantity, selling $190,000 of stock instead of $1,000. The API still returns 200 OK with no alerts.

[2:03](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=123s) [A request to sell $1,000 is contrasted with a circled sale of $190,000.](https://assets.ai.engineer/sites/aiecode2025/sha256/3dac991e617cd244219a29f8ff92d835b2c60ba3d6146b0f9387b34437d2aead.webp)

asked: sell $1,000
sold: $190,000

### Temperature equals zero

The speaker warns that setting temperature to zero won't fix a broken reasoning path or guarantee deterministic outputs.

[2:25](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=145s) [Slide reading temperature equals zero.](https://assets.ai.engineer/sites/aiecode2025/sha256/3466fbecff4a0ac91176082da38cedf7d94b101232402c27b1198bf4de98459b.webp)

temperature = 0

### Community observations and hard data

The slide pairs reports of varying outputs with an experiment: 1,000 runs of the same prompt produced 80 answers at temperature 0 using vLLM and Qwen-3-8B.

[3:15](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=195s) [Community comments about varying outputs at temperature zero alongside a panel showing 1,000 prompts and 80 answers.](https://assets.ai.engineer/sites/aiecode2025/sha256/1a73cb750ac04d1423cae1c0e8cc4fac127c83ad63f4387a167567d8d1b386dc.webp)

# unedited, from the threads

r/LocalLLaMA
“different outputs at temperature = 0, mostly the MoE architecture.”

r/LocalLLaMA
“even at temp 0 you get different answers, you’re using GPUs.”

Hacker News
“completely correct or completely wrong, depending on minute numerical diffs.”

HARD DATA
1,000 prompts
→ 80 answers

temp 0 · vLLM · Qwen-3-8B

### First principles of determinism

At temperature 0, batch-dependent computation can shift logits and flip the winning token. MoE expert capacity can also reroute tokens based on the batch.

[4:11](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=251s) [Three points distinguish sampling and system determinism, illustrate floating-point non-associativity, and discuss batch-dependent computation.](https://assets.ai.engineer/sites/aiecode2025/sha256/9b6766bdbfa7626b1dcedfe566734b36d309af1f21ad7865a08009c034925655.webp)

1  sampling determinism ≠ system determinism
temp 0 fixes the rule (argmax), not the logits you argmax over.

2  float addition is NOT associative
(0.1 + 1e20) − 1e20 = 0    0.1 + (1e20 − 1e20) = 0.1
reorder a reduction → a logit's last bits move → argmax flips.

3  the culprit is batch invariance
same matmul, same GPU, 1000× → bitwise identical.
prod batches you with strangers; the kernel depends on batch shape.

[4:30](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=270s) [Slide explains sampling determinism, floating-point addition, batch-dependent computation and mixture-of-experts routing.](https://assets.ai.engineer/sites/aiecode2025/sha256/cddf24ee42671a9c69c8d79ab0cfac4e4ea2910e991f87694b179b474bf10cc0.webp)

1  sampling determinism ≠ system determinism
temp 0 fixes the rule (argmax), not the logits you argmax over.

2  float addition is NOT associative
(0.1 + 1e20) − 1e20 = 0    0.1 + (1e20 − 1e20) = 0.1
reorder a reduction → a logit's last bits move → argmax flips.

3  the culprit is batch invariance
same matmul, same GPU, 1000× → bitwise identical.
prod batches you with strangers; the kernel depends on batch shape.

4  MoE routing jitter: expert capacity ceiling, route depends on the batch.

same token? no. we need the SYSTEM to run the same STATE TRANSITION.

### Determinism and replayability

Bitwise determinism requires identical outputs for the same input. Replayability records a run so it can be reconstructed well enough to debug, even when the model cannot reproduce it.

[5:34](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=334s) [Slide contrasts bitwise determinism with replayability and recommends recording a run so it can be reconstructed for debugging.](https://assets.ai.engineer/sites/aiecode2025/sha256/65f62b4bbba729866969717beaae40f9ce59cb2c383b9ef1f24ee6a92e93756b.webp)

X wrong question: can we make the model deterministic.

✓ right question: can we debug & test a run we can’t reproduce.

determinism was never the goal. record the run, replay the recording.

bitwise determinism
= controllability
same input → identical output.
you won’t get it from a hosted API, and you don’t want it: that randomness makes the model good.

replayability
= observability
reconstruct a run that happened, well enough to debug. you don’t need determinism, you need the run recorded.

you don’t freeze the model. you capture what it did.

### Record above the wire

Record each node’s inputs and outputs to capture local retrieval, tools and memory that never reach the network. Replay can then rerun the failure offline with the model stubbed and zero model calls.

[6:32](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=392s) [Slide contrasts network-layer recording with capturing inputs and outputs at each node boundary; it notes that replay can run offline with the model stubbed.](https://assets.ai.engineer/sites/aiecode2025/sha256/545ebdd374e79a454bb691897be814581b6f23a58693c2d33f10db53eaaa6af3.webp)

record above the wire, not on it.

X at the network layer
half your agent never touches the network: local retrieval, in-process tools, memory.

the socket can’t record what isn’t on it.

✓ at the boundary
capture what enters each node and what leaves it, every I/O, network or not.

the meaning of each step, not the packets.

tracing records it. replay re-runs it offline: stub the model, 0 calls.

OpenInference · Arize Phoenix · LangGraph checkpointers · framework-agnostic

### Live Demo

The speakers introduce Chronicle, a proof of concept for building replayability into an AI agent.

[7:08](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=428s) [Slide labeled “Live Demo” inside a blue outline.](https://assets.ai.engineer/sites/aiecode2025/sha256/679f2308349fa12399605b019c09e8bd9124a18d66923d9ecd17c6f9ba39f212.webp)

Live Demo

### Boundary wrapper

Chronicle’s boundary wrapper records the order tool’s inputs and output, then stores them as a trace.

[7:21](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=441s) [Diagram showing a boundary wrapper capturing a tool's input and output and storing a trace.](https://assets.ai.engineer/sites/aiecode2025/sha256/a543b2f3ce2cca3f830ee60230ee24a852a7b558a9bb10601bad4324d9830a50.webp)

@boundary wrapper (LIVE)

@boundary("place_order", kind="tool") ← annotate once

INPUT captured
symbol=ACME  quantity=1000  side=sell  (args → InputState)

↓

def place_order(symbol: str, quantity: int) -> dict:
    notional = quantity * SHARE_PRICE
    return {"status": "filled", "notional_cents": notional}

↓

OUTPUT captured
{"status": "filled", "notional_cents": 19000000, ...}

↓

Envelope → store → fixtures/traces/

Interface text:
README.md
trade_notional.py
zsh
002-place_order-1.json M
001-agent-1.json M
Preview README
Preview
Markdown

### Annotated agent workflow

The stock-selling demo annotates the order tool, planning step and final response step to record their inputs and outputs as a trace.

[8:06](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=486s) [Code showing boundary annotations on an order tool and two agent functions.](https://assets.ai.engineer/sites/aiecode2025/sha256/40f1f6e8ce55a193100dd4ed8bf778227c6f1ce9ab414b88029a4f54da9bda31.webp)

USER_MESSAGE = "Sell about $1,000 of ACME from my portfolio to rebalance."

def set_mode(mode: str) -> None: …

def _order_input(*args, **kwargs) -> InputState: …

@boundary(TOOL, kind="tool", extract_input=_order_input)
def place_order(symbol: str, quantity: int, *, side: str = "sell") -> dict[str, Any]: …

@boundary("agent", kind="llm", extract_input=agent_input)
def agent_plan(state: dict[str, Any]) -> dict[str, Any]: …

@boundary("agent", kind="llm", extract_input=agent_input)
def agent_finalize(state: dict[str, Any], tool_result: dict[str, Any]) -> dict[str, Any]: …

def run_agent(user_message: str = USER_MESSAGE) -> dict[str, Any]: …

Interface text:
README.md
trade_notional.py
zsh
002-place_order-1.json M
001-agent-1.json M
Preview README
examples > financial_incidents > trade_notional.py

### Trace metadata

The place_order trace links the tool invocation to its parent and records metadata including the model version and sampling parameters.

[9:17](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=557s) [JSON trace showing boundary identifiers, model metadata, and sampling parameters.](https://assets.ai.engineer/sites/aiecode2025/sha256/00825613e86d8de407a5b7de798a9e913e1da5fb0ce554a62003fe5c1f9fde6c.webp)

{
  "schema_version": "1.0",
  "envelope_id": "2a1f7bf0-d045-4d19-9ba2-67ce2247a849",
  "trace_id": "trace-trade-notional-001",
  "node_id": "place_order",
  "boundary_kind": "tool",
  "parent_envelope_id": "0527fba4-9311-4750-994c-fb5c109e84fc",
  "sequence": 2,
  "invocation_index": 1,
  "timestamp": "2026-06-19T16:00:55.136822Z",
  "metadata": {
    "model_version": "demo-model",
    "sampling_params": {
      "temperature": null,
      "top_p": null,
      "max_tokens": null,
      "seed": null,
      "extra": {}
    },
    "build_id": "financial-demo-trade-notional",
    "tool_schemas": [],
    "framework": "chronicle.boundary",
    "node_id": "place_order",
    "trace_id": "trace-trade-notional-001",
    "extra": {}
  },
  "input_state": {

Interface text:
README.md | trade_notional.py | zsh | 002-place_order-1.json M | 001-agent-1.json M | Preview README
fixtures > traces > trade-notional > 002-place_order-1.json > input_state > graph_state > symbol

### Recorded tool input and output

The recorded sell of 1,000 ACME shares filled for $190,000, despite an intended $1,000 notional and a $5,000 maximum.

[9:28](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=568s) [JSON trace showing an order's input values and filled result.](https://assets.ai.engineer/sites/aiecode2025/sha256/3d286f20b6b23d617278c76ae705dc83b6adb3821670a80a902063d470b7e41e.webp)

"input_state": {
  "system_prompt": null,
  "rag_chunks": [],
  "graph_state": {
    "symbol": "ACME",
    "quantity": 1000,
    "side": "sell",
    "share_price_cents": 19000,
    "intended_notional_cents": 100000,
    "implied_notional_cents": 19000000,
    "max_order_notional_cents": 500000
  }
},
"action_result": {
  "tool_calls": [],
  "completion": "filled",
  "finish_reason": null,
  "token_usage": {},
  "raw_response": {
    "status": "filled",
    "blocked": false,
    "symbol": "ACME",
    "quantity": 1000,
    "side": "sell",
    "fill_price_cents": 19000,
    "notional_cents": 19000000,
    "message": "Sold 1000 ACME at $190.00 ($190,000.00 total)"

Interface text:
README.md | trade_notional.py | zsh | 002-place_order-1.json M | 001-agent-1.json M
fixtures > traces > trade-notional > 002-place_order-1.json > input_state > graph_state > symbol

[9:36](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=576s) [A trace shows a filled sell order and its recorded notional.](https://assets.ai.engineer/sites/aiecode2025/sha256/26804ac99307bf4244418b176b6cc3299f69248e18024b5145d258a69efad84c.webp)

"input_state": {
  "graph_state": {
    "max_order_notional_cents": 500000
  }
},
"action_result": {
  "tool_calls": [],
  "completion": "filled",
  "finish_reason": null,
  "token_usage": {},
  "raw_response": {
    "status": "filled",
    "blocked": false,
    "symbol": "ACME",
    "quantity": 1000,
    "side": "sell",
    "fill_price_cents": 19000,
    "notional_cents": 19000000,
    "message": "Sold 1000 ACME at $190.00 ($190,000.00 total)"
  }
}
}

Interface text:
README.md | trade_notional.py | zsh | 002-place_order-1.json M | 001-agent-1.json M
fixtures > traces > trade-notional
~/Desktop/chronicle/fixtures/traces/trade-notional/001-agent-1.json • Modified

### Agent order call

The agent says it will sell $1,000 worth of ACME, but its place_order call specifies a quantity of 1,000. The speaker identifies this call as the source of the problem.

[9:40](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=580s) [An agent trace shows a sell order for 1,000 shares alongside a statement intending to sell $1,000 worth.](https://assets.ai.engineer/sites/aiecode2025/sha256/50b5d6bc00db9c32978ed47c9321124ee5fbbedecc0da8a0aceaa50667f65538.webp)

"input_state": {
  "graph_state": {
    [illegible]
    "finish_reason": "",
    "filled": false,
    "blocked": false
  }
},
"action_result": {
  "tool_calls": [
    {
      "id": "call_order_1",
      "name": "place_order",
      "arguments": {
        "symbol": "ACME",
        "quantity": 1000,
        "side": "sell"
      }
    }
  ],
  "completion": "I'll sell $1,000.00 worth of ACME.",
  "finish_reason": "tool_calls",
  "token_usage": {},
  "raw_response": null
}
}

Interface text:
README.md
trade_notional.py
zsh
002-place_order-1.json M
001-agent-1.json M
Preview READ[illegible]
fixtures > traces > trade-notional > 001-agent-1.json > action_result > tool_calls > 0

### Replay and stub mode

A stub returns the recorded output without running the function. A cut-point test can instead run the changed function live while upstream steps replay their saved outputs.

[10:19](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=619s) [Documentation explains that a stub returns recorded output without running the function, while a cut-point can run live.](https://assets.ai.engineer/sites/aiecode2025/sha256/b77cb3ac20365622262065c8b2f3dc6c3524247b1e7f0f73ef44d42bffabd9e1.webp)

2. Replay / eval mode — mimic output from a saved Envelope

Your function does not run. Chronicle returns the same output that was recorded during the incident (from the fixture trace).

@boundary wrapper (EVAL + stub)

@boundary("place_order", kind="tool")  ← same decorator

ReplayPlan(trace_id).stub("place_order",1)  ← eval: freeze this step

def place_order(symbol: str, quantity: int) -> dict:
    notional = quantity * SHARE_PRICE
    return {"status": "filled", ...}  ← NOT executed

OUTPUT returned from saved Envelope (incident fixture)
{"status": "filled", "notional_cents": 19000000, ...}
mimics the output Chronicle captured in LIVE mode

For cut-point tests, one boundary can be set to live instead of stub — the wrapper runs your new function body while upstream steps still mimic the saved Envelope. See Cut-point replay below.

Interface text:
zsh
002-place_order-1.json M
001-agent-1.json M
Preview README.md
test_financial_incidents.py
~/Desktop/chronicle/tests/test_financial_incidents.py

### Two kinds of check

Deterministic checks freeze recorded context and assert on tool output without calling the model. Behavioural checks replay a scenario and score whether the agent stayed grounded or refused a destructive call.

[12:08](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=728s) [Comparison of deterministic checks for control flow and guardrails with behavioral checks that score meaning.](https://assets.ai.engineer/sites/aiecode2025/sha256/2959d32369ff7ed700eff68e1d3207980ddcff4b89277c55c383c4dad8742dfd.webp)

two kinds of check.

deterministic
control flow · guardrails

freeze the recorded context as a fixture. Let the tool be called with qty 1000 again, but this time assert on the tool output
rerunnable & free.
never calls the model.

behavioural
prompt / wording changes

replay the scenario, score MEANING not bytes:
did it stay grounded? did it refuse the destructive call?
score it: assert fields / LLM-judge.

### Code and writeup

Scan the QR code for Chronicle’s code and articles.

[13:52](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=832s) [Closing slide with a QR code for code and writeup and a thank-you message.](https://assets.ai.engineer/sites/aiecode2025/sha256/b3e9b195bd0754cebba5625f244b9c773f5e6566a7fa089fec6ac87a2458c0e8.webp)

code + writeup

Thanks – now go chronicle your agent.....
-The Chronicle team

## Full transcript

[0:00](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=0s) Imagine something your agent did in prod was wrong. It called the wrong tool, it wrote the wrong thing, and now suddenly your team is on, on call rotation to figure out what actually went wrong.

[0:14](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=14s) Pretty common, right? Now, as per standard engineering response, your gut will tell you to pull the raw prompt from the telemetry logs, pass it to the same model using the same prompt, and run it locally to isolate the bug, which we'll all do.

[0:31](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=31s) And surprisingly, it will work as well. Run it again, it will work again. You run it ten more times, it will be just perfect every time. But now let's talk about that one run which costed you, and that will be gone.

[0:46](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=46s) You can't reproduce it, and if you can't reproduce it, you can't debug it. But if you can't debug it, you can't promise it won't happen to your next customer or user, right?

[0:57](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=57s) Now, I am Tisha. I have Susheem with me as my co-presenter. We both run agents against real production backends. You know, the kind of place where a bad write isn't, "Oh, well, run it again."

[1:09](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=69s) It's you on a call with a customer explaining where the data actually went. This whole talk is going to be about that one thing you lose the second an agent goes haywire in production, which is being able to reproduce it.

[1:24](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=84s) That will be our North Star for the next ten minutes to follow. Now let's look at how this actually blows up. You've got an agent hooked to a broker API, which is the scenario I'm taking.

[1:37](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=97s) The user says, "Hey, sell a thousand dollars of stock." Now comes the interesting part. Instead of doing the math, the agent sells the raw number one thousand and dumps it straight into the quantity field.

[1:53](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=113s) Guess what? It sells one thousand shares instead. Now, at a hundred and ninety bucks a share, a thousand dollar intent will become how much? A hundred and ninety thousand dollars disaster, right?

[2:07](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=127s) And the terrifying part is that the API on my end returned a clean two hundred OK in thirty milliseconds. We got zero exceptions, zero alerts. If you see the trade, it's completely wrong, but your dashboards are sitting there perfectly green, perfectly flawless.

[2:26](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=146s) When such a scenario as we last discussed comes up, what's the first thing which you will do to try and fix this? The reflex here is to, you know, just turn the model temperature down to absolute zero, assuming greedy decoding will make everything deterministic, right?

[2:45](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=165s) But that's a complete misconception. Setting the temperature to zero doesn't fix a broken reasoning path. It just means the model is going to make the exact same logical error, the exact same way, at the exact same time, and honestly, even worse than that.

[3:05](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=185s) To back up the scenario we just discussed, look at the engineering threads on Reddit and Hacker News. The hard data shows that temperature zero isn't even truly deterministic on a hardware level.

[3:17](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=197s) Running the same prompt a thousand times can still return dozens of completely different responses just due to the underlying GPU nondeterminism and the MoE architectures which are there.

[3:32](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=212s) So to understand why this actually happens, we'll have to look at it from first principles. It comes down to four simple things. One,

[3:42](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=222s) sampling determinism isn't system determinism. Temperature zero just means always take the argmax, but it doesn't guarantee that the underlying scores stay identical run to run. Two, floating point math isn't associative.

[3:59](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=239s) The order you add your decimal matters, right? But a timing shift in matrix operation alters the final logits, and which in turn will flip the winning token. Three, it's not a concurrency issue.

[4:15](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=255s) Run the same matrix multiplication alone on a GPU a thousand times, and I'll guarantee you'll get the exact same bits. So the real culprit is batch variance here, because your request gets grouped with whatever else hits the server that millisecond.

[4:32](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=272s) Four, mixture of experts routing has the exact same bottleneck. Experts have strict capacity limits. If a batch overflows a specific subnetwork, tokens get rerouted. Whether a to-token makes the cut depends entirely on the traffic you got batched with.

[4:51](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=291s) So the ultimate takeaway here is that chasing text output is a losing battle, completely. We don't need the model to return the exact same token back every time. We just need our system to execute the exact same state transition, which means we've been asking the wrong question all along, right?

[5:13](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=313s) The wrong question is, how do I make the model deterministic? And I've seen teams burning weeks on that and walk away deciding the system's just unknowable. The right question is, how do I debug and retest a run I can't reproduce?

[5:29](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=329s) Because determinism was never the North Star, debugging was. Two words we keep mixing up, which I'll talk about now, is bitwise determinism and replayability. Bitwise determinism is same input, same output.

[5:44](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=344s) That's controllability. You're not getting it from a hosted API, and you don't actually want it, because the randomness is what makes the model good. Once the model explores more, you'll get more creative answers.

[5:56](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=356s) The other one is replayability, which is rebuild a run that already happened well enough to debug it. That's observability. You don't need the model deterministic. You need the run recorded, and you don't freeze the model, you capture what it did.

[6:14](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=374s) Now the question which we are all thinking about is where do you record? For sure, not at the network layer because half your agent will never touch the network.

[6:25](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=385s) The local retrieval, the in-process tools, the memory, and the parts that do not shred under streaming and async.

[6:33](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=393s) Record at the boundary instead because you need to capture what enters each node and what leaves it, the meaning of each step and not the packets. What replay adds here is a deterministic CI where you stub the model, you'll rerun the exact failure offline with zero model calls.

[6:57](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=417s) Let's talk about the loop end-to-end now. It starts with annotation, recording, visualization, understanding, fixing, then the part we're working on, which is replaying, and finally verifying. All right. Let's now see how to bring the workflow we just discussed into action.

[7:15](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=435s) So we've established that replayability is a core tenet of productionizing any AI agent. But how do we build this in code? As a proof of concept for this, what we have done is we have built something called Chronicle.

[7:27](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=447s) At the heart of Chronicle lies the concept of a boundary. Think of a boundary as a bounding box around any node in your agentic workflow. A node can be a tool call, it can be a call to an LLM or a retrieval from a RAG.

[7:40](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=460s) It doesn't matter. As long as it's a method, it can be annotated with the boundary annotation. Now, what does this annotation do? It ensures that anything that goes into the method and comes out of the method gets recorded.

[7:51](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=471s) So any input and output pair will get recorded. On top of that, you can define parameters like your model version or the version of the code that is running, so that the entire state during which the agent run happened gets frozen and saved as a trace.

[8:05](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=485s) Now, let's see this in action. We've been talking about this stock selling agent, which went haywire in production. This is a representation of the same. You have your initial planning step, which takes into account the user input.

[8:17](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=497s) It can use the place order tool to do the actual selling and buying of the stocks. And then finally, it delegates to the finalize agent, which generates a succinct response for the end user.

[8:27](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=507s) We have annotated all three of these methods with the boundary annotation. The first one is a tool, and the second and the third one is an LLM. Let's run this.

[8:40](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=520s) So here's what happened. You gave a user request to sell about thousand dollars worth of Acme stocks. You have the three nodes, you have the input and the output recorded for every one of them.

[8:49](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=529s) You can see that the LLM mistook the thousand as the quantity and generated a tool call of place order with the symbol Acme and quantity thousand. And the place order tool obviously executed this input and sold thousand dollars or a thousand units of Acme stock at one ninety dollars per piece.

[9:08](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=548s) This is where the problem started. Now you have a trace for it, but is this all you can see? No. We record much more details than this. So you can go and see the hyper detailed JSON for each of the nodes that the call went into or went out of.

[9:24](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=564s) You can see the metadata, like the model version, the sampling versions that was there in the LLM call. You can see the input and the output. For example, this is for the place order tool.

[9:32](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=572s) You can see the input went in as a sell of thousand quantity on Acme, and the output was obviously that it sold that quantity. And if you go one step back, you can see the agent one node creating that tool call that caused this entire problem.

[9:46](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=586s) It created a tool call to place order with the symbol Acme and quantity thousand. Now, this is all good. You have a recording, you have a trace, you figured out what the problem is.

[9:56](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=596s) Now what do you do with it? You figured out that the problem is the LLM created a wrong tool call. You cannot control the LLM. That's what this entire discussion is about.

[10:06](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=606s) You cannot enforce bitwise determinism. What you can do is you can put guardrails on your tools to enforce some level of, uh, credibility on your production agent. But how do you test this?

[10:18](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=618s) Once you have built the guardrails, how do you test it? That is another tenet that Boundary offers. Since the boundary annotation is already providing a bounding box around your methods, it can be used to stub your methods in during testing.

[10:32](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=632s) So think of it like this. You have a run which is recorded. That run recorded every input and output for every node. Now, you have fixed your code at, let's say, the tool level, but you want the rest of the nodes to be stubbed so that the entire exact stack trace remains the same.

[10:48](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=648s) How do you do it? You run a test suite with the same trace that was recorded earlier. You stub every node other than the node that you changed, and you let Boundary handle the rest, right?

[11:00](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=660s) So let's see this one in action. This is your test case. You have loaded the trace, and you have enabled the replay mode on Boundary, which allows Boundary to stub every node that you want.

[11:12](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=672s) So, for example, in this case, you want to stub the first agent call, which generated the tool call, but you want the tool to be run live so that you can test out your code changes.

[11:21](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=681s) Once you do this, you run your agent. Now, another good thing about Boundary is that since it's already capturing the output of your tool as well, you can use it to run assertions.

[11:30](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=690s) So you can take the output and assert that this time around, the tool call got blocked. So let's run this once.

[11:41](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=701s) Perfect. So you can see that agent one, which was the LLM, was stubbed. You can see the same input/output as the recorded, uh, trace, but the tool and the LLM ran live.

[11:52](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=712s) And you can see that for the tool, this time the output is blocked, and your assertion on the tool has passed because the order is blocked. So this is the power of merging your, uh, replayability traces with auto-generated testing and stubbing and assertions.

[12:08](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=728s) Tool and the LLM. So we just saw how Chronicle not only records your agentic sessions, but it also uses those recordings as test cases. Now, when we talk about testing in AI agents, I want to draw a very clear distinction here.

[12:20](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=740s) There are two ways of testing AI agents, and both of them are equally important. There's the deterministic testing and then the behavioral testing. The deterministic testing applies to, obviously, the deterministic nodes of your agent graph.

[12:32](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=752s) This could be your guardrails or your tool calls. Now, this is exactly where Chronicle shines because, as we just saw, Chronicle freezes the entire agent run as a context.

[12:42](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=762s) So you can use the LLM nodes context to stub the LLM outputs. This essentially kicks the probability out of the window, and your entire agent run can become a test case.

[12:53](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=773s) This is re-runnable, and since it never calls the model, it is free. On the behavioral side of things, you measure things like the tone of the agent or whether the trajectory it took was right.

[13:03](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=783s) This is more subjective, and this is where techniques like LLM as a judge are better off. Now, at this point, I want to talk about the key takeaways. First, stop chasing bitwise determinism through the API.

[13:14](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=794s) The fundamental principles on which the APIs are built today do not make this possible. Second, know what are variables for your session. For example, your LLM version or your build ID or your RAG chunks, and make sure that you are logging these.

[13:28](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=808s) Third, capture the full envelope. Don't focus on just the prompt. There are, there are a lot more ingredients that go into that final response. Fourth, use the replays to debug.

[13:38](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=818s) Make sure that you find the issues, fix the failures, and then finally, use the same trace as a test case. Fifth and final, keep the generation time variation alive.

[13:47](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=827s) Don't try to pin the temperature to zero. After all, that is what brings the agency into your agent. So the QR on your screen, you can scan that to get access to the code for Chronicle and a bunch of nicely written articles.

[13:59](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=839s) And finally, thanks again for your time, and we hope that the traces that you put today in your agent make sure that your on-call cycle tomorrow is much better.

[14:08](https://www.youtube.com/watch?v=Lc8zRh9muoY&t=848s) Thank you.
