Skip to content
zero2vibecodelearn vibe coding
Harness EngineeringBy Mikhail Kuzmitskii

How to Evaluate and Improve AI Coding Agents Effectively

Based on the vendor announcement linked above — written with AI assistance and reviewed by the author.

In short

Learn how to move beyond end-to-end benchmarks and use behavioral evaluations to iteratively improve AI coding agents.

When working with AI coding agents, it’s tempting to rely on end-to-end benchmarks like Terminal-Bench and DeepSWE to measure performance. However, these benchmarks often leave you in the dark when scores fluctuate. Behavioral evaluations offer a more insightful approach, helping you understand why changes occur and ensuring your agent evolves in the right direction.

magnifying glass inspecting code

The Problem with End-to-End Benchmarks

End-to-end benchmarks treat AI agents like students taking an exam. They measure success based on test pass rates or task completion but fail to explain why performance changes. For example, if a score drops, you might not know whether the agent misunderstood a prompt, forgot to verify a test suite, or hallucinated a CLI flag. These benchmarks don’t provide actionable insights into specific behaviors.

Behavioral evaluations, on the other hand, focus on discrete, observable actions. Instead of asking whether the agent solved a complex refactor, they measure behaviors like:

  • Asking clarifying questions for ambiguous prompts
  • Running local validators before declaring a task complete
  • Providing canonical repository links in documentation

This granular approach helps you pinpoint exactly where improvements are needed.

When to Start Evaluating

Before diving into evaluations, focus on bootstrapping your agent. Use developer intuition and dogfooding—testing the agent on real-world tasks—to build a functional system. Only when your agent can handle routine developer tasks should you introduce evaluations. Their primary purpose isn’t to celebrate minor improvements but to guard against regressions and ensure forward progress.

How Behavioral Evaluations Work

A robust evaluation framework separates behavioral assertions into fast, deterministic checks that run locally. These unit-style tests act as a safety net, allowing you to iterate confidently on system prompts or switch models without breaking core behaviors.

Here’s an example of a behavioral eval written in Python:

import pytest
from google.antigravity import Agent, LocalAgentConfig, types

@pytest.mark.asyncio
async def test_agent_uses_web_search_for_live_weather():
    """Assert that the agent consults ground truth rather than guessing."""
    config = LocalAgentConfig()

    async with Agent(config) as agent:
        response = await agent.chat("What's the weather like in Mountain View, California?")
        tools = [call.name async for call in response.tool_calls]

        # Assert behavior, not output prose
        assert types.BuiltinTools.SEARCH_WEB in tools, (
            "Agent answered from memory without consulting live search."
        )

This test checks whether the agent uses web search to answer a weather query, ensuring it relies on live data rather than guessing.

Building a Behavioral Suite

To create a repeatable evaluation process, follow these steps:

  1. Pick one failure mode: Identify a recent mistake, such as forgetting to run unit tests, and target that behavior.
  2. Write flexible assertions: Use strict checks for simple tasks and fuzzier, outcome-based evaluations for complex ones.
  3. Automate batch evaluations: Monitor stability by tracking aggregate pass rates over time, rather than blocking PRs on single runs.

For example, running a local behavioral suite can be as simple as:

pytest evals/behavioral/ -v

Behavioral Evals vs. End-to-End Benchmarks

Behavioral evaluations aren’t a replacement for end-to-end benchmarks—they’re complementary. While benchmarks verify the final destination, behavioral evals act as guardrails during iteration. Together, they provide higher confidence when making prompt changes, building new features, or deploying updated models.

Final Thoughts

To build a stable AI coding agent, stop treating it like a black box passing an exam. Instead, approach harness engineering like standard software development, with unit and integration testing at its core. Behavioral evaluations enable safe, rapid iteration, helping you create a resilient system that evolves reliably.

Want to try all of this hands-on? Start with the free Claude Code from Zero course.

Source

Based on Google Developers Blog’s announcement, “The Anatomy of Harness Engineering: How to Evaluate, Iterate, and Guard AI Coding Agents”. Written for people learning to build with these tools.

Read next

Try it hands-on

Free interactive courses on this topic — in your browser, from zero.