Business document copilot built as a multi-agent RAG system for sales, finance, and operations workflows.
AgentFlow is no longer just a generic document chatbot. It now demonstrates the parts hiring teams actually look for in applied AI engineering work:
- persistent backend state for sessions, messages, and vector chunks
- multi-agent routing across ingest, question answering, verification, summarization, and RAG
- measurable evals and telemetry instead of unverified demos
- workspace-scoped session isolation
- provider-aware backend with Groq-first inference and tracked cost/latency
This makes it a stronger portfolio project for AI Engineer, Applied AI, GenAI Engineer, and AI/ML platform-oriented roles.
What works today:
- persistent sessions and document storage on the backend
- persistent vector chunk storage for RAG
- Groq-backed question answering and summarization
- evaluation harness with saved run history
- telemetry for routing, retrieval, provider usage, latency, and eval summaries
- workspace-scoped access to sessions and documents
- system insights panel in the frontend for demo-friendly metrics
What is intentionally still lightweight:
- auth is not implemented
- persistence is file-backed, not Postgres-backed
- workspace isolation is header-based, not identity-backed
Animated walkthrough:
Screenshots:
Full write-up (diagrams, sequence flows, deployment): docs/ARCHITECTURE.md
Demo video (embed + recording playbook): docs/DEMO_VIDEO.md
Frontend (Next.js)
-> Chat, sidebar, document upload, system insights panel
-> Calls backend API with workspace-scoped headers
Backend (Express + TypeScript)
-> Session routes
-> Multi-agent orchestration
-> RAG retrieval + vector search
-> Eval harness
-> Telemetry + Prometheus metrics
Persistence
-> backend/data/sessions.json
-> backend/data/vectors.json
-> backend/data/eval-runs.json
LLM Layer
-> Groq primary
-> Gemini / OpenAI fallback-ready
Recommended local demo:
- Open the app and create a new chat.
- Upload a sales, finance, or ops document.
- Ask a grounded question such as:
What changed in Q4?Which region had the highest revenue?Summarize the operational risks for leadership.
- Open
System Insightsfrom the sidebar. - Run the eval suite and show:
- latest eval score
- retrieval latency
- provider usage
- routing decisions
- Multi-agent orchestration with an explicit orchestrator
- Persistent RAG document indexing and retrieval
- Workspace-scoped backend access model
- Eval harness for repeatable document QA checks
- Telemetry endpoint for recent route, retrieval, and provider behavior
- System insights UI for live demos
- Business-document positioning instead of a generic chatbot UX
The backend can be deployed on Render as a Docker service.
Data directory: The backend tries DATA_DIR (if set), then /app/data under the app working directory, then a temp folder. So even if DATA_DIR=/var/data is set but that path is not writable (e.g. no disk attached), the service still starts and uses /app/data.
-
Recommended for free tier / no disk: Remove
DATA_DIRfrom Render Environment (or leave it; fallback still works). Data lives under/app/datain the container (ephemeral on free tier). -
With persistent disk (data survives redeploys):
- Render Dashboard → Disks → Add Disk, mount path
/var/data - Set
DATA_DIR=/var/data - The Docker entrypoint attempts to fix ownership on that path when present
- Render Dashboard → Disks → Add Disk, mount path
Sessions and demos: On the free tier without a disk, the container filesystem resets when the service sleeps or redeploys, so old session IDs disappear. The frontend validates the current session before each action and creates a new one when the server no longer has it, so you should not see stuck “Session not found” errors from stale state. For portfolio-grade persistence, use a Render disk (above) or a database.
Required env vars: GROQ_API_KEY, CORS_ORIGIN (your frontend URL; comma-separated for prod + local).
Custom domain (e.g. agentflow.thedixitjain.com on Vercel): see docs/CUSTOM_DOMAIN.md.
The browser should not call https://*.onrender.com directly (CORS is easy to misconfigure). This repo proxies /agentflow-api → your Render /api (see next.config.js).
Vercel → Environment variables (Production):
| Variable | Value |
|---|---|
NEXT_PUBLIC_API_URL |
/agentflow-api |
BACKEND_URL |
https://YOUR-SERVICE.onrender.com |
Redeploy after saving. Optional: omit BACKEND_URL if you use the default in next.config.js.
NEXT_PUBLIC_API_URL=http://localhost:4000/api
GROQ_API_KEY=your_groq_api_key
GEMINI_API_KEY=your_gemini_api_key_hereOptional. The backend also reads the repo-root .env.local.
PORT=4000
DATA_DIR=./data
GROQ_API_KEY=your_groq_api_key
OPENAI_API_KEY=your_openai_api_key
DAILY_BUDGET=10
CORS_ORIGIN=http://localhost:3000npm install
npm run devIn a second terminal:
cd backend
npm install
npm run devIf 3000 is already occupied, Next.js may start on another port such as 3002.
Core:
GET /api/sessionsPOST /api/sessionsGET /api/sessions/:idPOST /api/sessions/:id/documents/parsedDELETE /api/sessions/:id/documents/:documentIdPOST /api/sessions/:id/chatPOST /api/sessions/:id/chat/stream
Observability:
GET /api/statsGET /api/telemetryGET /api/metrics
Evaluation:
GET /api/evals/suitesGET /api/evals/runsPOST /api/evals/run
Evaluation runs are saved to:
backend/data/eval-runs.json
Persistent runtime data is saved to:
backend/data/sessions.jsonbackend/data/vectors.json
Tracked metrics include:
- route selection counts
- retrieval latency and top-score quality
- provider request counts, fallbacks, token usage, and cost
- eval suite runs and per-case scores
The strongest talking points for interviews are:
- moved the app from browser-local state to persistent backend sessions and vectors
- added a measurable eval harness instead of relying on subjective demos
- instrumented routing, retrieval, provider, and cost behavior for observability
- introduced workspace-scoped isolation and log redaction as practical security steps
- reframed the app around business document intelligence, improving product clarity
Copy-ready bullets live here:
Suggested screenshots / GIF sequence lives here:
- Next.js 14
- React + TypeScript
- Express + TypeScript
- Groq SDK
- Gemini SDK
- Recharts
- Prometheus client
MIT



