HarnessX is a Python SDK for building agents that reason, call tools, and carry work across turns. You supply the model, tools, and policies. The harness runs the loop and exposes what happens along the way.
Repeats until the model stops, a tool needs approval, or a guardrail is reached.
Start with one agent
A typed Python function can be a tool. Pass it when you construct the agent, then await a run.
import asyncio
from harnessx import Agent
def multiply(a: int, b: int) -> int:
"""Multiply two numbers."""
return a * b
async def main():
async with Agent(tools=[multiply]) as agent:
result = await agent.run("What is 40 * 10? Use multiply.")
if result.error:
raise RuntimeError(result.error["message"])
print(result.output)
asyncio.run(main())
Install the SDK, add a tool, and run a complete example.
02 / EXPLORELearn by running →Try streaming, skills, approvals, and incident playback.
What the harness provides
| Layer | What it does | Learn more |
|---|---|---|
| Agent loop | Sends context to a provider, validates and dispatches tools, returns results | Agents |
| Capabilities | Typed functions, external MCP tools, lazy skill instructions, and BM25F retrieval over OKF knowledge bundles | Tools, MCP, Skills, Knowledge |
| Context | Conversation history, notes, structured facts, and result spilling | Sessions & snapshots |
| Decisions | Standalone Choice routing, Score rubrics, and Noul evidence assessments | Decisions with Jev |
| Control | Permissions, explicit approval, budgets, and replay policies | Permissions |
| Execution | Direct runs or durable sessions with persisted execution boundaries | Durable agent runs (advanced) |
| Inspection | Typed streaming events, lifecycle hooks, traces, and incident archives | Streaming, Flight recorder |
Choose the execution model
Agent and AgentRuntime are two entry points into one execution engine, with the same tool and permission semantics. Use Agent for an in-process conversation or request. Use AgentRuntime when work must pause for an approval or survive a process failure. See Durable agent runs.