What it does
Multi-agent pipeline that turns a tech topic into a fact-checked, LinkedIn-ready post: an OrchestratorAgent runs a ReAct loop coordinating five specialized agents (Scout, Reporter, Editor, FactChecker, LinkedInWriter), with an automatic retry if the fact-check confidence score is too low. Spring Boot, Spring AI, OpenAI GPT-4o-mini, Tavily Search API, GitHub MCP Server, Java 21.
How it works
One POST to /api/news/generate starts the run. The OrchestratorAgent does not follow a fixed script: it runs a ReAct loop, reasoning about the state, calling a tool or an agent, observing the result, and deciding the next step.
ScoutAgent gathers material through Tavily web search, a page-fetch tool, and GitHub data served over the GitHub MCP server. ReporterAgent extracts the facts, EditorAgent shapes them, and FactCheckerAgent scores the result.
If the fact-check confidence falls below 0.6, facts are re-extracted and the loop runs again. That decision belongs to the model — nothing in the Java hardcodes it. A ContextSizeAdvisor guards against token overflow, and each agent keeps its own system prompt under resources/prompts.
LinkedInWriterAgent produces the final post. The response carries the post, a verified article marked up with [HIGH], [MEDIUM], and [UNVERIFIED], the overall confidence, the fact counts, and the processing time; a run takes 30–90 seconds.
Design decisions
- 01The orchestrator runs a ReAct loop: it reasons, calls tools, observes results, and decides the next step.
- 02The retry is decided by the model: if fact-check confidence falls below 0.6, facts are re-extracted; nothing in Java hardcodes the loop.
- 03Tools: Tavily web search, a page-fetch tool, and GitHub data through the GitHub MCP server.
- 04A ContextSizeAdvisor guards against token overflow; each agent has its own system prompt under resources/prompts.
- 05One POST /api/news/generate call returns the post, a verified article with [HIGH], [MEDIUM], and [UNVERIFIED] markers, overall confidence, fact counts, and processing time; a run takes 30–90 seconds.
Stack
- Language
- Java 21
- Framework
- Spring Boot 3.5.0, Spring AI 1.0.0
- Model
- OpenAI gpt-4o-mini
- Tools
- Tavily Search API, GitHub MCP Server v0.6.2
- HTTP client
- Spring WebFlux (WebClient)
- Build
- Maven