Agent Development in Practice: From Prompts to Multi-Agent Collaboration

    This article presents a practical, vendor-neutral path for building AI agents, structured across five layers: core concepts, prompt engineering, tool and knowledge base integration, multi-agent collaboration, and evaluation and deployment. It explains why agents should assume the underlying model is unreliable and how retrieval, tool calls, structured output, and task decomposition constrain that behavior. Readers will find a reusable six-layer reference architecture, a five-element system prompt template, tool description and least-privilege practices, retrieval pipeline guidance, orchestration and metric recommendations, and a staged rollout path. The emphasis is on defining problems clearly, constraining behavior precisely, and evaluating results rigorously rather than on simply wiring up APIs.

    1. Why Agent Development Matters Now

    The capability boundaries of large language models have been repeatedly reassessed over the past two years, yet what actually converts model capability into productivity is not the model itself but the “execution layer” built around it. An AI agent is the engineered form of that execution layer: it uses a large language model as its reasoning core, connects to perception inputs, tool calls, and memory storage, and autonomously plans steps and delivers results toward a given goal.

    The technical barrier to agent development is dropping quickly. Early on, building a usable agent required familiarity with model invocation, vector retrieval, function orchestration, and deployment. With no-code and low-code paradigms now mature, business users can complete most of the work through visual orchestration. This does not devalue engineering skills; it shifts the focus from implementation to defining the problem, constraining behavior, and evaluating results.

    This article takes a general technical perspective and lays out a practical path for building agents across five layers: concepts, prompts, tools and knowledge bases, multi-agent collaboration, and evaluation and deployment.

    2. Technical Foundation: How a Model Becomes the Agent’s Engine

    2.1 How Models Work and Where Their Limits Lie

    A large language model is fundamentally probabilistic sequence generation: given a context, it predicts the most likely next token, one at a time. Two consequences follow directly. First, the model has strong language understanding, summarization, and generation abilities, and can handle classification, extraction, and rewriting in zero-shot settings. Second, it is naturally prone to hallucination, stale knowledge, and reasoning decay over long chains.

    A mature agent design therefore assumes the model is unreliable by default and converges its output through external constraints:

    • Use retrieval to supply up-to-date knowledge instead of relying on parametric memory.
    • Use tool calls instead of letting the model “compute” or “look things up” on its own.
    • Use structured output and validation steps to intercept format drift.
    • Use step decomposition to reduce the complexity of any single inference.

    2.2 Where Agents Differ from Chatbots

    A chatbot’s interaction loop ends with a text reply; an agent’s loop ends with task completion. The difference comes down to three points: whether there is a goal state, whether the system can change the external world (write files, send requests, update records), and whether there is a rollback-capable execution trace. A simple test for whether a requirement truly needs an agent: if the task can be solved in a single question-and-answer exchange, do not introduce an agent, because the extra orchestration only adds latency and failure surface.

    2.3 A Reference Architecture

    A reusable agent architecture typically has six layers: an input layer (multimodal or structured data ingestion), a planning layer (task decomposition and strategy selection), a memory layer (short-term context and long-term vector storage), a tool layer (external interfaces and code execution), an output layer (format constraints and rendering), and an observability layer (logs, tracing, and metrics). The value of low-code platforms is that they package the last four layers as draggable nodes, letting developers focus on the planning layer and prompt design.

    3. Prompt Engineering: The Agent’s Behavioral Contract

    A prompt is not a magic spell; it is the agent’s behavioral contract. A sound system prompt should explicitly state five elements:

    1. [Role] You are a retrieval assistant for an enterprise knowledge base, and you answer only from the provided material.
    2. [Goal] For each user question, output a conclusion of no more than 200 words with citation numbers.
    3. [Context] The knowledge base was last updated on <date>; the users are frontline operations staff.
    4. [Constraints] If the material does not cover the question, answer "no supporting evidence found"; do not speculate.
    5. [Output] JSON: {"answer": string, "citations": number[]}

    Three practices deliver the highest returns on top of that.

    First, context must be sufficient and relevant. Irrelevant information not only wastes the window but also dilutes attention, causing key constraints to be ignored. Second, complex tasks must be decomposed. Split “analyze this log and draw a conclusion” into “extract anomalous lines -> classify error types -> count frequency -> generate the conclusion,” so each step can be verified on its own. Third, make good use of delimiters and examples. Delimiters separate instructions from data and prevent user input from being executed as instructions; few-shot examples stabilize output style without fine-tuning.

    Among advanced techniques, chain-of-thought guidance (asking the model to state reasoning points before the conclusion) noticeably improves multi-step reasoning quality, but it should be used cautiously in low-latency scenarios because it also enlarges the output length and exposes more steps where errors can occur.

    4. Tool Integration and Knowledge Bases: Letting the Agent Act

    The engineering focus of tool calling is description, not implementation. A tool’s name, parameter descriptions, and return structure are effectively part of the prompt; vague descriptions directly cause the wrong tool to be selected. For each tool, document the applicable scenarios, the non-applicable scenarios, and the shape of failure returns.

    On the knowledge base side, the common approach is four steps: document chunking, vectorization, retrieval recall, and reranking. Chunk granularity should match the granularity of the questions: chunks that are too coarse introduce noise, while chunks that are too fine lose context. Adding reranking and threshold filtering after recall is the most economical way to suppress hallucination.

    For scenarios that require connecting an agent across systems, the industry commonly adopts a standardized context protocol to unify how tools and data sources are exposed, so the same agent logic can be reused against different backends with lower coupling. Engineering should also follow the least-privilege principle: credentials assigned to an agent should cover only the interfaces required to complete the task, and write operations should include a human confirmation step.

    5. Multi-Agent Collaboration, Evaluation, and Deployment

    A single agent performs best when its responsibility is narrow. When a task spans multiple specialized domains, multi-agent systems (MAS) improve overall completion through role separation and message passing. Two points are key in practice: make the orchestration topology explicit to avoid the goal drift and cost blowup that free-form conversation causes, and add an aggregation node to check result consistency.

    Evaluation must come first. Observable metrics should include at least task success rate, tool call accuracy, average number of steps, cost per task, and human takeover rate. The recommended rollout path is offline test-set regression -> canary traffic -> full rollout, while keeping change records for prompts and model versions so that performance shifts can be traced back.

    To push further beyond a platform’s limits, the code-level next step is to master asynchronous invocation, streaming output, concurrent tool orchestration, and retry strategies for failures. For cloud deployment, container platforms can host the runtime, object storage can hold knowledge base files, message queues can smooth traffic spikes, and logging plus monitoring and alerting services can provide end-to-end observability. General-purpose cloud product categories from providers such as Baidu AI Cloud can serve as the underlying foundation for this kind of architecture.

    6. Conclusion

    The core competitive skill in agent development has shifted from “can you get the APIs working” to “can you define the business problem clearly, write the behavioral constraints rigorously, and make the evaluation solid.” Starting from the prompt contract and layering on tools, knowledge bases, and collaboration mechanisms is the sustainable engineering path.