From Models to Agents: Architecture and Engineering Practices of Execution Frameworks
Transitioning from LLMs to autonomous AI agents requires more than just advanced models; it demands a robust execution framework. This article explores the core architecture, engineering practices, and key responsibilities of agent execution frameworks, covering task state management, tool constraints, context organization, and failure recovery. It also discusses the future division of labor between models and frameworks, multi-agent collaboration, and how enterprises should evaluate and scale agent systems safely.
1. Why Discussing Agents Requires Discussing Execution Frameworks
The core shift in agent technology is moving from “generating an answer” to “continuously achieving a goal.” The former requires a single input and output; the latter involves understanding requirements, making plans, calling tools, checking results, correcting errors, and requesting human confirmation when necessary.
For example, “explaining a business metric” is a Q&A task, while “identifying the cause of a metric drop and generating an evidence-backed analysis report” is an execution task. The latter requires accessing data, checking data definitions, comparing time intervals, verifying anomaly sources, and organizing intermediate results into deliverables. The ability of a model to propose an analysis approach does not mean the entire system can reliably complete the task.
The layer connecting model inference with real-world execution is typically called the agent execution framework, or Harness. It is not a strictly standardized technology, but a set of runtime mechanisms built around the model: managing task state, providing tools, organizing context, controlling execution loops, and handling permissions, failures, and audits.
Therefore, discussing execution frameworks is essentially discussing an engineering problem: how to transform uncertain model outputs into constrained, verifiable, and recoverable business execution processes.
2. Responsibilities of Models, Agents, and Execution Frameworks
Models Provide Reasoning and Generation Capabilities
Models are responsible for understanding instructions, generating plans, selecting tools, and explaining results. They can determine the next step based on current information, but they do not inherently have access to external systems, nor can they guarantee an operation’s success just by generating text.
“The model thinks the task is complete” is different from “the external system actually completed the task.” Whether a task is complete should be determined by tool return results, business state, and acceptance rules.
Execution Frameworks Provide Runtime Environments and Control Mechanisms
The execution framework is responsible for turning proposed model actions into controlled operations. For example, if a model wants to read a file, the framework must check if the file is within the allowed access scope; if a model wants to commit a data change, the framework must determine if approval is needed or if there is a risk of duplicate submission.
It must also maintain task execution records so the system knows which steps are complete, which results are verified, and which operations have undetermined external impacts.
Agents are Goal-Oriented Complete Systems
An agent typically consists of a model, an execution framework, tools, task strategies, and domain knowledge. It might be an interactive assistant or a continuously running automated workflow.
This relationship helps clarify the concept:
Agent System = Model Capability + Execution Mechanism + Tools & Data + Domain Constraints + Acceptance Criteria
This is not a mathematical formula, but a way to break down system design. A significant shortfall in any one area can become a bottleneck for actual reliability.
3. Six Core Responsibilities of Execution Frameworks
1. Translate Goals into Verifiable Tasks
“Analyze our business operations” is not a sufficiently clear execution instruction. The system needs to confirm the analysis scope, time interval, data source, output format, and whether modifying raw data is allowed.
Task definition should include three elements:
- Goal: What result needs to be produced.
- Constraints: What actions are allowed and prohibited.
- Acceptance Criteria: How to judge whether the result meets requirements.
For requests with incomplete information, the agent should prioritize clarifying key conditions that affect the outcome, rather than filling in business facts on its own.
2. Manage Task State and Execution Loops
A typical execution loop includes: reading state, selecting an action, validating the action, calling a tool, recording the result, verifying progress, and then deciding to continue, pause, or terminate.
Continuous loops must have boundaries, such as maximum execution duration, tool call budgets, and consecutive failure limits. Otherwise, agents might endlessly attempt impossible tasks, increasing costs and risks.
State management should not just save chat history. A recoverable task state needs to distinguish between confirmed facts, unverified assumptions, executed operations, incomplete steps, and items requiring human intervention.
3. Provide Constrained Tool Entries
Tool descriptions determine what operations a model can understand, while tool contracts determine whether the system can safely execute them.
Tool entries should clearly define input types, output structures, permission requirements, timeout behaviors, and error classifications. For write operations, idempotency must also be considered—i.e., whether repeated execution will cause duplicate orders, notifications, or data modifications.
Tool design should not solely pursue powerful functionality. An entry point that can arbitrarily access the network, execute commands, and modify files is flexible but makes it difficult to establish reliable permission boundaries. Splitting high-risk operations into more explicit capabilities is usually better for control and auditing.
4. Organize Context and Memory
Context capacity is limited, while information generated during long tasks can continuously grow. The framework needs to decide what content must be retained, what can be summarized, and what should be retrieved on demand.
It is especially important to distinguish:
- Constraints that the current task must adhere to;
- Raw evidence returned by tools;
- The model’s interpretation of the evidence;
- Long-term user preferences;
- Unverified speculations.
If speculations are compressed into confirmed facts and used for subsequent decisions, errors can accumulate across a long chain. Memory records should carry source, timestamp, and applicable scope, and retain the access location of raw evidence when necessary.
5. Handle Failures and Recovery
Different failures require different strategies. Transient network anomalies can have limited retries; parameter errors require input correction; insufficient permissions usually require authorization; if business conditions are not met, the system should explain the reason to the user.
It is particularly vital to prevent “tool timeout, but the operation actually took effect” scenarios. Blindly retrying a write action in this case may produce duplicate side effects. A better approach is to first query the business state, then decide whether to retry.
Recovery capability also relies on checkpoints. The system should be able to continue from confirmed steps rather than re-executing the entire task after every interruption.
6. Implement Independent Security Controls
You cannot rely solely on prompts to ask the model to “be careful.” Permission checks, sensitive data filtering, and critical operation approvals must be implemented outside the model.
External web pages, documents, and tool returns may contain prompt injection. The framework must treat these as data to be processed, not as commands that can modify system permissions.
For high-impact operations like sending messages, deleting resources, modifying permissions, or publishing content, a “generate action plan first, then approve for execution” pattern can be adopted, while recording the actual execution target, changes made, and final results.
4. Will Execution Frameworks Disappear as Models Get Stronger?
Improvements in model capabilities will indeed reduce the value of some compensatory logic in frameworks. For example, complex parameter error-correction flows might become unnecessary once models understand tool parameters more accurately; aggressive context compression strategies may need adjustment once models stably handle longer contexts.
However, business permissions, state persistence, resource budgets, auditing, and external transactions are not purely language reasoning problems. These responsibilities still require deterministic engineering mechanisms.
Therefore, the more reasonable trend is not “models replacing frameworks,” but a reallocation of responsibilities:
Models handle understanding, reasoning, and generating candidate actions; frameworks handle verification, execution, and constraints; business systems maintain real state; and acceptance mechanisms judge whether the delivery is qualified.
When designing execution frameworks, avoid building too many rigid processes around the flaws of a specific model generation. Stable business controls should be retained, while reasoning strategies, context strategies, and model selections should remain adjustable.
5. General Agents vs. Vertical Agents: Not a Simple Replacement
The advantage of general agents lies in broad task coverage, combining different tools to handle open-ended problems. Vertical agents rely on specific domain data structures, business rules, and acceptance criteria to improve reliability.
Take financial analysis as an example. Reading tables and generating explanations are general capabilities, but account mapping, consistency in data definitions, period attribution, and approval rules are domain capabilities. Without these constraints, even fluent outputs may not integrate into actual workflows.
For enterprise deployment, a layered design is more suitable:
- The base layer provides unified model access, tool execution, and state management.
- The middle layer carries domain knowledge, business rules, and validators.
- The top layer organizes interactions for specific roles and tasks.
General capabilities can reduce redundant development costs, but they do not automatically eliminate the value of domain knowledge and business governance. The competitiveness of vertical systems should come from verifiable business results, not just a set of seemingly professional prompts.
6. Multi-Agent Collaboration: Define Task Boundaries Before Agent Counts
Multi-agent systems are suitable for tasks that can be explicitly decomposed and whose results can be independently verified. For example, different execution units check data quality, analyze business changes, and review reports, with a unified node integrating the final output.
However, increasing the number of agents brings coordination costs: context overlap, conclusion conflicts, state synchronization difficulties, and higher API consumption. Multiple agents reaching the same conclusion based on the same false premise does not constitute independent verification.
Effective collaboration requires clear boundaries in four areas:
- What task each execution unit is responsible for;
- What data and tools it can access;
- What structure the output uses;
- Which node has the authority to merge results or approve actions.
For business processes with clear structures and explicit dependencies, deterministic workflow orchestration might be more reliable than free-form conversational collaboration. Multi-agent setups are not a default upgrade path, but a means to solve specific parallelism and division-of-labor problems.
7. Crystallizing Personal Experience into Executable Skills
Turning human work experience into reusable agent skills is a direction worth exploring. However, experience cannot just be saved as a description that “mimics someone’s style.”
Truly reusable skills should include:
- Applicable and non-applicable scenarios;
- Required inputs and preconditions;
- Operational steps and tool dependencies;
- Common exceptions and handling methods;
- Output formats and quality checks;
- Permission requirements and conditions for human escalation.
For instance, “checking business reports” needs to specify how to verify field completeness, identify duplicate records, reconcile statistical definitions, and whether modifying data is allowed when anomalies occur.
Skills should also have version management and testing mechanisms. Old skills may become invalid when business rules change; unverified experience should not automatically be upgraded to an organization-wide execution standard.
8. How Enterprises Should Evaluate Execution Frameworks
Evaluation should not just look at smooth demos or satisfying final text. It is recommended to observe results, processes, costs, and security simultaneously.
1. Result Metrics
Includes task completion rate, acceptance pass rate, factual accuracy, and manual rework ratio. Completion rates must be based on explicit acceptance rules, not the agent’s self-reported success.
2. Process Metrics
Includes tool call accuracy, invalid retry counts, failure recovery situations, and critical step coverage. These metrics help locate whether problems stem from model judgment, tool design, or process organization.
3. Cost Metrics
Includes resource consumption per successful task, execution duration, and manual review costs. Comparing only single-call prices easily overlooks the actual expenditures from repeated attempts and manual corrections.
4. Security Metrics
Includes unauthorized operations, sensitive information exposure, unapproved writes, and protection against malicious external instructions. High-risk scenarios should also test whether refusal to execute and active pausing are effective.
Test sets must cover normal tasks, missing information, tool anomalies, input conflicts, and malicious content. Before going live, run in read-only mode first, then gradually open low-risk write permissions, while retaining a human takeover entry for critical workflows.
9. Infrastructure Opportunities Come from Reliability, Not Simple Wrappers
The long-term value of agent infrastructure comes more from state management, permission control, tool governance, evaluation replay, cost management, and observability.
A sustainable system usually requires a database to save task states, a message queue to coordinate asynchronous work, object storage to save artifacts, and logging/monitoring to track anomalies. However, merely using these components does not mean a reliable agent architecture has been formed.
The truly critical aspect is cross-component semantics: Will tasks be consumed repeatedly? Might tools write duplicate data? Can approval results be accurately bound to a specific operation? Are logs sufficient to reconstruct a failure path? Does task recovery retain original permission constraints?
Source code visibility also cannot replace these engineering requirements. Open source helps inspect implementations, but it does not mean the system is inherently safe; closed source cannot be an excuse for lacking audits and verification. Enterprises should judge systems based on actual control mechanisms and verifiable results, not just hype.
10. Moving Towards High Automation: Define Responsibility First
Agents can automate more repetitive tasks, but “automated execution” does not mean “no one is responsible.” Contractual obligations, data authorization, financial operations, and external commitments all require clear responsible parties and governance mechanisms.
Even if an agent completes most of a business process, someone still needs to define goals, approve permissions, handle exceptions, and bear the consequences. Therefore, a more realistic path for highly automated organizations is to reduce manual effort in daily operations while strengthening key decision-making and risk control, rather than chasing purely nominal full automation.
Conclusion
The value of an agent execution framework lies in organizing model capabilities into a deliverable engineering system. It needs to solve not just “what to do next,” but also “is it allowed,” “was the execution successful,” “how to recover from failure,” and “who confirms the results.”
For developers and enterprises, the most worthwhile priorities when building agents are defining task boundaries, designing tool contracts, maintaining recoverable states, setting up independent permission controls, and establishing an acceptance system based on real business. The model determines how complex a problem the system can attempt to solve, while the execution framework determines whether these attempts can be stably and securely transformed into actual value.
