How vamsi513/agentiq works
AgentIQ is a multi-step research assistant: users submit questions through either the Next.js chat or Streamlit interface; the backend runs a session-aware agent that routes questions to corpus retrieval, live web search, or direct answering, then returns cited results, optionally as a stream. The graph preserves documented optional persistence, caching, tracing, and alternative retrieval implementations. Some subsystem wiring is described in the README rather than shown in sampled source, so uncertain connections are omitted.
Main entry points: graph.py Agent Graph · main.py FastAPI Endpoints · nodes.py Intent Router · page.tsx Next.js Chat
Components 26
User Interfaces
- Next.js Chat
frontend/app/page.tsx - Chat Proxy Routes
frontend/app/api/chat/stream/route.ts - Streamlit App
app.py
API and Orchestration
- FastAPI Endpoints
api/main.py - SSE Streaming
api/streaming.py - Agent Graph
agent/graph.py - Query Security
agent/security.py
Research and Answers
- Intent Router
agent/nodes.py - Corpus Retrieval
agent/nodes.py - Embeddings
retrieval/embeddings.py - FAISS Vector Store
retrieval/vectorstore.py - Web Search Node
agent/nodes.py - Tavily Search
tools/web_search.py - Direct Answer Node
agent/nodes.py - Grounded Answer Node
agent/nodes.py - Pinecone Reference Store
retrieval/pinecone_store.py - LlamaIndex Loader
retrieval/llamaindex_loader.py
Session and Operations
- Checkpoint Memory
agent/memory.py - Response Cache
agent/cache.py - LangSmith Tracing
observability/langsmith_tracer.py
External Services
- OpenAI Model
- Tavily API
- PostgreSQL
- Redis
- LangSmith
Other components
- Researcher
Connections 27
- Researcher → Next.js Chat: asks
- Next.js Chat → Chat Proxy Routes: streams query
- Chat Proxy Routes → FastAPI Endpoints: proxies request
- Researcher → Streamlit App: asks
- Streamlit App → Agent Graph: invokes agent
- FastAPI Endpoints → Agent Graph: invokes agent
- FastAPI Endpoints → SSE Streaming: streams response
- SSE Streaming → Agent Graph: streams graph output
- Agent Graph → Intent Router: dispatches nodes
- Intent Router → Query Security: checks query
- Intent Router → OpenAI Model: classifies intent
- Agent Graph → Corpus Retrieval: routes retrieval
- Corpus Retrieval → Embeddings: embeds query
- Corpus Retrieval → FAISS Vector Store: queries vectors
- Agent Graph → Web Search Node: routes web search
- Web Search Node → Tavily Search: searches
- Tavily Search → Tavily API: requests results
- Agent Graph → Direct Answer Node: routes direct
- Direct Answer Node → OpenAI Model: answers query
- Agent Graph → Grounded Answer Node: routes synthesis
- Grounded Answer Node → OpenAI Model: generates answer
- Agent Graph → Checkpoint Memory: checkpoints turns
- Checkpoint Memory → PostgreSQL: persists checkpoints
- Agent Graph → Response Cache: checks response cache
- Response Cache → Redis: reads and writes
- Agent Graph → LangSmith Tracing: emits run data
- LangSmith Tracing → LangSmith: sends traces