For years, we treated code as the finish line. You asked an LLM to write a Python script. It gave you one. You ran it. End of story.

A new survey from UIUC, Meta, and Stanford flips that script. Code is no longer just what agents produce. It is the medium they think through, act with, and coordinate around. The paper, titled Code as Agent Harness, frames code as the operational substrate for the entire agent loop. Reasoning, action, environment modeling, verification, and multi-agent coordination all run through executable artifacts.

This is not a small shift. It redefines what an agent actually is.

The Old View vs. the New View

The old view was simple. An LLM generates code. A human reviews it. A compiler runs it. The code is the output.

The new view says code is the infrastructure. Agents write programs to externalize their own reasoning. They execute those programs to test hypotheses. They read stack traces and test failures as feedback. They store state in variables and data structures across turns. They share code artifacts with other agents to coordinate work.

Code becomes the harness that turns a stateless language model into a stateful, goal-directed system.

The authors define three elements of any long-running agent:

  • Model-internal capabilities — what the model can reason about on its own.
  • System-provided harness infrastructure — the tools, APIs, sandboxes, memory, and validators the system gives the agent.
  • Agent-initiated code artifacts — the programs, tests, traces, and temporary tools the agent creates and evolves during execution.

Most research focuses on the first two. This survey focuses on the third. And that is where the action is.

Three Layers of the Harness

The paper organizes the field into three connected layers. Each layer shows how code becomes more deeply embedded in agent behavior.

Layer One: The Interface

At the base layer, code is how the agent talks to the world.

Code for reasoning. Instead of asking a model to solve a math problem in natural language, you ask it to write a Python function. The interpreter runs it. The answer is exact. This is Program-Aided Reasoning, and it is now standard in competitive math benchmarks. Tools like PAL, Chain of Code, and MathCoder all use this pattern. The model offloads precise computation to an interpreter and keeps the high-level reasoning for itself.

Code for acting. Generated programs become policies. A robot does not get a paragraph of instructions. It gets executable code that calls motion primitives. GUI agents do not get a description of what to click. They get scripts that query the DOM and fire events. Embodied agents use code as behavior trees. The program is the action.

Code for environment modeling. Program states, repositories, execution traces, and test suites become the agent's model of the world. SWE-bench turns GitHub issues into evaluation environments. AgentBench turns Linux terminals into task spaces. The agent does not observe the world through raw pixels or text. It observes through structured, executable representations.

Layer Two: The Mechanisms

Once code is inside the loop, the harness needs mechanisms to keep the agent reliable over time.

Planning. Long-horizon tasks need decomposition. Code agents break problems into subroutines, search over possible implementations, and orchestrate multi-step workflows. Structure-grounded planning uses the codebase itself as a map. Search-based planning explores the space of possible patches. Orchestration-based planning chains tools and APIs in explicit workflows.

Memory. Agents need to remember what they tried. Working memory holds the current program state. Semantic memory retrieves relevant code snippets from a repository. Experiential memory stores successful patterns across tasks. Long-term memory persists learned skills. The survey even covers context compaction and state offloading, which we have written about before under context engineering.

Tool use. Code agents do not just call tools. They write new ones. A model might generate a temporary Python function to scrape a website, then throw it away. Or it might compose multiple API calls into a reusable script. Verification-driven tool use means the agent writes tests to check whether a tool call did what it expected.

Feedback-driven control. This is the closed loop. The agent writes code, executes it, observes errors or test failures, and revises. Static analysis catches bugs before runtime. Unit tests catch them after. Human feedback steers direction. The harness turns failures into corrections.

Layer Three: Scaling to Multi-Agent

Single agents are hard enough. Multi-agent systems add coordination, shared state, and consensus.

The survey reviews systems where agents take specialized roles: manager, planner, coder, reviewer, tester. They collaborate over shared repositories, tests, and traces. They debate design choices. They red-team each other's code. They maintain a common harness representation so every agent sees the same world state.

The key insight: code artifacts become the shared language. When one agent writes a test and another reads the failure trace, they are communicating through executable structure. Not natural language. Not JSON. Code.

Where This Shows Up in Practice

The authors trace this pattern across five major application areas.

Coding assistants. This is the obvious one. SWE-agent, OpenHands, and Claude Code all operate over live repositories. They author patches, run tests, and iterate on failure feedback. The code is both the product and the working memory.

GUI and OS automation. Agents like Voyager and UI-Voyager synthesize interface commands as executable scripts. They learn from failed attempts and build reusable skill libraries. The GUI becomes a programmable world.

Embodied agents. Robots use generated code as motion policies. SkillVLA reuses learned skills through code composition. Lifelong robot learning systems accumulate code-based behaviors over time. The robot's memory is a library of executable functions.

Scientific discovery. ChemCrow and The AI Scientist compose hypothesis-testing pipelines from code. They run simulations, analyze data, and iterate on results. The scientific method becomes a program that writes and runs other programs.

Enterprise workflows. DevOps pipelines, data engineering tasks, and business process automation all benefit from agents that generate, execute, and verify code against live systems. Salesforce Agent Script is a recent example: a single-file declarative language that pins load-bearing logic as deterministic code and lets the agent reason through the rest.

Why This Matters for Builders

If you are building agentic systems, this survey has a practical message: invest in the harness, not just the model.

The bottleneck of autonomy is not raw reasoning power. It is the reliability of the system that connects model outputs to long-horizon actions and persistent states. A better harness beats a bigger model more often than people admit.

Specifically:

  • Give your agent an interpreter. Let it offload precise computation to code. Do not make it do math in its head.
  • Expose execution feedback. Stack traces, test failures, and runtime errors are signals. Use them.
  • Let agents write temporary tools. A one-off script that scrapes a page and extracts a table is a perfectly valid tool call.
  • Store state in code. Variables, data structures, and program state persist across turns in ways that natural language summaries do not.
  • Design for multi-agent shared artifacts. If multiple agents will touch the same task, give them a common code-based workspace.

The Open Problems

The survey ends with a candid list of what is still broken.

Evaluation beyond final success. We grade agents on whether they finished the task. We do not grade them on how efficiently they used the harness, how many false paths they explored, or whether their intermediate code was sound. We need harness-level metrics.

Verification under incomplete feedback. Tests do not catch everything. Static analysis has limits. Agents need to reason about correctness when the feedback is partial or ambiguous.

Regression-free harness improvement. When an agent modifies its own harness, it can break things that used to work. Self-improving systems need safeguards against regressions.

Consistent shared state across agents. Multiple agents working on the same codebase need transactional semantics. Two agents editing the same file without coordination create merge conflicts in the harness itself.

Human oversight for safety-critical actions. Code can delete data, transfer funds, or deploy to production. The harness needs explicit permission boundaries and human checkpoints.

Multimodal harnesses. Most of this work is text and code. Extending the harness to images, video, audio, and physical sensors is still early.

The Bottom Line

The Code as Agent Harness survey, led by Xuying Ning at UIUC with collaborators from Meta and Stanford, gives the field a unified vocabulary for something practitioners already felt: code is becoming the central nervous system of agentic AI.

You can find the paper at arXiv:2605.18747 and the curated paper list at github.com/YennNing/Awesome-Code-as-Agent-Harness-Papers.

The shift is from code-as-output to code-as-infrastructure. If your agent strategy still treats code as the finish line, you are leaving most of the value on the table.


Suggested title: Code Is Not the Product Anymore. It Is the Harness.

Word count: ~1,420

Citations

  • Ning et al., Code as Agent Harness: Toward Executable, Verifiable, and Stateful Agent Systems, arXiv:2605.18747, 2026. https://arxiv.org/abs/2605.18747
  • Awesome-Code-as-Agent-Harness-Papers GitHub repository. https://github.com/YennNing/Awesome-Code-as-Agent-Harness-Papers
  • Gao et al., PAL: Program-Aided Language Models, ICML 2023.
  • Jimenez et al., SWE-bench: Can Language Models Resolve Real-world GitHub Issues?, ICLR 2024.
  • Wang et al., Voyager: An Open-Ended Embodied Agent with Large Language Models, TMLR 2023.
  • Bran et al., ChemCrow: Augmenting Large Language Models with Chemistry Tools, 2023.
  • Lu et al., The AI Scientist: Towards Fully Automated Open-Ended Scientific Discovery, 2024.

Fact-check notes

  • Verify the exact author affiliations and ordering if quoting directly.
  • The Salesforce Agent Script reference was drawn from prior coverage; confirm it appears in the survey's application examples if citing as survey content.
  • The three-layer taxonomy and five application domains are direct summaries of the survey structure.