Agent class is the core primitive of OpenHarness. An agent wraps a language model, a set of tools, and a multi-step execution loop into a stateless executor that you can run() with a message history and new input.
Creating an Agent
Running an Agent
agent.run() is an async generator that takes a message history and new input, and yields a stream of typed events as the agent works. The agent is stateless — it doesn’t accumulate messages internally. You pass the conversation history in and get the updated history back in the done event.
done event into the next run() call. It also means you have full control over the conversation history: you can inspect it, modify it, or share it between agents.
Events
The full set of events emitted byrun():
Configuration
Multi-Turn Conversations
Since the agent is stateless, multi-turn is achieved by passing the updated messages back in:Cleanup
If the agent uses MCP servers or background subagents, callclose() when done: