How intelligent-internet/ii-researcher works
Main Components
• API Backend (api.py & Docker/Dockerfile.api): This is the service that exposes endpoints (running on http://localhost:8000) to serve both the CLI commands and calls from the frontend.
• Frontend (frontend folder): A Next.js/React application that communicates with the backend API and provides a user interface on http://localhost:3000.
• LiteLLM Server (configured via Docker Compose and litellm_config.yaml in README): Acts as a local LLM proxy server (running on http://localhost:4000) that integrates with external language models.
• Core Research Modules (ii_researcher directory): Contains the pipeline, reasoning modules, and tool implementations. This part encapsulates the primary business logic for processing questions, running deep search workflows, and coordinating between different actions (search, scrape, analyze).
• BAML Modules (baml_client and baml_src directories): These components manage structured operations and outputs. The client library supports both async and sync operations and ties into the overall system, possibly leveraging the BAML (BoundaryML) framework for building structured outputs.
• CLI (cli.py): Provides another user interface mode (command-line) that lets users initiate deep search tasks in either pipeline or reasoning modes.
Relationships and Interactions
• The Frontend interacts with the API backend over HTTP, with clear separation of concerns and well-defined endpoints.
• The API backend acts as a coordination hub: receiving requests from the frontend or CLI, then invoking the core research modules (ii_researcher) for processing.
• Within the core research layers, pipelines and reasoning modules interact with various tools provided under ii_researcher/tools (e.g., scrapers and compressors) to execute multi-step searches.
• The BAML client and source libraries are likely used by these core modules to generate, parse, or validate structured outputs.
Architectural Patterns and Technologies
• Separation of Concerns: Distinct directories indicate clear layers (frontend vs backend vs core logic).
• Microservices / Containerization: Docker Compose orchestrates the containers for the frontend, API, and LiteLLM server.
• Async Operation: Both asynchronous and synchronous clients are available (visible in the baml_client package) and are used to improve performance during web scraping and API interactions.
• Modular Pipeline & Reasoning Architecture: The ii_researcher package is split into pipeline, reasoning, and tools—each handling different steps of the deep search workflow.
• Use of External APIs: Integration with multiple search and scrape providers, configurable via environment variables.
Final Touches
• Every component is clearly labeled.
• Essential elements and data flows as described in the README.