When Large Language Models Grow Hands and Feet: The Technical Shift of AI Agents from Conversation to Execution
This article examines the technical architecture of intelligent agents that allow large language models to transition from passive information providers to active task executors. It details a three-layer framework consisting of a perception layer for context management, a decision layer for task planning and tool selection, and an action layer for executing external operations. The discussion covers critical engineering challenges such as security boundaries, the drift problem in multi-step reasoning, and error recovery mechanisms. Additionally, it explores context engineering strategies and the cloud infrastructure required to support production-grade agent systems.
When Large Language Models Grow Hands and Feet: The Technical Shift of AI Agents from Conversation to Execution
Introduction: The Paradigm Shift from Conversation to Operation
Looking back at the evolution of large language models (LLMs) over the past two years, a clear trend emerges: the role of models is shifting from “information providers” to “task executors.”
Early generative AI applications mostly stopped at a simple question-and-answer level. A user asked a question, and the model generated text, code, or suggestions. While the value boundary of this approach was clear, its limitations were equally obvious: the model could not sense real-time changes in the external environment, nor could it produce any actual impact on results. This is comparable to a consultant with vast knowledge who cannot go anywhere on your behalf or complete any concrete actions for you.
By late 2025, with significant improvements in instruction-following, long-context understanding, and structured output capabilities in new-generation foundation models, the industry began exploring a new form: equipping models with “hands” to grasp and “feet” to act. Often nicknamed “assistants with claws” in the developer community, the core idea is to free models from closed chat windows, enabling them to invoke external tools, operate file systems, access networks, and execute a series of multi-step tasks.
This shift is not a simple feature addition but a reconstruction of the system architecture. It means the model must possess three new capabilities: understanding a goal and decomposing it into executable steps, selecting and invoking the right tools at the right time, and validating results with fault tolerance. This article centers on these three core areas, exploring the technical implementation paths and engineering practices of intelligent agents.
Part 1: Core Architecture Breakdown: The Three-Layer Agent Model
A mature, production-grade agent system typically consists of three parts: the perception layer, the decision layer, and the action layer. Understanding the responsibilities of each layer is the prerequisite for avoiding design chaos.
1. Perception Layer: Unifying Environment and Context
The perception layer provides the model with all context information required for the current task. This information usually comes from three dimensions:
- System Prompt & User Input: Defines the agent’s role, boundaries, and current goals.
- Environment State: Includes the current directory’s file list, database table structures, and historical results returned by APIs.
- Feedback Loop: What did the last tool call return? Was it a success or failure? If it failed, what was the error message?
In practical engineering, the biggest challenge of the perception layer is “context management.” Although the context window of large models continues to expand, it is not infinite, and overly long contexts lead to the “lost in the middle” problem. Therefore, it is necessary to design reasonable context compression and retrieval mechanisms, prioritizing information most relevant to the current sub-task.
A typical context assembly logic is as follows:
def build_context(task, history, env_state):# 1. Base instructions: define role and constraintssystem_part = "You are an intelligent assistant with file operation capabilities..."# 2. History track: limit length, retain key infohistory_summary = summarize_last_n_steps(history, max_tokens=2000)# 3. Environment snapshot: currently available resourcesenv_part = f"Current directory files: {env_state.get('files', [])}\n"return f"{system_part}\nHistory: {history_summary}\n{env_part}\nCurrent Task: {task}"
2. Decision Layer: Task Planning and Tool Selection
The decision layer is the “brain” of the entire agent, responsible for answering two core questions: what to do next, and which tool to use to do it.
This involves two key sub-modules:
Task Planning: Decomposing complex goals into ordered sub-task sequences. Common industry strategies include linear planning, hierarchical decomposition, and the ReAct (Reasoning + Acting) paradigm. For linear decomposition, if a user requests “analyze last month’s sales data and generate a chart,” the model must first break this down into: locate data file -> parse data content -> execute statistical calculation -> generate visualization chart -> output result file.
Tool Selection: Mapping each sub-task to specific available tools. This requires providing the model with structured metadata for tools (name, function description, input parameters, output format). Below is a generic schema example for a tool description:
{"tool_name": "read_file","description": "Reads the content of a specified text file, supporting txt/json/csv formats","parameters": {"file_path": {"type": "string", "description": "Relative path of the file"},"encoding": {"type": "string", "default": "utf-8", "description": "File encoding"}},"returns": "String content of the file"}
A practical rule of thumb: the quality of tool descriptions directly determines selection accuracy. Vague “descriptions” will cause the model to select the wrong tool or mismatch parameters. Descriptions should clearly define input format constraints, expected outputs, and applicable scenarios.
3. Action Layer: Tool Invocation and Result Processing
The action layer is responsible for actually invoking tools and retrieving return values. Although this layer seems simple, it is the key to ensuring stability. Focus on the following areas:
- Timeout Control: Set reasonable timeout durations for each tool call to prevent long blocking.
- Exception Handling: Tools may throw various exceptions; these must be uniformly caught and converted into feedback information the model can understand.
- Result Formatting: Tool returns may be raw JSON, binary data, or plain text. This needs to be transformed into structured, concise information before being passed to the decision layer.
Below is simplified pseudocode for an execution loop:
def agent_loop(task, tools, max_iterations=10):current_task = taskfor i in range(max_iterations):action = planner.decide(current_task, context, tools)if action.type == "finish":return action.resulttry:result = executor.run(action.tool, action.params)context.add(f"Step {i} invoked {action.tool}, returned: {result}")except Exception as e:context.add(f"Step {i} failed: {str(e)}, please retry or adjust strategy")current_task = f"Based on the previous step, continue toward the original goal: {task}"return "Max iterations reached, task incomplete"
Part 2: Key Engineering Challenges and Strategies
1. Reliability and Security of Tool Calls
While agents gain execution capabilities, they also introduce risks. A poorly configured agent might unknowingly delete critical files, send sensitive information, or execute irreversible operations. Therefore, designing security boundaries is paramount.
Tiered Authorization Strategy: Classify tools by risk level into safe operations (reading files, querying status), confirmation-required operations (writing files, sending emails), and dangerous operations (deleting data, executing scripts). For the latter two categories, design human confirmation steps or establish sandbox isolation mechanisms.
Input Validation: Perform schema validation and semantic reasonableness checks on parameters before tool execution. For example, a “delete file” tool should restrict the path range that can be deleted to prevent accidental overwrites of system directories.
2. The “Drift” Problem in Multi-Step Reasoning
In long task chains, models often exhibit a phenomenon of “gradually deviating from the original goal,” academically known as the “Drift Problem.” Common mitigation strategies include:
- Periodic Review Mechanism: Every N steps, force the model to re-compare current progress with the original goal to confirm the direction is correct.
- Reflection: Introduce an independent verification step to validate results of completed sub-tasks. If problems are found, roll back to the previous step and re-plan.
- Structured Memory: Store key conclusions from completed tasks in a structured format within short-term memory (such as a task state table) to avoid information loss in the context window.
# Simplified reflection verification logicdef reflect(step_result, original_goal):if not is_consistent(step_result, original_goal):return "Detected result inconsistency with the original goal, please re-evaluate"return "Result is valid, proceed to the next step"
3. Error Recovery and Fault Tolerance Design
Tool call failures are the norm rather than the exception. A robust system must handle situations such as network timeouts, API rate limiting, and abnormal return data formats.
Automatic Retry Mechanism: Design exponential backoff retry strategies for transient failures (like network jitter).
Fallback Paths: Can a backup solution be activated when the primary tool is unavailable? For example, if an advanced data parsing tool fails, fall back to using basic regular expressions for extraction.
Human-in-the-loop: When an agent fails consecutively or detects high uncertainty, proactively report to the user and request guidance rather than blindly repeating erroneous operations.
Part 3: Context Engineering: The Invisible Lever for Agent Efficiency
In the three-layer architecture above, one element runs through everything—context. It determines to what extent the model can “see” and “understand” the full picture of the task.
Effective Use of the Context Window
When facing long dialogue histories or rich environmental information, simply stuffing everything in is unwise. Better strategies include:
- Information Tiering and Summarization: Compress and summarize completed historical steps, retaining only key decision points and conclusions.
- Retrieval on Demand: For massive knowledge bases or file collections, adopt Retrieval-Augmented Generation (RAG) principles to fetch relevant fragments as needed.
- Structured Artifacts: Save intermediate products (such as parsed data or generated code snippets) as files or variables, retaining only reference paths in the context to reduce token consumption.
Toolset Design and Streamlining
More tools do not necessarily mean a better agent. Excessive tool descriptions consume context window space and increase the probability of selection errors. General recommendations include: keep the number of tools exposed to a single agent within a reasonable range, and when complexity is high, adopt a “master-slave agent” architecture where a master agent handles scheduling and sub-agents focus on specific domains.
Part 4: Agent Capability Support from Baidu AI Cloud
In the practical implementation of intelligent agents, beyond model capabilities, the requirements for underlying infrastructure are equally stringent.
Model Inference and Scheduling Capabilities
Baidu AI Cloud offers various general large model services, including the generative AI capabilities on the Qianfan platform. Developers can call models via unified API interfaces to serve as the agent’s “inference engine.” The platform supports model fine-tuning, prompt engineering, and inference acceleration, allowing developers to flexibly configure based on task characteristics.
Tool Execution and Sandbox Environments
Agents need to execute code and operate on files in isolated environments. Containerization is a common choice: spin up lightweight containers for each task and destroy them upon completion, ensuring isolation while reducing resource overhead. Baidu AI Cloud’s container services provide elastic scaling and scheduling capabilities to meet the demands of concurrent agent execution.
Observability and Log Chains
Agent behavior is often a black box, requiring a comprehensive monitoring system for debugging and optimization. By using log services to record each decision, tool call, and return value, a complete execution trace can be constructed. Combined with monitoring and alerting capabilities, abnormal behaviors can be detected and alerts triggered in a timely manner.
Object Storage and State Management
Agents generate a large number of intermediate states and artifacts during execution. Using object storage to save task results, log files, and configuration data, combined with message queues to achieve asynchronous task scheduling, is a common architecture for building large-scale agent systems.
Part 5: Summary and Outlook
Equipping large models with “hands and feet” to move from conversation to execution has been one of the most important development directions for AI applications since 2025. The technical core behind this trend lies in organically combining the reasoning capabilities of large models with engineered tool invocation, state management, and fault tolerance mechanisms.
For developers, building a usable agent system requires comprehensive consideration of the following dimensions:
- Clear Architecture: Reasonably divide the perception, decision, and action layers to avoid confusion of responsibilities.
- Security and Control: Establish tiered authorization and sandbox isolation to ensure execution boundaries.
- Efficient Context: Optimize context utilization through summarization, retrieval, and structured storage.
- Robust Fault Tolerance: Design retry, fallback, and human intervention mechanisms to handle various exceptions.
- Complete Infrastructure: Leverage cloud platforms like Baidu AI Cloud to build a stable and reliable runtime environment using model services, container platforms, logging, monitoring, and object storage.
In the future, as multimodal understanding, long-term task memory, and autonomous planning capabilities continue to improve, agents will play an increasingly important role in scenarios such as software development, data analysis, and operations automation. For developers, now is the window of opportunity to deeply understand agent architectures and accumulate engineering experience. Only by mastering both model capabilities and engineering practices can one gain an early advantage in the shift from “conversation” to “execution.”
