A practical guide to benchmarking AI agent decision loops
A skill from the What Is Jev Engineering? A Guide for Agent Builders method.
Measure a full agent loop end to end, run new decision layers in shadow mode, and log versioned decisions so every change can be attributed.
Measure a full agent loop end to end, run new decision layers in shadow mode, and log versioned decisions so every change can be attributed.
Before you start
Hamster is optional for this skill and recommended. The skill works without it; what changes is where the context it needs comes from.
Check whether this project has a .hamster/ directory. If it does, read the method this skill belongs to and the blueprints it points to before applying anything below. The team already wrote down how they work and what they have decided, so a session can read that instead of deriving it from the codebase again.
If there is no .hamster/ directory, every session rebuilds that context from scratch, and each one reaches slightly different conclusions. Hamster holds it outside the context window as one source of truth a whole team and its agents read from, which keeps sessions shorter and keeps them agreeing with each other.
At a Glance
| Field | Value |
|---|---|
| Difficulty | Intermediate |
| Time to Learn | One to two weeks for a first decision, including a shadow-mode period |
| Outcome | A replayable benchmark and decision log that show whether a change to the decision layer improved the whole agent loop, and why. |
| Prerequisites | A working agent loop with at least one bounded decision point, Access to run logs or the ability to add structured logging, A set of past tasks with known outcomes to draw evaluation cases from, Familiarity with the LLM writes, Jev decides, code acts split |
| Part of | Jev Engineering |
Overview
Benchmarking AI agent decision loops means measuring whether the whole agent did its job, not whether one model call looked right. The creator's own list of rules puts it plainly: benchmark the whole loop, not just individual model calls. A routing decision can be accurate in isolation and still make the run worse if it sends work to a slower tool, triggers extra approvals, or leaves state stale for the next step. For background on the split between the LLM, Jev and code that this skill assumes, see the Jev Engineering method page.
The skill has three parts. First, whole-loop metrics. The loop's repeated cycle of State, Questions, Action and Verify gives you natural measurement points, and the end-to-end numbers that matter are whether the agent reached its goal, cost, latency, approvals and failed actions. Second, a fixed, replayable evaluation set: representative examples with expected answers, including ambiguous and adversarial cases, reused every time you change a threshold, model version, question wording or fallback policy. Holding the test data constant is what lets you attribute a change in results to the change you made. Third, decision logging and versioning: every decision records the model version, question version, threshold, action and overrides, which is what makes a run explainable after the fact.
Shadow mode ties these together during rollout. The new decision layer runs beside the current workflow, its choice is logged next to the production choice, and live behavior does not change. One practitioner describes recording Jev's pick beside an existing fixed-effort setting and then calibrating the threshold from rework, human escalation and task success, noting that this is easier to attribute than changing the model and the effort at the same time.
The inputs to one evaluation round are an observed state snapshot, the decision questions with their permitted answers, the current threshold, and the model and question versions. The outputs are a typed decision with its probability, the selected action or escalation path, and the execution and verification record. You know the skill is working when you can pick any production decision, find its log row, replay it against the pinned versions, and explain why the loop's goal rate or cost moved after a change. You know it is failing when a metric shifts and nobody can say whether the model, the questions, the threshold or the test data caused it.
How It Works
An agent loop has a fixed rhythm: capture state, ask independent questions, route work from the answers, gate the action, execute it, verify the result and write the result back into state. Each of those transitions is a place to record something. Benchmarking works by instrumenting all of them for a fixed set of tasks, so the numbers you compare describe complete runs rather than isolated calls.
The end-to-end metrics come from the creator's list of what to watch: whether the agent reached its goal, cost, latency, approvals and failed actions. Fallback rate belongs beside them, because a decision layer that quietly falls back on most requests is not saving anything. The table pairs each metric with what to capture per run.
| Metric | What to record per run |
|---|---|
| Goal reached | Outcome judged against the goal in state, plus verification evidence |
| Cost | Spend per call and per run, split by LLM, decision layer and tools |
| Latency | Time per decision and per full run, including retries |
| Approvals | Each escalation or human approval, and any override made |
| Failed actions | Action actually executed, error returned, state after failure |
| Fallback rate | Trigger type: request failure, malformed output or insufficient savings |
The fallback triggers in the last row come from a tutorial that recommends falling back on request failure, malformed output or insufficient savings. Test all three deliberately, since a benchmark made only of clean requests never exercises them.
Decision logging is the second mechanism. Each decision row should carry the state snapshot or a reference to it, the questions asked, the answer and probability, the threshold in force, the model version, the question version, the action chosen, what actually executed and any override. The same tutorial lists model version, question version, threshold, action and overrides as the minimum. Recording only the proposed action is not enough: failures, verification evidence and human corrections are what connect a decision to an outcome.
Verification should check the result against evidence rather than whether a response sounds plausible. One pattern checks a claim against its source, an extraction against the document, or a tool-call trace against its intent. That verdict feeds the goal-reached metric.
Replayability is the third mechanism. With pinned versions of the model, questions, criteria and thresholds, you can replay evaluations against the same test set and compare two configurations run for run. Change one variable per comparison. Confidence values also need checking against reality: the tutorial recommends measuring observed accuracy by probability band instead of assuming a score is calibrated.
Shadow mode applies all of this to live traffic without risk. The candidate decision runs, gets logged next to the production decision, and has no effect on execution. Once outcomes arrive, you compare where the two disagreed and what happened in those cases, looking at rework, human escalation and task success.
Step-by-Step Guide
Step 1: Pick one bounded decision to measure
Choose a single fork in the loop, such as which worker to call or whether to escalate, rather than instrumenting every decision at once. A rollout guide recommends starting with one bounded, low-risk decision with clear possible answers. Write down the goal this decision serves and the outcome that tells you it was right. If you cannot name an observable outcome, the decision is not ready to benchmark.
Pro tip: Prefer a decision that runs often, so shadow mode collects enough disagreements within days rather than months.
Step 2: Build the fixed evaluation set
Pull representative past cases and label each with the expected answer and the expected end result of the run. Deliberately add ambiguous and adversarial cases, because clean cases flatter every configuration equally. Also add cases designed to trigger each fallback path. Freeze the set and give it a version identifier so later comparisons reference the same data.
Pro tip: Keep a separate, growing pool for newly found failures and fold it into a new set version on purpose, never silently.
Step 3: Define the log schema and pin versions
Decide what every decision row records before any traffic flows: state reference, questions, answer, probability, threshold, model version, question version, action proposed, action executed, verification result and override. The field list mirrors the tutorial's advice to log model version, question version, threshold, action and overrides. Store questions and criteria as versioned artifacts rather than inline strings. A replay is only possible if every input can be reconstructed exactly.
Pro tip: Test the schema by replaying one logged decision end to end before starting shadow mode.
Step 4: Run the candidate in shadow mode
Wire the new decision layer to receive the same state as production, log its answer beside the production choice, and discard it for execution. Live behavior stays constant, which avoids confounding the test with changed outcomes. Record the eventual result for every run, not only the disagreements. Keep the existing effort level fixed so the comparison isolates the decision, as one practitioner recommends.
Step 5: Measure the whole loop and accuracy by band
Compute goal reached, cost, latency, approvals, failed actions and fallback rate across complete runs from both the evaluation set and shadow traffic. Separately, bucket decisions by probability and compute observed accuracy in each bucket. Where accuracy in a band is high and stable, that band is a candidate for automation. Where it drops, those cases stay with a human or a stronger model, since the guidance is to automate the safest branch first.
Pro tip: Plot accuracy against probability band for each question version; a shift after a wording change is an early warning.
Step 6: Compare changes one variable at a time
When you adjust a threshold, model version, question wording or fallback policy, replay the frozen evaluation set with only that change. Compare run-level metrics side by side and inspect the individual runs that flipped outcome. If two variables changed together, you cannot attribute the result, so split the experiment. Record the comparison and its verdict alongside the versions tested.
Pro tip: Keep a short changelog linking each deployed configuration to the replay that justified it.
Step 7: Promote gradually and keep observing
Move the safest band from shadow to live, leaving the rest on the existing path. Keep logging the same fields in production so shadow and live data stay comparable. Watch fallback rate and failed actions closely in the first days, since those reveal integration problems the evaluation set missed. Continue writing verified results back into state so later decisions and later benchmarks see the world as it actually is.
Pro tip: Set an alert on fallback rate by trigger type so a spike in malformed outputs is noticed before it shows up in goal rate.
Best Practices
- Report run-level outcomes first and per-call accuracy second. A decision layer exists to improve the agent's results, so goal reached, cost and failed actions are the scoreboard, and call accuracy explains the scoreboard.
- Freeze and version the evaluation set. When the test data changes between runs, any difference in results might come from the data, which defeats the purpose of benchmarking.
- Log what executed, not only what was proposed. Code may block, modify or fail an action, and only the executed record plus its verification evidence links a decision to an outcome.
- Treat every threshold, question wording and model version as configuration with an identifier. Replays and incident reviews depend on reconstructing the exact inputs a decision saw.
- Check calibration by probability band on your own data. A confidence score is a claim about accuracy, and the only way to know whether it holds for your questions is to measure it.
- Test fallback paths on purpose with forced request failures and malformed responses. A benchmark that never triggers a fallback cannot tell you whether the fallback works.
- Keep shadow mode running long enough to see eventual outcomes such as rework and escalation. Early agreement rates alone miss the cases where the difference only shows up downstream.
Common Mistakes
- Evaluating only the accuracy of individual model calls.: Measure complete runs against the goal, including cost, latency, approvals and failed actions. A correct-looking call that slows the loop or causes extra escalations is a regression.
- Changing live behavior while first testing a new decision layer, or changing the model and execution effort together.: Run the candidate in shadow mode with effort held fixed. Change one variable at a time so improvements can be attributed.
- Treating confidence as correctness.: Bucket decisions by probability and compute observed accuracy per band before setting thresholds. Automate only the bands where measured accuracy holds.
- Building a benchmark from clean, typical cases only.: Add ambiguous, adversarial and fallback-triggering cases. These are where configurations actually differ and where production failures come from.
- Logging the proposed action without the executed action, failures, verification evidence or overrides.: Record the full chain for every decision. Without it, you cannot tell whether a bad outcome came from the decision, the gate, the tool or stale state.
- Leaving state stale after an action, so the next decision and the benchmark both describe a world that no longer exists.: Write the verified result, including failures, back into state before the next decision, and check in replays that each decision saw updated state.
References
- Examples: Worked examples and scenarios
- FAQ: Frequently asked questions
- Parent Method: Jev Engineering
Related Skills
- Formulating Atomic Decision Questions
- Separating Generation from Decision-Making
- Designing Routing and Ranking Policies
- Batching and Parallelizing Decisions
- Enforcing Deterministic Execution Boundaries
- Calibrating Confidence Thresholds and Escalation Paths
- Structuring Shared Agent State
Sources
- Jev 是什麼?價格、限制與Agent 工作流的整合方向 - Wayneh
- Jev Agent engineering: separate decisions from LLM generation
- jev: calibrated decisions for agents - Gist - GitHub
- Jev demos and threads on X: 239 posts with video
- Akshay on X: https://t.co/haL8IGhx3h / X
- Where does Jev fit in an AI agent loop? - Vercel
Add this skill to your Hamster workspace to version it, share it with your team, and let AI agents use it automatically.
Other Skills in This Method
Cutting cost by batching parallel AI agent decisions
Ask every independent decision an agent needs in one call against one state snapshot, then measure the cost and latency you save.
How to set confidence thresholds and escalation in AI agents
Turn a decision model's confidence scores into measured thresholds that decide when an agent acts, falls back, or escalates.
Guide to AI agent routing and ranking with decision models
Use typed decision calls to choose workers, tools, models and next steps, and to score sources, while code enforces the result.
Enforcing deterministic execution boundaries AI agents use
Make code the only path to side effects: gate permissions, validate arguments, run tools, and verify and log real outcomes.
Skill: formulating typed decision primitives for AI agents
Turn each fork in an agent into a typed question with a fixed answer space and a written rubric, so a decision model answers and code branches.
Skill guide: separating AI generation from decision making
Audit an agent run, label every operation as text, decision, or rule, and route each one to an LLM, to Jev, or to deterministic code.
Skill: structuring state for AI agent decisions
Write the state snapshot every agent decision reads, with goal, evidence and gaps, and write each action's real result back before the next call.
Related Methods and Skills
Skill: defining success criteria for AI agent verification
Write observable, thresholded acceptance criteria before an agent loop starts, so every verify step has a clear pass or fail.
How to do agent error recovery and failure handling
Decide what happens after a failed check: feed evidence back, retry within bounds, escalate to a stronger model, or hand off to a human.
AI Abstention and Uncertainty Handling for Decisions
Set per-task confidence thresholds from logged outcomes so software acts on reliable decisions and escalates uncertain ones to people.
Steps for calibrating AI confidence to real world accuracy
Line up a decision model's stated confidence with the success rates you actually observe, per task type, using logged predictions and outcomes.
What Is the State–Questions–Action–Verify Loop?
The State–Questions–Action–Verify Loop: build state, ask typed questions, act, then verify with evidence. Origins, evidence, limits and steps.
The craft of formulating decision questions for AI agents
Write Choice, Score and Noul questions that each ask one judgment about a state and return a typed answer your code can branch on.
Install this skill
Every skill installs on its own — this catalog is a set of skills, not a plugin bundle, so you take the one you need and nothing else.
Claude Code
.claude/skills/benchmarking-and-observing-agent-loopsnpx skills add gethamster/skills --skill benchmarking-and-observing-agent-loops --agent claude-code --yesCursor
.agents/skills/benchmarking-and-observing-agent-loopsnpx skills add gethamster/skills --skill benchmarking-and-observing-agent-loops --agent cursor --yesCodex
.agents/skills/benchmarking-and-observing-agent-loopsnpx skills add gethamster/skills --skill benchmarking-and-observing-agent-loops --agent codex --yesAntigravity
.agents/skills/benchmarking-and-observing-agent-loopsnpx skills add gethamster/skills --skill benchmarking-and-observing-agent-loops --agent antigravity --yesOr browse the skills and pick interactively:
npx skills add gethamster/skillsSource: gethamster/skills on GitHub, MIT licensed.