AZMX AI

Technical Guide · 2026-05-29 · 8 min read

Architecting Multi-Agent Systems for Code

Moving beyond single-prompt chat toward specialized sub-agents with strict approval gates and local context.

Most AI coding tools are single-threaded: one prompt, one model, one attempt. Real software engineering requires a multi-agent system where a coordinator delegates tasks to specialized sub-agents—one for documentation, one for testing, and one for implementation. The challenge is managing these agents without leaking credentials or losing control of the shell.

The Failure of the Monolithic Agent

The industry is moving away from the 'one model to rule them all' approach. When a single agent handles planning, coding, and debugging, the context window becomes cluttered with irrelevant noise, leading to hallucinations and regression bugs. Multi-agent systems solve this by decomposing complex goals into discrete tasks handled by specialized personas.

For example, in a typical refactoring workflow, you do not want the agent writing the code to be the same agent validating the test suite. You need a separation of concerns: a Planner to map the changes, an Executor to write the diffs, and a Reviewer to verify the output against the original requirements.

Core Components of an Agentic Architecture

To build a functional multi-agent system for local development, four components are non-negotiable:

  • Tool Access: Agents need a way to interact with the OS. This is typically handled via a PTY terminal (like xterm.js) or a file system API.
  • Communication Protocol: The Model Context Protocol (MCP) has become the standard for allowing agents to share tools across different implementations via stdio or HTTP.
  • Shared Memory: Agents cannot rely solely on short-term context. They need a persistent state—such as a project-specific AZMX.md file—to track decisions and architectural constraints across sessions.
  • Human-in-the-Loop (HITL): Autonomous agents are dangerous. Every shell command and file edit must pass through an approval gate.

Comparing Implementation Strategies

Different tools approach multi-agent orchestration differently. Frameworks like AutoGen or CrewAI provide high-level abstractions for agent communication but often lack deep integration with the local development environment. IDE-centric tools like Cursor, Windsurf, and GitHub Copilot focus heavily on the editor experience, while CLI-based tools like Aider and Claude Code prioritize speed and git integration.

AZMX AI takes a different path by focusing on sovereignty. Instead of a cloud-hosted orchestrator, it provides a native Rust backend that manages sub-agents locally. Because it is a ~7 MB binary rather than an Electron wrapper, the overhead of running multiple agentic loops is significantly reduced.

Implementing MCP for Agent Extensibility

The Model Context Protocol (MCP) allows you to plug in external data sources and tools without rewriting the agent's core logic. If your multi-agent system needs to query a Postgres database or check a Jira ticket, you implement an MCP server.

# Example MCP tool definition for a database agent
{ "name": "query_db", "description": "Execute read-only SQL", "parameters": { "query": "string" } }

By utilizing MCP over stdio, sub-agents can call these tools, return the result to the coordinator, and move to the next step of the plan. This prevents the primary model from needing to know the internals of every single API you use.

Security in Multi-Agent Workflows

The primary risk of multi-agent systems is the 'autonomous loop' where an agent recursively executes commands that delete data or leak secrets. Security must be implemented at the system level, not the prompt level.

A robust system must include a deny-list. Any attempt by an agent to read .env, .ssh/id_rsa, or .aws/credentials should be blocked by the backend before the request even reaches the OS. Relying on the LLM to 'behave' is a critical failure point. This is why strict approval gates are mandatory for any operation that modifies the state of the machine.

Choosing Your Model Backend

Multi-agent systems are computationally expensive. Running three agents on a single high-latency API can make the experience sluggish. The current gold standard is a hybrid approach:

  • Coordinator: A high-reasoning model (e.g., Claude 3.5 Sonnet or GPT-4o) for planning and delegation.
  • Workers: Faster, cheaper models (e.g., Groq-hosted Llama 3 or DeepSeek) for repetitive coding tasks.
  • Local Fallback: Fully offline models via Ollama or LM Studio for sensitive code that cannot leave the premises.

By using a BYOK (Bring Your Own Key) model, you avoid vendor lock-in and can swap the coordinator model as soon as a more efficient one is released. You can explore these configurations in the AZMX documentation.

Conclusion

Multi-agent systems are the logical evolution of AI coding. By moving from a single chat interface to a coordinated network of sub-agents with shared memory and strict security boundaries, developers can automate complex migrations and feature implementations with higher confidence. The goal is not total autonomy, but a highly efficient, human-steered orchestration of specialized intelligence.

One window. The whole loop.