Choosing an AI Agent Framework: Why the Same Model Behaves Differently

    When the same LLM is deployed across different agent frameworks, the results often vary significantly. This article explores why these differences arise—not from sampling temperatures or prompt phrasing, but from how runtimes manage stateless text generation into reliable, auditable task execution. We break down the core components of an agent loop, evaluate four common architectural approaches, and provide a practical guide for selecting a framework based on scenarios, key subsystem design, and a phased production rollout strategy.

    Deploying the same model weights into different agent runtimes rarely results in the “same assistant with four different skins.” Instead, it produces four systems with entirely different behavioral boundaries. The differences do not primarily stem from sampling temperatures or prompt phrasing, but from how the runtime transforms stateless text generation into repeatable, auditable, and interruptible task execution. Understanding this is more critical than memorizing a framework’s feature list.

    Models Generate, Runtimes Execute

    Large language models (LLMs) are inherently stateless at the inference interface: you provide a context, and it outputs the next token. The model itself does not maintain long-term conversations, directly access file systems or databases, nor does it automatically remember “the tool parameters that failed last time” between calls. For an AI agent to be productive, a runtime layer—often called a harness or agent framework—must surround the model. This layer is responsible for assembling the user’s goal, history, tool descriptions, and constraints into the current context. It parses the actions output by the model, actually invokes external capabilities, and writes the results back into the context until the task is complete or interrupted by a policy.

    Think of it as an “inference core + execution shell.” The inference core determines the upper limit of language understanding, planning, and generation quality. The execution shell determines whether these capabilities are utilized stably. A small model paired with clear tool contracts, short context windows, and strict validation can sometimes be more predictable than a frontier model paired with a loose loop. Conversely, a frontier model lacking conversation trimming, permission control, and failure retries will drift, repeat calls, or exceed permissions in long tasks. Therefore, when selecting a framework, its impact on the outcome is often no less than that of the model itself.

    Inside the Agent Loop

    A production-ready loop typically involves six steps. Missing any one of them will expose problems in production.

    1. Goal Normalization: Convert chat messages, tickets, or scheduled triggers into tasks with verifiable completion conditions, rather than a vague “help me handle this.”
    2. Context Assembly: Select system constraints, relevant memory, recent conversations, and tool inventories. More context is not always better; irrelevant history consumes reasoning budgets and amplifies hallucinations.
    3. Action Parsing: Agree on whether the model outputs natural language, structured calls, or a mix. The higher the degree of structuring, the more stable the execution, but flexible conversation suffers.
    4. Tool Execution: Invoke retrieval, computation, ticketing, or messaging capabilities within the bounds of sandboxes, timeouts, idempotency, and permissions, returning errors faithfully but comprehensibly.
    5. State Persistence: Save messages, tool trajectories, intermediate artifacts, and human confirmation points to ensure the process can resume after a restart.
    6. Termination and Guardrails: Stop when completion conditions, step limits, cost limits, or risk policies are met, rather than allowing infinite self-questioning.

    Minimalist tutorial implementations often only cover “assemble prompt—call model—execute a few tools—print result.” The codebase is small and suitable for explaining the loop. Production implementations insert authentication, quota management, tracing, and multi-tenant isolation into every step, causing the volume and complexity to increase rapidly. The code size itself is not a measure of quality; it reflects how many runtime responsibilities the framework assumes.

    Four Common Design Approaches

    Different frameworks are not simply feature additions but trade-offs among a set of competing goals. Abstractly, there are four common approaches.

    Minimalist Core. Retains only the loop, a few built-in tools, and local sessions. The advantage is readable behavior, low secondary development cost, and a small failure surface, making it suitable for personal automation, prototyping, and embedding agents into existing services. The trade-off is that channels, permissions, multi-user support, and observability must be built manually. If a business already has mature gateways and permission systems, a minimalist core provides a cleaner boundary.

    Shared Runtime, Multi-Client Access. Centralizes sessions, tool execution, and model calls into a single service process. CLI, editor, web, or internal portals act merely as clients. This unifies authentication, rate limiting, logging, and secret hosting, preventing each endpoint from writing its own loop. The challenges lie in session concurrency, client reconnection, and “who has the right to approve high-risk tools.” Once a shared service becomes a single point of failure, it requires horizontal scaling, request queuing, and clear tenant isolation; otherwise, a single long-running task will drag down all endpoints.

    Skill Write-back and Memory. After a task ends, reusable steps, failure reasons, or operational preferences are deposited as skills or memory entries. The next similar task retrieves these directly rather than planning from scratch. This reduces repeated costs, but memory is not a free lunch: dirty data, outdated processes, and incorrect experiences are amplified into stable erroneous behaviors. A viable approach is to distinguish between short-term sessions, retrievable knowledge, and human-confirmed skills. Writes should include source, timestamp, and scope of application; reads should support invalidation. A system that gets “smarter with use” without an elimination mechanism often just gets more biased.

    Multi-Channel Connection. Attaches the same agent to multiple message entry points: internal communication, email, tickets, webhooks, etc. The user value lies in “summoning the agent within existing workflows” rather than opening a new console. The engineering cost involves protocol adaptation, identity mapping, message deduplication, rich text and attachments, and varying rate limits and compliance requirements across channels. The number of channels is not a capability metric; identity consistency and a unified audit trail are. If thirty entry points each have their own session primary keys, troubleshooting will be more painful than having no entry point at all.

    Real-world systems are often hybrids: a minimalist core acts as the executor, wrapped in a shared service, with memory and limited channels attached. When hybridizing, maintain one principle: policy (what can be done) belongs on the server side, while display (how it is communicated) can belong to the client side. If clients can also alter tool permissions, multi-endpoint setups will create bypasses.

    Designing Key Subsystems to Avoid Failures

    Prompts and Tool Contracts. Tool descriptions should specify preconditions, parameter meanings, idempotency, and failure modes, rather than using marketing-style “handles everything.” Parameters should be constrained by stable structured schemas, with the model only filling in fields. For operations with side effects, require explicit confirmation or secondary validation, rather than relying on “please be careful” in the prompt.

    Session and Context Budget. Long conversations should be segmented and summarized, isolated by task threads, while retaining raw trajectories for auditing. Summarization is lossy compression; key numbers, commitments, and unfinished items should be preserved verbatim. In multi-agent collaboration, what should be shared is task status and artifact references, not combining all agents’ internal monologues into the same window.

    Security Guardrails. At least three layers are needed: the input side rejects obvious privilege escalation and injection instructions; the execution side applies least privilege based on identity, restricting network, file, and command scopes; the output side masks sensitive data and applies policy checks for external sends. Guardrails must be testable: use fixed cases to verify “what should be rejected is rejected, what should be allowed is allowed,” rather than adjusting prompts by feel after launch.

    Observability. Each loop should log the task ID, model calls, tool names, duration, error codes, and termination reason. Without trajectories, it is impossible to distinguish between model planning errors, tool timeouts, insufficient permissions, or context truncation. Observability data itself must be masked to avoid writing secrets and privacy data into logging platforms.

    Failure Strategy. Distinguish between retryable and non-retryable errors. Query-type operations can retry with backoff; placing orders, sending messages, or changing permissions should not auto-retry by default unless the tool is explicitly idempotent. Steps, duration, and costs must have hard limits. When exceeded, hand the situation over to humans instead of letting the model “think of another way.”

    Below is a product-agnostic loop skeleton that only expresses control flow and does not represent any vendor’s API:

    1. while not done and steps < limit and cost < budget:
    2. ctx = assemble(goal, memory, history, tools, policy)
    3. action = model.complete(ctx)
    4. if action.requires_confirm and not approved:
    5. pause_for_human()
    6. continue
    7. if action.type == "tool":
    8. result = execute_with_timeout_and_acl(action)
    9. history.append(redact(result))
    10. else:
    11. return action.final
    12. trace.finish(reason)

    Choosing by Scenario, Not Feature Count

    Write down your constraints first, then see if a framework matches them.

    • Personal or small team prototyping: Prioritize a form that runs locally, has few dependencies, and offers a readable loop. Restrict tools to read-only retrieval and local computation.
    • Multi-user, integrating into editors or internal portals: Prioritize a shared runtime that unifies identity, secrets, and auditing. Keep the client lightweight.
    • Repetitive operational workflows: After successfully running read-only tasks, introduce controlled skill deposition. Each skill must have an owner, invalidation conditions, and a rollback method.
    • Appearing across multiple work entry points: First establish a unified identity system and audit model, then add channels one by one. For each new channel, complete its deduplication, rate limiting, and attachment policies.
    • High compliance or high side-effects: Default to human confirmation, least privilege, and full trajectories. The model should only suggest, not directly execute write operations.

    Also consider whether your team can maintain the parts the framework promises. Many connectors mean keeping up with protocol changes; a memory system means doing data governance; a shared service means capacity and multi-tenant management. If a team only has application developers and no runtime operations personnel, choosing the “most feature-rich” solution will often become unmaintainable during the first incident.

    When evaluating, use the same set of tasks, the same model, and the same permissions, only swapping the runtime. Record success rates, human intervention counts, error types, tokens and latency, and whether any privilege escalation occurred. Do not use open-ended chatting as acceptance criteria. Tasks should include normal paths, tool failures, insufficient permissions, overly long contexts, and mid-task user goal changes. Four types of differences usually emerge at these boundaries: minimalist solutions are faster but lack unified auditing; shared services offer consistency but show noticeable queuing; memory solutions speed up repetitive tasks but might reuse outdated steps; multi-channel solutions have high reachability but are more prone to identity and message order chaos.

    A Minimal Reliable Path to Production

    It is recommended to proceed in phases rather than connecting all tools and channels at once.

    Phase 1: Single user, read-only tools, short sessions, and complete logging. Confirm that the loop, parsing, and failure reporting are stable.
    Phase 2: Consolidate the runtime into a service, adding identity, quotas, and tracing so a second client can reuse the same session model.
    Phase 3: Add invalidatable memory or skills for repetitive tasks, and define who can publish them.
    Phase 4: Expand channels and write operations. Write operations must all go through confirmation and idempotent designs.

    In each phase, you must be able to answer three questions: Who can invoke what right now? Is the failure site sufficient for post-mortem? If the model is turned off, is there still a manual path for critical business processes? An AI agent framework is an execution system, not a prompt template. Choosing a framework is essentially choosing which responsibilities you are willing to delegate to the runtime and which to keep within your own permissions, data, and release workflows. Models can be swapped out, but once this division of responsibilities is chosen incorrectly, all subsequent channels and skills will amplify the mistake.