AI Agents in Practice: From Answering Questions to Executing Tasks

    This article explains why a model that can answer questions is not the same as a system that can complete tasks, and presents a general technical blueprint for building AI agents. It covers a four-layer architecture (model, tool, data, and governance), tool calling with a closed execution loop, retrieval-augmented generation for hallucination control, knowledge base constraints and context engineering, structured multimodal output, and reliability and security boundaries. The guidance is based on general cloud capabilities such as Baidu AI Cloud and is not tied to any single vendor's proprietary features.

    1. Background: Why “Answering” Is Not “Getting Things Done”

    Over the past two years, the capability boundary of large language models has expanded rapidly: writing articles, writing code, summarization, generating images and videos, and creating memes have all become baseline abilities. But in real business scenarios, what users truly need is often not a piece of text but a result: an order that has been placed successfully, a document that has already been revised, or an itinerary that has been planned and is ready to execute.

    The gap here is essentially the gap between information delivery and task delivery. Traditional search returns a list of links, and users still have to judge, click, compare, and fill in forms themselves; general-purpose LLMs return natural-language suggestions, and users still have to complete all the follow-up operations themselves while bearing the risk of the model “confidently making things up.” Therefore, the direction that is truly worth investing in engineering is placing the model inside an execution framework that can call tools, access data, and verify results — what is commonly referred to as an agent system.

    It should be clear that this article does not recommend or review any specific vendor’s product. Instead, it abstracts the general technical paradigm behind this class of capability and discusses how to build a controllable, observable, and extensible task execution system using general cloud capabilities such as Baidu AI Cloud.

    2. Capability Layers: A Four-Layer Architecture from Model to Agent

    A system that can “get things done” can usually be broken down into four layers:

    1. Model layer: responsible for understanding intent, decomposing tasks, and generating structured decisions.
    2. Tool layer: packages business capabilities into interfaces the model can call, such as querying, order creation, payment redirection, calendar writing, and ticket creation.
    3. Data layer: provides authoritative, traceable knowledge and business context to suppress hallucinations.
    4. Governance layer: responsible for permissions, auditing, rate limiting, monitoring and alerting, and human fallback.

    In many failed projects, the problem lies not in the model layer but in the tool layer and the governance layer: vague interface semantics cause the model to select the wrong tool; the lack of idempotency design leads to duplicate orders; the absence of permission boundaries leads to unauthorized operations. These three are the most common pitfalls in engineering practice.

    3. Key Mechanism 1: Tool Calling and the Execution Loop

    The quality of tool calling depends on the “understandability” of the interface. In practice, it is recommended to provide a clear name, purpose description, parameter schema, and failure semantics for each tool, for example:

    1. {
    2. "name": "create_order",
    3. "description": "Create a pending-payment order for the specified product; create only, no charge",
    4. "parameters": {
    5. "sku_id": "string, unique product identifier",
    6. "quantity": "integer, default 1, range 1-99",
    7. "contact": "string, contact information"
    8. },
    9. "idempotency_key": "string, unique key generated by the client, used to prevent duplicate orders"
    10. }

    The execution loop should include: intent recognition → parameter extraction → parameter validation → secondary confirmation → call execution → result verification → state write-back. Among these, “secondary confirmation” and the “idempotency key” are necessary designs for financial and fulfillment operations; result verification requires the system not to simply trust the interface response but to recheck the final state through query interfaces.

    4. Key Mechanism 2: Retrieval Augmentation and Hallucination Suppression

    The biggest problem with using a general-purpose model directly as a search engine is the lack of evidence constraints. A more robust engineering approach is retrieval-augmented generation: first retrieve authoritative corpus, then have the model answer based on the given fragments and provide citation sources; when retrieval confidence is insufficient, explicitly reply “no supporting evidence found” rather than generating freely.

    A simplified pseudocode logic is as follows:

    1. def answer(query):
    2. docs = retriever.search(query, top_k=8)
    3. if max_score(docs) < THRESHOLD:
    4. return "Existing material is insufficient to support a conclusion; additional material is recommended"
    5. context = rerank_and_truncate(docs)
    6. return llm.generate(query, context, require_citation=True)

    For cloud implementation, document parsing, chunking, and vectorization can be written into object storage and a vector retrieval service, a message queue can decouple offline indexing from online queries, and logging and monitoring/alerting services can track metrics such as recall rate and citation hit rate.

    5. Key Mechanism 3: Knowledge Base Constraints and Context Engineering

    High-quality output depends on high-quality input. Unifying PDFs, web pages, long articles, meeting minutes, and lecture notes into a knowledge base and performing structured parsing (heading hierarchy, tables, formulas, image captions) can significantly improve answer stability. The focus of context engineering is budget allocation: the system prompt, retrieved fragments, conversation history, and tool return results need to compete for a limited context window. The usual approach is to compress history, rerank fragment relevance, and produce layered summaries for long documents.

    6. Key Mechanism 4: Multimodal and Structured Output

    Requirements such as “one-click generation of mind maps, briefings, voiceover scripts, quiz questions, memory cards, presentations, and illustrated notes” are, in engineering terms, about having the model output constrained structured data and then having the rendering layer convert it into the final format. For example, have the model output only an array of nodes and let the frontend render the mind map; output slide outline JSON and then have a template engine generate the presentation. This decouples “content correctness” from “layout aesthetics,” making them easier to test and iterate separately.

    7. Reliability and Security Boundaries

    • Least privilege: isolate tool credentials by scenario, and separate write operations from read operations.
    • Full-chain auditing: record inputs, retrieved fragments, tool calls, and returns for retrospection.
    • Human fallback: route high-risk actions to human confirmation and set up rollback paths.
    • Cost control: cache repeated requests, and limit the maximum number of tool-calling rounds and the maximum context length.
    • Evaluation system: build an offline test set to separately evaluate intent accuracy, parameter extraction accuracy, task completion rate, and citation correctness.

    8. Conclusion

    The real watershed for AI is not whether it can generate a beautiful piece of text, but whether it can reliably finish tasks within controlled boundaries. For developers, the directions worth investing in are tool semantic design, retrieval evidence constraints, structured output, and governance and observability; these capabilities can be built gradually on general cloud infrastructure rather than depending on the proprietary features of any single product.