AI Agent Framework Selection: Gateway vs. Execution Paradigms

    This article breaks down the divergence in open-source AI agent frameworks into two technical paradigms: gateway agents and execution agents. Instead of comparing feature checklists, it introduces a five-layer capability model and evaluates both paradigms across runtime position, state ownership, permission boundaries, and extension mechanisms. You will find a six-question decision checklist, a minimal reference architecture, and key implementation and security practices for choosing the right framework for your use case.

    1. Why “Which One Is Stronger” Is the Wrong Question

    Over the past two years, open-source AI agent frameworks have entered a period of rapid divergence. Two narratives dominate the community. One treats agents as personal assistants that are available everywhere, focusing on “I can reach it from any chat tool I use.” The other treats agents as terminal executors that grow over time, focusing on “it can finish the work on my machine for me.”

    Comparing feature lists side by side creates the illusion that the two categories are nearly identical, since both can connect to messaging channels, call tools, and write files. Engineering selection cannot stop at the checklist level. A more useful question is: what trade-offs do these two types of frameworks make across four dimensions: runtime position, state ownership, permission boundaries, and extension mechanisms? Understanding the trade-offs reveals the underlying logic and helps determine whether a framework has the potential to become a de facto standard.

    This article does not review or recommend any specific product. Instead, it abstracts the phenomenon into two technical paradigms, gateway agents and execution agents, and provides a reusable evaluation framework.

    2. A Capability Layer Model: Breaking “Nearly Identical” into Comparable Layers

    Agent capabilities can be split into five layers, and any framework can be aligned against this table:

    1. Access layer: messaging channel adapters, identity and authentication, session routing.
    2. Orchestration layer: task decomposition, plan generation, multi-turn progression, failure retries.
    3. Execution layer: terminal commands, file reads and writes, code execution, browser or web scraping.
    4. Knowledge layer: long-term memory, vector retrieval, skill registration and reuse.
    5. Governance layer: least privilege, audit logs, observability, cost control.

    The gateway paradigm focuses on the usability aspects of the access layer and the governance layer, aiming for low-friction reach. The execution paradigm focuses on the completability aspects of the orchestration, execution, and knowledge layers, aiming to push tasks to a final state. The two are not mutually exclusive; they simply prioritize differently, and that prioritization is the true reflection of a product roadmap.

    3. The Gateway Paradigm: Reach-Centered Design

    A gateway agent is essentially a personal assistant gateway residing on your own device. It abstracts different chat channels into a unified message bus, exposes a consistent session interface on top, and hides protocol differences between channels underneath.

    Core design points typically include:

    • Channel adapter pattern: one adapter per channel, responsible for message normalization, rich-text fallback, and callback signature verification.
    • Session and context mapping: mapping “channel + user + group” to a stable session ID to avoid context crossover.
    • Always-on availability: deployed on a personal device or private instance, ready to use at any time, with data staying within your domain.

    A schematic adapter interface (pseudocode, structure only):

    1. class ChannelAdapter:
    2. def normalize(self, raw_event) -> Message: ...
    3. def send(self, msg: Message) -> None: ...
    4. class AssistantGateway:
    5. def __init__(self, adapters: list[ChannelAdapter], agent):
    6. self.adapters = adapters
    7. self.agent = agent
    8. def on_event(self, raw_event):
    9. adapter = self.route(raw_event.channel)
    10. msg = adapter.normalize(raw_event)
    11. reply = self.agent.handle(session_id=msg.session, text=msg.text)
    12. adapter.send(reply)

    The advantage of this design is access breadth and experience consistency: users gain assistant capabilities within their existing communication tools without changing their habits. The challenge is that when a task requires long-running, multi-step operations with strong side effects, the “turn boundaries” of chat-style interaction become a constraint.

    4. The Execution Paradigm: Completion-Centered Design

    An execution agent is essentially a terminal agent that grows over time, closer to an AI workbench running inside a computer. It drives tasks through multiple rounds: reading projects, inspecting files, running tests, searching the web, writing documents, and performing automation, while continuously distilling effective practices into reusable skills.

    The key mechanisms can be summarized in four points:

    • Task loop (plan-act-observe): form a plan first, execute one step, observe the result, and revise the plan until a termination condition is met.
    • Structured contracts for tool calls: constrain tools with explicit input schemas and return structures to reduce hallucination and misoperation.
    • Skill distillation: abstract successful paths into skill entries with preconditions and verification steps, forming a searchable experience library.
    • Long-term memory: distinguish “session memory” from “task memory”; the former is short-lived, while the latter retains conclusions and preferences across sessions.

    A minimal task loop example:

    1. def run_task(goal, tools, memory, max_steps=20):
    2. plan = planner(goal, memory)
    3. for i in range(max_steps):
    4. action = plan.next_action()
    5. result = tools[action.tool](**action.args)
    6. memory.observe(action, result)
    7. if result.done or plan.is_satisfied(result):
    8. return memory.summarize()
    9. plan = plan.revise(result)
    10. return memory.partial()

    The advantage of the execution paradigm is completability and reusability: a task can span multiple turns, multiple files, and multiple retries, ultimately delivering a deterministic result. The challenge is the complexity of permissions and security: the ability to operate terminals and files means sandboxing, allowlists, auditing, and rollback must be in place.

    5. Why Side-by-Side Comparison Falls Short and Vertical Breakdown Delivers More

    Comparing the fuel consumption of two cars heading in different directions is meaningless. Gateway agents optimize for “reach cost,” while execution agents optimize for “completion cost.” A more effective evaluation approach is vertical breakdown:

    • Runtime position: the gateway sits on the message path; the execution agent works inside development or operations workspaces.
    • State ownership: gateway state is mostly session state; execution agent state is task state and skill state.
    • Permission boundaries: gateways typically need only network and messaging permissions; execution agents need controlled file and process permissions.
    • Extension approach: gateways extend by adding adapters; execution agents extend by adding tools and skills.

    As for capabilities like self-evolution and skill distillation, they are not exclusive to one framework type but reflect roadmap prioritization. When requirements are tiered, if the current stage aims to expand reach, skill distillation naturally comes later; if the goal is to replace repetitive terminal operations, skill distillation moves to the front.

    6. Selection Criteria: Six Questions for Decision-Making

    1. Is the primary interaction entry a chat tool, or a code repository or terminal?
    2. Does the task require long-running, multi-step operations with side effects?
    3. Do you need to retain conclusions and preferences across sessions?
    4. Do you need to solidify successful paths into reusable skills?
    5. Can data leave your domain, or is private deployment required?
    6. Is your team better at channel adaptation or at tool and sandbox governance?

    If the first four answers lean toward “chat or light operations,” prioritize the gateway type; if they lean toward “terminal, heavy operations, or reusability,” prioritize the execution type. In practice, the two are often combined: use a gateway as the unified entry point, hand off heavy tasks to the execution agent, and unify authentication and auditing at the governance layer.

    7. Reference Architecture and Implementation Essentials

    A sound minimum viable architecture can be organized as follows:

    • Access zone: unified message bus + identity authentication + rate limiting.
    • Orchestration zone: task queue + planner + retry and timeout policies.
    • Execution zone: containerized sandbox + read-only filesystem mounts + command allowlist.
    • Knowledge zone: object storage for artifacts, logging service for traces, vector retrieval for skill recall.
    • Governance zone: monitoring and alerting, cost quotas, full-chain auditing.

    When deploying in the cloud, general-purpose capability categories can carry the load: a container platform runs sandboxes, object storage holds build artifacts, a message queue buffers tasks, logging and monitoring services provide observability, and a key management service hosts credentials. Baidu AI Cloud offers corresponding product categories for these general capabilities, which can be combined as needed. However, avoid binding the architecture tightly to any proprietary interface, and keep it portable.

    For security, three hard constraints are recommended: least privilege by default, all side-effect operations must be rollback-capable, and key steps must leave auditable traces. Skill distillation needs versioning to avoid “experience pollution.”

    8. Conclusion

    Whether an agent framework can become long-term infrastructure is not measured by how many channels it connects to today, but by whether it forms compounding returns that accumulate in a given dimension: gateway agents accumulate reach and experience, while execution agents accumulate skills and completion rates. Break down the essence vertically first, then match scenarios horizontally; that is the correct order for engineering selection.