AI Agent Execution Frameworks: How LLMs Get Hands and Feet
This article explains what an execution framework (also called an agent runtime or tool execution layer) is and why a text-in, text-out model needs one to act in real environments. It breaks the framework into four layers—capability description, scheduling control, execution sandbox, and state/observability—then covers three key mechanisms: task state memory with a plan plus event log, classified error handling with bounded retries, and permissions with path and command boundaries. It also outlines deployment forms and cloud building blocks, common pitfalls, and four metrics for evaluating a framework.
1. Why Models Have Brains but No Hands
Over the past two years, the conversational and generation capabilities of large models have improved quickly. In real engineering scenarios, however, users soon hit a wall: a model can write a script but cannot run it for you; it can analyze a dataset but cannot open a file on your machine; it can list the steps to take but cannot go back and fix things after an error. The reason is not mysterious—the model itself is a function that takes text in and returns text out, with no handle on the external environment.
An execution framework (often called an agent runtime or tool execution layer in the industry) is the middle layer that fills this gap. It does not change the model weights. Instead, it establishes a controlled channel between the model and the real environment: it abstracts environment capabilities into descriptions the model can understand, translates the intent in the model’s output into concrete operations, and feeds the results back to the model. The metaphor of “giving AI hands and feet” is accurate, but the more precise engineering statement is that the model gets an execution shell with permissions, state, and feedback.
2. The Four-Layer Structure of an Execution Framework
A usable execution framework can usually be split into four layers with clear responsibilities that can evolve independently.
- Capability description layer. Each available action is written as a structured definition: name, purpose, inputs, outputs, and failure semantics. The quality of these descriptions directly determines how accurately the model selects tools, so the “purpose” field should spell out when an action applies and when it does not, rather than being a one-line slogan.
- Scheduling control layer. This layer runs the multi-turn loop: it presents the model with the current list of available actions and context, parses the call intent returned by the model, decides whether to execute serially or in parallel, and determines when to stop.
- Execution sandbox layer. This is where actions actually land, including the filesystem view, process and command execution, network egress, temporary directories, and resource quotas. This layer is the security boundary.
- State and observability layer. It records which step the task has reached, the input and output of each action, elapsed time, and failure reasons, for use in resuming, rollback, auditing, and human takeover.
3. Key Mechanism One: Task State Memory
A single question-and-answer turn is stateless, but real tasks often span dozens of steps. The framework needs to explicitly maintain three kinds of state: the task goal and constraints, completed steps and their artifacts, and pending steps with their blocking reasons. A common engineering pattern is to combine a plan with an event log: the plan describes intent, the event log describes facts, and when the two disagree, the log wins.
state = {"goal": "Summarize the error distribution across all logs in the directory","constraints": ["read-only", "do not modify source files"],"plan": ["list directory", "sample and read", "aggregate", "output conclusions"],"events": [], # append-only; records facts"retry": {} # action name -> retry count so far}
With an event log, resuming after an interruption is no longer a matter of “guessing everything again”; execution continues from after the last successful event, which also makes cost predictable.
4. Key Mechanism Two: Error Handling and Retries
Call intents generated by a model have a natural error rate: missing parameters, nonexistent paths, command timeouts, insufficient permissions. A mature framework does not throw these errors straight at the user; it handles them by category.
- Recoverable errors (timeouts, rate limiting, temporary unavailability): retry with exponential backoff, set an upper bound, and write to the log.
- Semantic errors (invalid parameters, out-of-bounds paths): return the validation failure reason to the model in a structured form so it can correct itself and retry. This is more effective than the framework hard-coding patches.
- Unrecoverable errors (permission denied, missing dependencies): stop immediately and report with minimal reproduction information, leaving the decision to a human.
It is worth stressing that retries must have both a count limit and a total duration limit. Otherwise a single faulty action gets amplified repeatedly inside the loop, leading to uncontrolled resource and cost consumption.
5. Key Mechanism Three: Permissions and Boundaries
“Being able to act” must hold at the same time as “not being able to act recklessly.” Constraints that can be put in place include: limiting file access to a designated working directory, normalizing paths before validation and rejecting anything out of bounds; using a whitelist or a restricted interpreter for command execution rather than passing arbitrary strings straight through; opening network egress only as needed; grading write and delete operations, with high-risk actions requiring explicit confirmation; and logging every action for later traceability. The following is illustrative validation logic:
import osdef safe_path(root, user_path):p = os.path.realpath(os.path.join(root, user_path))if not p.startswith(os.path.realpath(root) + os.sep):raise PermissionError("Path out of bounds")return p
6. Deployment Forms and Cloud Support
Frameworks of this kind typically appear in three forms: an open-source library, a capability built into a platform, or a self-built service. The differences lie in where state is stored and how strongly the sandbox is isolated. To build one in the cloud, you can combine general-purpose capabilities: use a container platform to host the sandbox and elastic scaling, object storage to hold task artifacts and intermediate files, a message queue to asynchronously decouple and smooth out long-running tasks, logging and monitoring/alerting services to observe the elapsed time and failure rate of each step, and a key management capability to hold credentials so sensitive information is not written into prompts or code.
For this kind of agent infrastructure, Baidu AI Cloud provides a general engineering foundation, and enterprises can choose a public cloud or private deployment form according to their own compliance requirements and connect the execution layer to their business systems.
7. Common Pitfalls and Evaluation Advice
The first pitfall is “more tools means a stronger agent.” As the number of actions grows, the model’s selection accuracy is diluted, so the list should be narrowed per scenario and the descriptions kept mutually exclusive. The second pitfall is treating the prompt as a security boundary. Prompts can be bypassed; the real boundary is the sandbox and permission checks. The third pitfall is looking only at whether the final answer is correct while ignoring process metrics. At a minimum, evaluate four things: task success rate, average number of steps, per-task elapsed time and failure distribution, and out-of-bounds interception rate. Turning these four into a continuously observable dashboard gives the framework’s iteration a basis.
8. Conclusion
The value of an execution framework is not making the model “look smarter”; it is confining uncertainty inside an engineering cage that is observable, rollback-capable, and permission-limited. Once you understand the four layers—capability description, the scheduling loop, sandbox isolation, and state/observability—you can judge whether a solution is reliable and start from a minimum viable version in your own system, gradually filling in the three pieces of memory, retries, and permissions.
