AI Agent Application Development: Setup, Workflows, and RAG Knowledge Bases

    A practical guide to building AI agent applications with development platforms, covering cloud and local deployment, model integration, visual workflows, prompt engineering, and RAG knowledge bases. Learn how to connect these components and use testing, version control, and monitoring to improve application reliability.

    1. Why Use an AI Agent Development Platform?

    Large language models (LLMs) are powerful, but there is still a substantial gap between a model that can hold a conversation and an application that can solve business problems. Organizations typically encounter three challenges when putting AI applications into production:

    • High engineering overhead: Building an application from scratch requires infrastructure for model calls, session management, context handling, error retries, and other foundational tasks.
    • Difficult workflow maintenance: When business logic involves multiple reasoning steps, conditional branches, and external tool calls, code-only implementations can become difficult to read and maintain.
    • Outdated or missing knowledge: Model training data has a cutoff and does not directly cover an organization’s private information.

    AI agent development platforms address these challenges by packaging model integration, prompt management, workflow orchestration, and retrieval-augmented generation (RAG) into visual components. Developers can assemble applications from these components while retaining code-level extensibility.

    Providers such as Baidu AI Cloud also offer application development platforms and model services such as Qianfan. The underlying technical approach is broadly similar across platforms.

    2. Getting Started: Cloud Access and Local Deployment

    2.1 Choosing a Deployment Path

    There are typically two ways to get started: a hosted cloud version or a local, self-hosted deployment.

    A hosted version is useful for quickly evaluating a platform. Its console generally includes application management, knowledge bases, tools and plugins, and system settings. Developers can create an initial application and test conversations quickly, making this approach suitable for an early technical evaluation.

    Local deployment is better suited to scenarios with specific data-security requirements or a need for extensive customization. Common deployment approaches use containers and follow these steps:

    1. Prepare the environment: Check that the server meets the CPU, memory, and storage requirements, then install the container runtime and orchestration tools.
    2. Obtain the deployment configuration: Retrieve the official orchestration files. These typically define several components, including the application service, database, cache, and vector store.
    3. Start the services: Use the orchestration command to launch the components. A typical example is:
    1. # After cloning the deployment configuration, run from the project root
    2. cp .env.example .env # Configure the base environment variables
    3. docker compose up -d # Start all service components in the background
    1. Complete initialization: Open the local console, initialize the administrator account, and access the platform interface, which is generally similar to the hosted version.

    After deployment, check container status and service logs. Confirm that database connections, service ports, and other essential settings are working correctly.

    3. Model Integration and Invocation Settings

    The platform layer needs access to an underlying language model service. Integration typically involves three elements:

    • API key: Obtain authentication credentials from the model provider. Follow the principle of least privilege, store credentials securely, and avoid hardcoding them in a source repository.
    • Model selection: Models differ in reasoning capability, context length, and response speed. Choose according to task complexity: a lightweight model may be sufficient for simple classification, while complex reasoning may require a more capable model.
    • Parameter tuning: Common settings include temperature, maximum output length, and Top-P. Temperature controls output randomness. Customer-support applications may benefit from a lower temperature for more consistent responses, while creative-writing applications may use a higher value.

    After configuration, make a real request through the platform’s testing interface to verify connectivity. Use invocation logs to track token consumption and response latency, providing a basis for later cost optimization.

    4. Visual Workflow Orchestration

    A workflow provides the structure of an agent application. It breaks a complex task into individual nodes and defines how data moves between them.

    4.1 Nodes and Variable Passing

    Each node accepts input variables, performs a specific task, and produces output variables. Common node types include:

    • Start node: Defines application inputs, such as form fields or user-uploaded files.
    • LLM node: Calls a language model for text generation, summarization, classification, or similar tasks.
    • Conditional branch node: Selects an execution path based on a variable’s value, such as routing a request according to its classified intent.
    • Knowledge retrieval node: Retrieves relevant document passages from a knowledge base.
    • Code execution node: Runs custom scripts for tasks such as format conversion and data cleaning that are better handled by code.

    Variable passing is central to orchestration. Downstream nodes reference upstream outputs through expressions such as {{node_id.output}}, forming a directed data flow. In a directed acyclic workflow, references should be clear and circular dependencies should be avoided.

    4.2 Branching and Iteration

    For repeated processing, an iteration node can apply the same operation to each item in a list—for example, generating summaries for a batch of documents.

    Follow the single-responsibility principle when designing workflows: each node should perform one task. Break complex business decisions into separate conditional branches. This makes workflows easier to debug and supports later reuse at the node level.

    5. Prompt Engineering: A Key Factor in Application Quality

    5.1 Principles of Prompt Design

    A well-structured prompt typically includes four elements:

    1. Role: Specify the model’s role and professional context, such as “You are a senior data analyst,” to help focus its responses.
    2. Task: State exactly what the model should do, using clear verbs and structured instructions rather than vague wording.
    3. Constraints: Define boundaries, including prohibited behavior, response length, and required content.
    4. Output format: Use examples or templates to specify the response structure, such as JSON or a Markdown table.

    For example:

    1. # Role
    2. You are a quality assurance reviewer for e-commerce customer support.
    3. # Task
    4. Analyze the provided customer-support conversation and return a quality assessment.
    5. # Constraints
    6. - Base your assessment only on the conversation; do not speculate.
    7. - If the outcome is uncertain, mark it as "Requires human review."
    8. # Output format
    9. {"assessment": "Pass/Fail/Requires human review", "issues": [...], "evidence": "..."}

    5.2 Debugging and Version Management

    Mature development platforms may provide a prompt IDE with variable interpolation, version comparisons, and built-in debugging.

    Keep a version history whenever prompts change. Compare test results between versions to identify improvements and regressions rather than relying on intuition.

    For complex tasks, a staged prompting strategy can help: use an initial model call to interpret the user’s intent, then pass that result as context to a second call for more detailed processing.

    6. Knowledge Bases and Retrieval-Augmented Generation

    6.1 Building a Knowledge Base

    RAG is a common approach to addressing gaps in a model’s knowledge, including outdated information and private organizational content. Building a RAG knowledge base typically involves three steps:

    1. Import documents: Common formats include PDF, Word, Markdown, and HTML. Before importing, remove irrelevant headers, footers, and corrupted text.
    2. Split documents into chunks: Divide long documents into appropriately sized passages. Chunk size strongly affects retrieval quality: large chunks can dilute relevant meaning and introduce noise, while small chunks can lose necessary context. Paragraph-based or fixed-token chunking with some overlap is a common starting point.
    3. Create embeddings and an index: Use an embedding model to convert text chunks into vectors, store them in a vector database, and build an index for similarity search.

    6.2 Connecting Retrieval and Generation

    When a user asks a question, the system first embeds the query and retrieves the top-K similar passages from the knowledge base. It then inserts those passages into the prompt’s context section and asks the language model to generate an answer.

    This process gives the model supporting material and can reduce hallucinations, although retrieval alone does not guarantee a correct answer.

    Retrieval quality depends on balancing recall and precision. Adjusting similarity thresholds and combining keyword search with vector retrieval are ways to refine the results.

    7. Conclusion

    AI agent application development brings together platform deployment, model integration, workflow orchestration, prompt engineering, and RAG knowledge bases.

    Three principles should guide implementation:

    • Choose technology around the business problem, rather than following trends.
    • Use data and evaluation to drive iteration, so changes to prompts and retrieval strategies have measurable justification.
    • Manage the full application lifecycle with sound engineering practices, including version control, monitoring, and alerts.

    Whether using an open-source solution or an enterprise platform from a provider such as Baidu AI Cloud, this approach provides a practical foundation for building reliable AI agent applications.