From Generation to Action: Compute and Engineering Practices for Deploying AI Agents
The focus of AI applications is shifting from generating answers to completing tasks. This article explains why an agent is a constrained execution system rather than "a model plus tools," covering goal and constraint management, planning and state control, tool execution layers, and independent verification. It analyzes why compute costs grow with execution paths, how to measure cost per successful task, why engineering judgment matters in AI-assisted coding, the gap between 2D recognition and 3D spatial understanding, security boundaries for production environments, and a phased approach to deploying agents through small, verifiable loops.
1. The Technical Focus Is Shifting from “Generating Answers” to “Completing Tasks”
The early value of AI applications was mainly reflected in text generation, content classification, image recognition, and code completion. These applications typically have clear interaction boundaries: the user submits an input, the model produces an output, and a human judges whether the result is usable.
When models start taking on work such as retrieving information, breaking down requirements, calling tools, modifying files, and checking execution results, the nature of the system changes. It is no longer just a content generator, but a decision-making component within a task execution pipeline.
This shift can be summarized as:
Moving from a single input-to-output mapping to a continuous feedback loop running around a goal.
For example, generating a piece of data processing code only requires the model to understand the requirement and produce text. Performing a real data repair, however, requires confirming the data scope, checking access permissions, designing a repair plan, executing the operations, verifying consistency, and stopping or rolling back when anomalies occur.
Both may use similar model capabilities, but their system engineering requirements are very different. Therefore, evaluating an agent should not be limited to whether its answers are fluent or its plans look complete. Three questions matter more:
- Was the task actually completed?
- Did the execution comply with permission and business constraints?
- When errors occurred, were they detected in time and was the impact contained?
This is the starting point for understanding the architecture, cost, and governance issues that follow.
2. An Agent Is Not “a Model Plus Tools” — It Is a Constrained Execution System
Connecting a model to a few external APIs only shows that the system has the possibility of calling tools; it does not prove the system has stable task execution capability. An agent ready for real business use needs at least the following components.
2.1 Goal and Constraint Management
User requirements often contain vague phrasing, such as “optimize this program” or “clean up the abnormal orders.” Without explicit acceptance criteria, an agent can easily perform formally correct operations while deviating from the actual goal.
Before execution, requirements should be converted into verifiable task specifications, covering at least:
- The input data and the scope that may be processed;
- The expected deliverables;
- Objects that must not be modified;
- Limits on time, cost, and number of operations;
- Critical checkpoints that require human confirmation.
For ambiguities that cannot be resolved, the system should ask the user for clarification rather than letting the model fill in business rules on its own.
2.2 Planning and State Management
Complex tasks usually need to be broken into multiple steps, but a plan should not be treated as an immutable script. Tool return values, permission check results, and environmental changes can all invalidate the original plan.
A sound approach is to model the task as a state machine:
Receive task → confirm constraints → generate plan → execute steps → verify results → finish or hand off to a human.
Every state transition should have explicit trigger conditions. The model may propose the next step, but critical transitions should be governed by program rules, preventing the system from retrying indefinitely or skipping necessary checks due to unstable generated content.
2.3 The Tool Execution Layer
The tool layer converts the model’s proposed actions into real operations, and it is where risk is most concentrated.
Tool interfaces should have a single responsibility, explicit inputs, and verifiable results. Reading data and modifying data should use different permission levels; simulated execution and formal submission should be separated; high-impact operations such as deletion, fund transfers, or batch updates should include approval and recovery mechanisms.
One point deserves special emphasis: the model generating a call request does not mean that request is authorized to execute. Authorization must be determined by an independent permission system.
2.4 Verification and Feedback
A model’s explanation of its own output is not factual proof. Effective verification should rely on independent evidence wherever possible — test results, data constraints, business rules, and the actual post-execution state.
When verification fails, the system needs to distinguish failure types:
- Insufficient input: request additional information;
- Tool temporarily unavailable: retry within budget;
- Insufficient permissions: stop and request authorization;
- Business constraint conflict: hand off to a human;
- Result unverifiable: preserve the scene and avoid expanding the scope of operations.
This classification prevents every problem from being handed back to the model for endless “thinking.”
3. Why Compute Demand Grows: The Execution Path Matters, Not a Fixed Multiplier
Moving from generating content to executing tasks usually increases computational overhead, but one cannot simply claim that all agent tasks require some fixed multiple of compute. Actual cost depends on task complexity, context length, number of model calls, tool latency, and failure retries.
A simplified expression for single-task cost:
Total task cost = sum of model call costs + tool and infrastructure costs + verification costs + human intervention costs.
The most easily underestimated factors are the number of calls and context accumulation.
A task involving multiple rounds of retrieval, planning, execution, and review may repeatedly feed historical records back into the model. If every round carries the full content, input size keeps growing. Meanwhile, some steps consume little model compute but require waiting for external queries or human approval, significantly increasing end-to-end latency.
Therefore, optimization should not focus solely on the price of a single model call, but on the complete task.
3.1 Allocate Capability by Task Difficulty
Highly deterministic work such as format conversion or field extraction should first use rules, templates, or lighter-weight models. Stronger reasoning capability should be used only when semantic ambiguity, complex planning, or cross-step reasoning genuinely exists.
This is not simply downgrading the configuration; it is matching compute resources to actual task needs.
3.2 Control Context Growth
Task state should be stored in structured form, managing the goal, confirmed facts, unresolved issues, and tool results separately. For long histories, summaries can be retained alongside references to the original evidence — but summaries must not replace all original records, or details that affect judgment may be lost.
3.3 Set Budgets for Execution
Budgets should cover the number of model calls, tool calls, runtime duration, and allowable spend. When a limit is reached, the system should return a partial result with the failure reason rather than continuing indefinitely.
Budget control is both cost management and a safety measure, because looping execution usually means the system has failed to correctly recognize a failure.
3.4 Measure Optimization by Cost per Successful Task
A cheaper single call does not necessarily mean a cheaper overall system. If reduced accuracy leads to more retries and more human review, the final cost may actually be higher.
A more meaningful metric is:
Average cost per successful task = total cost over the evaluation period ÷ number of tasks that passed acceptance.
This metric should be interpreted together with quality and risk — necessary verification must not be cut just to lower costs.
4. The Watershed in AI-Assisted Programming Is Engineering Judgment, Not Usage Frequency
AI coding tools can reduce repetitive labor, but they can either expand a developer’s capability boundaries or mask knowledge gaps. The difference lies not in whether tools are used, but in whether the developer retains control over problem definition, solution selection, and result acceptance.
4.1 Automatic Generation Does Not Equal Correct Implementation
A program that runs only shows it passed the current path; it does not prove it meets all requirements. Edge inputs, concurrency races, exception recovery, permission isolation, and resource release often go unexposed in simple demos.
Developers should therefore treat generated code as an implementation candidate awaiting review, not a verified answer.
4.2 Write Requirements and Acceptance Criteria First
Before asking a model to implement a feature, clarify inputs and outputs, error handling, performance boundaries, and compatibility requirements. For important logic, prepare test cases and counterexamples in advance.
For example, monetary handling should be validated not only for normal inputs but also for precision, rounding rules, negative values, nulls, and duplicate submissions. The model can help expand test cases, but the final rules must come from real business constraints.
4.3 Retain Independent Troubleshooting Ability
When program behavior diverges from expectations, developers should be able to locate the problem through logs, runtime state, data changes, and minimal reproduction — rather than repeatedly feeding error messages back to the model and waiting for new fixes.
A simple learning discipline: before accepting any significant code change, be able to independently answer “why is it implemented this way,” “under what conditions will it fail,” and “how can the fix be proven effective.”
The capability with greater long-term value is not producing code faster, but controlling change risk more accurately.
5. From 2D Recognition to 3D Understanding, a Clear Technical Gap Remains
An image model can recognize objects in a photo, but recognizing “what is there” is not the same as understanding “where it is,” let alone knowing “how to operate on it safely.”
A single 2D image is a projection of the 3D world. Different spatial structures can produce similar images; occlusion hides parts of objects; perspective alters perceived size; lighting and reflections affect judgment. Therefore, a single photo usually cannot reliably recover the true sizes, distances, and relationships of all objects.
5.1 Spatial Understanding Requires Additional Evidence
Depending on the task, the system may need multi-view images, depth information, camera calibration results, motion information, or environmental geometric constraints. This information establishes the relationships among object positions, scales, and viewpoints.
But adding sensors does not automatically yield reliable results. Different data sources also require time synchronization, coordinate transformation, and error validation — otherwise the fused environmental description may introduce new biases.
5.2 Operation Demands Stricter Conditions Than Description
“There is a cup on the table” is a description task. “Move the cup to a designated position” requires the system to know the cup’s graspable regions, surrounding obstacles, actuator capabilities, and collision risks during movement.
Therefore, action suggestions generated by a language model should be further validated by dedicated motion constraints, collision checking, and execution feedback — they cannot directly replace low-level control logic.
5.3 Uncertainty Must Be Handled Explicitly
For positions, distances, and occlusion relationships that cannot be confirmed, the system should retain an uncertain state and resolve ambiguity through additional observation or human confirmation.
In physical environments, “I don’t know” is often more valuable than a complete-sounding answer that lacks evidence. Especially where human safety is involved, stopping by default is usually more reasonable than proceeding on a gamble.
6. What Security Boundaries Does a Production Environment Need?
When agents can access data and perform operations, input content is no longer just information to be understood — it can also become an attack entry point that influences behavior.
For example, an external document may contain embedded text instructing the system to ignore restrictions, leak information, or perform extra operations. Even if such text looks like instructions, it should not automatically receive the same standing as user authorization.
Engineering practice should enforce the following boundaries:
- Separate instructions from data: retrieved content, file content, and tool return values should be treated as untrusted data.
- Apply least privilege: expose only the resources and operations required for the current task.
- Isolate sensitive information: avoid bringing irrelevant credentials, personal information, and business secrets into the model context.
- Restrict external communication: control which destinations can be accessed and what data can be sent.
- Maintain complete audit trails: record the task origin, authorization scope, key calls, execution results, and approval processes.
- Provide stop and recovery mechanisms: be able to abort tasks, revoke permissions, and roll back recoverable operations.
Idempotency deserves special attention for retries. Re-querying after a failed query usually carries low risk, but operations such as payments, notifications, or inventory deductions can cause real losses if executed twice. The system must be able to recognize whether an operation has already taken effect, rather than simply calling it again.
7. Advancing Deployment Through Small, Verifiable Loops
Enterprises should not start by “building a general-purpose agent that handles everything,” but should prioritize scenarios with clear goals, controllable risk, and verifiable results.
Phase 1: Establish a Human Baseline
Record the current task’s time consumption, error types, processing cost, and quality standards. Without a baseline, it is impossible to judge whether automation truly creates value.
Phase 2: Read-Only Assistance
Let the system first handle information organization, issue classification, and draft proposals, without directly modifying production state. Focus on verifying information accuracy, evidence completeness, and human adoption rates.
Phase 3: Controlled Execution
Open up clearly scoped, reversible operations with human confirmation. Observe whether the system stops correctly under abnormal inputs, insufficient permissions, or tool failures.
Phase 4: Expand Automation by Risk Level
Reduce human involvement for thoroughly validated low-risk tasks; retain approval for high-impact tasks. The scope of automation should be determined by evaluation and operational evidence, not by demo impressions.
Beyond task success rate, acceptance metrics should include human takeover rate, erroneous operation rate, recovery time, latency distribution, and cost per successful task. Different task types should be measured separately, so that high success rates on simple tasks do not mask systematic failures on complex ones.
Conclusion: Build Capability Growth on Top of Verification Capability
The shift of AI from generation to action genuinely expands the scope of work that software systems can undertake. But there is no automatic conversion among model capability, tool permissions, environmental perception, and engineering reliability.
A truly sustainable technical path is: define the task first, then set boundaries; establish evidence first, then expand permissions; prove results are verifiable first, then pursue higher degrees of automation.
For developers, the key is retaining independent judgment and troubleshooting ability. For enterprises, the key is building a delivery mechanism jointly constrained by cost, quality, and risk. Only by placing the model inside an observable, controllable, and recoverable system can intelligence move from impressive demos to stable, reliable production capability.
