Skip to main content
>_ supraj.dev
TOPIC AI
Agent Harness the orchestration framework that turns an LLM into a reliable agent
IN 10 SECONDS

An agent harness is the scaffolding code around an LLM that manages the planning-execution loop, tool dispatch, error recovery, and state persistence. Frameworks like LangGraph, CrewAI, and AutoGen provide this harness out of the box — they handle retries, conversation memory, multi-agent coordination, and human-in-the-loop checkpoints so you don't reinvent it.

GOTCHA Agent harnesses add abstraction layers that can obscure what the LLM is actually doing. When debugging, always log the raw LLM prompts and responses — the harness's summarized logs often hide critical details like hallucinated tool arguments or skipped reasoning steps.
HOW A HARNESS ORCHESTRATES AN AGENT
01 Task input user submits a goal: 'Research competitors and write a report.'
02 Planner the harness prompts the LLM to decompose the goal into subtasks: search, extract, summarize, format.
03 Executor each subtask is dispatched to the appropriate tool or sub-agent. The harness tracks state, handles tool failures with retries, and enforces timeouts.
04 Checkpoint after each step, state is persisted. If the agent crashes, it resumes from the last checkpoint rather than starting over.
05 Output the final result is assembled from subtask outputs and returned to the user.
POKE IT YOURSELF
python -c "from langgraph.graph import StateGraph; graph = StateGraph(...); graph.add_node('agent', agent_fn); app = graph.compile()" — build a LangGraph agent with state management
python -c "from crewai import Agent, Task, Crew; crew = Crew(agents=[...], tasks=[...]); crew.kickoff()" — run a multi-agent crew with CrewAI