Super Agent Architecture with Resident Routing and Isolated Execution

    This article examines a minimal, practical architecture for a “super agent” that separates a resident routing role from independent execution agents. Instead of relying on one agent to handle every operation, it divides continuous interaction, task scheduling, concurrent execution, and state supervision into clear engineering boundaries. The article covers lightweight routing, isolated execution, asynchronous task progression, periodic inspection, and file-based state management, then maps these ideas to a small set of general-purpose components. It also outlines the main limitations of the minimal implementation and a phased extension roadmap toward task registries, state machines, event routing, permissions, reliability mechanisms, and observability. Readers gain a concrete architecture pattern for validating task flow and isolation boundaries before adding production-grade controls.

    1. Background: Architecture Layering Is the Key to a Super Agent

    When discussing the idea of a super agent, it is easy to focus on model capability. In practice, however, system usability is often determined by how agents divide responsibilities, how tasks flow between them, how long-running operations avoid blocking interaction, and how abnormal states are detected in time. A more pragmatic view is that the core of a super agent is not making a single agent do everything. It is separating continuous interaction, task scheduling, concurrent execution, and state supervision into an engineering structure that is composable, observable, and recoverable.

    A useful part of the original concept is to split agents into two roles: a routing role responsible for communication and scheduling, and an execution role responsible for concrete work. The system is then built around event triggers, task context, state management, and periodic inspection. The direct benefits are clear: the routing side stays lightweight, the execution side can run concurrently and independently, long-running tool calls do not pollute the main interaction context, and contexts from different tasks do not mix.

    This article discusses an implementation path with as few components as possible. It does not attempt to reproduce a complete mechanism. Instead, it uses general engineering components to make “resident routing, independent execution, asynchronous progression, and periodic inspection” work end to end, while leaving room for later expansion. The components can be abstracted as a resident coordinator process, a persistent session manager, a remote message entry, a code execution agent, a periodic scheduler, and a virtual machine or container runtime. It is important to note that this minimal approach implements basic actions, not full product-grade capabilities.

    2. Overall Principles: Lightweight Routing, Isolated Execution, and Externalized State

    Three principles can be established first.

    First, routing should be lightweight. The resident coordinator process receives instructions, understands tasks, splits tasks, and dispatches tasks, but it should avoid personally performing concrete code changes or long-running tool calls. If all execution is concentrated in the router’s main session, long operations will block interaction and allow contexts from different tasks to contaminate each other.

    Second, execution should be isolated. Each concrete task should enter an independent execution session or execution process and be completed by a code execution agent. The execution side can fail, time out, or retry, but it should not drag the routing side into an uncontrolled waiting state.

    Third, state should be externalized. Plans, logs, task records, execution results, and exception information should be saved as files or structured records rather than existing only in the memory of a process. Externalized state provides the basis for periodic inspection, manual recovery, and auditing.

    These three points appear simple, but they determine whether the system can evolve from “wait for one instruction and do one thing” into “continuously receive tasks and push them forward.”

    3. Minimal Component Mapping and Overall Architecture

    In a minimal implementation, six types of general-purpose components can be used:

    Role General Component Abstraction Main Responsibility
    Coordination entry Resident routing agent Receives messages, parses intent, creates tasks, dispatches execution, and aggregates results
    Persistent host Persistent session manager Keeps routing and execution processes alive over time and supports background operation
    Remote entry Instant messaging or task entry Submits tasks, receives status, and returns results
    Execution unit Code execution agent Performs code changes, command execution, and file operations in an independent session
    Periodic supervision Periodic scheduler Triggers checks at fixed intervals and reminds the router to verify execution status
    Runtime Virtual machine or container Provides an isolated runtime space and mounts a shared working directory

    The overall data flow can be summarized as follows:

    1. User message
    2. -> resident routing agent
    3. -> task record and task ID
    4. -> allocate independent execution session
    5. -> code execution agent runs in background
    6. -> logs and results written to disk
    7. -> periodic scheduler triggers inspection
    8. -> routing agent aggregates and returns status

    The key here is not the small number of components, but clear responsibility boundaries. The routing agent does not need to complete every code change itself, and the execution agent is not responsible for global scheduling. The two collaborate through task records, session identifiers, and log files, forming a minimal closed loop.

    4. Resident Router: A Control Entry, Not a Universal Executor

    The resident routing agent is the control entry of the entire system and runs in a persistent session. It receives messages from the remote entry, uses system prompts and message adaptation logic to convert user messages into tasks, and then starts the corresponding execution agent. The core responsibilities of the routing side include:

    1. Identifying task intent and boundaries, and determining whether the task is a query, an execution, a modification, or requires manual confirmation;
    2. Generating a task ID and writing a task record so that the task is not lost in conversation;
    3. Selecting an appropriate execution session or execution environment and dispatching the task;
    4. Maintaining a task status summary, such as accepted, running, awaiting confirmation, succeeded, failed, or timed out;
    5. Aggregating execution results during periodic inspection or when the user queries status.

    The routing side should remain interactive as much as possible. This means that when an execution agent is performing a long-running operation in the background, the router can still receive new messages, answer status queries, cancel tasks, or adjust priorities. If the router is occupied by long-running calls, the system degrades into a single-threaded command entry.

    A simplified routing dispatch pseudocode is shown below:

    1. on_message(message):
    2. intent = parse_intent(message)
    3. if intent.need_confirmation:
    4. return ask_user_and_record_pending(intent)
    5. task_id = task_registry.create(intent)
    6. session = session_pool.allocate(task_id)
    7. session.start(worker_entry, task_id, intent.payload)
    8. audit.append(task_id, "dispatched", session.id)
    9. return "Task accepted: " + task_id

    The emphasis of this logic is “record first, dispatch next, audit last.” The task ID and session identifier are the anchors for later inspection, recovery, and troubleshooting.

    5. Execution Agent: Background Operation and Context Isolation

    The execution agent handles concrete development tasks. At present, it can be abstracted as a command-line programming agent or code execution agent. It runs in an independent session and executes in the background after the router dispatches a task. The execution agent needs to address the following concerns:

    • Working directory isolation: different tasks work in separate directories or separate branches to avoid overwriting each other’s files;
    • Context isolation: each task loads only the plans, logs, and file states relevant to itself;
    • Timeout and cancellation: long tasks should have a maximum execution time and support manual cancellation;
    • Result persistence: execution logs, change summaries, error information, and artifact paths are written into the task record;
    • Idempotency and retry: retries of failed tasks should avoid duplicate side effects.

    The execution agent is not suitable for directly handling global scheduling. It only answers whether the task is complete, what it produced, and what errors it encountered. Global state is maintained by the router and task records. In this way, the execution side can be replaced, scaled, or restarted without breaking the overall system logic.

    6. Asynchronous Tasks and Periodic Inspection

    The value of asynchronous execution is that it removes “waiting” from the interaction path. After the router dispatches a task, it immediately returns an accepted status, and the execution agent progresses in the background. To keep asynchronous tasks from becoming a black box, periodic inspection is needed.

    The periodic scheduler can trigger a check at fixed intervals and remind the router to verify the status of each execution session. The inspection content does not need to be complex, but it should at least include:

    1. Whether a task has exceeded its expected execution time;
    2. Whether the execution session is still alive;
    3. Whether logs have had no new entries for a long time;
    4. Whether there are blocking points awaiting manual confirmation;
    5. Whether task records are consistent with execution results.

    The inspector can be an independent process, or it can be an inspection entry triggered by the periodic scheduler in the router. Its output should be written to the audit record and, when necessary, sent to the user through the message entry. Periodic inspection is not complete state management, but it is the lowest-cost reliability patch in a minimal implementation.

    7. File-Based State: Plans, Logs, and Task Records

    In a minimal system, it is not advisable to introduce a complex state service at the beginning. Three types of information can be saved as files:

    • Plan file: task objectives, constraints, acceptance criteria, and execution steps;
    • Log file: execution process, command output summaries, and error stack summaries;
    • Task record: task ID, status, owning session, creation time, update time, and result path.

    The advantages of file-based state are transparency, ease of debugging, and ease of backup. The disadvantages are that concurrent writes, queries, and consistency require additional conventions. For example, each task can have one directory, the router writes only task records, the execution agent only appends logs, and the inspector only reads and generates status snapshots. This reduces write conflicts.

    As the system expands, task records can then be migrated to a database or message queue, logs can be migrated to a logging service, and artifacts can be migrated to object storage. During migration, task IDs and the state machine should remain unchanged to avoid rewriting upper-layer flows.

    8. Limitations and Extension Roadmap

    This minimal implementation does not cover full product-grade capabilities. At least the following are missing: a complete task registry, thread correlation mechanisms, fine-grained event routing, independent task state management, access control, resource quotas, failure compensation, and an observability system.

    The extension roadmap can be advanced in stages:

    1. Task registry: centrally manage task IDs, statuses, priorities, dependencies, and owners;
    2. State machine: explicitly define transitions among accepted, queued, executing, awaiting confirmation, succeeded, failed, canceled, and timed out;
    3. Event routing: handle messages, timed events, execution completion events, and exception events separately;
    4. Context correlation: use task IDs to link plans, logs, artifacts, and conversation records;
    5. Reliability mechanisms: add idempotency keys, retry policies, timeout cancellation, dead-letter handling, and manual takeover;
    6. Security and permissions: restrict the directories, executable operations, and callable resources available to execution agents;
    7. Observability: add metrics, logs, tracing, and alerts to form an auditable chain.

    For cloud deployment, general categories such as object storage, message queues, logging services, monitoring and alerting, and container platforms can be used to support persistence, asynchronous communication, and observability. Specific choices should fit the team’s existing infrastructure and avoid introducing excessive operational overhead for a minimal system.

    9. Evaluation and Conclusion

    When evaluating the super agent concept, the question is not only whether it can “work continuously like a human.” The more important question is whether it separates continuous interaction, task scheduling, concurrent execution, and state supervision into modules that can be engineered. The minimal implementation that separates resident routing from execution agents uses relatively few components to make the core collaboration work: the router receives requests uniformly, execution agents progress independently in the background, periodic inspection detects anomalies in long-running tasks, and file-based state supports recovery and auditing.

    Its value lies in validating the architectural direction, not in directly providing production-grade capabilities. Real deployment still requires a task registry, state machine, event routing, permissions, and observability. For developers, the safest path is to first validate task flow and isolation boundaries with a minimal closed loop, and then gradually abstract state, events, and monitoring out of files. This preserves the super agent’s ability to keep pushing tasks forward while preventing the system from losing controllability as complexity increases.