Skip to content

Cost and Latency in Agent Harnesses

Why agents can be expensive and slow, and how harness design keeps token usage and running time under control.

Editorial team 1 min read

Agents make many model calls with growing context, so costs and time add up quickly.

Where Cost Comes From

  • Repeatedly sending long context — instructions, tools, history — on every step.
  • Large tool outputs.
  • Many steps on complex tasks.
  • Sub-agents multiplying token usage.

Reducing Cost

  • Prompt caching: reuse the stable prefix of each request (instructions, tool definitions) where providers support it.
  • Trim tool output: return only what's needed.
  • Right-size models: use smaller, faster models for simple sub-tasks.
  • Compaction: summarise history rather than resending everything.
  • Budgets: cap steps, tokens and spend per task.

Reducing Latency

  • Run independent tool calls in parallel.
  • Stream progress to users.
  • Use faster models where quality allows.
  • Avoid unnecessary steps with better tools and instructions.

Measure Per Task

Track cost and time per completed task, not per call. A more capable model that finishes in fewer steps can be cheaper overall.

More in Agent harnesses

All Agent harnesses guides →
Agent harnesses Guide · 2 min

What Is an Agent Harness?

The software around a language model that turns it into an agent: the loop, tools, context, permissions and memory.

Agent harnesses 2 min read 27 Sep 2025

Agent harnesses Guide · 1 min

The Agent Loop Explained

The core cycle every agent runs: think, call a tool, observe the result, repeat — and how the loop knows when to stop.

Agent harnesses 1 min read 26 Sep 2025

Agent harnesses Guide · 1 min

Designing Tools for AI Agents

How to write tools agents use well: clear names, precise descriptions, sensible inputs and informative outputs.

Agent harnesses 1 min read 25 Sep 2025

Agent harnesses Guide · 1 min

Context Management in Agent Harnesses

How agents stay effective over long tasks: what to keep in context, what to summarise, and what to store outside.

Agent harnesses 1 min read 24 Sep 2025