Hanson Lab
Harness² graph engineering guide

A Hanson Lab resource

Graph engineering and self-improving harnesses

Summary by Spencer. Based on the Harness² research from Google Cloud AI Research and Northwestern University; see the original sources.

This guide teaches the basics of graph engineering. Then it explains Harness², a Google Research framework. Harness² lets an agent improve its own setup on each task. The model weights do not change.

01

The big picture

A language model alone only reads text and writes text. To do real work, it needs a system around it. This system gives it tools, memory and rules. People call this system the harness.

Model+Harness=Agent

The Harness² website uses this same equation: "Agent = Model + Harness." Many posts about this topic show a ladder of four steps:

Prompts to agents to loops to graphs Promptsone question, one answer Agentsmodel + tools + memory Loopsact, check, repeat Graphsmany nodes, set paths
The ladder from simple prompts to engineered graphs.

This guide covers two ideas:

  1. Graph engineering. You connect agents and normal code into a graph. You know the path before the work starts. This makes the system easier to predict and control.
  2. Harness optimization. The agent changes its own harness to do better. Harness² is one tested method for this. It also keeps lessons for the next task.
One sentence summary. A graph decides who does what, in which order. A self-improving harness makes each worker better over time.
02

Key words

Each word below has one meaning in this guide.

Model
The language model, for example Gemini 3.5 Flash or GLM-5. In Harness², the model weights stay fixed.
Harness
Everything around the model that lets it act as an agent. This includes prompts, tools, memory, skills and orchestration.
Harnessing
The process that makes a harness better. The Harness² paper uses this word.
Loop
The cycle an agent runs inside its harness. It thinks, picks a tool, uses it, and repeats until it meets the goal.
Graph
A set of connected steps. Each step is a node. Each connection is an edge.
Node
One step in a graph. An agent node uses a model. A function node runs normal code.
Edge
A connection that sends output from one node to the next node.
State
Shared data that nodes read and write as the work moves through the graph.
Fan-out
One step starts many steps at the same time.
Join
A step that waits for all parallel steps to finish. Then it collects their outputs.
Router
A step that picks the next path from a condition.
Execution harness
The harness the agent uses to do the current task.
Improvement harness
A second harness that guides how Harness² changes the execution harness. It holds a library of past harnesses and lessons.
Probe
A test run of a candidate harness on the same task.
k
The recursion budget. It sets how many candidates or steps Harness² uses.
03

Graph engineering basics

Google Cloud Tech explains graph engineering in the video Graph Engineering 101. In the video, a graph can look like an organization chart. Each node can be an agent node or a function node. A function node runs fixed logic.

Graph engineering is not about knowledge graphs. The video makes this point clearly. Here, "graph" means a workflow.

Three patterns to learn first

1. Fan-out

Start many tasks in parallel. This is faster than one task after another.

2. Join

Wait for all tasks to finish. Then collect all outputs into one record.

3. Router

Pick the next step from a condition. Use plain code when you can.

Example: an automated pull request review

The video uses a pull request (PR) review as its example. Five fetch steps run in parallel. A join collects their results. A router then sends the work to a fixer agent or to a human.

PR review graph PR opens fetch step 1fetch step 2fetch step 3fetch step 4fetch step 5 Join Router Fixer agentif checks fail Human approvalif checks pass fan-out
Fan-out, join and router, as shown in Graph Engineering 101 (redrawn).

What the code looks like

Google's Agent Development Kit (ADK) 2 builds graphs from a list of edges. This example comes from the ADK graph routes page. Three tasks fan out from START. A JoinNode waits for all three.

from google.adk.workflow import JoinNode

my_join_node = JoinNode(name="my_join_node")

edges=[
    ("START", parallel_task_A, my_join_node),
    ("START", parallel_task_B, my_join_node),
    ("START", parallel_task_C, my_join_node),
    (my_join_node, final_task_D),
]

A router in ADK is a function that returns a route name. The ADK 2 codelab uses a plain if statement. It makes zero model calls:

def route_by_weather(node_input):
    temp = node_input["fetch_weather"]["temp_f"]
    route = "HOT" if temp >= 70 else "COLD" if temp <= 40 else "NORMAL"
    return Event(output=node_input, route=route)
Caution. The ADK docs say a graph cycle "is not bounded automatically." If your graph has a loop, make sure the exit condition becomes true.

When to use a graph

  • Use a graph when you can draw the flow before the input arrives.The ADK 2 codelab gives this test for graph workflows.
  • Use code for decisions you can write as rules.A plain router is fast, costs nothing and gives the same result each time.
  • Use an agent node only where you need judgment.For example, write a summary or fix a failed test.
04

What Harness² is

Harness² (say "harness squared") is an open-source framework from Google Cloud AI Research and Northwestern University. Its full name is "Recursive Agent Harnessing for an Open World." The paper appeared on arXiv on Oct 9, 2026. The code uses the Apache 2.0 license.

The problem. Today a person designs a harness one time. Then the agent uses that same fixed harness on every new task. In the "open world," new tasks are different from the tasks the designer saw. Also, new tasks often have no correct answer to check against.

The solution. Harness² uses two levels of recursion. The model weights stay fixed.

Task-level and harnessing-level recursion LEVEL 1 · TASK-LEVEL RECURSION (this task) Proposeedit the harness Proberun each candidate Composekeep what helped Final harnessruns and delivers the work LEVEL 2 · HARNESSING-LEVEL RECURSION (across tasks) Reflect → save the adopted harness and the lessons the evidence supports → guide the next task
Level 1 improves the harness for this task. Level 2 improves how the next harness gets improved.
  1. Task-level recursion. For the current task, the agent proposes edits to its harness. It runs the candidates on the same task. Then it composes a better harness from the differences between the runs. It needs no correct answer.
  2. Harnessing-level recursion. After each task, a reflector saves the adopted harness. It also saves lessons that the evidence supports. The next task starts its improvement from these notes.
Important detail. Each new task starts the executor at the base harness again. The paper says the improver "selectively retains reusable components and lessons." It does not copy the last task's harness forward without thought.
Harness² pipeline figure from the repository. An agent executor runs the initial harness, a harness editor proposes invariant and domain edits, candidate probes run them, and a harness composer combines them into the final harness. An experience reflector updates the improvement harness for the next task.
The Harness² pipeline. Figure from google-research/harness2, Apache 2.0.
05

Propose, Probe, Compose

This step is the core of Harness². It lets the agent improve without a grader. The Harness² website shows these eight stages for one task.

  1. Arrive. A new task arrives. The executor starts from the base harness.
  2. Reference. The executor runs the task one time with the base harness. This run is the reference.
  3. Propose. A harness editor proposes two candidates. One has general ("invariant") edits. One has domain-specific edits.
  4. Probe. The executor runs each candidate on the same task.
  5. Compose. A harness composer compares all runs. It keeps the edits that the execution evidence supports.
  6. Final harness. The executor runs the composed harness and delivers the work.
  7. Reflect. An experience reflector reviews the full process.
  8. Update. The reflector adds harness files and lessons to the improvement library. The site names the lesson file EXPERIENCE.md.

With k = 1, one task uses one reference run, two probe runs and one final run.

Why it works without a correct answer

The method is contrastive. The runs use the same task and the same model. Only the harness changes. So a difference in behavior shows the effect of an edit. The paper calls these "behavioral contrasts."

Akshay Pachaar summarizes it this way: "because it learns from the differences between runs, it needs no correct answer or grader for the task."

But it is not proof. The paper's limits section says these signals "do not guarantee correctness." They are "sensitive to execution variability and shared model biases."

A real example from the paper

In one JobBench case, the base agent did not reconcile its source files. It also never opened its outputs again to check them. The improved harness added verification guardrails, a reconciliation skill and more exact tool guidance. (Source: Harness² website, "A closer look.")

06

Parallel and sequential recursion

You can give Harness² a larger budget, k. It can use that budget in two ways. The README says: "Parallel recursion explores wider; sequential recursion refines deeper."

Parallel ⇉ wider

Probe k general and k domain-specific candidates. Then produce k compositions from the shared evidence.

Good when you have compute to run many candidates at the same time.

Sequential → deeper

Run k Propose–Probe–Compose steps, one after another. Each step carries the refined harness and all evidence forward.

Good when each improvement depends on the last one.

Two ways to scale task-level recursion. Parallel probes k general and k domain-specific candidates, then makes k compositions. Sequential carries the refined harness through k steps.
Parallel and sequential recursion. Figure from the Harness² repository, Apache 2.0.

On the WorkBuddy-Bench code subset, the Harness² website reports a gain of 4.3 points from k = 1 to k = 5 with parallel recursion.

07

The eight harness parts

Harness² can edit more than the prompt. It exposes eight components. They control what enters the context, how the agent uses tools, how it hands off work, and what happens inside the tool loop.

C1System promptContext. The persona and top-level procedure for all tasks.
C2GuardrailsContext. Rules the agent must obey.
C3MemoryContext. Facts the agent keeps.
C4Tool guidanceTool interface. How and when to use each tool.
C5SubagentsOrchestration. Helpers that do delegated work.
C6SkillsContext. Saved procedures for kinds of tasks.
C7ScriptsTool interface. Code the agent can run.
C8PluginsMiddleware. Control inside the tool loop.

The group names (context, tool interface, orchestration, middleware) come from the Harness² README and website. The short notes for C2 to C8 are our plain-language summary.

Eight harness components grouped by runtime role.
Harness components by role. Figure from the Harness² repository, Apache 2.0.
08

What the results show

Google tested Harness² on three professional benchmarks: WorkBuddy-Bench (office, web and code), JobBench (professional work) and LAB (legal work). It used two models, Gemini 3.5 Flash and GLM-5, with OpenCode and Codex executors. That gives four model–harness configurations.

+11.5points, WorkBuddy-Bench
+4.5points, JobBench
+11.8percentage points, LAB partial pass rate

These are the largest gains from one Harness² step, as the paper abstract reports. A larger budget gave more gains.

WorkBuddy-Bench, Gemini 3.5 Flash with OpenCode

Reported means across three runs, from the Harness² website. Higher is better.

MethodCodeWebOfficeAverage
Base harness73.469.974.072.4
ReasoningBank72.670.776.873.4
Meta-Harness75.575.178.676.4
Harness Scaling74.074.077.975.3
Harness² · k=176.576.479.577.5
Harness² · k=580.878.383.480.8
WorkBuddy average score: base 72.4, Harness² k=1 77.5, k=5 80.8 Base harness72.4 Harness² k=177.5 Harness² k=580.8 Bar length is proportional to the score from 0. Same model. Only the harness changes.
WorkBuddy-Bench average. Data from harness2.github.io.

The paper also reports two transfer results. A library built with a larger budget gave stronger later edits, even with no extra probes. A library from JobBench improved results on WorkBuddy-Bench.

09

Try it

You need Linux, Python 3.12 and uv. Do these steps from the repository root.

Step 1. Run the free local demo

The demo runs both recursion modes with real Python runs. It needs no model credentials, so it costs nothing.

git clone https://github.com/google-research/harness2
cd harness2
uv venv --python 3.12 .venv
source .venv/bin/activate
uv pip install -e '.[render]'
harness2-demo --output runs/demo --k 2

Step 2. Set up models (costs money)

For real benchmarks, install Node.js 20+ and the Google Cloud CLI. LAB needs Pandoc and Poppler. WorkBuddy-Bench needs Docker.

cp .env.example .env
# Edit .env with your Vertex AI project and model IDs.
gcloud auth application-default login

Step 3. Run one small task

Start small. The full LAB task stream has 1,143 tasks. Add --dry-run to see the task list with no model calls.

harness2-setup lab
harness2-check --bench lab
harness2 --bench lab --k 1 --mode parallel \
  --only-domains antitrust-competition --max-tasks 1
harness2-judge --bench lab --k 1 --mode parallel
harness2-report --bench lab --k 1 --mode parallel
Warning. The README says executor network access is unrestricted, and Codex runs with its sandbox off. Public benchmark rubrics can be online. Set network limits before you evaluate.

Useful options

OptionWhat it does
--k 1One Propose–Probe–Compose step, then reflection
--k K --mode parallelK candidates per scope and K compositions
--k K --mode sequentialK steps, one after another
--substrate cxUse Codex in place of OpenCode
--workers NRun N domains at the same time
--seed NShuffle the task stream the same way each time

Use the same benchmark, executor, subset, k, mode and seed for refinement, judging and reporting. To resume, run the same command again.

10

Use the ideas in your own agents

You do not need to run Harness² to use its ideas. These recipes are our own advice, based on the sources. They are not steps from the paper.

Recipe 1. Draw your workflow as a graph

  1. Write each step of the work on its own line.
  2. Mark each step as "rule" or "judgment."
  3. Make rule steps into code. Make judgment steps into agents.
  4. Find steps that can run at the same time. Fan them out and join them.
  5. Add a router for each decision. Add a limit to each loop.

Recipe 2. Compare two harnesses on one task

  1. Pick one real task.
  2. Run it with your current prompt and tools. Save the full log.
  3. Make one change, for example a new guardrail. Run the same task again.
  4. Compare the two logs line by line. Keep the change only if the behavior got better.

This is a small, manual version of Propose, Probe, Compose.

Recipe 3. Keep a lessons file

  1. After each task, write down what changed and why.
  2. Keep only lessons that the logs support.
  3. Give the file to the agent at the start of the next task.
  4. Remove old lessons that no longer apply.

This copies harnessing-level recursion. The paper's future-work section names library cleanup as an open problem.

Recipe 4. Ask an agent to propose harness edits

Read the log of the last run and my current system prompt, tools and skills.
Propose two harness edits: one general, one specific to this kind of task.
For each edit, say which part it changes (prompt, guardrail, memory, tool guidance, subagent, skill, script or plugin).
Do not change anything yet. Tell me how we will compare the runs.
11

Limits and cautions

  • It costs more.Each step needs extra runs and editor sessions. A larger budget adds more cost. Parallel runs cut wait time, but not compute.
  • Evidence is not proof.Without a correct answer, the method uses behavior contrasts and model judgment. These can be wrong.
  • Edits may not transfer.The paper says an adopted change may not work on a different task.
  • The library grows.Today it is a simple indexed library. The authors list cleanup and smarter retrieval as future work.
  • The budget is fixed in advance.The authors suggest adaptive budgets as future work.
  • It is research code.The README says it "is not an officially supported Google product."
12

Videos

We checked each video below on its official source. We embed only those two.

Harness² video overview

Google Research, from the Harness² repository. 0:47. Apache 2.0.

A short animated tour of the two-level loop. Watch this first.

Graph Engineering 101

Google Cloud Tech on YouTube. Sep 3, 2026. 5:56.

Explains harness, loop and graph. Then it walks through the PR review graph with fan-out, join and router.

About the "1-hour Google breakdown" post

A viral X post shares a long video and calls it a Google breakdown of graph engineering. We could not confirm that Google published that video. The clip on X is about 1 hour 25 minutes long, not 1 hour. So we do not embed it. For an official start, use the ADK 2 codelab and the video above.

13

Cheat sheet

AgentModel + Harness
LadderPrompts → Agents → Loops → Graphs
Graphnodes + edges + shared state
Patternsfan-out · join · router
Level 1Propose → Probe → Compose (this task)
Level 2Reflect → update library (next tasks)
Parallelwider: k candidates per scope
Sequentialdeeper: k steps in a row
8 partsprompt, guardrails, memory, tool guidance, subagents, skills, scripts, plugins
Demoharness2-demo --output runs/demo --k 2
Previewharness2 --bench lab --dry-run
Codex--substrate cx
14

Sources

Built for Hanson Lab, Oct 18, 2026. Harness² is new and can change. If this guide and the repository do not agree, use the repository.