SproutStackSproutStack home

Agent Harnesses and Orchestration

7 min readBeginner-friendlyFree to read

Before this, it helps to know: What are AI Agents?, From Text Generation to Action, Multi-Agent Orchestration.

Read a little, play a little. No scary maths, and no rush.

Share:

Three things called "orchestration"

People say "we need an orchestrator" and mean very different things. Pin down which one before choosing a tool:

  • The agent harness. The runtime around one model: it runs the loop of "call the model, run the tools it asked for, feed the results back", and handles context, permissions, limits and logging. This chapter is mostly about this.
  • Multi-agent orchestration. Coordinating several agents: who plans, who works, how results are handed over. See Multi-Agent Orchestration.
  • Workflow engines. Systems such as Temporal, Airflow and AWS Step Functions that make long business processes survive crashes and waits. See the showdown Temporal vs Airflow vs Step Functions.

And one name clash: Harness (harness.io) is a software delivery platform for CI/CD and related tooling. It has nothing to do with agent harnesses.

What a harness does

A model on its own only turns text into text. Everything that makes it an agent lives in the harness around it:

taskcontextruncheckrecordUser or triggerHarnessthe agent loopModeldecides next stepToolsAPIs, files, searchPermissionsapprove risky callsState + tracesresume, debug
The harness runs the loop: it builds the context, calls the model, checks permissions, runs tools, records everything, and decides when to stop.
  • The loop. Send the context to the model; if it asks for tools, run them and send back the results; repeat until it answers or a limit is hit.
  • Tool execution. Call the tools with validated inputs, often in a sandbox, with timeouts and error messages the model can act on.
  • Context management. Decide what goes into each call: instructions, relevant history, tool results. Long tasks need trimming, summarizing older turns (compaction) or moving details into files or memory.
  • Permissions. Which tools run automatically and which need a person's approval. Deleting data or sending money should never be the model's decision alone.
  • Budgets and stop conditions. Maximum steps, tokens, time and cost, so a confused agent cannot loop forever.
  • State and observability. Save progress so a run can resume, and record every model and tool call so you can see what happened.

Workflows or agents?

Anthropic's "Building effective agents" draws a useful line. Workflows orchestrate models and tools through code paths you define. Agents let the model direct its own steps and tool use. Workflows are more predictable and cheaper; agents handle open-ended tasks where the steps cannot be known in advance.

The same post describes common workflow patterns worth knowing by name:

  • Prompt chaining: a fixed sequence of calls, each working on the previous output, with checks in between.
  • Routing: classify the input, then send it to a specialized prompt or a cheaper or stronger model.
  • Parallelization: split independent subtasks, or run the same task several times and compare.
  • Orchestrator-workers: one model breaks the task down and delegates to workers.
  • Evaluator-optimizer: one call produces, another critiques, and they iterate.

Start with the simplest thing that works: a single call, then a workflow, and only then an agent, when the task really needs the model to choose its own path.

Build it or use one

  • Write your own loop with a provider's client SDK. Fine for a few tools and short tasks, and the best way to understand what a harness does. Some client SDKs include a helper that runs the tool loop for you.
  • Use a framework. LangGraph models agents as graphs of steps with persistence (checkpointers) and human-in-the-loop interrupts. The OpenAI Agents SDK provides agents, handoffs between agents, guardrails, sessions and tracing.
  • Use an existing agent's harness as a library. The Claude Agent SDK gives you the same tools, agent loop and context management that power Claude Code, with permissions, hooks, subagents, MCP and sessions.
  • Use a hosted harness. Some providers run the loop for you (for example, Claude Managed Agents), so you configure the agent instead of operating it.

When the agent needs a durable workflow underneath

A harness keeps an agent's loop correct. It does not, on its own, make a run survive a deploy, a crash, or a two-day wait for a manager's approval. When a run is long or valuable, put it on durable execution:

  • A workflow engine. Temporal can run the agent loop as a workflow, with each model call and tool call as an activity that is recorded, retried and resumed after crashes. Temporal provides an integration for the OpenAI Agents SDK that does this.
  • A framework's persistence. LangGraph checkpoints each step so a run can resume after a failure or an interrupt.

The rule of thumb: if losing a run halfway is cheap, the harness is enough. If a run takes hours, waits on people, or moves money, run it on something durable.

A worked example: a refund agent

A support agent reads a customer's request, looks up the order, and issues refunds.

  1. Harness: tools for "look up order", "check refund policy" and "issue refund"; at most 15 steps and a cost cap per conversation; every call traced.
  2. Permissions: refunds up to $100 run automatically; larger ones need a manager's approval.
  3. Durability: approvals can take two days, so the conversation runs as a durable workflow that waits for an approval signal and resumes exactly where it stopped, even across deploys.
  4. Idempotency: the refund tool takes an idempotency key per request, because a retried step must not refund twice (see Idempotency).

Remember this

  • "Orchestration" can mean an agent's harness, several agents working together, or a workflow engine. Ask which.
  • A harness runs the loop and owns tools, context, permissions, budgets, state and tracing.
  • Workflows follow paths you define; agents choose their own. Start simple.
  • Long, valuable or human-in-the-loop runs need durable execution underneath the harness.
  • Harness.io is a CI/CD platform, not an agent harness.

Check your understanding

5 questions · first-try answers earn the most XP

1. A teammate says "we need an orchestrator" for the new support agent. What is the most useful first question?
2. In Anthropic's terms, what separates a workflow from an agent?
3. Your agent's conversation keeps growing until requests fail or quality drops. Which harness responsibility is missing?
4. An agent issues refunds, and refunds over $100 need a manager's approval, which can take two days. What does this call for?
5. Which is the safest default for an agent with a tool that can delete customer data?

My notes

Saved in this browser. Highlight a line above and save it, or write it in your own words.

Nothing saved yet. Your highlights will live here.

References

Finished reading?

Ticking it here also ticks the chapter in the sidebar, the section count and your streak — it is all one number.

End of Tools, Function Calling & Agents

Take the section checkpoint

A short mixed quiz on all 7 chapters, to check you are ready to move on.

Related chapters

Spotted a mistake or want a topic covered? Report an issue

📬 An occasional email when new lessons land

New lessons and showdowns, no more than a few times a month. No spam, unsubscribe anytime. We store your email only to send the newsletter.