Deep Dive into Open-Source Agent Framework 2.0: Evolving from Graph Orchestration to Agent OS
This article provides an in-depth analysis of a recently released open-source Agent framework 2.0, which underwent a complete rewrite from its 1.0 version. It explores the architectural shift from a simple graph orchestration engine to an "Agent OS" model, detailing the four-layer microservice architecture, the 11-segment middleware execution pipeline, and key takeaways for developers building custom Agent platforms in production environments.
Recently, an open-source Agent framework released its 2.0 version. Unlike typical iterative updates, this version shares zero code with 1.0 and represents a complete rewrite, quickly climbing the open-source trending charts. The decision to completely rewrite is significant: it indicates that the 1.0 architecture hit a ceiling when handling complex Agent scenarios, and the team gained a clearer vision of what Agent infrastructure should fundamentally be.
1. Why a Complete Rewrite: Shifting from “Toolchain” to “Agent OS”
In the 1.0 era, the Agent framework was essentially a wrapper for a graph orchestration engine: developers defined nodes and edges, and the framework handled scheduling and execution. This works for demos but exposes critical issues in production environments: thread pollution during multi-user concurrency, lack of self-healing for failed tool calls, context overflow in long conversations, and unsafe isolation of subtasks.
The 2.0 version answers this by redefining the problem. Instead of positioning itself as an “orchestration framework,” it positions itself as an Agent OS, providing operating system-level infrastructure for AI. This includes four core capabilities:
- Sandbox: Provides an isolated runtime environment for Agents to execute code and call tools, preventing runaway operations from affecting the host system.
- File System: Gives the Agent a persistent, read-write file space to manage intermediate artifacts of long-running tasks.
- Memory: A memory mechanism spanning across single sessions, supporting context summarization and state persistence.
- Sub-Agent Engine: Allows the main Agent to spawn sub-Agents to execute decomposed tasks, forming multi-level collaboration.
This positioning means the framework’s abstraction layer is significantly higher than the underlying graph orchestration engine. The graph orchestration engine manages “how the graph executes,” while the Agent OS manages “what the Agent runtime needs.” The former handles execution semantics; the latter provides runtime infrastructure. They are layered, not competing.
2. Four-Layer Microservice Architecture: How a Request Flows
The 2.0 deployment architecture follows a typical layered microservice design. A request travels top-down through four layers:
- Reverse Proxy Layer: The unified entry point, responsible for TLS termination, load balancing, routing, and basic rate limiting.
- Frontend Layer: A server-side rendered web application handling the human-machine interface and session display.
- API Gateway Layer: Built on an asynchronous Python framework, handling protocol conversion, authentication, request validation, and downstream aggregation.
- Agent Execution Layer: The graph orchestration service where the actual Agent logic runs.
The value of this layering lies in clear responsibilities: the gateway doesn’t care about Agent semantics, and the Agent layer doesn’t care about HTTP details. The gateway uses an async framework to ensure low-latency responses under high concurrency, while the Agent layer focuses on advancing the graph state machine. When horizontal scaling is needed, the execution layer can scale independently based on load without affecting the stateless front-end layers.
A brief illustration (pseudo-code) of the gateway’s role:
@app.post("/agent/run")async def run_agent(req: AgentRequest, user=Depends(auth)):session = await acquire_sandbox(user.tenant_id)return await forward_to_executor(session, req)
3. Core Design: The 11-Segment Middleware Execution Pipeline
The most noteworthy part of 2.0 is the middleware chain on the Agent execution pipeline. Before entering the actual model invocation, each Agent request passes sequentially through about 11 middleware segments, each doing only one thing:
- Thread Isolation: Assigns an independent execution thread and state context to each session, preventing data crosstalk between concurrent sessions.
- Sandbox Acquisition: Leases an isolated environment from the sandbox pool, binds it to the current execution flow, and reclaims it upon task completion.
- Tool Call Repair: Performs schema validation and parameter patching on the model’s tool call outputs, “healing” format errors before execution, significantly reducing task failure rates.
- Token Summarization: Monitors context window usage and automatically compresses historical messages via summarization when approaching the threshold, ensuring long tasks aren’t interrupted by overflow.
- Plan Mode: Generates an execution plan before running complex tasks, supporting plan review and step-by-step execution to prevent blind Agent actions.
- Memory Queue: Asynchronously enqueues events that need to be written to long-term memory without blocking the main execution flow.
The middleware design follows two principles: single responsibility and ordered combination. The sequence itself is a design decision: for example, sandbox acquisition must precede tool call repair (repair results might require sandbox pre-checks), and Token summarization must precede plan mode (plan generation depends on the compressed context). This pipeline architecture offers excellent extensibility—adding new capabilities (like audit logging or cost budget control) only requires inserting a new middleware segment without altering the core execution logic, mirroring the mature middleware pattern in web development.
4. Implications for Self-Built Agent Platforms
Even if you don’t adopt this framework directly, its architectural decisions offer universal reference value for building custom Agent platforms:
- Built-in Infrastructure over Add-ons: Treating sandboxes, memory, and file systems as first-class citizens built into the framework is more reliable than having different teams assemble them ad-hoc.
- Middleware Pipeline as a Complexity Management Tool: Stripping cross-cutting concerns (isolation, repair, compression) away from business logic drastically improves code testability.
- Layered Decoupling for Independent Scaling: Separating the gateway from the executor is a necessary prerequisite for bringing Agent services to production.
- Dare to Rewrite: When the abstraction level undergoes a qualitative change, the cost of incremental patching often exceeds that of a complete rewrite.
For enterprises looking to deploy Agent applications in the cloud, you can further assemble a similar architecture by leveraging cloud platform container services (to host sandboxes and executors), object storage (to host the Agent file system), and message queues (to host the memory write pipeline). These general-purpose cloud products significantly reduce the operational burden of self-built infrastructure. Overall, the competition among Agent frameworks has shifted from “who has the prettier orchestration graph” to “who has the more stable runtime,” a trend every architect should continue to monitor.
