Automated API Specification Generator powered by AI agents.
Spring AI Agent Pipeline is a multi-agent AI system that analyzes a MySQL database structure and automatically generates a professional API Specification. Users simply describe their system, and the pipeline analyzes it, generates code, and exports the API Specification as a .docx file.
Spec .docx Output:
View the spec via: v1.0.0 Release
User enters project description
↓
DatabaseReaderService reads MySQL table structure
↓
SA Agent analyzes the system and database
↓
Dev Agent generates Spring Boot code
↓
Spec Agent generates structured API Specification
↓
DocxGeneratorService fills Word template
↓
User downloads api-specification.docx
Download a sample generated API Specification from the v1.0.0 Release
Analyzes the project description and real database structure, then produces a comprehensive system analysis document including System Overview, Key Entities, Relationships, CRUD Operations, and REST API Endpoints.
Receives the SA Agent's analysis and generates production-ready Spring Boot code covering Model, Repository, Service, and Controller layers.
Receives the SA Agent's analysis and generates a fully structured API Specification in JSON format including Method, URL, Request Headers, Request Parameters, Response Parameters, and Example Data for each endpoint.
| Component | Technology |
|---|---|
| Backend Framework | Spring Boot 4.0.6 |
| AI Framework | Spring AI 2.0.0-M5 |
| AI Provider | Groq (llama-3.3-70b-versatile) / Ollama (llama3.2) |
| Database | MySQL 8.0 |
| Document Generation | Apache POI + poi-tl 1.12.2 |
| Language | Java 21 |
| Build Tool | Maven |
src/main/java/com/code/SpringAIAgentPipeline/
├── config/
│ └── AppConfig.java ← Jackson ObjectMapper configuration
├── controller/
│ ├── PipelineController.java ← POST /api/v1/generate
│ └── DownloadController.java ← POST /api/v1/download
├── dto/
│ ├── GenerateRequest.java
│ ├── GenerateResponse.java
│ ├── ApiSpecDto.java
│ └── ApiEndpointDto.java
├── service/
│ ├── DatabaseReaderService.java ← reads MySQL table structure
│ ├── SaAgentService.java ← SA AI Agent
│ ├── DevAgentService.java ← Dev AI Agent
│ ├── SpecAgentService.java ← Spec AI Agent
│ ├── DocxGeneratorService.java ← generates .docx from template
│ └── PipelineService.java ← orchestrates the full pipeline
src/main/resources/
├── static/
│ └── index.html ← Web UI
├── templates/
│ └── api-spec-template.docx ← Word template for .docx output
└── application.properties
| Tool | Version | Download |
|---|---|---|
| Java JDK | 21 | https://adoptium.net |
| Maven | 3.9+ | https://maven.apache.org |
| MySQL | 8.0+ | https://dev.mysql.com/downloads |
| IntelliJ IDEA | Any | https://www.jetbrains.com/idea |
Open MySQL Workbench and run:
CREATE DATABASE ai_agent_db
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;
USE ai_agent_db;
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(150),
phone VARCHAR(20),
address VARCHAR(255),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO users (name, email, phone, address) VALUES
('Kimthina Sok', 'kimthina@example.com', '012-345-678', 'Phnom Penh, Cambodia'),
('Jane Smith', 'jane@example.com', '098-765-432', 'Bangkok, Thailand'),
('Bob Johnson', 'bob@example.com', '081-234-567', 'Singapore');- Copy
.env.exampleto.env: - Fill in your own values in
.env:
AI_API_KEY— your Groq API key from https://console.groq.comDB_PASSWORD— your MySQL root password- Other values as needed
- Make sure API key is set in
application.properties - In IntelliJ, click the ▶ Run button or press
Shift + F10
http://localhost:8080
- Enter your system description in the Project Description field
- Click Generate and wait approximately 30–60 seconds
- View results from SA Agent, Dev Agent, and Spec Agent
- Click Download API Spec to download the
.docxfile
Build a contact list app to store and manage personal contacts.
Build a simple task tracker to create and manage daily tasks.
Build a note-taking app to save and organize personal notes.
Build a user management system with CRUD operations.
| Method | URL | Description |
|---|---|---|
| POST | /api/v1/generate |
Run the full AI pipeline |
| POST | /api/v1/download |
Download API Spec as .docx |
Request:
{
"project_description": "Build a user management system"
}Response:
{
"success": true,
"message": "Pipeline executed successfully",
"sa_analysis": "...",
"dev_code": "...",
"api_spec": {
"title": "User Management System",
"version": "1.0.0",
"endpoints": [...]
}
}Request: Send the api_spec object from the /generate response.
Response: .docx file download.
To run all tests in IntelliJ:
- Right-click the
src/test/javafolder - Click Run 'All Tests'
Or right-click any individual test class and click Run.
| Test Class | Tests | Coverage |
|---|---|---|
| SaAgentServiceTest | 3 | SA Agent behavior |
| DevAgentServiceTest | 3 | Dev Agent behavior |
| SpecAgentServiceTest | 4 | Spec Agent + JSON parsing |
| PipelineServiceTest | 6 | Full pipeline flow |
| PipelineControllerTest | 2 | HTTP endpoints |
| DocxGeneratorServiceTest | 8 | Document generation |
| Total | 26 |
-
Currently reads only from the
userstable — The goal of this project is to prove that the AI Agent Pipeline concept works end-to-end. A single table is sufficient to demonstrate the full pipeline from database reading to API Specification generation. -
Supports MySQL only — MySQL was chosen as the primary database for this proof of concept as it is the most commonly used database.
-
Generates API Spec for basic CRUD operations — CRUD operations cover the most common use case for REST APIs and are sufficient to validate the pipeline's capability to produce a professional API Specification document.



