{"slug": "building-a-multi-step-ai-agent-in-java-with-spring-ai-2-0", "title": "Building a multi-step AI agent in Java with Spring AI 2.0", "summary": "A developer built a multi-step AI agent in Java using Spring AI 2.0, creating a civic research assistant that takes a plain-English issue and UK postcode to determine the most effective way to raise the issue with Parliament. The agent uses an LLM (ChatGPT) along with free UK postcode and Open Parliament APIs, chaining tool calls dynamically without hardcoded flow. The project, available on GitHub, includes guardrails to ensure citations come from actual tool calls.", "body_md": "I wanted to try Spring AI's agentic tooling on something that resembles a real production project rather than the usual weather-API call, so I built an example Spring Boot API: a civic research assistant. You give it a plain-English issue and a UK postcode, and it works out the most effective way to raise that issue with Parliament. It uses an LLM (ChatGPT) along with the free UK postcode and Open Parliament APIs. The flow isn't dictated in code. We register a handful of @Tool methods (resolve the postcode, find the MP, search bills, find committees and open inquiries, check the voting record) and let the model decide which to call and in what order. It chains them itself and returns a final answer with a citation on every claim. The stack is Java 25, Spring Boot 4.1 and Spring AI 2.0.\n\nThe [full tutorial](https://tucanoo.com/building-an-agentic-workflow-in-java-multi-step-ai-agents-with-spring-ai-and-tool-calling/) walks through the Spring AI 2.0 tool-calling setup and what changed since 1.x, registering the tools, getting structured typed output back instead of free text, and a small guard that checks every citation actually came from a tool call so the model can't quietly invent a source. It's all runnable, with the complete code on GitHub.\n\nFull tutorial: [https://tucanoo.com/building-an-agentic-workflow-in-java-multi-step-ai-agents-with-spring-ai-and-tool-calling/](https://tucanoo.com/building-an-agentic-workflow-in-java-multi-step-ai-agents-with-spring-ai-and-tool-calling/)\n\nSource: [https://github.com/tucanoo/spring-ai-civic-research-assistant](https://github.com/tucanoo/spring-ai-civic-research-assistant)\n\nIf you're using Spring AI's tool calling on anything that touches real data, I'd be interested in how you're handling grounding to keep the model from citing things it never fetched.", "url": "https://wpnews.pro/news/building-a-multi-step-ai-agent-in-java-with-spring-ai-2-0", "canonical_source": "https://dev.to/davebrown1975/building-a-multi-step-ai-agent-in-java-with-spring-ai-20-4nk3", "published_at": "2026-06-30 19:02:21+00:00", "updated_at": "2026-06-30 19:18:40.159070+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-agents", "developer-tools"], "entities": ["Spring AI", "ChatGPT", "Open Parliament", "UK postcode API", "GitHub", "Java", "Spring Boot"], "alternates": {"html": "https://wpnews.pro/news/building-a-multi-step-ai-agent-in-java-with-spring-ai-2-0", "markdown": "https://wpnews.pro/news/building-a-multi-step-ai-agent-in-java-with-spring-ai-2-0.md", "text": "https://wpnews.pro/news/building-a-multi-step-ai-agent-in-java-with-spring-ai-2-0.txt", "jsonld": "https://wpnews.pro/news/building-a-multi-step-ai-agent-in-java-with-spring-ai-2-0.jsonld"}}