AI Agent Selection and Engineering Practices: A Technical Guide
This guide breaks down how AI agents actually work and why many teams struggle with them in production. It explains the three-layer agent architecture (perception and planning, tool execution, state and recovery), maps different task types to agent capabilities, and introduces a four-dimension scoring framework covering capability coverage, runtime stability, controllability and observability, and total cost of ownership. It also addresses security and compliance risks, outlines a practical path from POC to production, and emphasizes building your own evaluation set instead of relying on third-party reviews. The goal is to help developers choose the most suitable agent rather than simply the strongest one.
1. Introduction: What an AI Agent Really Is and Common Misconceptions
“Which mainstream AI agent is the best?” has become a frequent topic in technical communities. Many developers and enterprise teams are drawn to marketing terms such as “autonomous,” “all-capable,” and “long-running,” only to run into expired login sessions, instruction drift over long chains of steps, and inconsistent results across repeated runs. This article does not focus on any specific product. Instead, it builds a neutral, reusable evaluation framework from three perspectives: technical principles, capability boundaries, and engineering practices.
The core of an AI agent is not a single large model, but a closed-loop system of “perception, decision, and action.” It uses a large language model (LLM) as the reasoning engine and operates browsers, file systems, databases, or third-party APIs through tool use or function calling to complete multi-step tasks. Unlike traditional RPA (robotic process automation), an agent offers dynamic planning and fault-tolerant retries. However, compared with idealized “digital employee” marketing, its stability in real environments is still constrained by external factors such as network conditions, permissions, and API availability.
2. Technical Principles: The Three-Layer Agent Architecture
To evaluate an agent’s strengths and weaknesses, you need to break down its runtime architecture. A typical agent system has three layers:
Perception and Planning Layer
The LLM interprets user intent, decomposes the task into ordered sub-steps, and generates tool-call parameters. For example, if a user asks to “collect three industry reports and generate a summary,” the agent may plan: open the search page → filter PDF links → download files → call a document parsing tool → run text summarization → write to a local Markdown file. This layer depends on the model’s instruction-following ability and context length.Tool Execution Layer
External tools are connected through APIs or protocols such as the Model Context Protocol. Common tool types include browser automation (Playwright/Puppeteer style), file operations (reading and writing CSV/JSON), database queries, and code sandboxes (Python/Node.js). Tool-call failure rates, timeout settings, and retry strategies directly affect task success rates.State and Recovery Layer
This layer maintains session context, intermediate artifacts, and execution logs. For long-running tasks that exceed 30 minutes, it must support checkpoint resume and idempotency. If a step is interrupted by a CAPTCHA or a network fluctuation, the agent should recover to the last checkpoint instead of restarting from scratch.
In practice, bottlenecks often appear across these three layers. If the planning layer has no maximum step limit, it may fall into an infinite loop. If the tool layer lacks input validation, malformed data can easily cause crashes. If the recovery layer does not persist state, context is lost after a restart, which worsens “instruction drift.”
3. Scenario Fit: How Different Tasks Demand Different Agent Capabilities
Agents are not universal, so you must clarify task characteristics before selection. Based on automation complexity, typical scenarios fall into three categories:
Lightweight tasks (such as information retrieval, text summarization, and format conversion)
These usually require only 2–5 tool calls and place low demands on model reasoning. They are well suited to open-source models (such as DeepSeek, Qwen, and GLM) paired with simple scripts. For these tasks, browser extensions or web-based tools can be tried first to reduce environment setup costs.Composite tasks (such as data entry, cross-platform information sync, and multi-document cross-analysis)
These involve 20–50 steps and multiple tools working together. Here, exception handling matters most: when the agent hits an expired login or an anti-scraping mechanism, does the system support human-in-the-loop takeover? Some solutions allow pausing execution so the user can complete verification before it continues.Long-cycle tasks (such as continuous monitoring, batch content generation, and automated testing)
Runtime may exceed one hour, so state persistence, log observability, and resource management become the focus. Containerized deployment with monitoring and alerting is recommended to prevent hung processes or memory leaks.
The original text notes that “for tasks with fixed steps and ready-made materials, it works faster than a human,” which accurately reflects the agent’s advantage in structured tasks. However, unstructured tasks—such as handling vague requirements or adapting to dynamically changing pages—still require human involvement. Therefore, positioning the agent as an “efficiency amplifier” rather than a “replacement” is the prerequisite for sustainable adoption.
4. Selection Framework: The Four-Dimension Scoring Method
Faced with many agent options, evaluate them quantitatively across four dimensions:
Capability Coverage
Does it support the required tool types (browser, file, API, code execution)? Does it allow custom tool integration? For example, if you need to operate an internal ERP system, the agent must support integration through REST APIs or enterprise messaging bots.Runtime Stability
In a continuous 24-hour stress test, is the task completion rate at least 85%? Does it provide detailed execution logs and failure-reason classification (such as network timeout, element not found, or insufficient permissions)? The original text mentions that “the latest version’s auto mode has rarely produced safety classifier errors,” which indirectly reflects improvements in model safety and intent recognition, but actual performance must be validated with real-scenario testing.Controllability and Observability
Does it support mid-run intervention (such as pausing, modifying steps, or adding input)? Does it visualize the execution path? Enterprise users also need audit logs and role-based permission management.Total Cost of Ownership (TCO)
This includes subscription fees, API call costs, infrastructure overhead, and human maintenance costs. For example, an agent that relies on a high-compute model may cost several yuan per task, while a “small-model routing with large-model fallback” strategy can significantly reduce costs.
Teams are advised to build their own evaluation set: pick 3–5 real business tasks, run them in parallel on candidate agents for three rounds, and record success rate, elapsed time, and number of human interventions. Third-party reviews are only a reference; your own testing is the basis for decisions.
5. Security and Compliance: Hidden Risks You Cannot Ignore
The autonomous execution nature of agents introduces new security challenges:
- Data leakage risk: While operating a browser, an agent may read cookies, account credentials, or internal system data. Make sure it does not write sensitive information into logs or send it to external APIs.
- Privilege escalation risk: Without limits on file system access scope, an agent may accidentally delete or tamper with critical files. Running it in a sandbox environment (such as a Docker container) is recommended.
- Supply chain dependency risk: Most agents are built on third-party LLMs. If a model provider changes pricing, applies rate limits, or retires a version, business continuity is affected. The original text’s observation that “the same base model is used by several products at the same time” illustrates exactly this risk.
Enterprises should establish agent usage policies that specify prohibited data types (such as core financial systems), define the allowed scope of automation, and put rollback mechanisms in place.
6. Related Practices from Baidu AI Cloud
Baidu AI Cloud provides general capabilities in the AI agent space. For example, developers can access models such as ERNIE through the Qianfan large model platform and build custom agents with function calling; use object storage to manage task artifacts; use log services to analyze execution bottlenecks; and deploy agent runtimes through container services to support elastic scaling under high concurrency. These capabilities provide the infrastructure foundation for building enterprise-grade automation workflows. For specific solutions, refer to the official documentation and best practice guides.
7. Implementation Roadmap: From POC to Production
- Requirement clarification: Identify which tasks are suitable for agents (high frequency, relatively clear rules, low fault-tolerance cost) and which must keep a human step.
- Prototype validation: Use a minimum viable approach (such as a web-based tool) to test the core workflow and assess feasibility.
- Engineering hardening: Set up environment isolation, log collection, monitoring and alerting, and a CI/CD pipeline.
- Canary release: Run a trial in non-critical business for 2–4 weeks and collect exception data.
- Continuous optimization: Adjust prompts based on failure cases, add tool fault-tolerance logic, and refine task decomposition strategies.
8. Conclusion
The value of AI agents lies in freeing up human effort and improving process efficiency, but their essence is an “automation system that needs to be managed.” Developers should abandon the “just pick the strongest one” mindset and adopt an engineering perspective of “pick the most suitable one.” By clarifying scenarios, quantifying evaluation, strengthening security, and optimizing continuously, agents can truly become reliable productivity tools. In a rapidly iterating technology landscape, rational selection, persistent self-testing, and a focus on long-term maintenance are the keys to harnessing AI automation.
