How yashchinchole/agenthub works
Project Type and Purpose
• AgentHub is a full-stack, multi-agent AI assistant system.
• It combines a Streamlit UI (frontend), a FastAPI service (backend), an agent orchestrator (LangGraph/LangChain), multiple specialized agents, persistent memory (ChromaDB/SQLite), and external services (OpenAI, Groq, DuckDuckGo, ArXiv).
• Use cases: conversational chat, document Q&A (RAG), SQL querying, live web searches, Wikipedia lookups, ArXiv paper research.
File Structure Analysis
• Top-level: docker-compose.prod.yml, Dockerfiles in docker/, environment config (.env.example), project metadata (pyproject.toml, requirements.txt, uv.lock).
• scripts/: a utility to build ChromaDB.
• src/: the core of the system:
• run_agent.py, run_service.py, run_client.py, streamlit_app.py – entrypoints.
• agents/: implementations of 6 agents + content moderation tools.
• service/: FastAPI service layer and utilities.
• client/: client abstraction for backend calls.
• core/: LLM integration and settings.
• memory/: persistent store adapters (ChromaDB, SQLite).
• schema/: Pydantic models, Graph schemas, task definitions.
Key Architectural Patterns
• Modular, plugin-style agents loaded into a LangGraph orchestrator.
• Asynchronous, event-driven FastAPI service exposing REST and streaming endpoints.
• Separation of concerns: UI (Streamlit) ↔ API (FastAPI) ↔ Orchestrator (LangGraph) ↔ Agents/Tools ↔ Data Stores.
• Containerized deployment (Docker Compose for app + service).
Main Components
A. Frontend (Streamlit App)
• Entrypoint: streamlit_app.py
• Connects via HTTP/Websocket to FastAPI service.
B. Backend Service (FastAPI)
• run_service.py → exposes /chat, /stream endpoints.
• service/service.py, service/utils.py
C. Agent Orchestrator (LangGraph + LangChain)
• Defined by langgraph.json and core/llm.py, schema/schema.py
• Orchestrates agent workflows and streaming.
D. Agents
• agents/*.py: chatbot, rag_assistant (ChromaDB), sql_agent (Chinook SQLite), research_assistant (DuckDuckGo + calculator), wikipedia_agent, arxiv_agent.
• LlamaGuard for content moderation.
E. Client Library
• client/client.py & run_client.py for programmatic usage.
F. Memory / Data Stores
• ChromaDB (vector store) folder + chroma.sqlite3
• SQLite (Chinook.db) for SQL Agent
• task_data.py + models.py for schema persistence
G. External Services
• LLM providers (OpenAI, Groq)
• DuckDuckGo Search API (ddgs)
• ArXiv API
• LangSmith telemetry
H. Deployment
• Dockerfile.app (Streamlit + client?)
• Dockerfile.service (FastAPI)
• docker-compose.prod.yml orchestrates multi-container setup
I. Utility Scripts
• scripts/create_chroma_db.py to ingest PDFs into ChromaDB
Relationships and Data Flows
1. User interacts with Streamlit UI → sends request to FastAPI.
2. FastAPI handler loads Graph workflow (langgraph.json) → instantiates required agent(s).
3. Agents request LLM calls via core/llm.py.
4. Agents may read/write memory: ChromaDB (RAG), SQLite (SQL), in-memory state.
5. Agents may invoke external tools/services (DuckDuckGo, ArXiv, calculator).
6. Responses stream back through FastAPI to Streamlit.
7. Feedback/analytics sent to LangSmith.
Essential Elements to Capture
• Component names (exact file or module names).
• Data stores and their physical locations (local file vs. container volume).
• Deployment units (Docker images, Compose services).
• Interaction protocols and asynchronous streams.
• Extensibility points (adding new agents or tools).