# Mini-SWE-Agent's 100-Line Architecture: What Radical Simplicity Reveals About Agent Orchestration Overhead

> Source: <https://dev.to/mech_app_ai/mini-swe-agents-100-line-architecture-what-radical-simplicity-reveals-about-agent-orchestration-3cge>
> Published: 2026-11-30 00:07:44+00:00

**Recommendation:** Keep the agent loop to tool calls and a step cap, but run untrusted tasks in a Docker sandbox rather than a local subprocess to avoid host corruption.
More in the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

Mini-SWE-Agent scores above 74% on SWE-bench verified with roughly 100 lines of agent code. Meta, NVIDIA, Essential AI, IBM, and Stanford use it in production. The architecture challenges a common assumption: that effective coding agents require complex orchestration frameworks with elaborate state machines, memory layers, and retry logic.

The project exposes which orchestration primitives are load-bearing and which are ceremony. When you strip away abstractions, what remains is a tight loop of tool calls, environment boundaries, and error surfaces. This is a case study in minimal viable orchestration.

The agent class lives in `agents/default.py`. It is not a toy. It contains:

No explicit state machine. No memory abstraction. No retry decorator. The loop runs until the model emits a finish signal or hits a step cap.

The environment class (`environments/local.py`) wraps shell execution. It spawns a subprocess, captures stdout and stderr, and returns them as strings. The model class (`models/litellm_model.py`) wraps LiteLLM, which handles API calls to OpenAI, Anthropic, or local models.

The run script (`run/hello_world.py`) wires these together. It loads a task, initializes the agent, and prints the result. The entire orchestration stack fits in four files, each under 150 lines.

Here is what mini-swe-agent includes:

Here is what it omits:

The absence of these layers is not an oversight. It is a design choice. Each omitted feature represents a trade-off between simplicity and robustness.

The full SWE-agent uses Docker containers for sandboxing. Mini-SWE-Agent runs commands in a local subprocess. This difference reveals the cost of isolation.

| Feature | Mini-SWE-Agent (Local) | Full SWE-Agent (Docker) | 
|---|---|---|
| **Startup time** | <1 second | 5-15 seconds | 
| **Filesystem isolation** | None | Full container | 
| **Network isolation** | None | Configurable | 
| **Dependency management** | Host environment | Per-task image | 
| **Security boundary** | Process-level | Kernel-level | 
| **Failure mode** | Host corruption | Container exit | 

The local environment is fast and simple. It is also dangerous. A malicious or buggy tool call can delete files, install packages, or open network connections on the host. The Docker boundary adds latency and complexity but prevents these failure modes.

For trusted tasks or development workflows, the local environment is sufficient. For untrusted code or production deployments, the Docker boundary is non-negotiable.

Mini-SWE-Agent v2 introduced breaking changes. The migration guide lists three major shifts:

These changes reflect lessons from production use. Modular environments address the sandboxing problem. Explicit tool definitions make the agent's capabilities inspectable. Standard message formats reduce integration friction.

The v2 architecture is still minimal, but it is no longer naive. It acknowledges that real deployments need swappable backends and clear boundaries.

Here is the agent loop, condensed from the actual implementation:

``` python
class Agent:
    def __init__(self, tools, model, environment):
        self.tools = tools
        self.model = model
        self.environment = environment
        self.messages = []

    def run(self, task, max_steps=25):
        self.messages.append({"role": "user", "content": task})

        for step in range(max_steps):
            response = self.model.call(self.messages)
            self.messages.append(response)

            if self._is_finished(response):
                return self._extract_result(response)

            tool_calls = self._parse_tool_calls(response)
            for call in tool_calls:
                result = self.tools[call.name](call.args)
                self.messages.append({
                    "role": "tool",
                    "content": result
                })

        return "Max steps reached"
```

This is not production code. It omits error handling, logging, and type safety. But it captures the essential structure: call the model, parse tools, execute, append, repeat.

The simplicity is the point. There is no state machine, no event bus, no middleware stack. The loop is explicit and linear.

Mini-SWE-Agent has no built-in observability. The run script prints messages to stdout. There are no trace IDs, no structured logs, no metrics.

This creates three failure modes:

Production deployments add observability by wrapping the agent loop. Common patterns:

These additions are not part of mini-swe-agent. They are left to the integrator. This is intentional. The agent provides the loop. The deployment provides the instrumentation.

Use mini-swe-agent when:

Avoid it when:

Mini-SWE-Agent proves that effective agent orchestration does not require elaborate frameworks. A 100-line loop with tool calling, environment boundaries, and message history is sufficient for many tasks.

The architecture exposes the essential primitives: model calls, tool execution, and context accumulation. Everything else is a trade-off between simplicity and robustness.

For production deployments, you will add sandboxing, observability, and error handling. But you will understand which layers are load-bearing and which are optional. That clarity is the project's real contribution.
