A multi-agent research system built with Kotlin and Koog Agents that conducts comprehensive research through intelligent agent coordination and web search.
Three-phase pipeline with specialized AI agents:
SCOPING → RESEARCH → REPORT GENERATION
Agents:
- ClarificationAgent: Interactive questioning to refine research scope
- BriefGenerationAgent: Converts user input into detailed research briefs
- ResearcherAgent: Individual research with web search capabilities
- SupervisorAgent: Coordinates multiple researchers and parallel research
- FinalReportAgent: Synthesizes findings into comprehensive reports
Key Features:
- Parallel research execution (up to 3 concurrent tasks)
- Tavily web search integration with source attribution
- Structured report generation with citations
- Built-in evaluation framework
The system uses a supervisor-subagent architecture for specialized research:
SupervisorAgent (Coordinator)
├── ResearcherAgent 1 (Context A)
├── ResearcherAgent 2 (Context B)
└── ResearcherAgent 3 (Context C)
Supervisor Agent:
- Analyzes research brief and breaks it into specialized subtopics
- Decides between single vs. parallel research based on complexity
- Each subtopic gets independent context and instructions
- Aggregates findings from all sub-agents
Researcher Agents:
- Work independently with focused context
- Execute parallel research on different aspects
- Use ReAct pattern: Reason → Act → Observe → Plan
- Built-in reflection after each search to plan next steps
Each researcher follows a Reasoning-Acting cycle:
- Reason: Analyze current findings and identify gaps
- Act: Execute targeted web searches with specific queries
- Observe: Process search results and extract key information
- Plan: Reflect on progress and determine next actions
This creates deliberate, strategic research rather than random searching.
- Java 21+
- OpenAI API Key
- Tavily API Key
- Clone and build
git clone <repository-url>
cd deep-research-agent
./gradlew build- Set environment variables
export OPENAI_API_KEY="your-openai-api-key"
export TAVILY_API_KEY="your-tavily-api-key"- Run
./gradlew runval researchWorkflow = ResearchWorkflow(
apiKey = openaiKey,
tavilyApiKey = tavilyKey,
maxConcurrentResearchers = 2, // Parallel research limit
maxIterations = 20 // Maximum research iterations
)TavilySearchTool.Args(
query = "research topic",
searchDepth = "advanced", // "basic" or "advanced"
maxResults = 5, // 1-10 results
includeRawContent = true, // Include full content
topic = "general" // "general" or "news"
)Run the built-in evaluation:
val scopeEvaluator = ScopeEvaluationRunner(openaiKey)
val passed = scopeEvaluator.run()