2026-11-26 16:13 UTC

Ali outlines a ZizkaDB workflow for turning agent incidents into regression tests

state: expiredheat: lowuncertainty: mediumrelevance: mediumagent-regression-testing production-sessions agent-reliabilityMir Arshad Ali

What is this?

Mir Arshad Ali published a practitioner guide on Medium on 29 October 2026, describing how to turn real AI-agent production sessions into regression tests using ZizkaDB, an open-source tool he links to. The workflow selects incidents and other representative sessions, reviews traces to identify where behavior first diverged, checks trace integrity, and exports cases with expected outcomes, tool actions, and budgets for repeatable tests. The article also discusses privacy safeguards, non-determinism, and test isolation. Its SDK details and business-case figures are presented by the author; the savings figures are explicitly modeled assumptions, not measured results. The supplied sources contain no independent validation or adoption evidence.

Why it matters

This is a practical reliability workflow, not a new model or independent evidence that agent failures are solved. Its useful idea is to make production incidents reusable tests that check an agent’s steps and tool use—not just its final answer—so teams can catch recurring mistakes before release. If adopted, this could make iteration on prompts, tools, and models safer, while increasing the importance of trace quality, privacy controls, and evaluation infrastructure. The article’s claims about ZizkaDB’s capabilities and the projected business payoff should be treated as author-provided, not independently established.

Current assessment

New: Ali’s article proposes an incident-to-regression-test workflow built around ZizkaDB. It recommends choosing a small, varied set of production sessions; identifying the first divergent action; verifying records; freezing inputs, context, and tool results into fixtures; and checking outcomes, action paths, safety, cost, and speed in CI. The author says ZizkaDB supports relevant logging, search, replay/trace inspection, verification, export/import, and write idempotency features, and links the project repository and changelog. These are claims in the article; the supplied evidence does not independently verify the implementation or show deployment results. The guide itself stresses that checksums establish whether records changed, not whether their contents were correct, and that exported production data requires redaction, access control, retention, and deletion handling. It also notes model non-determinism and recommends repeated runs and pinned versions. Its estimated annual savings are based on stated assumptions, not measured outcomes. Broader web results show that production traces and agent regression tests are also discussed elsewhere, but snippets alone do not establish adoption or validate this particular workflow. Track as a practitioner tool/workflow development; no evidence here establishes that it is a field-wide breakthrough.

Measured heat

no measured readings yet — the hourly heat pass fills this in

How the heat travelled

10-29 13:32 (minted)⭐ origin echo-reconstructedThe article outlines selecting production sessions, replaying and labeling failures, checking trace integrity, and exporting cases as regres
Mir Arshad Ali on blog (echo) · attributed from hn.story.50288110 · published time unknown
—
10-29 12:50first on hacker news · published · lag ?How to Turn Production Sessions into Regression Tests for Your AI Agent
Arshad-Talpur
—
10-29 12:50amplified on hacker news 👑hn.story.50288110
Arshad-Talpur
peak 1 · 0 comments · 104% of case engagement
10-29 13:28our radar first saw it · lag ?discovery anchor: hn.story.50288110—

Evidence (2) — ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnHow to Turn Production Sessions into Regression Tests for Your AI Agent
Retrieved article excerpt

Open article · Retrieved 2026-10-29T13:30:16.362094+00:00

[Ai Agents In Action](https://medium.com/tag/ai-agents-in-action?source=post_page---header_tags--e7836c2d0fc4-----------------------------------------)

[Compliance](https://medium.com/tag/compliance?source=post_page---header_tags--e7836c2d0fc4-----------------------------------------)

[Zizkadb](https://medium.com/tag/zizkadb?source=post_page---header_tags--e7836c2d0fc4-----------------------------------------)

[Open Source](https://medium.com/tag/open-source?source=post_page---header_tags--e7836c2d0fc4-----------------------------------------)

# How to Turn Production Sessions into Regression Tests for Your AI Agent

[Mir Arshad Ali](https://medium.com/@MirArshadTalpur?source=post_page---byline--e7836c2d0fc4-----------------------------------------)

[Mir Arshad Ali](https://medium.com/@MirArshadTalpur?source=post_page---byline--e7836c2d0fc4-----------------------------------------)

10 min read

·

Just now

--

[Listen](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2Fplans%3Fdimension%3Dpost_audio_button%26postId%3De7836c2d0fc4&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40MirArshadTalpur%2Fhow-to-turn-production-sessions-into-regression-tests-for-your-ai-agent-e7836c2d0fc4&source=---header_actions--e7836c2d0fc4---------------------post_audio_button--------------------)

Share

Press enter or click to view image in full size

Most agent test suites are written at a desk. Someone imagines twenty realistic questions, writes the expected answers, and runs them before each release. They pass, the agent ships, and then production produces a failure nobody imagined: an odd phrasing, a tool that times out at the wrong moment, a customer who changes their mind halfway through.

Your best source of test cases is already sitting in your logs. Every real failure, escalation, and dispute is a case your agent has actually met. This guide shows how to turn those sessions into regression tests with ZizkaDB, so each incident you fix stays fixed.

A note on scope: the changelog documents these SDK and API capabilities: `log_batch`, `iter_events`, `export_events` and `import_events`, `verify_chain`, `search` with a `mode` option, `baseline`, and `idempotency_key` on writes. It does not give every parameter, so the code below is illustrative. Check the SDK READMEs for exact signatures, and use `zizkadb-sdk` 0.5.0 or later.

## Why production sessions make better tests

**They are real.** Synthetic cases reflect what you expect users to do. Production sessions show what they did.

**They carry the full story.** A session of linked events records the path: which tools ran, what they returned, and where the first wrong step happened.

**They match your failure history.** Every incident becomes a permanent check, so a bug cannot quietly return after a prompt change.

**They keep your suite honest.** As users and tools change, new sessions refresh your picture of normal.

## Step 1: Define what regression means for your agent

Decide what a test should check before collecting anything. A final-answer check catches only one kind of regression:

- **Outcome:** did the agent reach the right result?
- **Path:** did it take the required steps, such as verifying an amount before a refund?
- **Tools:** did it call the right tool with sensible arguments, and avoid forbidden ones?
- **Cost and speed:** did it stay within a token and time budget?
- **Safety:** did it avoid saying or doing something it must never do?

Write two or three checks for each important workflow. Path checks are the most valuable and the least common, because they catch an agent that reaches a correct-looking answer by skipping a safeguard.

## Step 2: Make sure the record is complete

A regression test is only as good as the session it came from. Before relying on your record, check these:

- **Events are linked with parent IDs,** so the path can be read as a chain.
- **Tools are named,** with results recorded. The SDK’s `log_tool` and `log_tool_result` do this, and the LangChain, LiveKit, and MCP integrations already name tools.
- **A prompt or configuration version is logged,** so you know which version produced the session.
- **Token usage is recorded,** for cost budgets. The Python SDK’s `log()` accepts `token_usage`, while the TypeScript SDK does not, so check the README for the shape.
- **Retrieved context is recorded or referenced,** since a wrong answer is often a wrong retrieval.

Cases missing these can still be kept as outcome-only tests, but you lose the path checks.

## Step 3: Find the sessions worth keeping

A well-chosen set of fifty to two hundred cases beats thousands of random ones. Look in these places:

- **Failures:** sessions that ended in an error, a timeout, or an abandoned conversation.
- **Escalations and disputes:** anything a human had to fix or a customer complained about.
- **Expensive sessions:** the top few percent by cost, which often reveal loops.
- **Drift periods:** the baseline view accepts time windows of 24h, 7d, and 30d, so you can pull sessions from the period when behavior shifted.
- **Described patterns:** use search to pull sessions matching a behavior you can describe in words.
- **Normal sessions:** a sample of ordinary successful cases, so the suite also protects what works.

python

```
# illustrative, check the SDK README for exact parameters  
async for event in db.iter_events("support-bot"):      # cursor paging, stable at any depth  
    ...                                                 # filter by type, session, or time
```

```
hits = await db.search("agent kept asking for documents already uploaded",  
                       agent="support-bot", mode="auto")
```

One accuracy point on search: with embeddings off, which is the self-hosted default, search is keyword based. Any word can match and prefixes count, so refund finds refunded. Meaning-based matching needs embeddings, either a hosted provider or a local OpenAI-compatible endpoint such as Ollama. Describe the behavior using words that would actually appear in the logs.

## Step 4: Replay each case, find the first divergence, and trace its impact

For every candidate, do a short review:

1. Open the session in replay and read it from the first message to the last.
2. Write one sentence on what should have happened.
3. Mark the first step where the session diverged. Many failures begin two or three steps before they become visible.
4. Run `zizkadb why <event_id>` on that step to find the cause: bad input, bad context, a failing tool, or a reasoning error.
5. Use the impact route, `GET /v1/events/{event_id}/impact`, to see everything that descended from the bad step. It is the mirror of why, and it shows which later events your test should also check.
6. Label the case with workflow, cause category, and whether the original outcome was good or bad.

## Step 5: Verify the source, then export the cases

Before you turn sessions into fixtures, confirm the record is intact. ZizkaDB links every event into a per-agent hash chain, and a verify call checks the whole chain and every checksum:

python

```
# illustrative  
report = await db.verify_chain("support-bot")  
print(report)   # intact flag, summary, problems, and chain_head
```

Save the `chain_head` outside ZizkaDB. Later you can pass it back as an anchor to show that older history has not been rewritten. Note that checksums show a record has not changed since it was written, not that the logged content was correct.

Then export. The export route streams an agent’s events as NDJSON, oldest first, and you filter down to your chosen sessions in your own script:

python

```
# illustrative, check export_events parameters in the SDK README  
events = await db.export_events("support-bot")  
cases = [e for e in events if e["session_id"] in chosen_sessions]
```

Because export works per agent, filter by session yourself. For CI jobs and evaluation tools, create a read-only API key with `scope: "read_only"`. It can query, search, export, and verify, but every write or delete route refuses it, and it belongs to one agent. You can also set `expires_in_days` so the key stops working after a set time.

## Step 6: Make fixtures safe

Production sessions contain real people’s information, and test suites live in repositories and CI systems with wider access.

- **Check redaction.** ZizkaDB replaces values under secret-named keys, such as password and api\_key, with [REDACTED] before storage, and optional patterns can redact emails, phones, cards, IBANs, and IPv4 addresses inside strings. This applies at write time, so older events written before you configured it are not cleaned retroactively. Inspect your exports.
- **Replace personal details** with synthetic ones that keep the same structure, such as a made-up name and order number.
- **Never copy secrets** into case files.
- **Link to the source session by ID only,** and keep access to the original controlled.
- **Tag cases with a subject identifier** where a real person’s data remains, so an erasure request can find the fixtures as well as the production events.
- **Remove fixtures when the source is erased.** Forget deletes events from ZizkaDB, but copies in your repository stay until you delete them. Tombstones in the chain mark where data was removed without keeping content.
- **Set a retention rule** for fixtures, since a copy is also stored data.

## Step 7: Freeze the case

A regression test needs the same inputs every time. For each case capture:

- **The input:** the user messages in order.
- **The context:** retrieved documents or memory given to the agent, or fixed stand-ins.
- **The tool results:** what each tool returned, so the test stubs them and avoids live systems.
- **The expected result:** the outcome, plus the path and tool checks from Step 1.
- **Metadata:** source session, date, configuration version, cause category, and who labeled it.

python

```
# illustrative case file  
{  
  "case_id": "refund-amount-001",  
  "source_session": "sess_8842",  
  "captured_with": "prompt v14",  
  "inputs": ["I was charged twice, please refund the second charge"],  
  "tool_stubs": {"lookup_order": {"order_id": "ORD-8842", "charges": [49.0, 49.0]}},  
  "expect": {  
    "outcome": "refund of 49.00 offered",  
    "must_call": ["lookup_order", "verify_charge"],  
    "must_not_call": ["close_account"],  
    "max_input_tokens": 12000  
  },  
  "cause_category": "skipped verification"  
}
```

Stubbing matters. Without it, tests depend on live data that changes, and failures become hard to interpret.

## Step 8: Run the suite on a disposable instance

This is where self-hosted setups differ from the earlier advice. A self-hosted deployment runs one agent with one API key, and multiple agents are a Cloud feature. That means you should not write test runs into your production agent, because they would distort your behavior baselines and cost figures.

Use one of these instead:

- **A throwaway instance in CI.** The single container image starts with one command, so each run can start fresh, load the cases, run the candidate agent, assert, and discard. The container image is `ghcr.io/zizka-ai-sl/zizkadb`, and `ENV=development` gives you the local one-click setup.
- **Separate agents on Cloud,** where multiple agents are available, with test traffic under its own agent name.

For the run itself:

1. **Load the cases** with `import_events`. The documented behavior keeps original timestamps, remaps parent links, gives every event fresh checksums and chain links, and returns duplicates instead of copies if you re-run an import.
2. **Run the candidate agent** against each case with tool results stubbed.
3. **Write the runs in batches** with `log_batch`, up to 500 events per request, and give each write an idempotency key built from run, case, and step, so a retried CI job does not double count.
4. **Assert** by reading events back and checking required tools, order, arguments, budgets, and o
Arshad-Talpur10
🟧 echo.blog ⭐The article outlines selecting production sessions, replaying and labeling failures, checking trace integrity, and exporting cases as regresMir Arshad Ali——

Interpretation history

Decision trace