InkFlow AI - Multi-Agent AI Blog Generation Platform
āļø Inkflow AI ā Autonomous Multi-Agent AI Blog Writer
Inkflow AI is an advanced, full-stack, autonomous multi-agent content generation platform. It converts high-level topics into deeply researched, structured, fully illustrated, and professionally formatted technical blog posts in real time.
Powered by LangGraph, FastAPI, Mistral AI, Tavily Search, and Next.js 16, Inkflow AI orchestrates a team of specialized AI agents that dynamically perform web research, formulate execution blueprints, write sections in parallel, plan visual assets, generate custom illustrations on the fly, and stream progress live to an interactive dark-themed web application.
šļø System Architecture & Workflow
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Next.js 16 Web Application ā
ā (Zustand State & SSE Listener) ā
āāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāā
ā
SSE Stream / REST ā POST /blog/stream
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā FastAPI Async Backend ā
ā (Middleware & Static Server) ā
āāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāā
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā LangGraph Multi-Agent DAG ā
āāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāā
ā
āāāāāāāāāāāāāāāāāāāā“āāāāāāāāāāāāāāāāāāā
ā ā
ā¼ ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāāāāāā
ā Router Agent ā ā Research Agent ā
ā (Mistral AI Reasoning) ā ā (Tavily Search API) ā
āāāāāāāāāāāāāā¬āāāāāāāāāāāā āāāāāāāāāāāāāā¬āāāāāāāāāāāā
ā ā
āāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāā
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāā
ā Orchestrator Agent ā
ā (Outline & Strategy) ā
āāāāāāāāāāāāāā¬āāāāāāāāāāāā
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāā
ā Parallel Worker Agents ā
ā (Fan-out Sub-sections)ā
āāāāāāāāāāāāāā¬āāāāāāāāāāāā
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāā
ā Reducer Subgraph ā
ā āāāāāāāāāāāāāāāāāāāāāā ā
ā ā Merge Markdown ā ā
ā āāāāāāāāāāāāāāāāāāāāā⤠ā
ā ā Decide Images ā ā
ā āāāāāāāāāāāāāāāāāāāāā⤠ā
ā ā Pollinations.ai ā ā
ā āāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāā¬āāāāāāāāāāāā
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāā
ā Markdown & Image Asset ā
ā Export ā
āāāāāāāāāāāāāāāāāāāāāāāāāā
š Key Concepts & Architectural Highlights
1. LangGraph Multi-Agent Orchestration
Instead of relying on a single prompt-response LLM call, Inkflow AI decomposes blog creation into a deterministic state machine managed by LangGraph (StateGraph):
- Shared Execution State (State): Tracks topic context, recency parameters, evidence list, writing plan, section outputs, image specs, and final markdown content.
- Router Agent (router.py): Classifies user queries into execution modes:
- Open Book (7-Day Cutoff): Used for breaking news and current events. Forces format to
news_roundup. - Hybrid (45-Day Cutoff): Used for ongoing industry developments and tech updates.
- Closed Book (3650-Day Cutoff): Used for evergreen/educational topics using LLM parametric knowledge.
- Open Book (7-Day Cutoff): Used for breaking news and current events. Forces format to
- Research Agent (research.py): Executes targeted Tavily web queries in parallel, extracts structured evidence (
EvidencePack), deduplicates URLs, and filters out stale references based on recency rules. - Orchestrator Agent (orchestrator.py): Acts as the managing editor. Constructs a detailed writing
Plandefining blog title, target audience, tone, style constraints, and section tasks (Task). - Worker Agents (worker.py): Executes section-writing tasks in parallel using LangGraph fan-out routing (
fanout). Workers strictly adhere to word count targets and cite evidence URLs. - Reducer Subgraph (reducer.py):
merge_content: Aggregates and orders drafted sections into a cohesive markdown draft.decide_images: Analyzes text flow and proposes image placements (GlobalImagePlan) with visual prompts.generate_and_place_images: Concurrently fetches image binaries from Pollinations.ai, saves them tooutput/images/, updates image tags, and exports the final.mdfile.
2. ā” 3-Tier Resilient SSE Streaming Architecture
The frontend web application communicates with the backend through a 3-tier resilient streaming engine (api.ts):
- Tier 1 (Live SSE Stream): Connects to
/blog/streamviatext/event-streamPOST request. Parses incoming events in real time to update progress indicators, node step labels, evidence counters, and terminal logs without polling. - Tier 2 (Snapshot Recovery): If network interruptions terminate the stream prematurely, state is recovered using the last parsed stream payload snapshot.
- Tier 3 (Batch Rest Fallback): If streaming is unsupported or blocked by proxies, the frontend transparently falls back to
POST /blog/generate.
3. šØ Dark-Themed Next.js 16 Web Workspace
The frontend provides a dark-themed user interface:
- Interactive Generation Suite: Real-time progress tracker (ProgressTracker.tsx) and live terminal log stream (EventLog.tsx).
- Multi-Tab Workspace:
- Blog Reader: Renders styled GitHub-flavored markdown with code syntax highlighting and resolved image URLs (BlogRenderer.tsx).
- Plan Blueprint: Displays multi-agent task breakdown, target word counts, and audience strategy (PlanPanel.tsx).
- Evidence Panel: Interactive list of research web sources and citations (EvidencePanel.tsx).
- Gallery & Image Specs: Image grid browser and raw prompt JSON inspector.
- ZIP Bundle Export: One-click export bundling markdown and local image assets into a
.ziparchive usingJSZip(ExportMenu.tsx).
š Repository Structure
inkflow-ai/
āāā backend/ # FastAPI & LangGraph Python Engine
ā āāā app/
ā ā āāā api/ # REST routes (/generate, /stream) & schemas
ā ā āāā config/ # App settings & LLM initialization (Mistral AI)
ā ā āāā graph/ # LangGraph DAG (router, research, orchestrator, worker, reducer)
ā ā āāā models/ # Pydantic state & data domain models
ā ā āāā prompts/ # System prompts for AI agents
ā ā āāā services/ # File I/O, Tavily search, Pollinations.ai image generator
ā ā āāā main.py # FastAPI entry point & CORS configuration
ā āāā output/ # Generated .md blogs & output/images directory
ā āāā .env # Environment variables (API Keys)
ā āāā requirements.txt # Python backend dependencies
ā āāā README.md # Detailed Backend Documentation
āāā frontend/ # Next.js 16 Web Application
ā āāā app/ # App Router pages & layout
ā āāā components/ # UI components (Generation, Reader, Layout)
ā āāā lib/ # Zustand store, API SSE client, Export utilities
ā āāā package.json # Frontend Node dependencies
ā āāā README.md # Detailed Frontend Documentation
āāā README.md # Root Project Documentation
š ļø Tech Stack & Key Libraries
| Component | Stack / Library | Key Purpose |
|---|---|---|
| Backend Framework | FastAPI + Uvicorn | High-performance async REST & streaming web server |
| Agentic Framework | LangGraph + LangChain | Stateful multi-agent workflow orchestration & DAG execution |
| LLM Provider | Mistral AI (mistral-medium-latest) | Reasoning, planning, evidence synthesis, and content generation |
| Web Research | Tavily Search API | Real-time web research and citation extraction |
| Image Synthesis | Pollinations.ai | Contextual AI image generation REST API |
| Frontend Framework | Next.js 16 (App Router) + React 19 | SSR/CSR web framework |
| State Management | Zustand 5 | Global reactive state store |
| Styling & Motion | Tailwind CSS v4 + Framer Motion 12 | Dark-themed UI and smooth animations |
| Markdown Processing | react-markdown + remark-gfm | GitHub-flavored markdown rendering |
| File Archiving | jszip + date-fns | Client-side ZIP bundle packaging |
š Quickstart Guide
Prerequisites
- Python 3.10+
- Node.js 18+
- Valid API Keys for Mistral AI and Tavily
1. Backend Setup
# Navigate to backend directory
cd backend
# Create and activate virtual environment
python -m venv .venv
# On Windows (PowerShell):
.venv\Scripts\Activate.ps1
# On Linux/macOS:
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create .env file in backend/ root
cat <<EOT > .env
MISTRAL_API_KEY=your_mistral_api_key_here
TAVILY_API_KEY=your_tavily_api_key_here
EOT
# Start FastAPI dev server
uvicorn app.main:app --reload --port 8000
Backend API will be running at: http://localhost:8000 (Swagger docs at http://localhost:8000/docs).
2. Frontend Setup
# Open a new terminal and navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Create .env.local file in frontend/ root
cat <<EOT > .env.local
NEXT_PUBLIC_API_BASE_URL=http://localhost:8000
EOT
# Start Next.js development server
npm run dev
Frontend web application will be accessible at: http://localhost:3000.
š” API Endpoints Reference
| Endpoint | Method | Description |
|---|---|---|
GET / | GET | API Health Check. |
POST /blog/stream | POST | Server-Sent Events (SSE) endpoint. Streams live LangGraph node updates and final result payload. |
POST /blog/generate | POST | Synchronous REST endpoint. Runs the graph to completion and returns full blog JSON payload. |
š License
Distributed under the MIT License. See LICENSE for details.