Key Features β’ Tech Stack β’ Architecture β’ Installation β’ Usage
WorkFlowGen moves beyond traditional chatbots by implementing a Semantic Router powered by Google Gemini 2.0 Flash.
It intelligently classifies user intent (QA vs. Summarization) and routes requests to specialized agents using a LangGraph State Machine.
| Feature | Description |
|---|---|
| π§ Agentic Workflow | Replaces linear logic with a cyclic LangGraph state machine for decision-making. |
| π― Semantic Routing | Uses structured JSON output to distinguish between "help/critique" (QA) and "overview" (Summary) requests without brittle keywords. |
| β‘ Structured Output | Enforces strict JSON schemas on the LLM to prevent routing errors and hallucinations. |
| π Smart Retrieval | Uses pgvector for similarity search to fetch precise context from documents. |
| π Async Ingestion | Handles PDF/Text parsing and vectorization asynchronously using FastAPI. |
| π Modern UI | Real-time, responsive dashboard built with Next.js 16, Tailwind CSS, and Lucide Icons. |
| Frontend | Backend | Data & AI | Deployment |
|---|---|---|---|
| Next.js 16, Tailwind CSS, Lucide Icons | FastAPI, LangGraph | pgvector, Google Gemini 2.0 Flash | Docker, PostgreSQL |
The system follows a cyclic graph architecture rather than a linear chain:
flowchart TD
A[User Input] --> B[FastAPI Endpoint]
B --> C{LangGraph Workflow}
subgraph Agent_Brain [Agent Brain]
C --> D[Retriever Node]
D --> E[Semantic Router]
E -->|Intent: QA| F[QA Generator]
E -->|Intent: SUMMARY| G[Summary Generator]
end
F --> H[Final Response]
G --> H
Follow these steps to set up and run the WorkFlowGen Agentic Stack on your local machine.
Before installation, make sure you have the following:
| Tool | Version | Purpose |
|---|---|---|
| π³ Docker Desktop | Latest | To run PostgreSQL (with pgvector) |
| π Python | 3.10+ | Backend (FastAPI + LangGraph) |
| π Node.js | 18+ | Frontend (Next.js 16 + Tailwind CSS) |
git clone https://github.com/Prachet-Dev-Singh/WorkFlowGen.git
cd WorkFlowGenSpin up the database container:
docker compose -f infra/docker-compose.yml up -dβ Verify that your database is running:
docker psThis launches a PostgreSQL instance with pgvector extension pre-installed for efficient semantic search.
Navigate to the backend directory and create a virtual environment:
cd backend
python -m venv venvActivate the environment:
# Windows (Git Bash)
source venv/Scripts/activate
# Mac/Linux
source venv/bin/activateInstall dependencies:
pip install -r requirements.txtCreate a .env file inside the backend folder:
touch .envPaste the following and replace YOUR_GEMINI_API_KEY_HERE:
# Local Docker Database
DATABASE_URL=postgresql+asyncpg://admin:password123@localhost:5432/workflowgen_db
# Google Gemini API Key
GEMINI_API_KEY=YOUR_GEMINI_API_KEY_HEREpython init_db.py
# β
Tables created successfully!uvicorn app.main:app --reloadBackend runs on β http://localhost:8000
Open a new terminal and navigate to the frontend directory:
cd frontend
npm install
npm run devFrontend runs on β http://localhost:3000
- Open http://localhost:3000 in your browser.
- Upload a document (PDF or text) using the left upload panel.
- Try different queries:
- π βSummarize this document.β β Routed to Summary Agent
- π¬ βHow can I improve this email?β β Routed to QA/Critique Agent
- Observe the backend terminal logs for real-time routing and reasoning steps.
When done, stop Docker containers safely:
docker compose -f infra/docker-compose.yml down| Component | Tech | Port | Description |
|---|---|---|---|
| π§ Backend | FastAPI + LangGraph | 8000 |
Handles semantic routing and agent logic |
| π₯οΈ Frontend | Next.js + Tailwind | 3000 |
Interactive UI for document upload and analysis |
| ποΈ Database | PostgreSQL + pgvector | 5432 |
Vector similarity storage |
π Youβre all set!
WorkFlowGen is now fully functional on your local machine β explore, extend, and build agentic intelligence on your own data!
Once both servers are running:
- Open http://localhost:3000
- Use the Upload Panel to add PDFs or
.txtfiles. - Enter natural language queries:
- π§ βSummarize this document.β β Routed to Summary Agent
- π¬ βWhat is the main argument of section 2?β β Routed to QA Agent
- Watch the backend logs to see:
- Intent classification (QA / SUMMARY)
- Node transitions in the LangGraph
- Final structured JSON response
| Type | Example | Agent Invoked |
|---|---|---|
| Summary | "Give me a short overview of this file" | π Summary Generator |
| Critique | "How can I improve this paragraph?" | π‘ QA Generator |
| Clarification | "Explain section 3 in simple terms" | π‘ QA Generator |
In the backend terminal, youβll see live logs like:
[Router] Intent detected: SUMMARY
[SummaryAgent] Fetching context from pgvector...
[SummaryAgent] Generating overview response...
[Graph] Returning final output to user.
This shows how the LangGraph state machine routes and executes agents dynamically.
This project is licensed under the MIT License.