A multi-agent system where specialized AI agents collaborate to research any topic, fact-check findings, and produce comprehensive reports. Built with LangGraph (primary) and CrewAI (secondary) for framework comparison.
| Agent | Role | Tools |
|---|---|---|
| Researcher | Web search & information gathering | Tavily, Wikipedia |
| Analyst | Theme extraction, data analysis, gap identification | Calculator |
| Critic | Fact-checking, bias detection, quality scoring | Tavily (verification) |
| Writer | Report generation with citations & revision support | — |
| Orchestrator | Pipeline management, state transitions, routing | — |
User Topic
│
▼
┌──────────────┐
│ Orchestrator │ ─── validates input, initializes state
└──────┬───────┘
▼
┌──────────────┐
│ Researcher │ ─── generates queries → Tavily + Wikipedia → summarizes findings
└──────┬───────┘
▼
┌──────────────┐
│ Analyst │ ─── themes, data points, comparisons, gaps
└──────┬───────┘
▼
┌──────────────┐
│ Writer │ ─── generates structured markdown report
└──────┬───────┘
▼
┌──────────────┐ ┌──────────┐
│ Critic │ ──► │ Writer │ (revision loop, max 2 cycles)
└──────┬───────┘ └──────────┘
▼
Final Report
AgentForge/
├── week-1/ # Single ReAct agent with tools
├── week-2/ # Multi-agent LangGraph pipeline
├── week-3/ # + CrewAI implementation + guardrails + reflection
└── week-4/ # + Streamlit UI with streaming & comparison
Each week builds progressively on the previous one.
# 1. Navigate to the week you want to run
cd week-4
# 2. Install dependencies
pip install -r requirements.txt
# 3. Copy and configure environment
cp .env.example .env
# Edit .env with your API keys (OPENAI_API_KEY, TAVILY_API_KEY)
# 4. Run via CLI
python main.py langgraph "Compare renewable energy adoption in US vs EU"
python main.py crewai "AI regulation trends 2026"
python main.py compare "Quantum computing breakthroughs"
# 5. Or launch the Streamlit UI
python main.py ui- LangGraph ReAct pattern with tool use loop
- Tools: Tavily web search, Wikipedia, safe calculator, sandboxed Python executor
- Conversation memory with sliding window
- CLI:
python main.py run "question"orpython main.py interactive
- 4 specialized agents + orchestrator in a LangGraph
StateGraph - Shared
ResearchStatewith typed fields for each agent's output - Conditional routing: retry research if no findings, revision loop via critic
- Persistent long-term memory using ChromaDB vector store
- CrewAI rebuild: Same pipeline using CrewAI's
Agent/Task/Crewpattern- Two-stage execution with manual revision loop (CrewAI lacks native conditional routing)
- Guardrails: Input validation, prompt injection detection, PII masking, toxicity check
- Hallucination detection: Heuristic (word overlap) and LLM-as-judge modes
- Loop detection: Max iterations, max revisions, wall-clock timeout, repeated state detection
- Reflection loop: Critic → Writer feedback cycle until quality threshold met
- CLI:
python main.py compare "topic"runs both frameworks and prints comparison
- 4-tab interface: Research, Reports, Compare, Settings
- Real-time agent activity feed with
st.status()per agent - Streaming pipeline progress bar
- Side-by-side framework comparison with winner highlighting
- Guardrail toggles in sidebar
- Saved reports browser
| Aspect | LangGraph | CrewAI |
|---|---|---|
| Control flow | Explicit state graph with conditional edges | Sequential/hierarchical process |
| State management | TypedDict with field-level updates | Task output strings passed via context |
| Feedback loops | Native conditional routing | Manual Python loop around crew stages |
| Streaming | Built-in stream(mode="updates") |
Verbose console output only |
| Flexibility | Full control over routing and state | Simpler setup, less customization |
| Best for | Complex workflows needing precise control | Rapid prototyping with standard patterns |
- Frameworks: LangGraph, CrewAI
- LLM Providers: OpenAI, Anthropic Claude, Mistral (unified client)
- Search: Tavily API, Wikipedia
- Vector Store: ChromaDB with sentence-transformers
- Frontend: Streamlit
- Guardrails: Pydantic validation, regex-based injection detection, hallucination scoring
| Variable | Required | Description |
|---|---|---|
OPENAI_API_KEY |
Yes* | OpenAI API key |
ANTHROPIC_API_KEY |
Optional | Anthropic Claude API key |
TAVILY_API_KEY |
Recommended | Tavily search API key |
MISTRAL_API_KEY |
Optional | Mistral API key |
DEFAULT_LLM_PROVIDER |
No | openai (default), anthropic, or mistral |
*At least one LLM provider key is required.