Skip to content

aditya2425/AgentForge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AgentForge — Autonomous Research Team

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.

Agents

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

Architecture

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

Project Structure

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.

Quick Start

# 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

Week-by-Week Breakdown

Week 1 — Single ReAct Agent

  • 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" or python main.py interactive

Week 2 — Multi-Agent Architecture

  • 4 specialized agents + orchestrator in a LangGraph StateGraph
  • Shared ResearchState with 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

Week 3 — CrewAI + Guardrails + Reflection

  • CrewAI rebuild: Same pipeline using CrewAI's Agent/Task/Crew pattern
    • 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

Week 4 — Streamlit UI + Polish

  • 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

LangGraph vs CrewAI Comparison

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

Tech Stack

  • 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

Environment Variables

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.

About

Multi-agent AI framework: tool-using agents, ReAct reasoning, orchestration patterns, streaming & Streamlit dashboard

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages