Skip to content

Welcome to Agent Harness

🤖 Agent Harness

Compositional execution-state management for long-horizon agentic code generation

Build intelligent agents that learn, adapt, and recover from failures with full visibility into execution state and dependency tracking.

Get Started View on GitHub


Why Agent Harness?

Long-horizon agentic code generation requires more than just LLM calls. It demands:

  • State visibility across multi-step execution pipelines
  • Smart recovery from failures without re-executing unchanged dependencies
  • Compositional design that scales from simple scripts to complex workflows
  • Feedback loops that enable agents to learn and improve their outputs

Agent Harness provides the infrastructure to make all of this seamless.


Key Capabilities

Automatically track dependencies between code artifacts, execution states, and intermediate results. Know exactly what needs to re-run when something changes, and what can be safely cached.

Generate targeted patches from execution feedback without rewriting entire functions. Agent Harness intelligently identifies the minimal code changes needed to fix failures and improve outputs.

Only re-execute the code that matters. With full dependency graphs, skip unchanged branches and focus computational resources on what actually needs to run.

Build complex agents from simple, reusable components. Each piece of your system can be independently tested, versioned, and evolved.


Quick Start

Installation

pip install agent-harness
uv pip install agent-harness

Basic Usage

from agent_harness.state import ExecutionState
from agent_harness.manager import StateManager
from agent_harness.executor import CodeExecutor

# Initialize your execution harness
state = ExecutionState()
manager = StateManager(state)
executor = CodeExecutor()

# Execute code with full state tracking
result = executor.run(
    code="x = 42\ny = x * 2",
    state=state
)

# Inspect dependencies and execution history
print(manager.get_dependency_graph())
print(manager.get_execution_history())

What's Included

Component Purpose
ExecutionState Core data structure for tracking execution artifacts and dependencies
StateManager High-level API for state manipulation and querying
CodeExecutor Safe code execution with instrumentation and feedback capture
DependencyTracker Automatic detection of code and data dependencies
PatchGenerator Intelligent patch creation from execution feedback
RecoveryEngine Smart re-execution and state recovery strategies

Getting Started

Ready to build your first agent harness?

📚 Read the Getting Started Guide →

Or explore the documentation:

  • Core Concepts — Understand execution states, dependencies, and recovery
  • API Reference — Complete reference for all public APIs
  • Examples — Real-world usage patterns and recipes
  • Architecture — Deep dive into design decisions

Design Philosophy

Agent Harness is built on three core principles:

  1. Compositional — Systems are built from simple, composable pieces with clear interfaces
  2. Observable — Full visibility into execution state, dependencies, and decision-making
  3. Recoverable — Failures are learning opportunities; systems gracefully recover with minimal re-work

Project Status

Agent Harness is in active development. We're working toward:

  • ✅ Core execution-state management
  • ✅ Dependency tracking and visualization
  • 🔄 Feedback-driven patch generation
  • 🔄 Multi-agent coordination
  • 🔧 Enhanced recovery strategies
  • 📅 Production hardening and optimization

Contributing

We welcome contributions! Whether it's bug reports, feature suggestions, or code submissions, please check out our Contributing Guide.


License

Agent Harness is released under the MIT License. See LICENSE for details.