Claw Mart
← All issuesClaw Mart Daily
Issue #68June 8, 2026

Measure first, ship second — the eval-first pattern that prevents agent disasters

Your agent works perfectly in testing. Then you deploy it and it starts hallucinating API endpoints, ignoring instructions, or worse — confidently doing the wrong thing at scale.

The problem isn't the model. It's that you're flying blind. You have no idea what "working" actually means until it's too late.

Here's the pattern that fixes this: eval-first development. Write your tests before you write your agent. Measure before you ship. Know what success looks like before you start optimizing.

Start with a golden dataset

Before you write a single prompt, collect 20-50 examples of the exact inputs and outputs you want. Real data, not synthetic examples.

# eval_dataset.json
[
  {
    "input": "Customer says: 'I want to return my order from last week'",
    "expected_action": "lookup_order",
    "expected_params": {"timeframe": "7_days", "status": "completed"},
    "expected_response_tone": "helpful"
  },
  {
    "input": "Customer says: 'This is bullshit, I want my money back now'",
    "expected_action": "escalate_to_human",
    "expected_params": {"priority": "high", "reason": "angry_customer"},
    "expected_response_tone": "calm_professional"
  }
]

Notice what we're measuring: not just the right action, but the right parameters and tone. Your eval should catch the difference between "lookup recent orders" and "lookup orders from exactly 7 days ago."

Build your eval harness first

Before you optimize your prompt, build the system that measures it. This takes 30 minutes and saves you weeks of guessing.

def run_eval(agent_prompt, dataset):
    results = []
    for case in dataset:
        response = agent.process(case['input'], prompt=agent_prompt)
        
        score = {
            'action_correct': response.action == case['expected_action'],
            'params_correct': response.params == case['expected_params'],
            'tone_appropriate': check_tone(response.text, case['expected_response_tone'])
        }
        
        results.append(score)
    
    return calculate_metrics(results)

Now you have numbers. "Version A gets 85% action accuracy, Version B gets 92%." No more guessing whether your prompt changes actually helped.

The 80% rule: Don't deploy until your agent hits 80% accuracy on your eval. Below that, it's not ready for real users.

Measure the failure modes that matter

Don't just measure accuracy. Measure the failures that will hurt your business:

  • Hallucination rate — How often does it make up API endpoints or data?
  • Escalation precision — Does it know when to ask for help?
  • Context retention — Does it remember what you told it 10 messages ago?
  • Safety compliance — Does it refuse dangerous requests consistently?

Each failure mode gets its own subset of test cases. Track them separately. A customer service agent that's 95% accurate but escalates everything to humans is useless.

Run evals on every change

Prompt engineering without evals is like coding without tests. Every tweak breaks something else, and you won't know until it's live.

Set up a simple CI check:

# In your deployment script
echo "Running agent evals..."
python run_eval.py --prompt-version latest --dataset golden_set.json

if [ $? -ne 0 ]; then
    echo "Eval failed. Not deploying."
    exit 1
fi

echo "Evals passed. Deploying agent..."
./deploy.sh

This catches regressions before they hit production. Your agent might get smarter at handling refunds, but if it starts ignoring cancellation requests, your eval will catch it.

The pattern in practice

I've seen teams ship agents that worked great in demos but fell apart with real users. Every time, it was because they optimized for the happy path without measuring the edge cases.

The teams that succeed build their measurement system first. They know exactly what "better" means before they start tweaking prompts. They catch failures in testing, not in production.

Your agent is only as reliable as your ability to measure it. Start measuring today.

Paste into your agent's workspace

Claw Mart Daily

Get tips like this every morning

One actionable AI agent tip, delivered free to your inbox every day.