An end-to-end AI blog writing system built with FastMCP, LangGraph, FastAPI, and Next.js — featuring multi-tool research, human-in-the-loop review, and real-time streaming.
This project is a production-grade AI agent that takes a user's blog topic as input and autonomously researches, plans, writes, and edits a full blog post — pausing at key moments for human review before continuing. It is built as a modern full-stack application with a clean separation between the frontend, backend orchestration layer, and a dedicated MCP (Model Context Protocol) tool server.
This is not a one-shot “call the model once and hope” workflow. It’s a stateful LangGraph execution where each step updates shared state, and the run can be paused for human review, resumed later, and edited at checkpoints. Every LLM/tool call is traceable end-to-end (e.g., via LangSmith), making the system debuggable and production-friendly.
The system is composed of four independently deployable services:
1. Next.js Frontend
The user-facing interface where users submit blog prompts, watch live agent progress via Server-Sent Events, review and edit AI-generated plans and drafts at human-in-the-loop checkpoints, and download or copy the final blog post.
2. FastAPI Backend
The orchestration layer that receives requests from the frontend, manages LangGraph graph execution in background tasks, exposes REST endpoints for starting runs, polling status, submitting human reviews, and streaming events, and handles authentication, database persistence, and session management.
3. LangGraph Agent Graph
The brain of the system. A directed stateful graph where each node is a focused AI step: routing, research query generation, web research via MCP tools, summarization, blog planning, task-based writing, assembly, and editing. Human-in-the-loop interrupts pause the graph at the planning and final review stages.
4. FastMCP Server
A dedicated tool server built with FastMCP that exposes research and utility tools: web search, page fetching/scraping, keyword extraction, content summarization, and (optionally) image generation. LangGraph connects to this server and binds its tools for use inside agent nodes.
The agent follows this high-level execution path: