Harness: composing the patterns
LLM / environmentagent pattern
- The LLM alone: no tools, no state, no environment.
- Each agent pattern is one piece.
- Composed around the LLM, they form the harness.
- The harness is the environment: any task in, grounded result out.
Notes & references
Use when
Any agent beyond a single call: choose the pieces the task needs.
Avoid
Assembling every piece by default: each adds latency, tokens and failure modes.
harness = compose(
llm,
loop = agent_loop(max_turns),
workflows = [chain, route, evaluate],
tools = [*native, *mcp],
skills = discover("skills/"),
context = [cache_prefix, compaction],
memory = [working, semantic, episodic],
subagents = orchestrator(workers),
guardrails = [input, hitl, output],
)
result = harness.run(task)
- The anatomy of an agent harnessLangChain
- Agent harness engineeringAddy Osmani
- Unrolling the Codex agent loopOpenAI
- Building agents with the Claude Agent SDKAnthropic