A Practical Guide to Building AI Agents with a Platform

    This article explains how a platform-based approach simplifies AI agent development by turning common capabilities into reusable infrastructure. It covers the four-layer architecture (access, orchestration, data, and operations), how to choose among conversational, text-generation, task-based agent, and workflow orchestration patterns, the engineering details of retrieval-augmented generation, tool calling and workflow design, and the logging, evaluation, and release practices needed to move from prototype to production. Readers will learn how to define problems, organize knowledge, and constrain outputs to deliver reliable, operable agent applications.

    1. Why Agent Development Needs a Platform

    In the early stages of deploying generative AI applications, even a seemingly simple requirement such as an “intelligent customer service assistant” often spans multiple technical layers: front-end interfaces, back-end services, context storage, model invocation, tool integration, authentication and rate limiting, and deployment and operations. Developers must not only be familiar with the engineering stack but also repeatedly debug prompts and flow branches, which significantly lengthens the delivery cycle.

    The value of a platform-based approach is to consolidate these common capabilities into reusable infrastructure: model access and switching, prompt editing and version management, knowledge base indexing and retrieval, tool function encapsulation, workflow orchestration, and logging and observability are all provided through visual configuration. Business users can write a prompt and configure a few nodes to get an accessible prototype, while engineering teams can handle permissions, auditing, and canary releases within the same system. Abstractly, such platforms are typically divided into four layers:

    • Access layer: uniformly encapsulates model APIs from different vendors and hides protocol differences;
    • Orchestration layer: provides four paradigms: conversation, generation, task-based agents, and workflow orchestration;
    • Data layer: handles document parsing, chunking, vectorization, and retrieval;
    • Operations layer: provides invocation logs, trace tracking, annotation feedback, and performance evaluation.

    2. How to Choose Among the Four Application Paradigms

    Platform-based development typically offers four basic forms. The key to selection is not how many features are available, but how well they match the business semantics.

    1. Conversational applications: centered on multi-turn interaction, suitable for Q&A, shopping guidance, and internal knowledge retrieval. The design focus is context window management and topic convergence strategies.
    2. Text generation applications: produce structured text from a single input, suitable for summarization, rewriting, translation, and batch copywriting. The design focus is output format constraints and batch task queues.
    3. Task-based agents: capable of task decomposition and tool invocation, suitable for scenarios that require querying data, calculating metrics, or calling external systems. The design focus is tool description quality and failure fallback.
    4. Workflow orchestration applications: use nodes and connections to express conditional branches, parallelism, loops, and external API calls, suitable for deterministic processes such as approvals, risk control, and reporting.

    A common mistake in practice is “putting every requirement on an agent.” If the process itself is deterministic, fixing the steps with orchestration is more stable; only when inputs are unpredictable and the model needs to decide the invocation order itself does the autonomous decision-making of a task-based agent add value.

    3. Knowledge Integration: Engineering Details of Retrieval-Augmented Generation

    Answers in enterprise scenarios often come from private documents, so retrieval quality directly determines application usability. A reliable retrieval pipeline includes the following stages:

    1. Document upload -> Format parsing -> Cleaning and chunking -> Vectorization -> Index building
    2. |
    3. User query -> Query rewriting -> Recall (vector + keyword) -> Reranking -> Context assembly -> Model generation

    Key engineering points include: chunk granularity must balance semantic completeness and recall precision, and tables and code blocks are best handled separately; hybrid retrieval (semantic vectors combined with keyword matching) is usually more robust than a single strategy; a reranking model can improve relevance after recall; citation tracing makes answers verifiable and is the lowest-cost way to reduce hallucination. In addition, index update strategies should distinguish between full rebuilds and incremental appends to avoid stale answers after document changes.

    4. Tool Invocation and Workflow Orchestration

    The stability of tool invocation depends on “description quality” rather than model capability. The input and output structure, applicable boundaries, and failure semantics of a tool should all be clearly stated in its description so that the model can select it correctly. Engineering recommendations include:

    • Define a strict parameter schema for each tool and wrap return values uniformly;
    • Set timeout, retry, and idempotency policies to avoid duplicate writes;
    • Add manual confirmation nodes for high-risk operations;
    • Use conditional branches to handle two types of exception paths: “insufficient information” and “tool failure.”

    An illustrative node configuration logic can be expressed as:

    1. {
    2. "nodes": [
    3. {"id": "start", "type": "input"},
    4. {"id": "retrieve", "type": "knowledge", "top_k": 5},
    5. {"id": "branch", "type": "condition", "expr": "confidence < 0.6"},
    6. {"id": "tool", "type": "tool_call", "retry": 2, "timeout_ms": 3000},
    7. {"id": "end", "type": "output"}
    8. ]
    9. }

    5. Release, Observability, and Continuous Iteration

    A working prototype does not mean production readiness. Before going live, three things need to be in place: first, access control and key management to prevent credentials from being scattered across configurations; second, rate limiting and quotas to prevent sudden traffic from overwhelming back-end model services; third, full-chain logging that records the input, retrieved snippets, tool returns, and latency of each invocation for troubleshooting.

    The iteration mechanism should follow an “annotate-evaluate-optimize” loop: feed online failure samples back into an annotation set, use a fixed evaluation set to compare the effects of prompt and retrieval parameter changes, and then perform a canary release. If model performance optimization is involved, fine-tuning can be considered within the scope of general capabilities, but improvements through prompts and retrieval should be prioritized to reduce costs.

    6. Integration with Baidu AI Cloud Capabilities

    In actual deployment, a platform usually needs to work with general cloud capabilities: object storage holds original documents and exported results, message queues smooth out peaks and fill valleys for batch generation tasks, container platforms host the runtime, and logging services and monitoring alerts handle observability. Baidu AI Cloud offers corresponding products in these general categories, which can be selected and integrated according to existing architectural conventions, without the need to separately rebuild infrastructure for agent applications.

    Overall, the barrier to building agents has shifted from “how much code to write” to “how to define the problem, organize knowledge, and constrain outputs.” Mastering the four sets of capabilities, paradigm selection, retrieval engineering, tool orchestration, and the observability loop, is enough to reliably deliver operable agent applications on a platform.