This tool combines web research, data analysis, and writing capabilities to investigate topics related to Data for Black Lives (D4BL). It uses AI agents to gather information, analyze data, generate insights, and create written summaries about data justice and racial equity issues.
- π€ AI Agent System: Multi-agent crew (Researcher, Data Analyst, Writer) powered by CrewAI
- π Web Interface: Modern Next.js frontend with real-time progress tracking
- π Live Agent Output: Stream live agent activity and processing steps in real-time
- π³ Docker Support: Easy deployment with Docker Compose
- π Real-time Updates: WebSocket-based progress updates and live logs
- π Multiple Output Formats: Brief, detailed, and comprehensive summaries
- π¨ D4BL Branding: Custom styling with D4BL colors and logo
The easiest way to run the application is using Docker Compose with a local Ollama instance, a Supabase (Postgres) instance started by the Supabase CLI, and Langfuse for tracing.
- Docker and Docker Compose installed
- Ollama installed and running on your host machine
- Mistral model pulled in Ollama
- Supabase CLI installed (
brew install supabase/tap/supabaseor see Supabase docs) - Langfuse requirements are bundled in Docker Compose (Postgres, ClickHouse, Redis)
See Prerequisites Guide for detailed setup instructions.
-
Install and start Ollama:
# Install Ollama from https://ollama.ai ollama serve ollama pull mistral -
Create a
.envfile in the project root:FIRECRAWL_API_KEY=your_firecrawl_api_key OLLAMA_BASE_URL=http://localhost:11434
-
Start the application (modular Compose):
- Core app (API + frontend + Postgres):
docker compose -f docker-compose.base.yml up --build
- Add Langfuse observability stack:
docker compose -f docker-compose.base.yml -f docker-compose.observability.yml up --build
- Add Crawl4AI (self-hosted crawl provider):
docker compose -f docker-compose.base.yml -f docker-compose.crawl.yml up --build
- Add Firecrawl (self-hosted crawl provider):
docker compose -f docker-compose.base.yml -f docker-compose.firecrawl.yml up --build
- Full stack (base + observability + Crawl4AI):
docker compose up --build
- Core app (API + frontend + Postgres):
-
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs
- Langfuse UI: http://localhost:3001
- The app connects to Postgres in Docker (
docker-compose.base.yml) by default. - Override
POSTGRES_*env vars to point to Supabase/remote Postgres as needed (set SSL per your provider).
- To enable Langfuse, include
docker-compose.observability.ymlwhen starting Compose. - Reachable from host at
http://localhost:3001(web UI) and services viahttp://langfuse:3000. - Default credentials/env seeded via
.env; overrideLANGFUSE_*keys as needed.
docker-compose downThe application consists of three main components:
graph TB
subgraph "Host Machine"
Ollama[Ollama Server<br/>localhost:11434]
end
subgraph "Docker Network"
Frontend[Next.js Frontend<br/>Port 3000]
Backend[FastAPI Backend<br/>Port 8000]
end
subgraph "CrewAI Agents"
Researcher[Researcher Agent]
Analyst[Data Analyst Agent]
Writer[Writer Agent]
end
User[User Browser] --> Frontend
Frontend <-->|HTTP/WebSocket| Backend
Backend --> Researcher
Backend --> Analyst
Backend --> Writer
Backend -->|LLM Requests| Ollama
Researcher -->|Web Research| Firecrawl[Firecrawl API]
style Frontend fill:#00ff32,stroke:#fff,color:#000
style Backend fill:#333,stroke:#00ff32,color:#fff
style Ollama fill:#1a1a1a,stroke:#00ff32,color:#fff
For detailed architecture documentation, see Architecture Guide.
- Open http://localhost:3000 in your browser
- Enter your research query
- Select summary format (brief, detailed, or comprehensive)
- Click "Start Research"
- Watch live agent output and progress updates
- View formatted results when complete
For programmatic use, you can also use the CLI:
# Activate virtual environment (if not using Docker)
source .venv/bin/activate
# Run research
python src/d4bl/main.py "your research question here" --summary detailed- Prerequisites: Detailed setup instructions for all prerequisites
- Architecture: System architecture and component details
- API Reference: API endpoints and WebSocket documentation
- Development Guide: Local development without Docker
- Troubleshooting: Common issues and solutions
d4bl_ai_agent/
βββ src/d4bl/ # Core application code
β βββ api.py # FastAPI backend with WebSocket support
β βββ crew.py # CrewAI agent definitions
β βββ main.py # CLI entry point
βββ ui-nextjs/ # Next.js frontend
β βββ app/ # Next.js App Router
β βββ components/ # React components
β βββ hooks/ # Custom React hooks
β βββ lib/ # Utilities
βββ docs/ # Documentation
βββ docker-compose.yml # Docker Compose configuration
βββ Dockerfile # Backend Docker image
βββ requirements.txt # Python dependencies
βββ README.md # This file
Docker: "ports are not available"
- Ensure ports 3000 and 8000 are not in use
Docker: "Cannot connect to Ollama"
- Verify Ollama is running:
ollama serve - Check Ollama is accessible:
curl http://localhost:11434/api/tags
Docker: "model 'mistral' not found"
- Pull the model:
ollama pull mistral
WebSocket connection fails
- Ensure backend is running on port 8000
- Check firewall settings
For more troubleshooting help, see Troubleshooting Guide.
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch
- Submit a pull request with a detailed description
This tool is provided under the MIT License. See LICENSE file for details.
See Future Work for planned improvements and features.