From Conversation to Execution: A Practical Guide to Building AI Agents

    This article explains how AI applications are shifting from generating text suggestions to delivering completed, verifiable tasks. It outlines a four-layer reference architecture with a feedback loop, then covers the core engineering capabilities: reliable tool calling, voice interaction, retrieval-augmented generation, and the permissions, evaluation, and cost controls needed for production. The goal is to show how to build auditable agent applications on general cloud capabilities.

    1. The Shift in Requirements: From Answers to Outcomes

    Traditional conversational applications produce text suggestions. Users read them and still have to carry out the follow-up work themselves. The goal of the new generation of intelligent applications is to move a task to a deliverable state, leaving only key decisions such as confirmation and payment to the human. This shift has three direct consequences:

    1. The evaluation metric changes from “is the answer fluent?” to “is the task completed and verifiable?”;
    2. The system boundary expands from the model itself to tools, data, and external systems;
    3. The risk model escalates from “saying the wrong thing” to “doing the wrong thing,” making permissions and rollback first-class concerns.

    Given this, debating which tool to recommend has limited value. What is worth investing in is mastering the general methods for building agents and using the general cloud product capabilities offered by Baidu AI Cloud to complete the engineering work.

    2. Reference Architecture: Four Layers and a Feedback Loop

    • Interaction layer: multiple entry points such as text, voice, and forms, responsible for intent clarification and result confirmation;
    • Planning layer: task decomposition, step orchestration, failure retries, and termination conditions;
    • Execution layer: tool registration, parameter validation, idempotent calls, and result normalization;
    • Data layer: document parsing, chunking, vectorization and retrieval, plus logging and monitoring alerts;
    • Feedback loop: execution results are fed back for verification; if verification fails, the flow returns to the planning layer to retry or escalates to a human.

    The following is an illustrative tool description and scheduling skeleton (it expresses a general idea only, not a specific API):

    1. tools = {
    2. "search_kb": {"desc": "Search authoritative material", "schema": {"q": "string"}},
    3. "create_order": {"desc": "Create a pending-payment order", "schema": {"items": "array"}},
    4. "call_service": {"desc": "Make an outbound voice call", "schema": {"script": "string"}}
    5. }
    6. def run(task):
    7. plan = planner(task) # Generate a sequence of steps
    8. for step in plan:
    9. if step.risk == "high":
    10. ask_user_confirm(step) # Force human confirmation for high-risk steps
    11. result = executor(step, tools)
    12. if not verify(result):
    13. plan = replan(task, result) # Return to planning if verification fails
    14. return summarize(plan)

    3. Key Capability 1: Reliable Tool Calling

    Getting things done depends on tool calls rather than the model improvising. Engineering practice requires the following: define a strict parameter schema for each tool and validate it up front; introduce idempotency keys for write operations to avoid duplicate orders; set timeouts, retry limits, and circuit breakers for external calls; and preserve the original wording when mapping natural-language requests to structured parameters, so that audits are possible. Inputs and outputs of all calls should go into a logging service to form a traceable chain.

    4. Key Capability 2: Voice Interaction and Human-Like Communication

    For outbound voice scenarios, the technical focus is in four areas: noise robustness in speech recognition, intent and slot extraction in semantic understanding, naturalness and pause control in speech synthesis, and dialogue state management (when to ask a follow-up question, when to confirm, and when to end). It is important to emphasize that human-like behavior should only appear in the interaction experience. When it comes to recording, identity disclosure, and user authorization, compliance and transparency are mandatory, and the relevant prompts and records cannot be omitted.

    5. Key Capability 3: Retrieval Augmentation and Authoritative Material

    To “find reliable answers from more authoritative material,” the general approach is retrieval-augmented generation: first parse and clean the documents, then chunk them along semantic boundaries and build a vector index. At the retrieval stage, combine keyword and vector recall, with reranking to improve relevance. At the generation stage, require citations of source snippets and apply a fallback policy of “no answer without evidence.” When material is updated, use incremental ingestion and version tagging to avoid answers citing outdated content.

    6. Engineering in Practice: Permissions, Evaluation, and Cost

    • Least privilege: grant a tool whitelist per task, and isolate write operations and payment actions separately;
    • Human-machine collaboration: high-risk steps must be confirmed, with one-click rollback and human takeover;
    • Evaluation system: establish four metrics: task success rate, step redundancy, citation accuracy, and human takeover rate;
    • Cost governance: cache repeated requests, control context length, and use large models for planning and small models for extraction;
    • Observability: tracing plus monitoring alerts, with automatic degradation to a rule-based flow on anomalies.

    7. Conclusion

    The dividing line between “telling you how to do it” and “doing it for you” lies not in model parameters but in tooling, the verification loop, and permission design. Master the general methods above and build on general capabilities such as Baidu AI Cloud’s container platform, object storage, message queue, logging service, and monitoring alerts, and you can reliably deliver auditable agent applications.