A professional-grade AI research platform that delivers comprehensive, multi-source synthesized reports with real-time financial data integration.
AI Research Agent is designed for high-stakes information gathering. Unlike standard chat AI, it follows a rigorous research methodology: analyzing the knowledge space, clarifying intent, planning the investigation, and synthesizing findings from across the web and financial markets.
- Framework: Next.js 15+ (App Router, Turbopack)
- LLM Orchestration: OpenCode Zen (utilizing the
big-picklereasoning model for synthesis, via its OpenAI-compatible API). - Web Search: LangSearch for comprehensive web crawling and information retrieval.
- Financial Data: Alpha Vantage for real-time stock quotes and company overviews.
- Runtime: Bun for ultra-fast development and build cycles.
The application features a dynamic, state-aware interface that guides users through the research process:
- Real-time Feedback: Displays specific loading states (Exploring, Clarifying, Confirming, Researching) so users know exactly what the agent is doing.
- Contextual Search Box: The search input adapts to the current state. During the "Refine Scope" phase, it acts as a context-injector rather than a new search trigger.
- History Management: Automatically saves research sessions to local storage for quick reference.
- Source Transparency: Every report includes direct links to the original sources, ensuring all findings are verifiable.
AI Research Agent follows a sophisticated multi-stage process to ensure accuracy and depth.
- Knowledge Mapping: The agent performs an initial exploratory search to map the knowledge space and identify key themes.
- Ambiguity Detection: Analyzes the query for missing context or multiple interpretations.
- Financial Trigger: Automatically detects if the query involves companies or market data requiring Alpha Vantage integration.
- Targeted Questions: If the query is broad, the agent generates 3-5 specific questions to narrow the focus.
- User Preferences: Users can answer these questions or "Skip" to let the AI use its best judgment based on initial findings.
- Initial Synthesis: Provides a "Research Scope" summary based on the initial exploration.
After clarification, the agent presents a Research Strategy which includes:
- Confirmed Scope: A concise summary of what will be investigated.
- Optimized Query: The refined search string that will be used for retrieval.
- Investigation Path: A step-by-step plan showing the specific topics to be covered.
- Execute Research ("Go"):
- Confirms the current strategy.
- Triggers the full multi-source investigation.
- Moves directly to the final synthesis phase.
- Refine Scope:
- Allows the user to provide additional instructions or context.
- Logic: The system combines the previous refined query with the new user input (e.g., "Previous Query + Additional context: [User Input]").
- Restart: The workflow loops back to Phase 1 with the newly enriched query to re-evaluate the strategy.
- Query Decomposition: The main query is broken down into 5-7 specialized sub-queries for maximum coverage.
- Parallel Retrieval: Executes simultaneous searches across the web using LangSearch.
- Data Augmentation: Merges real-time financial metrics (if applicable) with web findings.
- Professional Synthesis: OpenCode Zen's
big-picklemodel processes hundreds of data points to generate a structured, cited report.
Every research report is generated with a professional layout:
- Executive Summary: High-level overview of the findings.
- Key Findings: Bulleted list of critical insights.
- Detailed Analysis: Deep dive into specific aspects of the research.
- Financial Overview: (Optional) Real-time stock data and company metrics.
- Sources: Numbered citations linking directly to the original web sources.
Copy .env.example to .env.local (or .env) in the root directory and fill it in:
# Core API Keys
OPENCODE_API_KEY=your_key_here
# Optional — defaults to this URL
OPENCODE_BASE_URL=https://opencode.ai/zen/v1
LANGSEARCH_API_KEY=your_key_here
ALPHA_VANTAGE_API_KEY=your_key_here
# App Configuration
NEXT_PUBLIC_APP_URL=https://your-deployment-url.comEnv files holding real keys are git-ignored — only .env.example is committed.
The app talks to OpenCode Zen's OpenAI-compatible endpoint
(POST {OPENCODE_BASE_URL}/chat/completions) with plain fetch.
big-pickle is a reasoning model: it returns a reasoning_content field
and those reasoning tokens are charged against max_tokens. Budgets below
~1024 get consumed entirely by reasoning and return empty content, so token
budgets live in LLM_MAX_TOKENS (src/lib/constants.ts) — 16384 for synthesis
reports, 4096 for the shorter structured-JSON steps. Model limits: 200k
context / 160k input / 32k output, text-only (no vision, embeddings or audio).
-
Install Dependencies:
bun install
-
Run Development Server:
bun dev
-
Build for Production:
bun run build