Domain Distillation: Rethinking AI Agent Architecture
How we went from a monolithic multi-agent runtime to an interruptible agent harness and a network connecting AI agents across machines.
When we started building Mozaik, our goal was simple: enable multiple AI agents to work concurrently, communicate, and collaborate toward a shared goal.
We built a runtime where agents could execute independently, exchange messages, share state, and react to one another.
It worked. Developers started building systems with multiple agents solving problems together.
But as we introduced more use cases, we began questioning some of our original design decisions.
We realized that several concepts we initially considered fundamental weren't actually the most important ones.
This is a story about domain distillation: how we gradually discovered the essential concepts behind AI agent execution and collaboration, and how those discoveries changed Mozaik's architecture.
1. We started with a monolith
The first version of Mozaik was a monolithic runtime for concurrent AI agents.
It handled agent execution, communication, state management, and coordination in one framework.
This was a good starting point. It allowed us to experiment with multi-agent collaboration without worrying too much about architectural boundaries.
Our initial mental model was straightforward: an agent is a state machine.
An agent could be waiting for inference, executing a tool, processing a result, or completing its task.
We modeled these states explicitly:
idleawaiting_inferenceawaiting_tool_outputstoppedcompleted
Transitions between states determined what happened next.
This approach made sense. State machines are a familiar way to model complex execution flows.
But gradually, we noticed something interesting.
The states themselves weren't as important as we initially thought.
Developers didn't necessarily care whether an agent was in awaiting_inference or awaiting_tool_output.
They cared about something more fundamental: what the agent was about to do, and whether they could influence that decision.
That observation led us to rethink the execution model.
2. From state machines to Loop Breakpoints
Consider what an AI agent actually does.
It requests an inference from a language model, interprets the response, potentially executes a tool, and repeats.
The interesting part isn't necessarily the state transition.
It's the moment between deciding what to do and actually doing it.
What if developers could inspect and manipulate that moment?
For example:
An agent wants to modify a file. Before executing the operation, another agent reports that the same file has changed.
Should the first agent continue with its original plan?
Probably not.
Or imagine an agent preparing to execute a destructive database operation. The application should have an opportunity to inspect the operation and request human approval.
We needed an execution model where these decisions could be made dynamically, rather than encoded into a fixed sequence of states.
That's how we arrived at the Loop Breakpoint Pattern.

Instead of making the state machine the central abstraction, we explicitly modeled the agent's loop and its pending instructions.
An instruction could represent an inference request or a tool call.
Before executing an instruction, the loop exposes a breakpoint.
The application can inspect the instruction, modify its parameters, provide a result, or decide when execution should continue.
This might sound like a small architectural change, but it fundamentally changes how developers interact with an agent.
Instead of only observing what an agent is doing, developers can control how its execution advances.
More importantly, the loop's data is separated from its execution.
This means we can inspect it, test it, persist it, or resume it later without coupling the representation of the loop to the mechanics of executing it.
The breakthrough wasn't adding more states.
It was discovering a simpler abstraction that gave us more flexibility.
We published this idea as the Loop Breakpoint design pattern.
3. Agents need to react, not just execute
While working on agent execution, another challenge kept appearing.
How do we coordinate multiple agents when their behavior is unpredictable?
Traditional workflows often assume we know the sequence of operations in advance.
Execute A, then B, then C.
But multi-agent systems are different.
Agents run concurrently. Their outputs are unpredictable. New information can arrive at any moment, sometimes invalidating decisions made just seconds earlier.
Imagine two coding agents working on related features.
One agent discovers that an API contract needs to change. The other agent is already implementing code against the original contract.
Without coordination, they might continue working independently and create incompatible changes.
We need the second agent to react to the new information, potentially pause its current execution, and reconsider its next step.
This led us to another important domain concept: rules.
We introduced a Rule Engine where developers can define how a multi-agent system should react to events.
Instead of hardcoding every possible workflow, developers can describe conditions and the actions that should follow.
An event might be a message from another agent, a tool result, or a change in shared state.
A rule evaluates the event and determines how the system should respond.
For example, an incoming message could cause an agent to pause, reconsider its task, or wait for another agent to finish.
Rules give us a way to express collaboration behavior independently from individual agents.
And combined with Loop Breakpoints, they point toward something powerful: a system where events can influence agent execution at runtime.
We're still refining this integration. Our rule engine already supports reacting to events, while connecting it directly to the new loop model requires adapting the loop to emit events.
But the underlying direction is clear.
Agent collaboration shouldn't require developers to predict and hardcode every possible interaction.
The system should be able to adapt as new information becomes available.
4. Separating the domain revealed two different products
As we continued refining Mozaik, another architectural boundary became obvious.
We were solving two fundamentally different problems.
The first was about agent execution.
How do agents reason, execute tools, maintain their loops, pause, resume, and respond to external decisions?
The second was about agent communication.
How do agents discover one another, exchange messages, and collaborate even when they're running on different machines?
Initially, both responsibilities lived inside the same runtime.
But they don't have to.
An agent harness should be useful even when running a single agent on one machine.
And communication infrastructure shouldn't need to know the internal implementation of each agent's reasoning loop.
Recognizing this distinction led us to split the original runtime into two independent projects.
Mozaik Agent is an interruptible agent harness. It provides the abstractions for building agents and controlling inference and tool execution through breakpoints.
Mozaik Network provides communication infrastructure for connecting agents across machines.

This separation also makes the system more open.
An agent doesn't necessarily need to be built with our harness to communicate through our network.
And an agent built with our harness doesn't need a distributed network to be useful.
That's an important outcome of domain distillation.
We didn't just split a large codebase into smaller packages.
We discovered two independent responsibilities that deserve their own models.
5. From concurrent agents to connected machines
When we initially launched Mozaik, we were focused on concurrent execution.
We wanted multiple AI agents to work together rather than execute sequentially inside rigid workflows.
That was the right direction.
But as we experimented with real applications, particularly software development, we realized that collaboration shouldn't be limited to agents running inside the same process or even the same machine.
Developers already use powerful coding agents such as Claude Code and Codex.
Why should these agents work in isolation?
Why couldn't a Claude Code session on one machine communicate with a Codex session on another?
Why couldn't agents notify each other about changes, coordinate tasks, or share important discoveries without developers manually copying information between terminals?
This is what we're now building with Mozaik Network.
We've started connecting coding agents across machines, allowing Claude Code and Codex sessions to exchange messages.
It's an extension of the same idea that motivated Mozaik from the beginning: agents should be able to work independently while collaborating toward shared goals.
But now we're taking that idea beyond a single runtime.
6. What domain distillation taught us
Looking back, the most interesting part of building Mozaik wasn't adding more features.
It was questioning the concepts we had already introduced.
We started by modeling agents as state machines. Then we realized that pending instructions and execution boundaries were more useful abstractions for controlling agent behavior.
We started by coordinating agents directly. Then we discovered rules as a way to describe how a system should react to events.
We started with a monolithic runtime. Then we recognized that agent execution and communication were separate domains.
Each discovery simplified one part of the system while opening possibilities we hadn't originally anticipated.
That's what I find fascinating about domain distillation.
The goal isn't to model every detail of a system. It's to discover the few concepts that explain its behavior and give developers the most freedom.
And those concepts don't necessarily reveal themselves at the beginning.
Sometimes you have to build the wrong abstraction, experiment with it, and understand its limitations before discovering a better one.
For us, that's been the journey from state machines to breakpoints, from predefined workflows to event-driven rules, and from concurrent agents inside one runtime to agents collaborating across machines.
We're still early in this journey.
But I believe these abstractions are bringing us closer to a foundation for building truly collaborative AI systems.
Not agents that simply execute a predefined chain of steps, but agents that can communicate, react, and coordinate as their environment changes.
That's the direction we're taking with Mozaik.
Explore the projects: