Agent harness — give any LLM a computer. Ship any agent product.
--- **UniHarness** is an open-source **agent harness**: the production runtime that gives any LLM a fully-equipped computer — terminal, filesystem, and shell — to complete tasks autonomously. Unlike every other agent framework, UniHarness **separates the agent runtime from the computer it operates on**. Your agent gets a sandboxed machine; your runtime keeps its API keys, config, and source code private. > **Why "harness" and not "framework"?** A framework gives you building blocks and says "assemble your own agent." A harness gives the agent a fully equipped runtime — tools, context management, safety, execution environments — so you focus on *what* the agent does, not *how* it executes. ([Read more](#agent-harness-vs-agent-framework)) ## The Computer Layer In Claude Code, Codex, and every LangChain agent, the agent runtime and the computer it controls are the same process. The agent can read its own source code, config files, and API keys. UniHarness's `Computer` protocol makes this separation explicit and pluggable — swap execution environments without changing a line of agent code. ```python from uniharness import create_agent from uniharness.computer import LocalNativeComputer, LocalVM, RemoteE2BComputer # Development — run on your machine agent = await create_agent(model="openai:gpt-5.5", computer=LocalNativeComputer()) # Security-sensitive — sandboxed VM (Lima on macOS, WSL on Windows) agent = await create_agent(model="openai:gpt-5.5", computer=LocalVM()) # Production / multi-tenant — isolated cloud sandbox agent = await create_agent(model="openai:gpt-5.5", computer=RemoteE2BComputer(api_key="...")) ``` ``` ┌───────────────────────────┐ ┌───────────────────────────┐ │ Agent Runtime │ │ Agent's Computer │ │ (your host) │ run() │ (sandboxed) │ │ │ ─────────> │ │ │ - LLM API keys │ start() │ - Terminal + filesystem │ │ - Agent source code │ upload() │ - User's project files │ │ - Harness config │ stop() │ - Installed tools │ │ - Middleware & hooks │ │ │ │ │ │ Cannot access runtime │ └───────────────────────────┘ └───────────────────────────┘ ``` Three built-in implementations cover every deployment scenario: | Computer | Environment | Use case | |---|---|---| | `LocalNativeComputer` | Host shell | Development, trusted agents | | `LocalVM` | Lima (macOS) / WSL (Windows) | Security-sensitive work, Cowork products | | `RemoteE2BComputer` | E2B cloud sandbox | Production, multi-tenant, CI/CD | Implement the `Computer` protocol to add your own — Docker, Kubernetes pods, or any remote execution target. ## Quick Start ```bash pip install uniharness ``` ### Minimal example ```python import asyncio from uniharness import create_agent from uniharness.computer import LocalNativeComputer async def main(): async with await create_agent( model="openai:gpt-5.5", # or any LLM computer=LocalNativeComputer(), ) as agent: result = await agent.ainvoke({ "messages": [{"role": "user", "content": "Find all TODO comments in this project"}] }) print(result["messages"][-1].content) asyncio.run(main()) ``` ### Use any model ```python from uniharness import create_agent, ModelProfile from uniharness.computer import LocalNativeComputer # DeepSeek, Qwen, Llama, Mistral — anything OpenAI-compatible model = ModelProfile( model="deepseek:deepseek-v4-flash", base_url="https://api.deepseek.com/v1", api_key="your-key", context_window=64000, ) agent = await create_agent(model=model, computer=LocalNativeComputer()) ``` ### Add subagents, MCP servers, web tools ```python from uniharness import create_agent, AgentDefinition from uniharness.computer import LocalNativeComputer agent = await create_agent( model="openai:gpt-5.5", computer=LocalNativeComputer(), # Subagents for parallel specialized work agents={ "researcher": AgentDefinition( description="Deep-dives into codebases", tools=["Read", "Glob", "Grep", "WebSearch"], model="fast", ), }, # MCP tool servers mcp_servers={ "github": {"type": "http", "url": "https://mcp.github.com/mcp"}, }, # Web capabilities search_provider=("tavily", "your-key"), fetch_provider=("jina", "your-key"), ) ``` ### Run in a cloud sandbox ```python from uniharness import create_agent from uniharness.computer import RemoteE2BComputer # Fully isolated cloud execution — no local risk agent = await create_agent( model="openai:gpt-5.5", computer=RemoteE2BComputer(api_key="your-e2b-key"), ) ``` See [`libs/uniharness/README.md`](libs/uniharness/README.md) for the full API reference. ## What Can You Build? One harness powers four product types — no other agent SDK does this: | Product Type | Description | Example | |---|---|---| | **CLI Coding Agent** | Terminal-native agent that lives in your shell, reads your codebase, writes and runs code autonomously | [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview), [Gemini CLI](https://github.com/google-gemini/gemini-cli) | | **Chatbot** | Conversational AI assistant — you ask, it answers, with web search, file uploads, and tool use in the loop | [ChatGPT](https://chatgpt.com/), [Claude Chat](https://claude.ai/) | | **Cowork** | Desktop agent that works on your local files, folders, and apps — completing knowledge work tasks autonomously while you steer | [Claude Cowork](https://www.anthropic.com/product/claude-cowork) | | **Autonomous Agent** | Headless agent that runs tasks end-to-end without supervision | [OpenClaw](https://github.com/openclaw/openclaw), [Devin](https://devin.ai/) | The [`uniharness_demo`](libs/uniharness_demo/) app ships with ready-to-use **Chat** and **Cowork** modes as concrete examples. ## Features ### Core Architecture - **Computer Protocol** — Pluggable execution environments (local, VM, cloud) with full runtime isolation. The agent's computer is a separate process from the agent itself. - **Model-agnostic** — Anthropic, OpenAI, DeepSeek, open-weight models via OpenRouter, or any OpenAI-compatible endpoint. Swap models without changing your agent. - **Context engineering** — Automatic 3-phase compaction keeps agents effective across long sessions. Context is an architectural concern, not an afterthought. ### Production Capabilities - **12+ built-in tools** — Bash, Read, Write, Edit, Glob, Grep, WebSearch, WebFetch, plus extensible skills and MCP servers - **Subagent orchestration** — Spawn specialized child agents (foreground + background) with isolated contexts and filtered tool sets - **MCP native** — First-class [Model Context Protocol](https://modelcontextprotocol.io/) support via stdio, SSE, or HTTP transports - **Permission gating** — Multi-layer safety rules validate every tool call before execution with human-in-the-loop approval flows - **Skills system** — Filesystem-based extensions with SKILL.md metadata and on-demand loading - **System reminders** — Rule-based context injection before model calls (`