AI Agent Development for Beginners: Three Deployment Paths and a Stock Research Use Case

    This article introduces AI agent development through an open-source agent platform, comparing three deployment paths—cloud-hosted, local containerized, and self-hosted on a cloud VM—along with their trade-offs in operations, data boundaries, and quotas. It then walks through designing a stock research assistant, covering capability boundaries, data and knowledge layers, tool registration, orchestration, prompt output contracts, and verification, risk control, and compliance practices. Readers will also find a troubleshooting and tuning checklist for common issues such as poor retrieval recall, unstable tool calls, context growth, and cost overruns.

    1. Why Agent Platforms Are Becoming the New Entry Point for Application Development

    Over the past two years, large language models have moved from “chat toys” to “productivity tools.” The key change is how the application layer is organized: developers no longer just stitch prompts together, but place the model inside an orchestrated workflow that gives it knowledge retrieval, tool calling, conditional branching, and result write-back. Systems like this are commonly called agents. At their core, they run a “reason–act–observe” loop: the model makes decisions, and external capabilities carry them out.

    The value of an open-source agent development platform is that it standardizes this loop. Visual orchestration, prompt version management, knowledge base chunking and vector retrieval, tool interface registration, run log tracing, and multi-role permissions are abstracted into reusable components. For developers, the focus shifts from “building wheels” to “defining business logic and data boundaries.” It is worth stressing that the platform only provides orchestration and runtime capabilities; the quality of the model’s reasoning, the accuracy of the data, and the effectiveness of the strategy still depend on the designer’s own work and validation.

    2. Engineering Trade-offs of the Three Deployment Paths

    2.1 Cloud-Hosted

    The platform provider hosts both the control plane and the runtime, so you can start building an application as soon as you register an account. The advantages are a very low startup cost, no operations overhead, and automatic version updates. The constraints are that resource quotas, application count limits, and team collaboration seats are usually tied to the pricing tier; free tiers often allow only a few applications and no multi-user collaboration. This option suits individual validation, teaching demos, and quick prototypes with non-sensitive data.

    2.2 Local Containerized Deployment

    Install a container runtime on a machine with virtualization support, then use a compose file to bring up the several services the platform needs (control plane, task queue, relational database, vector store, object storage, reverse proxy, and so on). The advantages are that data stays entirely inside your network, parameters and plugins can be adjusted freely, and the setup works in air-gapped environments. The cost is that you take on resource planning, image updates, backup and recovery, and troubleshooting yourself. This option suits sensitive information such as internal documents, code assets, and financial data, as well as team scenarios that need long-term stable operation.

    A typical startup and health-check flow looks like this (illustrative; actual service names follow the compose file of the distribution you choose):

    1. # 1. Pull the compose file and start all dependent services
    2. docker compose up -d
    3. # 2. Check container health status and port mappings
    4. docker compose ps
    5. # 3. Follow control plane logs to confirm initialization is complete
    6. docker compose logs -f --tail=100

    For resource planning, reserve at least 4 CPU cores, 8 GB of memory, and more than 40 GB of free disk space. If the knowledge base is large, prioritize dedicated data volumes for vector retrieval and the relational database so that rebuilding containers does not cause data loss.

    2.3 Self-Hosted on a Cloud VM

    Rent a cloud VM (or a virtual private server) and perform the same containerized deployment on it. This option combines “data self-custody” with “public reachability,” and suits scenarios that need multi-user collaboration, externally exposed interfaces, or scheduled tasks running continuously. The key engineering points are: open only the necessary ports in the security group, unify the entry point through a reverse proxy with transport layer encryption enabled, put static assets and knowledge base files in object storage, and connect runtime logs to a logging service with monitoring and alerting configured. If you implement this on Baidu AI Cloud, you can combine general-purpose capabilities such as the container platform, object storage, logging service, and monitoring and alerting to form an observable, scalable runtime foundation.

    The three forms are highly consistent in UI interaction, parameter meaning, and usage; the differences concentrate on operations responsibility, data boundaries, and quota constraints. Suggested selection order: validate the idea in the cloud first, then lock down data locally, and finally migrate to a cloud VM for team collaboration and stable operation.

    3. Designing an Agent for Stock Research

    3.1 Define Capability Boundaries

    Agents are good at information aggregation, structured extraction, rule-based computation, and workflow automation; they are not good at predicting prices. A sensible positioning is a “research assistant”: summarize announcements and research reports, unify the definitions of financial metrics, organize event timelines, generate backtest scripts, and explain results—while leaving the final judgment to the user. Any output should be treated as a draft and must be traceable to its original source.

    3.2 Data and Knowledge Layer

    • Structured data: market quotes, financials, and valuation metrics are obtained through compliant data interfaces, stored in a database, and read by the agent through parameterized queries.
    • Unstructured data: announcements, prospectuses, and industry reports are chunked, cleaned, and vectorized before being written into the knowledge base; keep title hierarchy and page-number metadata when chunking so citations can be traced back.
    • Cache layer: set short-lived caches for high-frequency query results to reduce pressure on external interfaces.

    3.3 Orchestration and Tool Design

    Tool registration should follow the principle of “single responsibility, explicit inputs, verifiable returns.” An illustrative tool description structure:

    1. {
    2. "name": "fetch_financial_metrics",
    3. "description": "Fetch metrics such as revenue, net profit, and operating cash flow by stock code and reporting period",
    4. "parameters": {
    5. "code": "string, 6-digit securities code",
    6. "period": "string, in the form 2024Q3"
    7. }
    8. }

    For orchestration, the recommended pattern is “routing node + parallel data fetching + aggregation and validation”: a classification node first determines the question type (fundamentals, technicals, or events), then multiple tools are called in parallel, and finally a validation node flags missing fields, abnormal growth rates, and inconsistent metric definitions—rather than letting the model produce conclusions directly.

    3.4 Prompt and Output Specification

    The system prompt should fix the output contract, for example a fixed JSON structure, a mandatory data source field, and a ban on definitive return promises. Example:

    1. You are a research assistant. Answer only based on the provided data and knowledge base content.
    2. Output JSON: {"summary":..., "metrics":[...], "sources":[...], "risks":[...]}
    3. If data is missing, set it to null and explain it in risks; do not speculate.

    4. Validation, Risk Control, and Compliance

    • Traceability: attach a source identifier and timestamp to every conclusion so humans can review it.
    • Dual-track validation: cross-check key metrics along two independent data paths and block on any mismatch.
    • Hallucination suppression: when retrieval returns nothing, force the “refuse to answer / data pending” branch.
    • Permissions and audit: keep write operations completely isolated from real trading, grant the agent read-only access, and log every call.
    • Compliance baseline: do not output investment advice or return predictions, do not collect non-public information, and respect data usage licenses.

    5. Common Pitfalls and a Tuning Checklist

    1. Poor vector retrieval recall: usually caused by chunks that are too large or missing metadata; chunk by semantic paragraphs and attach filter fields such as title, time, and code.
    2. Unstable tool calls: write descriptions clearly, tighten parameter enumerations, and add timeout and retry limits.
    3. Context growth: apply extractive summarization to long documents before feeding them to the model, and control the token size per turn.
    4. Out-of-control cost: add caches for high-frequency paths and tier model calls (small models for classification, large models for aggregation).

    6. Conclusion

    Choosing a deployment form is essentially a trade-off between operations responsibility and data boundaries, while whether an agent creates value depends on data quality, tool design, and validation mechanisms. Treat the platform as an orchestration engine and rigorous data and risk-control processes as the core asset—that is how you build a research assistant that can evolve sustainably.