A Practical Guide to Building AI Agent Applications on a Platform

    This article explains why building conversational AI agents benefits from a platform approach, the four common application types and how to choose among them, and a five-layer technical architecture. It then walks through six implementation steps, from defining task boundaries and structuring prompts to retrieval quality, tool governance, evaluation-driven iteration, and release, along with common pitfalls and how to avoid them. Readers will gain a practical engineering methodology for turning ideas into operable agent applications.

    1. Why Agent Development Needs a Platform

    Building a conversational AI application traditionally requires a team to cover several engineering disciplines at once. First, you design and repeatedly tune prompts and dialogue flows. Then you build backend services to connect to model APIs, and implement session context storage, message persistence, and the parameter parsing and result handling for tool calls. If you need to incorporate private knowledge, you also have to handle document parsing, chunking, vectorization, writing into a vector retrieval store, and tuning recall. Finally, you still need to deliver the frontend interface, deployment, key management, rate limiting, and access control. A long pipeline, many roles, and frequent rework are the most common sources of cost during the prototype stage.

    The value of a platform is that it turns these shared capabilities into reusable components: model integration and switching, context management, knowledge base retrieval, tool encapsulation, logging and observability, and publishing and integration are all provided in a configurable way. Product managers, operations staff, and even interns can produce an interactive, usable prototype by configuring prompts and flows alone, lowering the barrier from “idea to application” so that everyone can participate.

    2. Four Application Types and How to Choose

    Mainstream agent platforms typically offer four basic application types. The choice should always come back to the business problem itself:

    • Chat assistants: for multi-turn interaction scenarios such as after-sales Q&A and internal knowledge lookup, where the focus is intent understanding and context consistency.
    • Text generation: for batch content production such as summarization, rewriting, translation, and structured extraction, where the focus is templating and batch invocation.
    • Agents: for composite scenarios that require task decomposition and external tool calls, such as retrieving information and then producing a consolidated analysis, where the focus is planning capability and tool reliability.
    • Workflow orchestration: for processes with deterministic steps and clear branches, such as conditional logic, API calls, and data processing, where the focus is observability and retryability.

    Practical advice: if a workflow can solve the problem deterministically, do not leave it to an agent’s free planning; introduce agent capabilities only when the input is unpredictable and the path requires dynamic decisions. This trade-off directly determines the stability of the system and the cost of debugging.

    3. Understanding the Technical Architecture in Layers

    A usable agent platform can usually be abstracted into five layers:

    1. Access layer: a web console and open APIs, supporting delivery either by sharing a link or by API integration.
    2. Orchestration layer: prompt editing, variable injection, conditional branches, loops and parallelism, and sub-flow reuse.
    3. Capability layer: model management and routing, retrieval augmentation (document parsing—chunking—vectorization—recall—reranking), and tool registration and invocation protocols.
    4. Data layer: session and message storage, knowledge base and vector indexes, and annotation data and evaluation sets.
    5. Operations layer: call logs, trace tracking, token and latency observability, permission and key management, and release and canary rollout.

    Understanding the layers matters because it helps you locate problems: if answers are inaccurate, look first at retrieval and prompts; if a tool does not take effect, look first at parameter schemas and error propagation; if performance fluctuates, look first at model routing and trace latency.

    4. Six Steps for Implementation

    Step 1: Define the task boundary and acceptance criteria. Specify the input and output formats, the refusal policy, and the systems that must be called, and write down quantifiable metrics (such as first-answer accuracy, task completion rate, and average number of turns).

    Step 2: Structure the prompt. Separate the role, constraints, steps, and output schema, as in the following example:

    1. Role: You are an enterprise knowledge base assistant.
    2. Constraints: Answer only based on retrieved snippets; if the snippets are insufficient, state clearly what is missing and do not speculate.
    3. Steps: 1) Determine the question type 2) Retrieve 3) Summarize 4) Provide source numbers
    4. Output: {"answer": string, "sources": number[], "confidence": 0-1}

    Step 3: Prioritize retrieval quality. Choose chunk granularity based on semantic completeness rather than a fixed character count; preserve structural information for tables and heading levels; after recall, add reranking and threshold filtering, preferring to return less rather than noise.

    Step 4: Govern tools and APIs. Declare a clear name, purpose, parameter schema, and failure semantics for each tool; set timeouts, retries, and idempotency keys for external calls to avoid duplicate writes.

    Step 5: Drive iteration with evaluation. Build a fixed evaluation set that covers normal questions, boundary questions, unauthorized-access questions, and tool-failure scenarios, and change only one variable per iteration before running a regression.

    Step 6: Release and operate. Start with a small canary traffic slice, enable logging and annotation entry points, and feed real online issues back into evaluation samples to form a closed loop.

    5. Common Pitfalls and How to Avoid Them

    • Unbounded context growth: set limits on turns and tokens, and apply summary compression when the limit is exceeded.
    • Hallucination and unauthorized answers: require source citations, and fall back to a default response when retrieval returns nothing.
    • Incorrect tool calls: tighten tool descriptions, and add pre-checks and human confirmation steps.
    • Out-of-control cost: route models by scenario tier, sending simple tasks to lightweight models.
    • Lack of observability: from day one, integrate common cloud capabilities such as logging, trace tracking, and monitoring alerts.

    6. How It Differs from General Development

    Compared with coding from scratch, a platform-based approach has clear advantages in prototyping speed, out-of-the-box context and knowledge base capabilities, and release and integration. However, for highly customized interactions, special compliance deployments, and deep performance tuning, you still need to build on your own using general infrastructure such as container platforms, object storage, and message queues. A reasonable strategy is to complete prototyping and operational validation quickly on a platform, then move critical paths to self-built services once they are stable, connecting the two through standard APIs. Baidu AI Cloud provides relatively complete support at this general infrastructure level and can serve as one reference option for an architecture of this kind.

    In summary, the core of building agents is not any particular tool, but the engineering methodology of “clear task boundaries, reliable retrieval, controllable tools, and a closed evaluation loop.” Master it, and regardless of the platform you use, you can turn ideas into operable applications reliably.