Live Demo AI-powered research system with modular architecture, multi-agent collaboration, and real tool integration.
- Multi-Agent System: 3 specialized AI agents working together
- Researcher: Searches web for current information
- Fact-Checker: Verifies claims and cross-checks sources
- Summarizer: Creates professional reports
- Real Tool Access: Web search, webpage scraping, calculations
- JWT Authentication: Secure user authentication and authorization
- Database Storage: SQLite for research history and user management
- Modular Architecture: Clean separation of concerns
- RESTful API: FastAPI with automatic OpenAPI documentation
- Fully Tested: Unit tests with pytest
research_assistant/
βββ agent/ # AI agents and workflow logic
β βββ tools.py # Research tools (search, scrape, calculate)
β βββ state.py # Workflow state definition
β βββ agents.py # Agent classes
β βββ router.py # Routing logic
β βββ graph.py # LangGraph workflow builder
βββ api/ # FastAPI application
β βββ main.py # App entry point
β βββ models.py # Pydantic models
β βββ auth_routes.py # Authentication endpoints
β βββ research_routes.py # Research endpoints
βββ database/ # Database layer
β βββ db.py # Database setup
β βββ models.py # SQLAlchemy models
βββ auth/ # Authentication
β βββ security.py # Password hashing, JWT
β βββ dependencies.py # Auth middleware
βββ config/ # Configuration
β βββ settings.py # Settings management
βββ tests/ # Unit tests
β βββ test_agents.py # Agent tests
βββ requirements.txt # Python dependencies
βββ .env # Environment variables
βββ README.md # This file
# Clone repository
git clone <your-repo-url>
cd research_assistant
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtCreate .env file:
# API Keys
GOOGLE_API_KEY=your_google_gemini_api_key
# JWT Secret (generate with: openssl rand -hex 32)
SECRET_KEY=your_super_secret_jwt_key_here
# Database
DATABASE_URL=sqlite:///./research_assistant.db
# Agent Settings
MAX_RESEARCH_ITERATIONS=2
DEFAULT_LLM_TEMPERATURE=0.7# Start server
uvicorn api.main:app --reload
# Server will start at: http://localhost:8000- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
- Health Check: http://localhost:8000/health
curl -X POST http://localhost:8000/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "testuser",
"email": "test@example.com",
"password": "password123"
}'curl -X POST http://localhost:8000/auth/login \
-H "Content-Type: application/json" \
-d '{
"username": "testuser",
"password": "password123"
}'Response:
{
"access_token": "eyJhbGc...",
"token_type": "bearer",
"username": "testuser",
"email": "test@example.com"
}curl -X POST http://localhost:8000/research/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"query": "What are the latest AI developments in 2024?",
"max_iterations": 2
}'curl -X GET http://localhost:8000/research/history \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"curl -X GET http://localhost:8000/research/1 \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"# Run all tests
pytest tests/ -v
# Run specific test file
pytest tests/test_agents.py -v
# Run with coverage
pytest tests/ --cov=agent --cov-report=html
# View coverage report
open htmlcov/index.html| Variable | Description | Default |
|---|---|---|
GOOGLE_API_KEY |
Google AI API key | Required |
SECRET_KEY |
JWT secret key | Required |
DATABASE_URL |
Database connection | sqlite:///./research_assistant.db |
MAX_RESEARCH_ITERATIONS |
Max research cycles | 2 |
ACCESS_TOKEN_EXPIRE_MINUTES |
Token expiration | 1440 (24h) |
Edit config/settings.py:
MAX_RESEARCH_ITERATIONS: int = 2 # 1-5 iterations
DEFAULT_LLM_TEMPERATURE: float = 0.7 # 0.0-1.0User Query
β
Researcher Agent (with tools)
β (searches web, scrapes pages)
Fact-Checker Agent (with tools)
β (verifies claims)
Summarizer Agent
β (creates report)
Final Report
- Web Search: DuckDuckGo search for current information
- Web Scraper: Extract content from URLs
- Calculator: Perform mathematical calculations
Users Table:
- id, username, email, hashed_password, is_active, created_at
ResearchSessions Table:
- id, user_id, query, research_data, verified_facts, final_report
- status, agent_iterations, processing_time, created_at
- Lines of Code: ~1,500+
- Modules: 10
- API Endpoints: 8
- Test Coverage: 80%+
- Tools Integrated: 3
- β Modular Design: Clean separation of concerns
- β Multi-Agent System: LangGraph orchestration
- β Tool Integration: Real web search capabilities
- β Production Ready: Auth, DB, error handling
- β Well Tested: Unit tests with pytest
- β Documented: Comprehensive API docs
- β Scalable: Easy to extend with new agents/tools
- Add streaming responses
- Implement caching with Redis
- Add more tools (Wikipedia, arXiv, GitHub)
- Create admin dashboard
- Add usage analytics
- Implement rate limiting
- Deploy to cloud (AWS/GCP)
MIT License
[Asadullah Shebaz]
- LangChain & LangGraph
- FastAPI
- GROQ API Key