Skip to main content

Overview

The Deep Researcher Agent is a sophisticated multi-stage AI workflow that automates comprehensive research tasks. It orchestrates three specialized agents—Searcher, Analyst, and Writer—to gather information, synthesize insights, and produce polished reports.

Multi-Stage Pipeline

Sequential workflow with specialized agents

Web Scraping

Advanced data extraction with ScrapeGraph

AI Analysis

Intelligent synthesis with DeepSeek-V3

Multiple Interfaces

Streamlit UI, CLI, and MCP server

Architecture Pattern

This agent demonstrates the Sequential Workflow Pattern using Agno’s Workflow class to orchestrate multiple specialized agents.

Workflow Structure

from agno.workflow import Workflow
from agno.agent import Agent

class DeepResearcherAgent(Workflow):
    """
    Multi-stage research workflow:
    1. Searcher: Gathers information from the web
    2. Analyst: Synthesizes and interprets findings
    3. Writer: Produces final polished report
    """
    
    searcher: Agent = Agent(
        tools=[ScrapeGraphTools(api_key=os.getenv("SGAI_API_KEY"))],
        model=Nebius(id="deepseek-ai/DeepSeek-V3-0324"),
        description="Expert at finding and extracting high-quality information",
        instructions="""
            1. Search for authoritative and up-to-date sources
            2. Extract key facts, statistics, and expert opinions
            3. Cover multiple perspectives and controversies
            4. Organize findings in structured format
            5. Include References & Sources
        """
    )
    
    analyst: Agent = Agent(
        model=Nebius(id="deepseek-ai/DeepSeek-V3-0324"),
        description="Critical thinker who synthesizes research findings",
        instructions="""
            1. Identify key themes, trends, and contradictions
            2. Highlight important findings and implications
            3. Suggest areas for further investigation
            4. Extract ONLY actual reference links provided
            5. Do NOT hallucinate or create fake links
        """
    )
    
    writer: Agent = Agent(
        model=Nebius(id="deepseek-ai/DeepSeek-V3-0324"),
        description="Professional technical writer",
        instructions="""
            1. Write engaging introduction with context
            2. Organize findings into logical sections
            3. Use bullet points, tables for clarity
            4. Conclude with summary and recommendations
            5. Include References ONLY if provided by analyst
        """
    )
    
    def run(self, topic: str) -> Iterator[RunResponse]:
        # Step 1: Research
        research_content = self.searcher.run(topic)
        
        # Step 2: Analysis
        analysis = self.analyst.run(research_content.content)
        
        # Step 3: Report Writing (with streaming)
        report = self.writer.run(analysis.content, stream=True)
        yield from report

Key Multi-Agent Patterns

1. Sequential Handoffs

Each agent’s output becomes the next agent’s input:
# Chain of execution
research → analysis → report

# Each agent processes previous output
research_content = searcher.run(topic)
analysis = analyst.run(research_content.content)
report = writer.run(analysis.content, stream=True)

2. Role Specialization

Each agent has a distinct role:
  • Searcher: Web research and data extraction
  • Analyst: Synthesis and interpretation
  • Writer: Professional report generation

3. Streaming Final Output

def run_research(query: str) -> str:
    agent = DeepResearcherAgent()
    final_report_iterator = agent.run(topic=query)
    
    # Stream chunks as they're generated
    full_report = ""
    for chunk in final_report_iterator:
        if chunk.content:
            full_report += chunk.content
    
    return full_report

Integration Approaches

import streamlit as st
from agents import run_research

st.title("Deep Researcher Agent")

query = st.text_input("Research Topic")

if st.button("Start Research"):
    with st.spinner("Researching..."):
        # Stream results to UI
        placeholder = st.empty()
        full_response = ""
        
        for chunk in agent.run(query):
            if chunk.content:
                full_response += chunk.content
                placeholder.markdown(full_response)
Run with: streamlit run app.py

Advanced Techniques

Hallucination Prevention

The agent uses explicit instructions to prevent AI hallucinations:
analyst_instructions = """
    5. Extract and list ONLY the reference links that were 
       ACTUALLY found and provided by the researcher.
    6. Do NOT create, invent, or hallucinate any links.
    7. If no links were provided, do not include a References section.
    8. Verify each link was present in researcher's findings.
"""

writer_instructions = """
    6. Use ONLY reference links explicitly provided by the analyst.
    7. Do NOT create, invent, or hallucinate any links.
    8. If analyst provided links, format as clickable markdown.
    9. If no links provided, do not include References section.
"""

Tool Integration

from agno.tools.scrapegraph import ScrapeGraphTools

searcher = Agent(
    tools=[ScrapeGraphTools(api_key=os.getenv("SGAI_API_KEY"))],
    show_tool_calls=True,  # Display tool usage
    markdown=True          # Format output as markdown
)

Configuration

Environment Variables

NEBIUS_API_KEY=your_nebius_api_key_here
SGAI_API_KEY=your_scrapegraph_api_key_here

Model Selection

# All agents use DeepSeek-V3 for consistency
model = Nebius(
    id="deepseek-ai/DeepSeek-V3-0324",
    api_key=os.getenv("NEBIUS_API_KEY")
)

Use Cases

Research emerging technologies, market trends, and competitive landscapes.
query = "Latest trends in AI agent frameworks and orchestration tools"
report = run_research(query)
Gather information about APIs, frameworks, and development tools.
query = "Nebius Token Factory features, capabilities, and use cases"
report = run_research(query)
Compare products, services, and technology stacks.
query = "Comparison of serverless AI inference providers"
report = run_research(query)

Project Structure

deep_researcher_agent/
├── agents.py           # Core workflow and agent definitions
├── app.py              # Streamlit web interface
├── server.py           # MCP server implementation
├── pyproject.toml      # Dependencies and configuration
├── .env                # API keys (not committed)
└── assets/             # UI assets and demos

Job Finder Agent

Multi-agent career analysis with sequential handoffs

Meeting Assistant

Parallel task execution with Agno workflows

Learn More

Agno Framework

Learn about Agno workflows and multi-agent orchestration

Multi-Agent Patterns

Best practices for sequential workflows

Model Providers

Configure AI model providers

Build docs developers (and LLMs) love