GitHub

Agents as Microservices

Agents as Microservices
System Design
David JafariDavid JFounder
System Design

Agents as Microservices

A service-shaped agent boundary makes agents easier to build, test, debug, and change.

David JafariDavid JFounder

Autonomous agents need sharper boundaries.

A useful agent needs to know its job, its tools, its data, its permissions, and the point where it should stop and ask.

A context boundary gives the agent that shape.

Microservices gave software teams a practical bargain: isolate a responsibility behind an interface, and one part can change without forcing every other part of the system to change with it.

The same is true for agents.

The useful development question is simple:

How do I make this agent easier to build, test, debug, and change?

The design pattern is a service-shaped agent.

Give each durable responsibility its own agent boundary: a defined context packet, a small tool set, explicit permissions, a typed output contract, and a handoff rule for work outside the boundary. Then decide what belongs outside the agent.

The agent should own judgment inside the task. The harness should own repeatable execution: retries, tool wiring, fixture setup, tracing, session logs, and eval runs. The platform should own shared integration concerns: auth, rate limits, audit logs, policy gates, memory stores, and common adapters.

If every agent reimplements that integration logic, the boundary is only decorative. Small scope makes the agent testable.

An agent has nondeterministic output. Every extra tool, memory source, permission, and branch expands the dependency matrix. Narrowing the job narrows what can happen, what must be mocked, and what a valid answer can look like.

For example, a refund eligibility agent can be evaluated against policy fixtures and expected decision shapes. It does not need access to the mailer, CRM write APIs, or deployment logs. The job of an agent harness and the platform backing it should be to help you isolate an agent's code to its business purpose.

The agent is left with the one thing it should decide: does this request satisfy the refund contract?

The benefits are practical: smaller prompts, narrower permissions, reproducible failures, faster tests, clearer reviews, and fewer accidental changes across unrelated workflows.

Give the agent the whole codebase and it becomes a traveler. Give it a boundary and it can become an owner.

Agents get better faster when we can change one part without revalidating the whole machine.

Further Reading

  • CrossCodeEval: Shows that relevant cross-file context improves performance on real repository tasks. For development, the lesson is not "less context"; it is scoped context that matches the work.
  • ContextBench: Shows that coding agents often retrieve noisy context and favor recall over precision. That supports building cleaner context packets and narrower agent boundaries.
  • SWE-Pruner: Shows that task-aware pruning can reduce token use substantially with minimal performance impact. That is exactly the kind of development discipline agent boundaries should make repeatable.
  • SWE-agent: Shows that the agent-computer interface materially changes coding-agent performance. That supports treating the harness and tool interface as first-class architecture, not prompt decoration.
  • ClawsBench: Uses high-fidelity mock services with deterministic snapshot and restore to evaluate productivity agents. That supports the claim that realistic harnesses and controlled service boundaries make agent behavior easier to test.
  • RepoBench: Frames repository-level coding as retrieval plus completion, reinforcing that context selection is part of the system design.