What is harness engineering and why should I care? —…
    Neura Market
    Neura Market
    /Midjourney
    Marketplace
    Directories
    Resources
    Midjourney
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityDeepSeekDeepSeekCoPilotCoPilotStable DiffusionStable DiffusionMidjourneyMidjourney
    OverviewPromptsBlogVideosGuidesCoursesCommunityStylesTrending
    MidjourneyBlogWhat is harness engineering and why should I care?
    Back to Blog
    What is harness engineering and why should I care?
    ai

    What is harness engineering and why should I care?

    Shir Meir Lador August 26, 2026
    0 views

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

    {% embed https://youtube.com/shorts/04MDDx19yoM?feature=share %}

    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.

    What exactly is a 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:

    1. Set strict boundaries: Don't let the agent guess what it can touch. Enforce strict access rules (like confining it to a specific sandbox) so it can't accidentally wipe out production data.
    2. Build "Repair Loops": Agents will inevitably make mistakes. A great harness automatically traps errors, like a failed build or a test failure, and feeds those clean logs right back to the agent so it can fix its own code.
    3. Give them a map, not a manual: As the OpenAI team discovered, don't overwhelm the agent with massive instruction files. Structure your repository logically so the agent can discover context progressively as it works.

    Show me the code

    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
    
    # Ensure absolute paths for workspace containment
    sandbox_dir = os.path.abspath("./sandbox")
    os.makedirs(sandbox_dir, exist_ok=True)
    save_dir = os.path.abspath("./trajectories")
    
    # 1. Engineer the harness environment
    sdk_config = LocalAgentConfig(
        system_instructions="You are a helpful local environment assistant.",
        workspaces=[sandbox_dir],
        # Let the agent write safely within the restricted sandbox boundary
        policies=[policy.allow_all()],
        save_dir=save_dir,
    )
    
    # 2. Wrap the config to run the agent inside the harness
    root_agent = AntigravityAgent(
        name="antigravity_assistant",
        description="Runs an Antigravity SDK agent inside ADK.",
        config=sdk_config,
    )
    

    The policy keeps the agent access only in the Sandbox folder

    <center><small><em>The policy keeps the agent access only in the Sandbox folder</em></small></center> &nbsp;

    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.

    Adding Tests

    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
    
    # 3. Evaluate the code in the sandbox
    def execution_test_node(ctx: Context):
        # Safely track our attempts to prevent infinite loops
        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:
            # Success! End the workflow.
            return Event(actions=EventActions(route="END"))
    
        if iteration_count > 5:
            # The Kill Switch: The agent is stuck. Stop the loop.
            return Event(actions=EventActions(route="END"))
    
        # Failure! Feed the error trace back to the agent and loop it.
        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.

    Wiring it all together using graph-based workflow

    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
    
    # 4. Wire the agent and the test node together into a loop
    repair_loop = Workflow(
        name="repair_loop",
        edges=[
            # 1st Step: Define the main sequence (START -> agent -> test node)
            ("START", root_agent, execution_test_node),
    
            # 2nd Step: If the test returns "loop_back", go back to the agent
            (execution_test_node, {"loop_back": root_agent})
        ]
    )
    

    The test loop

    <center><small><em>The test loop</em></small></center> &nbsp;

    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.

    Try it yourself

    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:

    1. Install the framework: Run pip install "google-adk[antigravity]" in your terminal to get the open-source Agent Development Kit and the Antigravity integration.
    2. Set your API key: Grab a free Gemini API key from Google AI Studio and export it to your environment (export GEMINI_API_KEY="your-key").
    3. Run the loop: Save the code blocks above as a Python script, drop a broken Python or Node file into your new ./sandbox directory, and run your script.
    4. Expand your graph: Unit tests are just the baseline. To make your harness bulletproof, add a second AI agent to your workflow, like a SecurityAuditor, to review the code before it passes, or wire in custom linters to enforce strict architectural rules.

    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.

    Further reading

    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.

    Tags

    aiagentsprogrammingsoftwareengineering

    Comments

    More Blog

    View all
    Gemini Agentic Video Isn't Always Cheaper: A 24-Run Benchmarkgemini

    Gemini Agentic Video Isn't Always Cheaper: A 24-Run Benchmark

    A controlled Gemini 3.7 Flash benchmark shows why agentic video is excellent for long-form search—but...

    J
    JimmyLiao
    1
    AI Engineering Is Easy. Changing How We Work Is Hardai

    AI Engineering Is Easy. Changing How We Work Is Hard

    AI engineering sounds fancy. New terms are everywhere: agentic development, AI-native engineering,...

    U
    ujja
    1
    Kong AI Gateway 2.0 on Google Cloud: Securing GKE, Cloud Run, and Vertex AI(Agent Platform)ai

    Kong AI Gateway 2.0 on Google Cloud: Securing GKE, Cloud Run, and Vertex AI(Agent Platform)

    Most teams running on Google Cloud don't pick one compute model and stay there. Some services live...

    S
    Saurabh Mishra
    1
    Join our DEV Weekend Challenge: Generosity Edition! $1,000 in Prizes Across FIVE Winners. Submissions Due September 7 at 6:59 AM UTC.devchallenge

    Join our DEV Weekend Challenge: Generosity Edition! $1,000 in Prizes Across FIVE Winners. Submissions Due September 7 at 6:59 AM UTC.

    We're back with another DEV Weekend Challenge, a short bite-sized challenge planned to fit into your...

    J
    Jem
    Taming Flutter Infinite Scroll (Part 2): Turning ScrollController into a Reactive State Machine with CubitSignalMixinflutter

    Taming Flutter Infinite Scroll (Part 2): Turning ScrollController into a Reactive State Machine with CubitSignalMixin

    Discover how to eliminate Flutter StatefulWidget boilerplate and overcome Dart's single-inheritance wall by combining ScrollController with CubitSignalMixin and BlocSignalMixin for a 100% StatelessWidget UI.

    R
    Randal L. Schwartz
    1
    I Built My First AWS Agent Workflow, and the Hardest Part Was Getting It to Stop Assuming Thingsdiscuss

    I Built My First AWS Agent Workflow, and the Hardest Part Was Getting It to Stop Assuming Things

    TL;DR I recently finished a project from Udacity's Future AWS Agent Engineer Nanodegree Program,...

    H
    Hemapriya Kanagala
    1

    Stay up to date

    Get the latest Midjourney prompts, rules, and resources delivered to your inbox weekly.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for Midjourney and more.

    Content Types

    • Prompts
    • Blog
    • Videos
    • Guides
    • Courses
    • Community
    • Styles

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.

    Neura Market

    Custom AI Systems & Services

    Our team of experienced AI builders will help build custom AI systems, workflows, and solutions.

    Request custom work

    Ready-made automations for this

    Workflows from the Neura Market marketplace related to this Midjourney resource

    • Process Invoices & Engineering Emails with Gmail, AI Analysis & Telegram Alertsn8n · $14.99 · Related topic
    • Automate AI-Driven Engineering Department with OpenAI Agentsn8n · $14.99 · Related topic
    • Automate Software Documentation Queries with Context7 and Google Geminin8n · $14.99 · Related topic
    • Automate Graphic Wallpaper Creation with Midjourney and Canvas APIsn8n · $9.99 · Related topic
    Browse all workflows