guide
Comparing two frameworks
Which framework, model, or agent design should you actually ship? Run both through the same inputs, capture cost, latency, and quality for each, and read the difference off one dashboard. You run each framework and send the results in — so this works with any stack in any language — and an optional BYO-key LLM judge can score both sides for you.
The shape of a fair comparison
Keep the dataset, scoring, and environment constant and vary only the framework — then every delta on the dashboard is attributable to the framework itself. Four moving parts:
- One dataset
- The fixed set of inputs both frameworks must handle, so you compare like with like.
- One experiment per framework
- A named run recording what each framework produced for every dataset item.
- Traces
- Per-run execution detail — steps, latency, tokens, cost — tagged so you can tell the frameworks apart.
- Scores
- The same quality judgment applied to both, so “better” is a number, not an impression.
The runbook
- 1
Point both frameworks at one project
Both report into the same project so their metrics sit side by side. Create a project and API key, then:
export AGENTSENTRI_HOST=http://localhost:3000 export AGENTSENTRI_SECRET_KEY=sk-as-...
- 2
Build the shared dataset
Curate the inputs once; both frameworks run against these exact items. create_dataset is idempotent by name.
sentri = AgentSentri() ds = sentri.create_dataset(name="support-eval") for c in CASES: # each case: {"input": ..., "expected_output": ...} sentri.add_dataset_item( dataset_id=ds["id"], input=c["input"], expected_output=c["expected_output"], ) - 3
Run each framework, tracing every call
Tag every trace with the framework (metadata + session_id) so runs are separable, and record real token usage so cost is computed per framework.
with sentri.trace( name=f"{fw}:answer", session_id=fw, metadata={"framework": fw}, ) as trace: with trace.generation(name="answer", model="gpt-4o") as gen: gen.set_input(case["input"]) out, usage = call_your_framework(fw, case["input"]) gen.set_output(out) gen.set_usage( input_tokens=usage["input_tokens"], output_tokens=usage["output_tokens"], ) - 4
Record an experiment per framework
An experiment ties a framework's outputs to the shared dataset. AgentSentri stores the results you post — it never runs a model loop.
items = sentri.list_dataset_items(ds["id"])["data"] for fw in FRAMEWORKS: exp = sentri.create_experiment(name=f"{fw}-v1", dataset_id=ds["id"]) for item in items: r = run_case(fw, {"input": item["input"]}) sentri.post_experiment_result( experiment_id=exp["id"], dataset_item_id=item["id"], output=r["output"], metrics={"trace_id": r["trace_id"]}, ) - 5
Score both the same way
Use one score name and one rule for both — human, heuristic, or an LLM judge. AgentSentri can run the judge for you with a BYO-key evaluator (see the LLM-as-judge evals guide), or store scores you computed yourself.
sentri.create_score( name="answer-quality", # same name for both frameworks trace_id=r["trace_id"], value=score_output(r["output"], item.get("expectedOutput", {})), comment=fw, ) - 6
Read the verdict on the dashboard
Same project, same score name — so cost & tokens, latency (avg/p50/p95), error rate, and answer-quality line up side by side. Open each framework's session in the Sessions tab for chronological trace replay; dashboard aggregates remain project-wide. Use per-item experiment results to see which cases each wins.
metrics = sentri.get_metrics(days=1) print(metrics["aggregates"]["totalCostUsd"], metrics["aggregates"]["p95LatencyMs"], metrics["aggregates"]["scores"]) - 7
Make it a standing check (optional)
Add an alert rule (e.g. answer-quality < 0.8 over 24h) so regressions are caught, and re-run with a fresh experiment name (-v2, …) on every version bump. Fixed dataset + fixed scoring keeps every comparison apples-to-apples.
Keeping the comparison honest
| Pitfall | Fix |
|---|---|
| Different inputs per framework | One shared dataset; both read the same items. |
| Scores that aren't comparable | One score name and one scoring rule for both. |
| Cost looks wrong | Send real usage, or set_cost(...); don't leave tokens unset. |
| Can't tell the runs apart | Tag every trace with metadata={"framework": …} and a session_id. |
| Latency skewed by cold starts | Warm up, run enough cases, compare p50/p95 not one-offs. |
| Unversioned LLM judge | Pin the judge model + prompt; note it in the score comment or experiment config. |