DeepTrace is a professional AI Research Assistant built on the OpenAI Agents SDK. It intelligently plans web searches, synthesizes information from multiple sources, and produces comprehensive Markdown reports. The system features dual research modes (Quick and Deep), database persistence, and optional email delivery.
- Multi-Agent System: Orchestrated workflow with specialized AI agents
- Dual Research Modes: Quick (4-6 sources, ~2 min) or Deep (10-14 sources, ~8 min)
- Smart Planning: Mode-aware search strategy generation (
backend/app/agents/planner_agent.py) - Parallel Search: Concurrent web searches with result summarization (
backend/app/agents/search_agent.py) - Report Synthesis: Structured 11-field reports with confidence scoring (
backend/app/agents/writer_agent.py) - Database Persistence: SQLite storage for reports, sources, and logs (
backend/app/data/db.py) - Export Options: Markdown file export and optional email delivery (
backend/app/agents/email_agent.py) - Query Clarification: Automatic detection of vague queries with clarifying questions (
backend/app/agents/clarifying_agent.py) - Gradio UI: Interactive web interface with live execution logs
- Python 3.10+ recommended
- An OpenAI API key (
OPENAI_API_KEY) - Network access (the web-search tool and model calls require it)
-
Create and activate a virtual environment.
Windows (PowerShell):
python -m venv .venv .\.venv\Scripts\Activate.ps1macOS/Linux:
python3 -m venv .venv source .venv/bin/activate -
Install dependencies:
pip install -r backend/requirements.txt
-
Configure environment variables:
cp .env.example .env
Then edit
.envand set at leastOPENAI_API_KEY.
Start the Gradio UI:
python app.pyThis launches Gradio and opens a browser window (inbrowser=True). Select your research mode (Quick or Deep), enter your query, and click Run. The UI updates with live execution logs and displays the final Markdown report. Use the Export button to save reports as .md files in the exports/ directory.
If SENDGRID_API_KEY is not set, emailing is skipped automatically.
To enable email sending, set:
SENDGRID_API_KEYSENDGRID_FROM(must be a verified sender/domain in many SendGrid setups)SENDGRID_TOSENDGRID_DEFAULT_SUBJECT(optional)
DeepTrace/
├── app.py # Gradio UI entry point
├── .env.example # Environment variables template
├── CLAUDE.md # AI assistant instructions
├── README.md # This file
│
├── backend/ # Backend application
│ ├── app/
│ │ ├── agents/ # AI agents
│ │ │ ├── planner_agent.py # Search strategy planner
│ │ │ ├── search_agent.py # Web search executor
│ │ │ ├── writer_agent.py # Report synthesizer
│ │ │ ├── email_agent.py # Email delivery
│ │ │ └── clarifying_agent.py # Query clarification
│ │ ├── core/ # Core business logic
│ │ │ ├── orchestrator.py # ResearchManager orchestration
│ │ │ ├── types.py # ResearchMode enum & config
│ │ │ ├── confidence.py # Confidence scoring
│ │ │ ├── retry.py # Retry logic with backoff
│ │ │ └── monitoring.py # Performance tracking
│ │ └── data/ # Database layer
│ │ └── db.py # SQLite CRUD operations
│ ├── tests/ # Test suite
│ └── requirements.txt # Python dependencies
│
├── data/ # Local data storage (gitignored)
│ └── research.db # SQLite database
│
├── docs/ # Documentation
│ ├── project_spec.md # Full project specifications
│ ├── architecture.md # System design
│ └── ... # Additional docs
│
└── exports/ # Exported reports (gitignored)
DeepTrace follows a multi-agent architecture with clear separation of concerns:
-
Orchestration Layer (
backend/app/core/orchestrator.py)- Manages the research pipeline
- Handles retries, errors, and partial results
- Provides live status updates to UI
-
Agent Layer (
backend/app/agents/)- Specialized AI agents for each task
- Stateless and composable
- Uses OpenAI Agents SDK
-
Data Layer (
backend/app/data/)- SQLite persistence (PostgreSQL-ready)
- Stores reports, sources, and execution logs
- Migration-ready for production scaling
See docs/architecture.md for detailed system design and docs/project_spec.md for full specifications.
- Documentation: See
CLAUDE.mdfor development guidelines and agent instructions - Testing: Run tests from
backend/tests/directory
.envis gitignored; keep API keys out of source control- Database files in
data/are gitignored - Exported reports in
exports/are gitignored - OpenAI trace links printed to console for debugging:
https://platform.openai.com/traces/trace?trace_id={trace_id}