Designing Agent Networks With Isolation and Shared State Patterns

Fazm Team··2 min read

Isolation Is the Foundation

The best agent networks are not built on tight coupling. They are built on isolation with carefully designed shared state. Each agent should operate as if it is the only one running - with its own context, its own tools, and its own failure boundaries.

The shared state is what ties them together, but it has to be intentional. Not everything should be shared. Not every agent needs to know what every other agent is doing.

What Good Isolation Looks Like

Each agent gets:

  • Its own working directory - files, worktrees, or sandboxed environments so agents do not step on each other.
  • Its own context window - no sharing of conversation history. Each agent gets the minimum context it needs.
  • Its own failure boundary - if one agent crashes or loops, others keep running.

This is not theoretical. When you run five Claude Code agents in parallel on the same codebase, you quickly learn that without git worktrees or separate branches, they will overwrite each other's changes constantly.

What Shared State Should Be

Shared state is the narrow bridge between isolated agents. It should be:

  • Append-only logs - agents write status updates that others can read but never modify.
  • A shared queue - tasks go in, agents pull from it. No agent owns the queue.
  • A single source of truth - one file, one database, one state store that all agents reference but only modify through controlled interfaces.

The mistake teams make is sharing too much. When agents share mutable state freely, you get race conditions, conflicting writes, and cascading failures.

The Pattern That Works

  1. Define clear input and output contracts for each agent.
  2. Use a message bus or shared file system for coordination.
  3. Never let one agent directly modify another agent's working state.
  4. Validate at every boundary.

Keep agents dumb and isolated. Make the shared state layer smart and well-defined.

Fazm is an open source macOS AI agent. Open source on GitHub.

More on This Topic

Related Posts