How aiman-hafeez-0/nexa-agent works
Nexa Agent is a stateful conversational web app. The browser receives the chat UI from Flask, starts a thread, and sends messages to stream or polling endpoints. Those endpoints invoke a compiled LangGraph that classifies intent, then generates a task-oriented or direct response; graph state is keyed by thread and checkpointed to Redis, enabling history retrieval across restarts. The graph obtains models through a provider abstraction, with Groq as the documented backend and Anthropic as an optional code path. The graph and API wiring are supported by sampled source; deployment infrastructure is omitted from this runtime view.
Main entry points: graph.py Compiled graph · llm.py Model provider · main.py Flask app · routes.py Stream chat
Components 17
Web interface
- Chat UI
templates/index.html
Flask API
- Flask app
main.py - Start chat
app/routes.py - Stream chat
app/routes.py - Poll chat
app/routes.py - Get history
app/routes.py
Conversation graph
- Compiled graph
app/graph.py - Classify intent
app/graph.py - Route intent
app/graph.py - Handle task
app/graph.py - Direct response
app/graph.py
Model and memory
- Model provider
app/llm.py - Groq API
- Anthropic API
- Redis checkpointer
app/memory.py - Redis
Other components
- Browser
Connections 25
- Browser → Flask app: requests UI
- Flask app → Chat UI: serves page
- Flask app → Start chat: registers routes
- Browser → Start chat: starts thread
- Start chat → Browser: returns thread ID
- Browser → Stream chat: sends message
- Browser → Poll chat: sends message
- Browser → Get history: requests history
- Stream chat → Compiled graph: streams graph
- Poll chat → Compiled graph: invokes graph
- Get history → Compiled graph: reads state
- Compiled graph → Classify intent: starts at
- Classify intent → Model provider: classifies with
- Classify intent → Route intent: passes intent
- Route intent → Handle task: routes task
- Route intent → Direct response: routes otherwise
- Handle task → Model provider: requests summary
- Direct response → Model provider: requests answer
- Model provider → Groq API: calls by default
- Model provider → Anthropic API: can call
- Compiled graph → Redis checkpointer: loads and saves state
- Redis checkpointer → Redis: persists checkpoints
- Stream chat → Browser: sends SSE tokens
- Poll chat → Browser: returns reply
- Get history → Browser: returns messages