Dynamic AI Agent System
A dynamic AI agent platform for autonomous planning, tool execution, real-time reasoning, and workflow automation using MCP and RAG.
- Java
- Spring Boot
- Spring AI
- MyBatis
- MySQL
- PostgreSQL
- PgVector
- OpenAI/Ollama
- MCP
- RAG
- SSE
- FlowGram.AI

The AI Agent Station is a sophisticated, highly decoupled platform designed to move beyond simple AI chatbots into the realm of autonomous agents. Unlike standard LLM interactions, this project implements agents capable of environment perception, autonomous decision-making, and execution to achieve specific user goals. By integrating Model Context Protocol (MCP), Retrieval-Augmented Generation (RAG), and dynamic task scheduling, the system empowers AI to perform real-world tasks such as system monitoring, log analysis, and automated content publishing.
Technical Architecture
-
Architecture Design: The project is built on a Hexagonal Architecture (DDD), ensuring high decoupling between the core domain logic and external triggers. The system is divided into layers: API (interface standards), Trigger (HTTP/SSE/Job entry points), Domain (core logic for agents, RAG, and tasks), Infrastructure (persistence), and App (startup and configuration).
-
Core Technologies:
-
Backend: Spring Boot, Spring AI (1.0.0), MyBatis.
-
Intelligence Layer: OpenAI/Ollama API, Model Context Protocol (MCP) for tool use.
-
Data Storage: MySQL for business metadata and PostgreSQL (PgVector) for high-performance vector storage.
-
Communication: Server-Sent Events (SSE) for streaming AI "thought processes" to the frontend.

With ChatClient as the core, we configure the AI model, conversation prewarming, planning mode, advisors, and tools to complete the construction of an LLM ChatClient. These injected components and their properties drive the implementation of Agent capabilities. During a conversation, from input to output, multiple ChatClients can be executed sequentially. In this way, ChatClients with different configurations can leverage their respective strengths to collaboratively drive the completion of the final objective.
AI Agent Module Highlights
-
Dynamic Resource Orchestration: All Agent components — including APIs, Models, MCP Tools, System Prompts, and Advisors, are decoupled from code and managed via 14 database tables.
-
Versatile Execution Strategies:
-
AutoAgent: A dynamic multi-rounds decision making loop that analyzes user intent, executes tasks, supervises quality, and summarizes results (Step 1–4).
-
FlowAgent: A planning based strategy that decomposes complex user requests into sequential steps based on available MCP tools.
-
FixedAgent: A workflow oriented strategy for precisely ordered task execution, ideal for routine automation.
-
Advanced Tool Integration (MCP): Implements the Model Context Protocol (supporting both SSE and stdio modes), enabling AI to interact with the real world, such as searching the web, managing local files, or posting to forums like Stack Overflow.
-
Intelligent Monitoring & Analysis: Specifically engineered for enterprise scenarios, including ELK log analysis and Prometheus monitoring to identify system anomalies and root causes autonomously.
AI Agent Strategy Dispatcher Execution Process

The AI agents we implement have multiple types. Therefore, when selecting an execution scenario, we need to determine which type of AI agent execution strategy to use based on the specific scenario.
We place both AutoAgent and FlowAgent into the dispatcher for execution. In addition, we add a strategy execution strategy configuration field to the ai_agent database table. This allows the system to retrieve the corresponding execution strategy using the agent ID provided by the user when they submit a question.
The following diagram is the flowchart for Auto Dynamic Multi-Round Execution Strategy:

Core Responsibilities & Technical Contributions
-
Engineering the "Thinking" Process (AutoAgent)
-
To make the AI more reliable, I implemented a four-step autonomous loop known as the AutoAgent strategy,. This loop ensures the AI checks its own work before giving an answer:
-
Analyze: The AI breaks down the user’s request into a plan.
-
Execute: It performs the task using real-world tools.
-
Supervise: It reviews the result for quality and accuracy.
-
Summarize: It provides a clear, final response to the user
-
Connecting AI to the Real World
-
Integrated the Model Context Protocol (MCP), which gives the AI "hands" to interact with external systems
-
Developed tools that allow the AI to post articles to forums like Stack Overflow, manage local files, or send notifications via Discord.
-
Built support for both stdio (local) and sse (web-based) communication, ensuring the agent can talk to any modern software service.
-
Real-Time Thinking via Server-Sent Events (SSE)
-
To address the "black box" problem of AI processing, I developed a streaming response system using Spring MVC’s ResponseBodyEmitter. This ensures that as the Agent progresses through its analysis, execution, and supervision phases, the frontend receives real-time updates of the AI's internal logic. I designed a structured
*AutoAgentExecuteResultEntity*to categorize these updates into types like "analysis status," "execution process," and "quality score," providing users with total transparency into the Agent's decision-making. -
Visual Orchestration & Task Scheduling
-
I shifted the management of AI agents from database scripts to a user-friendly drag-and-drop orchestration platform.
-
Integrated flowgram.ai to allow users to link Models, Advisors, and Tools visually, which then saves the entire configuration as a JSON structure to the database.
-
Integrated the** Task Scheduling component** to enable cron-based autonomous triggers. This allows agents to work 24/7. For example, automatically monitoring stock prices every morning or performing nightly system health checks
Database Design
