cd /news/ai-agents/what-is-harness-engineering-and-why-… · home topics ai-agents article
[ARTICLE · art-119148] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=· neutral

What is harness engineering and why should I care?

A developer explains harness engineering, a methodology for building reliable AI agent systems by designing deterministic guardrails around large language models. The approach, highlighted by an OpenAI experiment where three engineers shipped a product with zero manually-written code, shifts developer focus from writing logic to engineering the environment. The post demonstrates configuring a sandboxed agent using Google's Antigravity SDK and ADK 2.0.

read5 min views1 publishedSep 2, 2026

How do you ship a software product with 0 lines of manually-written code?

A friend asked me this today, and I realized I didn't have a simple answer. So I dug deeper.

It turns out the answer is in how you engineer your harness.

Wait now, what? What is harness engineering?

There is a reason this is the most important trend right now around coding agents. The biggest question these days is how to validate AI-generated code without reading every single line. How do you make sure an agent doesn't break production or delete your data?

A blog by OpenAI shared an interesting experiment where a team of 3 engineers have built and shipped an internal beta of a software product with 0 lines of manually-written code. Every line of code: application logic, tests, CI configuration, documentation, observability, and internal tooling, has been written by Codex.

How did they do it? They didn't write the app. They designed the harness.

Think of an AI agent like a powerful racehorse. The harness is the track, the blinders, and the jockey's reins that keep it running in the right direction instead of jumping into the stands.

As my colleague Arthur Thompson explained today: for agents — the harness is composed of all the deterministic components that wrap the LLM.

Balaji Subramaniam details those deterministic components in his blog the orchestration layer, execution sandboxing, state persistence, and verification tools.

If you want to build reliable agentic systems, your job shifts from writing the logic to designing the environment. Here is what you need to focus on:

What does this look like in practice? Here is a simple example using the Google Antigravity SDK with Google's ADK to configure a local harness. Notice how we are strictly bounding the agent to a specific workspace (workspaces=["./sandbox"]) and giving it a place to save its memory (save_dir="./trajectories" ) so it can learn from previous experience:

import os
from google.adk.labs.antigravity import AntigravityAgent
from google.antigravity import LocalAgentConfig
from google.antigravity.hooks import policy

sandbox_dir = os.path.abspath("./sandbox")
os.makedirs(sandbox_dir, exist_ok=True)
save_dir = os.path.abspath("./trajectories")

sdk_config = LocalAgentConfig(
    system_instructions="You are a helpful local environment assistant.",
    workspaces=[sandbox_dir],
    policies=[policy.allow_all()],
    save_dir=save_dir,
)

root_agent = AntigravityAgent(
    name="antigravity_assistant",
    description="Runs an Antigravity SDK agent inside ADK.",
    config=sdk_config,
)

With this design in place, you can drop your legacy code into the sandbox, write a simple loop to run unit tests against it, and let the agent iteratively fix its own bugs.

So, how do we actually run tests against this sandboxed agent?

In modern harness engineering, tests are an active part of the agent's workflow graph. Using Google's ADK 2.0, which introduces graph-based workflows, you can define a test validation step as a simple routing node.

If the test passes, the job is done. If it fails, the harness automatically loops the error back to the agent to try again. Notice the built-in 'kill switch': we track the iteration count so if the agent gets stuck in an infinite loop of breaking and fixing code, the harness safely pulls the plug.

from google.adk.agents.context import Context
from google.adk import Event
from google.adk.events.event_actions import EventActions
from google.genai import types

def execution_test_node(ctx: Context):
    iteration_count = ctx.state.get("iteration_count", 0) + 1
    ctx.state["iteration_count"] = iteration_count

    test_passed = ctx.state.get("test_passed", False)
    feedback = ctx.state.get("feedback", "")

    if test_passed:
        return Event(actions=EventActions(route="END"))

    if iteration_count > 5:
        return Event(actions=EventActions(route="END"))

    feedback_msg = f"The unit tests failed with the following traceback:\n\n{feedback}"

    return Event(
        content=types.Content(role="user", parts=[types.Part(text=feedback_msg)]),
        actions=EventActions(route="loop_back")
    )

If you want to see this test routing pattern in action, you can check out an example with a full implementation in Balaji's ADK harness repository.

To connect the agent and the test node, you can use a Workflow graph to map out exactly how the execution should flow without needing complex, nested Python while loops.

Think of this as drawing the actual lanes on the racetrack:

from google.adk import Workflow

repair_loop = Workflow(
    name="repair_loop",
    edges=[
        ("START", root_agent, execution_test_node),

        (execution_test_node, {"loop_back": root_agent})
    ]
)

Congratulations! you've built an autonomous system. The agent writes the code and hands it off to the test node. If the test fails and returns a loop_back route, the agent tries again with the error log in hand.

See more examples of loop patterns in ADK samples.

You might wonder why you need a Python script to run an agent. In a normal chat window, you are the harness: you copy the error logs and babysit the model. A software harness lets the system babysit itself, allowing you to fully automate test-driven coding or safely refactor massive legacy codebases.

To run this self-healing loop on your own machine today, the setup takes less than five minutes:

From there, you can swap out our simple test node for a subprocess that actually executes pytest or npm test against your sandbox, and you will have a fully functioning repair loop.

If you are ready to scale this up, you can download the full IDE and CLI at antigravity.google, explore the Antigravity managed agent for remote execution and google's ADK 2.0 for using graph based workflows.

My colleagues at Google have put together some incredible guides on where to go next. To learn how to build secure environments for your agents, check out Sara's codelab showcasing Cloud Run sandboxes. If you want to master self-correction, Balaji Subramaniam recently published a deep dive on Loop Engineering for Coding Agents. And to see all of this applied to a massive enterprise use case, read James O'Reilly's breakdown of Automating legacy modernization at scale using agentic pipelines and Antigravity.

── more in #ai-agents 4 stories · sorted by recency
── more on @openai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/what-is-harness-engi…] indexed:0 read:5min 2026-09-02 ·