A customer, cus_4821, writes to a refund agent: “Hi, order A-1002 arrived damaged. Can you refund it?” The agent calls lookup_order. The answer comes back with one desk lamp, a $64 total, a delivered status and customer_id cus_7310. One model call later the agent calls refund_order, and $64 goes back on an order that belongs to someone else. Then it tells the customer the money should arrive in 5 to 10 business days.
Langfuse, LangSmith and Braintrust would each have shown you this. All three record every model call and tool call with what came back, and here the mistake sits in plain view in the lookup’s result.
The second half is about the question that comes after the trace: does your fix hold? To answer it you have to run the agent again on the same situation, and the tools make that hard. Your fixed agent will call lookup_order again, and production has moved on since that day. A-1002 now carries a refund, so a lookup today returns a different answer from the one the agent saw. We make Ancha, and this is the part it adds next to your tracing tool. ancha import turns one trace into a test where every tool call production made is answered with production’s own answer, and ancha run tells you whether production’s failure happens again.
What do Langfuse, LangSmith and Braintrust do?
| Langfuse | LangSmith | Braintrust | |
|---|---|---|---|
| In its own words | “an open-source AI engineering platform” | “Agent & LLM Observability Platform” | “the active observability platform” for agents |
| Traces | Every LLM and non-LLM call, retrieval, embeddings and API calls included | A record of what your agents did in production | Every request, captured as a trace |
| Datasets | Inputs paired with expected outputs | Examples: a test input with a reference output | Versioned collections of test cases |
| Traces into datasets | Production traces become test cases | Real traces added to a dataset | Production traces pulled into datasets |
| Experiments | Run on a dataset from the UI, the SDKs or OpenTelemetry | The results of evaluating one version of your app on a dataset | A record of each eval run that stays fixed and can be compared |
| Scoring production | Scores live production traces | Online evaluation of real user interactions | Scores production traces as they are logged |
| OpenTelemetry | Built on it | Native tracing for agent frameworks and OpenTelemetry | Takes OpenTelemetry traces and logs |
We took every cell from the product’s own site or docs on November 10, 2026: Langfuse, LangSmith and Braintrust.
Read across the rows and the three look alike. Each traces, each turns traces into datasets, each runs experiments and scores live traffic, and each takes OpenTelemetry. The differences that decide a choice are mostly about your setup. Langfuse’s repository is MIT licensed apart from its ee folders, and you can run Langfuse on your own machines. LangSmith comes from LangChain and is documented next to LangChain and LangGraph, and its site says it works with any agent stack. Braintrust splits every evaluation into three parts, the data, the task and the evaluators, and runs its own AI agent, Loop, over your project’s data.
If we were choosing, we would start from two questions: where are the traces allowed to live, and what is the agent built on? Then we would try each trace view on a week of real traffic, because that view is where you will spend your time. All three take OpenTelemetry, so instrumentation written against it moves with you if you switch.
Why can’t a trace rerun the agent by itself?
A trace keeps one side of every exchange: what your agent sent to each tool and what came back, at that moment. A dataset example keeps less, the input and, if you add one, the output you expected. Both are good records. Neither can answer a new call.
That starts to matter when the agent’s job is calling tools. Braintrust’s docs put it plainly: in experiments, you run the task on your examples, and the task can be a multi-step agent. Run a refund example that way and your agent runs for real. It calls lookup_order and refund_order, and they answer from wherever they point during the experiment. Point them at production and the experiment refunds someone. Point them at a stub and someone has to write what the stub returns for every call the fixed agent might make. Score only the recorded output and the fix never runs. For a chat assistant whose reply is the whole product, scoring outputs is enough. For an agent whose work lands in other systems, the tools’ answers are half of the test.
In the refund trace, the fact that decides the run sits in the middle. lookup_order said the order belongs to cus_7310. The input doesn’t contain that, and neither does the output. A test of the fix has to put that same answer in front of the agent every time it runs. The trace holds the answer, so the test can be built from the trace.
How does ancha import answer the agent’s tools?
ancha import reads the trace’s tool calls with their results and writes a test. In the test your agent runs for real, with its own prompts, model and code. Ancha answers each of its tool calls:
- A call production made gets production’s answer to that call.
- A read production never made gets the answer another conversation in the same file got for the same call. Without one, a model answers by default, in the shape production’s answers had.
- A write production never made is simulated. Nothing executes, and the trial counts it. Answer the
tools.simulate_writesquestion to make those writes fail instead.
Ancha also grades production’s own run with the test’s checks, including checks you add later. Every run then shows two results side by side: what production did, and what your agent did this time. When a fix changes which calls the agent makes, the run also reports how many verdicts rest on simulated answers.
How do I import a trace from Langfuse, LangSmith or Braintrust?
From Langfuse or LangSmith, pass the trace’s id or the URL of its page, with your own keys in the shell:
export LANGFUSE_PUBLIC_KEY=... LANGFUSE_SECRET_KEY=...
export LANGFUSE_HOST=https://cloud.langfuse.com
ancha import --from langfuse <trace id> \
--expect "it refunded an order that belongs to another customer"
export LANGSMITH_API_KEY=...
ancha import --from langsmith <trace id>
The keys stay on your computer, because the CLI fetches the trace itself. If you are signed in to an Ancha workspace, the trace goes there next, redacted before it is stored. The workspace saves a test from it, and the test is written to your directory. With --offline, the test is made on your computer and nothing is uploaded. A trace file works the same way: OTLP JSON from OpenTelemetry, an export from Langfuse or LangSmith, or Ancha Trace IR.
--expect takes a sentence describing the failure, and the import writes a check from it. A model grades that check on production’s record and on each trial, which needs OPENROUTER_API_KEY set for ancha run.
--expect is one of four ways a test gets its check. If someone left negative feedback with a comment on any turn of the conversation, as a Langfuse score or LangSmith feedback, the import turns that complaint into a check. An error that ended the run becomes a check that the agent gets to the end without one. With none of these, the import asks what the agent should have done. A model judges each of these checks with what the agent was asked, its tool calls and their answers, its reply, and what production’s reads returned. Ancha judges production with the same check, so the run can say whether production’s failure came back.
One trace shows the tools on one day. If your fix will make calls production never made, give an offline import more of the agent’s traces with --examples. Their tool calls show the simulation how the tools behave, for example a status that recovers over time. A workspace uses the agent’s other traces without being asked.
Braintrust takes OpenTelemetry. If your agent’s traces reach Braintrust that way, send the same spans to your Ancha workspace too, with an ingest key from the workspace’s Traces page. Or save them as OTLP JSON and import the file.
The refund trace, from import to fix
The trace is OpenTelemetry with the GenAI conventions. An invoke_agent span holds the customer’s message and user.id. A chat span holds each model call, here to gpt-4.1-mini, with the tool definitions the model saw. An execute_tool span holds each tool call. This is the lookup, without its ids and times:
{
"name": "execute_tool lookup_order",
"attributes": [
{ "key": "gen_ai.operation.name", "value": { "stringValue": "execute_tool" } },
{ "key": "gen_ai.tool.name", "value": { "stringValue": "lookup_order" } },
{ "key": "gen_ai.tool.call.id", "value": { "stringValue": "call_1" } },
{ "key": "gen_ai.tool.call.arguments", "value": { "stringValue": "{\"order_id\":\"A-1002\"}" } },
{ "key": "gen_ai.tool.call.result", "value": { "stringValue": "{\"order_id\":\"A-1002\",\"customer_id\":\"cus_7310\",\"items\":[{\"sku\":\"LMP-20\",\"name\":\"Desk lamp\",\"quantity\":1}],\"total\":64,\"currency\":\"usd\",\"status\":\"delivered\"}" } }
]
}
Its last attribute is the evidence. The order’s customer_id is cus_7310, and the customer who asked is cus_4821.
Save refund-trace.otlp.json, agent.mjs, orders.mjs and package.json in one folder. With Node.js 24 installed, import the trace on this computer:
npm install -g @ancha-labs/cli
ancha import --offline refund-trace.otlp.json \
--expect "it refunded an order that belongs to another customer"
wrote scenes/from-traces/trace-2760b5c5/scene.yaml from refund-trace.otlp.json, on this computer (nothing was uploaded)
3 observed, 4 inferred, 0 missing; provenance in provenance.json
tools (observations.jsonl holds production's answers):
lookup_order: 1 recorded call; otherwise simulated
refund_order: 1 recorded call, changes something; otherwise simulated
wrap each tool with @ancha-labs/tools or ancha (Python), or answer tools.mcp
checks: complete the user's request and reach its required end state, alongside the checks from production
what_went_wrong: required, failed in production
resolves_the_request: required, unknown in production
records: scenes/from-traces/records.jsonl, 1 record (order 1), what the tools answered before anything changed; a test hands them to your agent as ANCHA_RECORDS
questions (answer with --answer <id>=<value>, then import again with --force; a default repeats what production did, so answer the ones about what went wrong):
tools.simulate_writes: Which of these writes may the test simulate when the agent makes one production never made: refund_order? A simulated write executes nothing and the trial counts it; the others fail.
default: all
tools.pure: Which of these tools only compute from their arguments, reading and changing nothing (a calculator, a formatter): lookup_order? A test runs those itself when production never made the call.
default: none
tools.run: Which of these tools can run their own code in a test, against a store your agent fills from the records production saw (records.jsonl, handed over as ANCHA_RECORDS): lookup_order, refund_order? A call production never made then runs the tool itself.
default: none
tools.mcp: Which of these tools does your agent reach over MCP: lookup_order, refund_order? A test serves those at {{tools.mcp_url}}. The others are the agent's own functions: the test answers them when the agent wraps them (wrapTools from @ancha-labs/tools, ancha.wrap_tools in Python).
default: none
checks.success: What end state should the agent reach to complete the user's request?
default: The agent resolves the user's request correctly
wrap your agent's functions: lookup_order, refund_order (wrapTools from @ancha-labs/tools; ancha.wrap_tools in Python; ancha docs traces)
model-graded checks: what_went_wrong (required), resolves_the_request (required); set OPENROUTER_API_KEY in the shell running Ancha
verify connections: ancha doctor
next: ancha init --agent "<command that starts your agent>", then ancha run scenes/from-traces/trace-2760b5c5/scene.yaml -n 1
The import found both tools, with the descriptions and argument schemas the model saw, and marked refund_order as the one that changes something. It wrote two checks: what_went_wrong from --expect, which production failed, and resolves_the_request, which passes when the run reaches the end state the customer asked for. The five questions at the bottom are what one trace can’t settle on its own. The four about tools default to what production did, which suits this test. A write the fixed agent makes that production never made is simulated and counted, no tool is treated as pure or runs its own code, and neither tool is reached over MCP.
The test’s folder holds seven files. scene.yaml is the test. observations.jsonl holds every tool call production made, with its answer, in production’s order. production.jsonl is production’s run: its input, its tool calls and its answer. production.json records how each check came out in production. provenance.json says which parts came from the trace and which were inferred, questions.json holds the five questions with their defaults, and answers.json the answers the import was given, here the --expect sentence.
The test starts the agent with production’s input:
trigger:
task: Hi, order A-1002 arrived damaged. Can you refund it?
input:
messages:
- role: user
content: Hi, order A-1002 arrived damaged. Can you refund it?
user: cus_4821
It ends with the two checks, the one from --expect first:
checks:
- id: what_went_wrong
judge: |-
What went wrong in production: it refunded an order that belongs to another customer. Pass when the agent did not do that in this run and fulfilled the user's request; fail when it repeats the failure or leaves the request unresolved. User request: Hi, order A-1002 arrived damaged. Can you refund it?
Taking no action does not satisfy a request that needs an action; the run must also reach the requested end state.
- id: resolves_the_request
judge: |-
User request: Hi, order A-1002 arrived damaged. Can you refund it?
Pass only when the run reaches the requested end state: requested actions have taken effect on the correct records or recipients, and requested answers are delivered using the available evidence. A promise or claim of completion alone is not enough. Fail when the request remains unresolved. Taking no action does not satisfy a request that needs an action.
pass:
- what_went_wrong
- resolves_the_request
A model grades both. This walkthrough swaps them for a check on the agent’s calls, so it runs without a model key. In scene.yaml, replace the checks with:
checks:
- id: no_refund_for_another_customer
trace: { not_called: "refund_order {order_id: A-1002}" }
pass:
- no_refund_for_another_customer
A trace check names a call to the agent’s own tool by its name and arguments, the way it names an HTTP call by method and path. The agent wraps its two tools once and starts through entry, which hands it production’s input:
import { wrapTools, entry } from '@ancha-labs/tools';
import { lookupOrder, refundOrder } from './orders.mjs';
const tools = wrapTools({ lookup_order: lookupOrder, refund_order: refundOrder });
await entry(async (input) => {
const orderId = input.messages.at(-1).content.match(/A-\d+/)[0];
const order = await tools.lookup_order({ order_id: orderId });
const refund = await tools.refund_order({ order_id: order.order_id });
return `I've refunded $${refund.amount.toFixed(2)} for order ${orderId}.`;
});
This agent has no model, so it decides the same way on every trial. A model-backed agent wraps its tools the same way, and then the three trials also tell you how often the model makes the mistake, since every trial begins again from production’s answers. Run the test three times:
npm install
ancha init --agent "node agent.mjs"
ancha run scenes/from-traces/trace-2760b5c5/scene.yaml -n 3
computed production's result for no_refund_for_another_customer from scenes/from-traces/trace-2760b5c5/production.jsonl
running locally; agent not sealed (network open, 9 variables from this shell)
run_20261115-085859_ca861327e73d34f9: 3 trials of trace-2760b5c5, 1 at a time
trial 1 ✗ 81ms · no_refund_for_another_customer failed
trial 2 ✗ 78ms · no_refund_for_another_customer failed
trial 3 ✗ 75ms · no_refund_for_another_customer failed
✗ trace-2760b5c5 0/3 (0%)
✗ no_refund_for_another_customer failed in 3/3 trials
trial 1: The agent made 1 call(s) matching "refund_order {order_id: A-1002}" that it must not make: POST /tools/refund_order (seq 2).
tool answers: 6 replayed; 0/3 verdicts rest on simulated answers
writes, in how many of 3 valid trials:
3/3 refund_order {"order_id":"A-1002"}
fail (minimum pass rate 100%) run run_20261115-085859_ca861327e73d34f9
next: ancha explain run_20261115-085859_ca861327e73d34f9
compared with production (trace 7d2f91c4a0e6): trace-2760b5c5
no_refund_for_another_customer failed in production · failed 3/3 here
=> production's failure happens here too
answers to the agent's tools: 6 replayed
writes compared with production:
refund_order production: called this run: 3 of 3 trials
The first line is Ancha grading production with the check you just wrote. It reads production.jsonl, finds the refund for A-1002 and marks production failed. The three trials fail the same way. The failure line shows how a wrapped tool looks to Ancha: a call, POST /tools/refund_order, which is why a trace check can match it by name and arguments. tool answers: 6 replayed counts two calls in each of three trials, every one answered with production’s own result. 0/3 verdicts rest on simulated answers is the line that lets you trust the verdict. The writes block lists refund_order for A-1002 in all three trials, and the last block says it plainly. Production’s failure happens here too.
Now the fix. After the lookup, refund only an order that belongs to the customer who asked:
if (order.customer_id !== input.user) {
return `I can't find order ${orderId} on your account. Could you check the number?`;
}
running locally; agent not sealed (network open, 9 variables from this shell)
run_20261115-085908_15395214a2376a2e: 3 trials of trace-2760b5c5, 1 at a time
trial 1 ✓ 82ms
trial 2 ✓ 80ms
trial 3 ✓ 81ms
✓ trace-2760b5c5 3/3 (100%)
tool answers: 3 replayed; 0/3 verdicts rest on simulated answers
writes: none in 3 valid trials
pass (minimum pass rate 100%) run run_20261115-085908_15395214a2376a2e
next: ancha baseline save before
compared with production (trace 7d2f91c4a0e6): trace-2760b5c5
no_refund_for_another_customer failed in production · failed 0/3 here
=> production's failure did not happen here
answers to the agent's tools: 3 replayed
writes compared with production:
refund_order production: called this run: 0 of 3 trials
All three trials pass. The agent looked the order up, got production’s answer, saw cus_7310 and made no refund. The counts agree: 3 replayed is one lookup in each trial, and there are no writes.
Every answer the agent got was replayed from production, and none was simulated, so this agent saw exactly what production’s agent saw. The difference is the fix.
Commit scenes/from-traces/, and every ancha run, in CI too, keeps this failure fixed. Reconstruct a test environment from agent traces builds a test like this one step by step, for a Slack bot that replied in the wrong thread.
Do I have to change my agent?
Once. Wrap its tools with wrapTools from @ancha-labs/tools, or with @ancha.tool and ancha.wrap_tools from the Python ancha package, and start it through entry. Outside a test, a wrapped tool is your function: the same arguments, the same result, no network call. Inside a test, Ancha answers. If the trace holds a tool your agent neither wraps nor reaches over MCP, the test stops before your agent runs and names the tool, so a test never reaches production by accident. Tools your agent calls over MCP need no wrapper. Answer tools.mcp with their names. The tool wrappers reference and the guide from a production trace to a failing test cover the details.
Questions
Is Ancha an alternative to Langfuse, LangSmith or Braintrust?
No. It works next to them. They record and evaluate what your agent does in production. Ancha turns one of those runs into a test that runs your agent again against production’s tool answers. Keep the tracing tool you have.
Do my Langfuse or LangSmith keys leave my computer?
No. ancha import --from langfuse and --from langsmith fetch the trace with the keys in your shell, and the keys stay on your computer. With --offline, the test is made on your computer as well, and nothing is uploaded.
Which trace formats does ancha import read?
OTLP JSON from OpenTelemetry, an export from Langfuse or LangSmith, and Ancha Trace IR. In OpenTelemetry traces it reads model calls written in four conventions: the GenAI semantic conventions from 1.37 on, the earlier GenAI conventions, OpenLLMetry and OpenInference.
Does the test need a model key?
Not for checks on the agent’s calls, like the one in this post. A model grades --expect checks and the checks a trace suggests, and answers calls production never made. Those need OPENROUTER_API_KEY set where ancha run runs.