Agent Reliability Lab · for development

Stop editing code to debug your agent.

A few lines that only run in development record every run of your agent: the prompt it sent, the tools it called, what each step cost. Then change the prompt, model, tools or input in the lab, send the run again and compare. Your code changes once, when you know what works.

$ docker compose up -d · open source · no-op outside STAGE=dev

Agent lab · live tracews://arl:8000/api/agent-lab/ws
input
retrieval
agent
output
events
0
model calls
0
tool calls
0
known cost
$0.00000

Why a lab

The agent lives in your code. Debugging it does not have to.

Most questions about an agent are about behaviour: did it call the right tool, what did the prompt really say, which step was slow. Answering them by editing code means a restart, a hand-made input and a hunt through logs for every variant, and the test you write afterwards lives somewhere else. Record the run once and ask the lab instead.

Debugging inside the code

variants tried 0
  1. 1Change the prompt string in the codeeditor
  2. 2Restart the serviceterminal
  3. 3Recreate the input by handcurl · UI
  4. 4Find the tool calls in the logslogs
  5. 5Compare with what you remember of the last runmemory
  6. 6Write the case again as a test, elsewheretest harness

Five places, and the test lives apart from the experiment that found the bug.

With the lab beside it

variants tried 0
  1. 1Open the run the agent already recordedlab
  2. 2Change the prompt, model, tools, state or inputlab
  3. 3Send it, then read the diff, tool calls, latency and costlab

One place. Keep the variant that wins as a scenario; the same scenario runs in CI.

Both loops advance one step every 1.1 s. Your code changes once, when you already know what works.

What you see

Tools, prompts and timing, without a print statement

Every recorded run keeps what you would otherwise log by hand, linked step by step.

Tool behaviour

Which tools ran, with what, in what order?

  1. orders.lookuperror · 2.1 s
    {"id": "4471"} → timeout
  2. agent.retry · attempt 2
  3. orders.lookupok · 180 ms
    {"id": 4471} → {"status": "delivered"}

The first call sent the ID as a string. You see it in the arguments, not in a stack trace.

Prompts

What did the model actually receive?

systemsupport.answer v7 · production
You are a support agent for Acme. Refunds over $200 need a manager…
user
Can I get a refund for order 4471?
model gpt-4.1-mini · temperature 0.7 · max_tokens 400

The rendered messages and parameters as sent, with the prompt version that produced them.

Performance

Where did the time and the money go?

retrieval320 ms
model · plan640 ms
orders.lookup180 ms
model · answer410 ms
total
1.55 s
tokens
1 632 → 214
cost
$0.00099

How it works

A few lines in development. Nothing in production.

Add the lab to your development docker compose and wrap what your agent already does. Events stream over one WebSocket while you work. Outside STAGE=dev the SDKs return immediately, so the instrumentation can stay in your code.
Development
# your agent's service in docker compose
environment:
  STAGE: dev
  LAB_WS_URL: ws://arl:8000/api/agent-lab/ws

Every run streams to the lab, and the lab can send edited runs back.

Production
# STAGE unset, or anything but dev
with lab.run("Support question") as run:
    run.input(question)   # returns at once

No connection, no data sent, nothing to remove before you ship.

your docker compose · devarl/1 eventsreplayLLM stepsexperimentsYour agent+ arl SDK · Python, TS, GoAgent Reliability LabAPI · UI · worker · one binarytracesworkbenchexperimentsmonitorPostgreSQLtraces · runs · resultsYou, in the browserlocalhost:8000Model providersOpenRouter · OpenAIGroq · Ollama · local

Already on OpenTelemetry? Point your exporter at the lab. OpenAI Agents SDK, LangGraph, LlamaIndex, Vercel AI SDK, Pydantic AI and ADK spans become lab traces.

Any language. SDKs for Python, TypeScript and Go; anything else speaks JSON over the WebSocket, or gRPC on the same port.

Private by default. The compose file binds to 127.0.0.1. Set ARL_AUTH_TOKEN before you expose it; secrets are redacted from every trace.

Anatomy of a trace

The whole journey, phase by phase

A run moves through phases your agent declares in its handshake. Every event lands in one, so you can follow what the agent read, which paths it walked, when it retried and what each step cost.

The four default phases run in this order. Your handshake can declare up to 32 phases of your own.

  • graph.node · graph.edgeThe search space: candidates you looked at, not only the ones you kept.
  • graph.visitEach step of the walk, with depth, score, attempt and whether it was selected as context.
  • retrieval.retryWhy the retriever tried again. Counted against the run's retry budget.
  • retrieval.resultThe context that reached the model, also for vector or full-text search without a graph.
Context retrieval · knowledge graphretries 0
·refund question·policy:refunds·order:4471·faq:shipping·order:4471/history

Workbench

Customise the run until it is right

A recorded run keeps its functional state, so it becomes a scenario you can edit and send again with a different model, prompt, parameter, state or input. Keep the scenarios that matter in a collection and export them as arl-workbench/1 JSON to share or commit.
Workbench · scenario “refund, order 4471”
modelgpt-4.1-mini
system promptYou are a support agent.
temperature0.7
inputCan I get a refund for order 4471?
state{"memory": ["prefers email"]}
send
Lab → your agent (replay frame) → new linked trace
Your code runs again with the edited values: tools, retrieval and all.

Night · observe

Watch what your agent did.

Flame · measure

Then measure whether it is good enough.

Experiments

Then prove the improvement, with a denominator

A variant that looked better on one run may be noise. Benchmark it on a frozen dataset with seeded schedules, retries and budgets: pass rates come with 95% intervals, models are compared on the same samples, and a gate written before the run decides. Try it: move the sliders.
Evidence scope · pass rate with 95% intervalgate: min_pass_rate 70%
0%25%50%75%100%
30
80%

24/30 passed: 80% with a 95% interval of 63%–90%. The interval crosses 70%: the data cannot tell yet which side the true rate is on. If the rate holds, about 62 trials would decide it.

Paired comparison · same samples, both armsbaseline 67% · candidate 80%
win 11loss 3tie, both passtie, both fail
+12%

Exact McNemar on 14 discordant samples: p = 0.0574. Not distinguishable from chance yet: ties carry no evidence, only disagreements do.

Comparing many models

McNemar p-values are adjusted with Holm (family-wise) and Benjamini–Hochberg (false discovery rate), with Cohen's h as the effect size.

Planning the run

Power analysis tells you how many samples detect the change you care about, and what a finished run can and cannot detect.

Reproducible

A seed fixes the schedule and every bootstrap; a frozen dataset digest fixes the questions. The same seed reproduces the same report.

Retries and errors counted

Every provider attempt is recorded with its cost. Errors are not quietly dropped from the denominator.

Rescoring is free

Change a scorer and rescore as a new revision, without calling a model again.

Safety probes built in

Harmful requests, over-refusal, prompt injection, system-prompt extraction and PII leakage, with refusal and canary scorers.

Keep it good

Checks on every run, a gate before every merge

The fix you found in the Workbench should stay fixed. Checks run on every trace, people and judges cover what checks cannot, and the scenarios become a regression suite.

Trajectory checks · frozen at run.start

  • required_toolsorders.lookup was called
  • tool_sequencelookup → refund, in that order
  • max_tool_calls · max_model_callsthe loop stayed within its step budget
  • output_regex · output_json_schemathe answer has the shape you promised
  • output_not_containsno canary or system-prompt leak
  • max_cost_usd · max_latency_msa budget that unknown costs cannot pass

A running agent can still call a missing tool, so unmet checks stay pending until run.end. A verdict is pass only when every check passed on a completed run.

Feedback from users and reviewers

Thumbs, scores and comments sent from your API land on the trace they judge, by run ID.

Annotation queues with rubrics

Reviewers label sampled traces. Krippendorff's α and Cohen's κ tell you whether they agree before you trust the labels.

LLM judges, calibrated

A judge is compared with the human labels on the same traces, so you know how far its verdicts can be trusted.

Online evaluators and alerts

Evaluators run on a sample of live traces; alert rules check every minute and call your webhook.

Regression suites gate your merges

Keep a Workbench collection in your repository and run it against a new model or prompt in CI, repeated, against the last baseline. Exit code 0 means the gate passed, 1 that it failed, 2 a usage or connection error.

Prompts live in a registry with immutable versions and production / staging labels; agents fetch them with a fallback, and every run records the version it used.

Modules

Run only what you use

A small core plus optional modules, chosen with one environment variable. Enabling a module brings what it needs; removing one removes what depends on it. Pick a preset or switch modules on and off.
# docker-compose.yml · service arl
ARL_FEATURES: all
# startup log
ready · 11 of 11 modules

A switched-off module starts no background work, runs no jobs, disappears from the UI, and its API answers 404 with the reason. To drop the code too, build with Go tags such as arl_nootel or arl_nosqs.

Footprint

Light enough to leave running

The lab sits beside the services you are developing, all day. Idle, it should cost nothing; busy, it should not compete with your agent for CPU.
PostgreSQL transactions per second, idle−84%
before
5.66/s
after
0.93/s
Lab CPU, idle−47%
before
0.95%
after
0.50%
Ingestion throughput+45%
before
667 events/s
after
969 events/s
Lab CPU per 1 000 ingested events−53%
before
1.86 s
after
0.88 s
PostgreSQL CPU per 1 000 ingested events−28%
before
2.46 s
after
1.78 s

Measured on Docker Desktop · Windows 11 · 16 threads · postgres:17-alpine · November 2026. Lab memory stays around 13 MiB, idle or under load.

An idle lab no longer polls. Work queued inside the process wakes the worker immediately, so the database is only asked every few seconds for retries; the browser UI backs off when nothing changes, stops in hidden tabs, and gets 304 Not Modified instead of the same JSON again.

No ornament in the bench. The workbench UI has no looping decoration; this website carries the animation instead.

Two round trips per event. Profiling showed ingestion spent its CPU on database round trips, not computation. Each event now pipelines its reads and locks in one round trip and its writes and commit in a second, instead of nine.

  • Inter-rater agreement (Krippendorff's α, 3 000 ratings)
    8.9 ms → 0.09 ms
    closed-form sums instead of all pairs: linear, not quadratic
  • Edit similarity scorer (2 000 × 2 000 characters)
    15.9 ms · 32.8 MB → 0.38 ms · 25 KB
    bit-parallel Levenshtein, 64 characters per machine word
  • Bootstrap interval (500 samples × 2 000 resamples)
    5.7 ms → 3.0 ms
    same seeded random stream, bit-identical results

Quick start

Two commands, then a few lines in your agent

No API key needed to try it: the example agent falls back to a mock model, and experiments can use the free fake targets.
# 1 · the lab, next to your code → http://localhost:8000
$ git clone https://github.com/VicoAritonang/lab-of-night-and-flame.git
$ cd lab-of-night-and-flame && docker compose up -d
# 2 · give each agent service
LAB_WS_URL=ws://arl:8000/api/agent-lab/ws
STAGE=dev # the SDKs are no-ops anywhere else
from arl_lab import Lab

lab = Lab("support-agent")          # reads LAB_WS_URL, STAGE, LAB_TOKEN

def answer(question, config):
    with lab.run("Support question") as run:
        run.input(question)
        run.snapshot(state={"memory": memory}, config=config)   # what a replay needs
        request = {"model": config["model"], "messages": [
            {"role": "system", "content": config["system_prompt"]},
            {"role": "user", "content": question}]}
        reply = llm(request)
        run.model_call(request, reply)                          # re-sendable LLM step
        run.output(reply)
        return reply

@lab.on_replay                      # Workbench → your code, with edited values
def replay(r):
    answer(r.input_text(), {"model": r.model(DEFAULT_MODEL),
                            "system_prompt": r.system_prompt(DEFAULT_PROMPT)})

lab.connect(wait=30)

Questions

Before you add it to your compose file

Do I have to restructure my agent?

No. You add a few calls around what the agent already does: the input, a snapshot of the state a replay needs, each model call, and the output. If your framework already exports OpenTelemetry spans (OpenAI Agents SDK, LangGraph, LlamaIndex, Vercel AI SDK, Pydantic AI, ADK), point the exporter at the lab and skip the SDK.

What does the instrumentation do in production?

Nothing. The SDKs only connect when STAGE=dev; anywhere else every call returns immediately, opens no connection and sends no data. The instrumentation can stay in your code.

How do I try a different prompt without touching the code?

Open the recorded run in the Workbench, edit the system prompt, model, parameters, state or input, and send it. Agent replay runs your own code again with the edited values; LLM step re-sends only the captured model call. Every attempt is kept and compared with a word diff, latency, tokens, cost and checks.

Can I see why a tool was or was not called?

Each tool call is recorded with its arguments, result, status and duration, next to the model request that led to it. Checks such as required tools, tool order and step budgets are evaluated on every run.

Where does my data go?

Into the PostgreSQL database next to the lab, on your machine. The provided compose file binds to 127.0.0.1, API keys and tokens are redacted from traces, and ARL_AUTH_TOKEN protects the lab before you expose it.

How do I turn a good result into a test?

Keep the scenarios that matter in a Workbench collection, export it as arl-workbench/1 JSON into your repository, and run arl suite in CI. It compares with the last baseline and exits with 1 when the gate fails.

Which languages are supported?

SDKs for Python, TypeScript and Go. Anything else can send JSON over the WebSocket protocol arl/1, use gRPC on the same port, or export OpenTelemetry traces.

How heavy is it to keep running?

One Go binary and PostgreSQL. Measured idle, the lab uses about 13 MiB of memory and half a percent of one CPU; modules you do not use can be switched off.

What does it cost?

Nothing: it is open source under the Apache-2.0 license. Model calls you make from the lab use your own provider keys, and the built-in fake targets let you try experiments for free.