Multi-Agent AI Paper Writing System: A Full-Stack Breakdown of FastAPI + Vue3

A FastAPI + Vue3 multi-agent system that automates academic paper writing end-to-end using RAG and LLMs.
This article analyzes an open-source AI paper writing system built with FastAPI and Vue3, exploring how it uses multi-agent collaboration, RAG (Retrieval-Augmented Generation), and streaming output to automate every stage of academic writing — from topic selection and outline generation to full-text drafting and polishing. The system uses ChromaDB for semantic reference retrieval, JWT for auth, and LangGraph-style orchestration for coordinating five specialized AI agents.
As generative AI rapidly penetrates specialized domains, academic writing — a highly structured, process-driven task — is becoming an ideal proving ground for intelligent agent (Agent) technology. This article takes a deep dive into an open-source project shared by a Bilibili creator: an AI paper writing system built on FastAPI + Vue3, examining how it leverages large language models (LLMs), RAG (Retrieval-Augmented Generation), and multi-agent collaboration to automate the entire writing pipeline from topic selection to polishing.
Project Background and Goals
Academic writing typically spans multiple stages — topic selection, literature review, outline drafting, body writing, and polishing/paraphrasing — each demanding significant time and effort. Traditional AI writing tools tend to address only isolated steps, lacking the ability to orchestrate the full writing pipeline.
The core idea behind this project is to decompose paper writing into specialized subtasks, each handled by a dedicated AI Agent working in concert. According to the creator, the system achieves "end-to-end automation from topic selection to polishing" — essentially transforming a complex long-form generation task into multiple controllable, orchestratable subtasks, significantly improving output quality and predictability.

Core Feature Modules
Based on the demo, the system offers a fairly complete feature set organized around three dimensions: users, content, and workflow.
User Authentication and Access Control
The system provides registration, login, and JWT-based authentication. JWT (JSON Web Token) was standardized by the IETF in 2015 via RFC 7519. A token consists of three Base64URL-encoded parts joined by dots: the Header (declaring the signing algorithm, e.g., HS256 or RS256), the Payload (carrying claims such as user ID, permission scope, and expiration time), and the Signature (a digital signature over the first two parts to prevent tampering). Since the server doesn't need to store session state in a database — it simply verifies the signature on each request — this stateless design naturally supports horizontal scaling, which is especially valuable in AI inference services requiring multi-node deployment. Compared to traditional session-based mechanisms, JWT scales far better in distributed systems, which is why it's widely adopted in AI full-stack applications. Common security best practices include keeping Access Token lifetimes as short as 15 minutes paired with Refresh Token renewal, and using RS256 asymmetric signing for cross-service identity propagation. The creator also noted that the backend database may enter a "sleep" state after prolonged inactivity — a common behavior in free-tier cloud-hosted databases — and may require multiple retries to wake up on first access. This is a practical deployment detail worth keeping in mind.
Intelligent Topic Selection and Outline Generation
After the user inputs a research area and keywords, the system uses AI to recommend 3 to 5 candidate topics. Once a topic is selected, the system can generate a paper outline that supports manual editing. This semi-automated "AI generation + human intervention" model balances efficiency with control, avoiding the unpredictability of fully black-box generation.
Full-Text Generation and Streaming Output
Building on the outline, the system can generate a complete draft with an editable interface. The generation process uses streaming output powered by the Server-Sent Events (SSE) protocol. SSE, defined in the HTML5 standard, enables one-directional server-to-client data push over persistent HTTP connections — no need for a full WebSocket bidirectional channel. In LLM applications, each token generated by the model (roughly 0.75 English words) is immediately pushed to the frontend via SSE, which renders it character by character, producing the familiar "typewriter effect." This makes users feel the content is being generated in real time rather than waiting for a complete response. FastAPI natively supports SSE via StreamingResponse and async generators, integrating seamlessly with LangChain's on_llm_new_token callback to stream token-level output directly to the client — one of the key reasons this project chose FastAPI. Compared to WebSocket, SSE is lighter to implement, supports automatic reconnection natively, and is the better engineering choice for unidirectional server-push scenarios. This interaction pattern aligns with mainstream LLM products and significantly improves the user experience for long-form text generation.

AI-Assisted Editing and Reference Management
For generated content, the system plans AI expansion, AI rewriting, and AI polishing capabilities (the creator acknowledged some features are still under development). The reference management module supports CRUD operations and uses a vector database for semantic search, providing the underlying data layer for RAG.
RAG (Retrieval-Augmented Generation) was formally introduced by Meta AI Research in the 2020 paper "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks." The full pipeline has three stages: ① Indexing — external documents are chunked and each chunk is converted into a high-dimensional vector via an embedding model (e.g., OpenAI's text-embedding-ada-002), then stored in a vector database; ② Retrieval — when a user submits a query, it is also vectorized, and the top-K most relevant chunks are retrieved via approximate nearest neighbor (ANN) search; ③ Generation — the retrieved content is inserted into the prompt as context, guiding the LLM to generate answers grounded in real sources. This architecture effectively addresses two core LLM limitations: the knowledge cutoff date and hallucination. In academic writing, RAG's value is especially clear: by storing uploaded references as vectors, the system can retrieve the most semantically relevant passages at generation time, ensuring citations are traceable and accurate rather than fabricated.
Technology Stack Analysis
The project's technology choices are quite representative of current best practices in AI full-stack development.

Backend Stack
- Language: Python 3.10+
- Web Framework: FastAPI — renowned for high performance and native async support, ideal for streaming AI applications
- ORM: For structured data object-relational mapping
- Workflow Engine: Handles multi-agent task orchestration and state management
- Vector Database: ChromaDB — responsible for vectorized storage and semantic retrieval of references
ChromaDB was open-sourced in 2022 by Chroma under the Apache 2.0 license, positioning itself as "the embedding database built for AI applications." Its core mechanism maps text into high-dimensional vector spaces (typically 768 or 1536 dimensions) via embedding models, and uses HNSW (Hierarchical Navigable Small World) graphs for efficient approximate nearest neighbor search — returning results in milliseconds even at the million-vector scale. Compared to cloud-based vector databases like Pinecone or Weaviate, ChromaDB runs fully locally with no API key required, no data leaving the machine, and zero operational overhead — making it a great fit for open-source learning projects and privacy-sensitive use cases. In this system, each uploaded reference is chunked and vectorized into ChromaDB. It's worth noting that the chunking strategy — chunk size and the overlap ratio between adjacent chunks — directly affects RAG retrieval quality and is a key hyperparameter to tune in practice. When the writing agent needs to reference relevant content, semantic similarity search (rather than simple keyword matching) finds the most contextually relevant passages.
Frontend Stack
- Framework: Vue 3.4+
- Language: TypeScript
- Component Library: Element Plus
- Build Tool: Vite 5.3
The "FastAPI + Vue3 + TypeScript" combination is the go-to configuration for small-to-medium AI full-stack projects today, offering a solid balance of development speed and maintainability.
System Architecture and Multi-Agent Design
At the architecture level, the system adopts a clean layered design.

Layered Architecture
- Frontend Layer: User interface built with Vue 3
- API Gateway Layer: Request handling entry point via FastAPI
- Agent Orchestration Layer: LangChain-based framework orchestrating multiple AI workflows
- Data Layer: MySQL for structured data, ChromaDB for vector data
Multi-Agent Collaboration
This is the most compelling aspect of the project's design. Multi-Agent Systems (MAS) trace their conceptual roots back to distributed AI research in the 1980s, grounded in the idea of decomposing complex problems across multiple autonomous agents that cooperate toward a solution. In the LLM era, each Agent is essentially "an LLM call unit with a specific role definition" — its responsibilities scoped via Prompt Engineering and chained together through a workflow framework. LangChain, LangGraph, AutoGen, and similar frameworks operationalize this concept. LangGraph, for instance, defines data flow and control flow between agents as a Directed Acyclic Graph (DAG), supporting conditional branching, iterative loops, and State Persistence — allowing intermediate outputs from each node to be tracked, rolled back, and debugged. This makes it particularly well-suited for long-running tasks like paper writing that require multi-turn interaction and state tracking.
The system splits the writing workflow into five specialized agents:
- Topic Expert: Handles research direction and topic recommendations
- Outline Expert: Handles paper structure planning
- Writing Expert: Handles body content generation
- Literature Expert: Handles reference retrieval and citation (integrated with RAG)
- Polishing Expert: Handles language refinement and paraphrasing
The core value of this division of labor is that each Agent focuses on a single responsibility, chained together by the workflow engine for visual orchestration and state tracking. Compared to having a single model generate an entire paper in one shot, the multi-agent architecture keeps the context window for each inference step within a manageable range — avoiding attention dilution from overly long prompts — while reducing token costs and making it easier to independently evaluate and fine-tune each stage's output. This approach excels in accuracy, controllability, and extensibility, and aligns well with the Single Responsibility Principle from software engineering.
Reflections and Assessment
As a learning-oriented open-source project, this system demonstrates solid technical choices and architectural design, covering RAG, multi-agent collaboration, and streaming output — the core pillars of modern LLM application engineering. It serves as an excellent reference for understanding "LLM application development in practice."
That said, some honest limitations deserve acknowledgment: certain AI capabilities (like text expansion) are still under development; deployment issues like database sleep states serve as a reminder that the gap between a demo and a production environment is significant. Furthermore, for a serious use case like academic writing, questions of originality, accuracy, and compliance are unavoidable — these tools should be positioned as "assistants" rather than "replacements."
Overall, this project offers developers interested in AI Agent engineering a complete, runnable, decomposable, and extensible reference implementation. Its source code is well worth a deep dive.
Key Takeaways
Related articles

VICE Platform: An AI Security Scanning Tool Review for Indie Developers
VICE Platform scans web app vulnerabilities from an attacker's perspective, with open-source CLI and GitHub Action integration. Covers leaked secrets, Supabase RLS misconfigs, and exposed APIs for indie developers.

ScreenMark: A Mac Screen Annotation Tool with iPhone Remote Control for Freer Presentations
ScreenMark is a macOS menu bar screen annotation tool with live drawing, zoom, whiteboard overlay, recording, and a free iPhone remote app for teachers, presenters, and developers.

Switchy: One-Click Switching of Magic Keyboard, Mouse, and Trackpad Between Multiple Macs
Switchy is a macOS menu bar tool that lets you switch Magic Keyboard, Trackpad, and Mouse between multiple Macs with one click—no manual Bluetooth re-pairing needed.