The AI research swarm that cites its sources.
Four specialized agents — each powered by a different open-source model via Featherless.ai — collaboratively retrieve, reason, validate, and synthesize a cited Markdown research report in under 90 seconds. Every citation verified against CrossRef. Every step streamed live.
flowchart TD
subgraph Client["▸ NEXT.JS FRONTEND — localhost:3000"]
QI["QueryInput\n(textarea + suggestions)"]
ASD["AgentSwarmDashboard\n(4 agent cards + Framer Motion)"]
PS["ProgressStream\n(SSE live event timeline)"]
RV["ReportViewer\n(Markdown + citation tooltips + BibTeX)"]
end
QI -->|"POST /api/research\n{query: '…'}"| API["Next.js API Routes"]
API -->|"SSE /api/research/stream/{id}\ndata: {step, agent, message}"| PS
API -->|"GET /api/research/{id}\nfull checkpoint state"| ASD
API -->|"GET /api/research/{id}\nfinalReport + sources"| RV
subgraph Swarm["▸ LANGGRAPH AGENT SWARM — 4 Nodes, Conditional Edges"]
direction LR
S["🔍 Scout\nQwen/Qwen2.5-7B"] --> A[" Analyst\nzai-org/GLM-5.2"]
A --> C[" Critic\nDeepSeek-R1"]
C -->|"≤2 flagged → synthesize"| Y["📄 Synthesizer\nQwen/Qwen2.5-72B\n(streaming)"]
C -->|">2 flagged &\niter < 3"| S
end
API --> Swarm
subgraph Services["▸ SERVICE LAYER"]
MR["ModelRouter\n• Featherless.ai (primary)\n• Circuit breaker (3 failures → 30s cooldown)\n• Tenacity retry (3× exponential backoff)\n• Local fallback (graceful degradation)"]
SD["SourceDiscovery\n• arXiv API (OR-query)\n• Semantic Scholar Graph API\n• Wikipedia REST\n• Verified corpus (8 real papers)"]
CV["CitationVerifier\n• CrossRef REST API\n• doi.org redirect resolution\n• arXiv native confirmation"]
VS["VectorStore\n• Qdrant (primary, cosine, dim=256/4096)\n• In-memory fallback\n• 512-token chunks, 50-token overlap"]
end
Swarm --> MR
Swarm --> SD
Swarm --> CV
Swarm --> VS
MR -->|"OpenAI-compatible\nBearer token auth"| FL["☁ Featherless.ai\n30,000+ models"]
SD -->|"Atom XML / REST"| ArXiv["arXiv API"]
SD -->|"Graph API v1"| SS["Semantic Scholar"]
CV -->|"REST + mailto"| CR["CrossRef API"]
subgraph Persistence["▸ DURABLE STATE"]
PG["PostgreSQL\n• threads (checkpoint)\n• events (SSE replay)\n• metrics (token accounting)"]
QD["Qdrant\n• research_sources collection\n• cosine similarity"]
end
Swarm -->|"checkpoint\nevery node"| PG
VS --> QD
style Client fill:#f7f7f4,stroke:#e6e5e0,color:#26251e
style Swarm fill:#003c33,stroke:#1a1a1a,color:#ffffff
style Services fill:#f1f5ff,stroke:#e5e7eb,color:#212121
style Persistence fill:#eeece7,stroke:#d9d9dd,color:#212121
style FL fill:#f54e00,stroke:#d04200,color:#ffffff
| Agent | Model | Stage | Role |
|---|---|---|---|
| Scout | Qwen/Qwen2.5-7B-Instruct |
Grepping | Searches arXiv, Semantic Scholar & Wikipedia. Extracts top passages, verifies DOIs via CrossRef. |
| Analyst | zai-org/GLM-5.2 |
Thinking | Deep reasoning over the corpus: patterns, conflicts and coverage gaps become extractable claims. |
| Critic | DeepSeek-AI/DeepSeek-R1 |
Reading | Validates every claim against evidence. Flags hallucinations and routes the Scout back for re-evidence. |
| Synthesizer | Qwen/Qwen2.5-72B-Instruct |
Editing | Streams the final Markdown report with inline citations and a BibTeX block — live, as it writes. |
The Critic validates every claim against its source. If more than two claims fail verification, the graph routes back to the Scout for a targeted re-search — up to three iterations — before the Synthesizer is allowed to write a single word.
| Layer | Technology |
|---|---|
| Frontend | Next.js 14 · Tailwind CSS · Framer Motion · Radix UI |
| Backend | Next.js API Routes · Drizzle ORM · PostgreSQL |
| AI | Featherless.ai · 4 open-source models · SSE streaming |
| Search | arXiv API · Semantic Scholar · CrossRef REST |
| Vector | Qdrant (cosine, 4096-dim) · In-memory fallback |
# Clone and configure
git clone https://github.com/manishpatel00/PolyMind.git
cd PolyMind
cp .env.example .env
# Edit .env with your FEATHERLESS_API_KEY
# One-command startup
docker-compose up --build
App: http://localhost:3000
API Docs: http://localhost:8000/docs
Health: http://localhost:8000/health
# Prerequisites: Node.js 20+, PostgreSQL 15+
npm install
cp .env.example .env
# Edit .env
# Push database schema
npx drizzle-kit push
# Start development server
npm run dev| Variable | Description |
|---|---|
DATABASE_URL |
PostgreSQL connection string |
FEATHERLESS_API_KEY |
Get from featherless.ai (promo: IMPACT26) |
FEATHERLESS_BASE_URL |
Default: https://api.featherless.ai/v1 |
CROSSREF_EMAIL |
Polite pool email for CrossRef API |
SEMANTIC_SCHOLAR_API_KEY |
Optional, higher rate limits |
FRONTEND_URL |
Default: http://localhost:3000 |
| Endpoint | Method | Description |
|---|---|---|
/api/health |
GET | Health check with DB status |
/api/metrics |
GET | Token usage, session stats |
/api/research |
POST | Submit research query → returns threadId |
/api/research/stream/[threadId] |
GET | SSE stream for real-time updates |
/api/research/session/[threadId] |
GET | Session status and results |
POST /api/research
{
"query": "What are the latest advances in quantum error correction?"
}data: {
"step": "scout_complete",
"agent": "scout",
"message": "Found 5 sources, 3 verified",
"timestamp": "2026-08-01T10:30:00.000Z",
"data": { "sourceCount": 5 }
}-
"We use 4 different open-source models via Featherless.ai, not one closed API" — Each agent uses a distinctly different model, showcasing the breadth of the platform.
-
"LangGraph-style state management with checkpointing" — Every pipeline step is persisted to PostgreSQL. Interrupted runs can be resumed via
/api/research/session/[threadId]. -
"Every citation is verified against CrossRef — no hallucinated sources" — DOI resolution via CrossRef REST API with green checkmark badges for verified sources.
-
"The agent swarm iterates: Critic can send findings back for re-evidence" — Critic-to-Scout re-routing is real, implemented as a stateful loop with max 3 iterations.
-
"Full Docker setup, one command to run" —
docker-compose up --buildstarts everything. -
"Real-time SSE streaming shows live agent collaboration" — Every agent step is streamed to the frontend as it happens, including live report generation from the Synthesizer.
| Library | License | Purpose |
|---|---|---|
| Next.js | MIT | Full-stack framework |
| Drizzle ORM | Apache-2.0 | Type-safe PostgreSQL ORM |
| Framer Motion | MIT | UI animations |
| React Markdown | MIT | Markdown rendering |
| Tailwind CSS | MIT | Utility-first CSS |
| Lucide React | ISC | Icon library |
| OpenAI Node SDK | Apache-2.0 | Featherless.ai client |
MIT © 2026 PolyMind Team