Agentic Example

Equity Investment Research

High-Level Structure

The workflow runs in RAGFlow’s visual canvas (drag-and-drop nodes). It starts with a user query (e.g., “Analyze Apple’s financials” or “What’s the outlook for AAPL?”) and ends with a complete report including: - Financial metrics (tables from APIs) - Qualitative insights (from internal knowledge base + external sources) - Synthesized analysis (summary, overview, performance, trends, recommendation, citations)

Key flow: 1. Input → Ticker Extraction
2. Conditional check (valid ticker?)
3. Data collection (financials + research)
4. Synthesis & Report Generation
5. Output

Agents are modular nodes; they can call tools (e.g., web search, APIs), retrieve from knowledge bases, or delegate to sub-agents. The system maintains context (e.g., the ticker) across nodes for seamless handoffs.

The Main Agents & How They’re Set Up

RAGFlow agents are configured with: - Role/system prompt — Defines personality, expertise, rules (e.g., “Act as a senior investment banker”, “Output only JSON”, “Never fabricate data”). - Tools — External functions/APIs they can call (via function calling). - Knowledge bases — RAG retrieval from uploaded/parsed documents. - Output constraints — Strict formats to make handoffs reliable.

Here are the key agents in this workflow:

  1. Stock Code Extraction Agent (or “Search Agent”)
    • Role: Turn natural language into a standard ticker (e.g., “Apple” → “AAPL”).
    • Setup: Strict prompt — output only the ticker or “Not Found” (no extra text). Uses Tavily Search tool for ambiguous cases (e.g., if company name is unclear).
    • Why agentic? It reasons autonomously: if the query is vague, it calls a search tool to resolve → demonstrates tool use and planning (decide if/when to search).
  2. Information Extraction Agent (Coordinator/Planner Agent)
    • Role: Gather qualitative insights once ticker is known.
    • Setup: Acts as a planner — its prompt tells it to delegate subtasks:
      • Call AlphaVantage API (via MCP tool) for earnings transcripts, key insights.
      • Trigger Internal Research Report Retrieval Agent (sub-agent) for internal docs.
    • Outputs structured sections (e.g., “alphavantage”: raw transcript; “internal”: full reports).
    • Agentic aspect: This is where multi-agent delegation shines — it autonomously plans steps (“I need external + internal → call these”), calls tools/agents, aggregates results.
  3. Internal Research Report Retrieval Agent (Sub-agent)
    • Role: Pure retrieval from RAGFlow’s internal knowledge base.
    • Setup: Uses Retrieval Tool on a dataset (e.g., Hugging Face “company_financial_research_agent” — parsed research reports with structure preserved: abstracts, forecasts, risks). Supports aliases, merges multiple reports chronologically.
    • Agentic? Less reasoning, more execution — but fits into the multi-agent pattern as a specialized worker.
  4. Research Report Generation Agent (or “Report Agent”/“Analyze Agent”)
    • Role: Senior analyst — synthesize everything into a professional report.
    • Setup: Detailed role prompt (experienced IB analyst). Strict structure:
      • Sections: 1. Summary, 2. Company Overview, 3. Recent Financial Performance, 4. Industry Trends, 5. Investment Recommendation, 6. Appendix/References.
      • Rules: Preserve conflicting viewpoints (don’t merge), use tables for comparisons (e.g., Buy/Hold ratings from sources), cite everything (source, date, institution).
      • Input: Formatted financial table + extracted research texts.
    • Agentic aspect: Heavy reasoning + synthesis. It analyzes, compares sources, draws conclusions — all grounded in provided data (no hallucination allowed).

Supporting nodes (not agents but crucial): - Yahoo Finance Tool — Fetches balance sheet/income data. - Code Node (Python) — Formats raw API data into clean Markdown tables. - Conditional Node — Branches (e.g., invalid ticker → error message).

How Agents Interact (Orchestration in Practice)

Why This Shows Agentic AI Working in Practice

If you have access to RAGFlow (self-hosted or cloud), you can import/recreate this workflow via their canvas, tweak prompts/tools, or even see the exact node graph in their demo/examples. The blog post (linked in sources) has the most detailed breakdown if you want to replicate it.

Let me know if you’d like help adapting this to your own setup (e.g., different APIs or domain)!