
"Roll for Initiative... in Java!"
Welcome, brave adventurer, to the ultimate Spring AI quest! This comprehensive workshop will transform you from a coding apprentice into a master of AI agent orchestration using Java 25 and Spring AI. Through five epic chapters, you'll learn to create, equip, and command digital companions that can think, act, and collaborate like a legendary adventuring party.
Your journey through the realms of AI agents is carefully structured as a progressive quest. Each chapter builds upon the previous one - complete them in order to unlock the full power of Spring AI!
Master the fundamental ritual of agent creation
Equip your agents with community-powered tools
spring-ai-agent-utils)SmartWebFetchToolForge your own custom tools and enchantments
@Tool and @ToolParam//SOURCES directive for multi-file JBang projectsExpose tools as remote services through Model Context Protocol
@McpToolSyncMcpToolCallbackProviderCommand multiple agents in perfect harmony
AgentCard and AgentExecutorMessageChatMemoryAdvisorBefore you start, commit to one of the two paths below. Both are first-class โ pick the one that fits how you want to work.
For: Java developers curious to try a new way of running Java, and non-Java developers who want a minimal setup.
Tooling: JBang CLI + any text editor (VS Code, Sublime, nano โ whatever you like).
You'll run code like this: jbang GameMasterSimple.java
The contract: Follow the workshop instructions exactly as written. If you deviate, you're on your own.
For: Java developers who want to work the way they usually do.
Tooling: IntelliJ IDEA + Maven. No JBang needed.
Prerequisite: You already have IntelliJ IDEA for Java installed on your laptop (Community or Ultimate). This path does not cover installing the IDE.
You'll run code like this: open chapter1-maven/ in IntelliJ, click the green arrow next to main() in GameMasterSimple.java.
The contract: Work the way you normally do. If your IntelliJ / Maven / JDK setup has quirks, you're on your own.
โ ๏ธ Pick one and stick to it. Mixing paths (editing the JBang file while running the Maven project, or vice versa) is the fastest way to get confused.
Before embarking on this legendary adventure, ensure you have:
Install JBang
JBang runs .java files directly with dependencies declared as //DEPS comments โ no Maven, no Gradle, no pom.xml.
curl -Ls https://sh.jbang.dev | bash -s - app setup
jbang --version
Install Java 25 via JBang
jbang jdk install 25
jbang jdk default 25
eval $(jbang jdk java-env)
java -version # Should show: openjdk version "25"
To make this permanent, add eval $(jbang jdk java-env) to your ~/.bashrc or ~/.zshrc.
Install Java 25
Install JDK 25 the way you normally do โ Amazon Corretto, Homebrew (brew install openjdk@25), or your usual JDK manager. Verify:
java -version # Should show: openjdk version "25"
Amazon Bedrock API Key โ this content uses Amazon Bedrock so make sure to get your API key to get started
export AWS_BEARER_TOKEN_BEDROCK=<your-api-key>
๐ก Tip: A plain
exportonly lives in the current terminal. If you'd like every new shell, IDE run-config, and tool to inherit it, add the line to~/.zshenv(zsh) or~/.bash_profile(bash) instead. This avoids the classic "why isn't my agent answering?" surprise when you open a new terminal mid-workshop.
A sense of adventure and willingness to experiment! ๐ฒ
Before running Chapter 1, paste this into your terminal โ it gives a one-glance health check.
java -version
echo "Bedrock: ${AWS_BEARER_TOKEN_BEDROCK:+OK (length=${#AWS_BEARER_TOKEN_BEDROCK})}${AWS_BEARER_TOKEN_BEDROCK:-MISSING โ see step 3}"
You should see openjdk version "25" line and Bedrock: OK (length=NNNN).
If Bedrock says MISSING, revisit Amazon Bedrock API Key step above.
โ ๏ธ REMINDER: Complete the chapters in order! Each builds upon the previous one's knowledge and skills.
jbang and see them come to lifeEach chapter follows the same magical pattern:
Spring AI is a powerful framework for creating AI-powered applications in Java - think of it as your spellbook for summoning digital companions that can interact with tools and services. Like a well-equipped adventuring party, Spring AI provides:
ChatClient โ the gateway to AI conversations@Tool / @ToolParam annotations and community tools.java files directly with embedded //DEPS metadataThe repo ships two parallel views of the same content โ pick the tree that matches your path.
jbangsample-once-upon-spring-ai/
โโโ README.md
โโโ chapter1/ # ๐งโโ๏ธ The Art of Agent Summoning
โ โโโ GameMasterSimple.java
โโโ chapter2/ # โ๏ธ AI Agent with Built-in Tools
โ โโโ GameMasterWithBuiltInTools.java
โโโ chapter3/ # ๐จ The Adventurer's Arsenal
โ โโโ DiceTools.java
โ โโโ GameMasterWithCustomTools.java
โโโ chapter4/ # ๐ The Tavern Notice Board (MCP)
โ โโโ DiceRollMcpServer.java
โ โโโ GameMasterMCPClient.java
โ โโโ application.properties
โโโ chapter5/ # ๐ฐ The Council of Agents (A2A)
โโโ agents/
โ โโโ rules/
โ โ โโโ RulesAgent.java # TTRPG rules lookup agent with RAG
โ โ โโโ RulesTools.java # PDF knowledge base search tools
โ โโโ character/
โ โ โโโ CharacterAgent.java # Character management agent
โ โ โโโ CharacterTools.java # Character CRUD & inventory tools
โ โ โโโ characters.json # Persistent character storage
โ โโโ gamemaster/
โ โโโ GameMasterOrchestrator.java # Spring Boot app with A2A + MCP
โ โโโ GameMasterService.java # Agent discovery & orchestration
โ โโโ GameMasterController.java # REST API endpoints
โโโ test/
โ โโโ test.http # HTTP test requests
โโโ utils/
โโโ CreateKnowledgeBase.java # PDF โ vector store ingestion
main()sample-once-upon-spring-ai/
โโโ chapter1-maven/ # Mirror of chapter1 โ runs GameMasterSimple
โโโ chapter2-maven/ # Mirror of chapter2 โ runs GameMasterWithBuiltInTools
โโโ chapter3-maven/ # Mirror of chapter3 โ runs GameMasterWithCustomTools
โโโ chapter4-maven-server/ # MCP server (DiceRollMcpServer + application.properties)
โโโ chapter4-maven-client/ # MCP client (GameMasterMCPClient)
โโโ chapter5-maven/ # Multi-module Maven project for the A2A council
โโโ rules/ # โ RulesAgent, RulesTools
โโโ character/ # โ CharacterAgent, CharacterTools, characters.json
โโโ gamemaster/ # โ GameMasterOrchestrator, Service, Controller
โโโ utils/ # โ CreateKnowledgeBase
๐ก Chapter 4 is split into two Maven projects (
-serverand-client) because MCP requires the server and client to run as independent processes โ each gets its ownpom.xmland IntelliJ run config. Chapter 5 is a single multi-module project so the four agents share dependencies and can be launched from one IntelliJ window.
You must have permissions to Amazon Bedrock in an AWS account. You can use any model available in your Bedrock console โ simply update the model ID in each chapter's source file to match your preferred model.
This content default to:
By completing this workshop, you'll master:
ChatClient@Toolvar, and JBangThis workshop is a low-bar, practical intro. Spring AI has many more abstractions than we could cover in five chapters. If you want to go deeper, here's a curated path โ grouped so you can dive into whatever caught your interest.
MessageChatMemoryAdvisor)@Tool / @ToolParam model from Chapters 3โ4SimpleVectorStore for OpenSearch, pgvector, and moreagent-utils (Chapter 2) and the A2A bindings (Chapter 5) live hereBedrockProxyChatModel calls under the hoodio.modelcontextprotocol client/server library you usedChatClientvoid main() works without a classRemember, the most epic adventures are the ones you create yourself. Whether you're building the next great AI application or just exploring the boundaries of what's possible, you now have the tools and knowledge to make it happen.
May your agents be wise, your tools be sharp, and your code compile on the first try! ๐ฒโจ
"The best way to predict the future is to build the agents that will create it." - Modern Developer Wisdom
Happy coding, Agent Master! ๐โ๏ธ๐งโโ๏ธ
Java
97.0%
Shell
3.0%

"Roll for Initiative... in Java!"
Welcome, brave adventurer, to the ultimate Spring AI quest! This comprehensive workshop will transform you from a coding apprentice into a master of AI agent orchestration using Java 25 and Spring AI. Through five epic chapters, you'll learn to create, equip, and command digital companions that can think, act, and collaborate like a legendary adventuring party.
Your journey through the realms of AI agents is carefully structured as a progressive quest. Each chapter builds upon the previous one - complete them in order to unlock the full power of Spring AI!
Master the fundamental ritual of agent creation
Equip your agents with community-powered tools
spring-ai-agent-utils)SmartWebFetchToolForge your own custom tools and enchantments
@Tool and @ToolParam//SOURCES directive for multi-file JBang projectsExpose tools as remote services through Model Context Protocol
@McpToolSyncMcpToolCallbackProviderCommand multiple agents in perfect harmony
AgentCard and AgentExecutorMessageChatMemoryAdvisorBefore you start, commit to one of the two paths below. Both are first-class โ pick the one that fits how you want to work.
For: Java developers curious to try a new way of running Java, and non-Java developers who want a minimal setup.
Tooling: JBang CLI + any text editor (VS Code, Sublime, nano โ whatever you like).
You'll run code like this: jbang GameMasterSimple.java
The contract: Follow the workshop instructions exactly as written. If you deviate, you're on your own.
For: Java developers who want to work the way they usually do.
Tooling: IntelliJ IDEA + Maven. No JBang needed.
Prerequisite: You already have IntelliJ IDEA for Java installed on your laptop (Community or Ultimate). This path does not cover installing the IDE.
You'll run code like this: open chapter1-maven/ in IntelliJ, click the green arrow next to main() in GameMasterSimple.java.
The contract: Work the way you normally do. If your IntelliJ / Maven / JDK setup has quirks, you're on your own.
โ ๏ธ Pick one and stick to it. Mixing paths (editing the JBang file while running the Maven project, or vice versa) is the fastest way to get confused.
Before embarking on this legendary adventure, ensure you have:
Install JBang
JBang runs .java files directly with dependencies declared as //DEPS comments โ no Maven, no Gradle, no pom.xml.
curl -Ls https://sh.jbang.dev | bash -s - app setup
jbang --version
Install Java 25 via JBang
jbang jdk install 25
jbang jdk default 25
eval $(jbang jdk java-env)
java -version # Should show: openjdk version "25"
To make this permanent, add eval $(jbang jdk java-env) to your ~/.bashrc or ~/.zshrc.
Install Java 25
Install JDK 25 the way you normally do โ Amazon Corretto, Homebrew (brew install openjdk@25), or your usual JDK manager. Verify:
java -version # Should show: openjdk version "25"
Amazon Bedrock API Key โ this content uses Amazon Bedrock so make sure to get your API key to get started
export AWS_BEARER_TOKEN_BEDROCK=<your-api-key>
๐ก Tip: A plain
exportonly lives in the current terminal. If you'd like every new shell, IDE run-config, and tool to inherit it, add the line to~/.zshenv(zsh) or~/.bash_profile(bash) instead. This avoids the classic "why isn't my agent answering?" surprise when you open a new terminal mid-workshop.
A sense of adventure and willingness to experiment! ๐ฒ
Before running Chapter 1, paste this into your terminal โ it gives a one-glance health check.
java -version
echo "Bedrock: ${AWS_BEARER_TOKEN_BEDROCK:+OK (length=${#AWS_BEARER_TOKEN_BEDROCK})}${AWS_BEARER_TOKEN_BEDROCK:-MISSING โ see step 3}"
You should see openjdk version "25" line and Bedrock: OK (length=NNNN).
If Bedrock says MISSING, revisit Amazon Bedrock API Key step above.
โ ๏ธ REMINDER: Complete the chapters in order! Each builds upon the previous one's knowledge and skills.
jbang and see them come to lifeEach chapter follows the same magical pattern:
Spring AI is a powerful framework for creating AI-powered applications in Java - think of it as your spellbook for summoning digital companions that can interact with tools and services. Like a well-equipped adventuring party, Spring AI provides:
ChatClient โ the gateway to AI conversations@Tool / @ToolParam annotations and community tools.java files directly with embedded //DEPS metadataThe repo ships two parallel views of the same content โ pick the tree that matches your path.
jbangsample-once-upon-spring-ai/
โโโ README.md
โโโ chapter1/ # ๐งโโ๏ธ The Art of Agent Summoning
โ โโโ GameMasterSimple.java
โโโ chapter2/ # โ๏ธ AI Agent with Built-in Tools
โ โโโ GameMasterWithBuiltInTools.java
โโโ chapter3/ # ๐จ The Adventurer's Arsenal
โ โโโ DiceTools.java
โ โโโ GameMasterWithCustomTools.java
โโโ chapter4/ # ๐ The Tavern Notice Board (MCP)
โ โโโ DiceRollMcpServer.java
โ โโโ GameMasterMCPClient.java
โ โโโ application.properties
โโโ chapter5/ # ๐ฐ The Council of Agents (A2A)
โโโ agents/
โ โโโ rules/
โ โ โโโ RulesAgent.java # TTRPG rules lookup agent with RAG
โ โ โโโ RulesTools.java # PDF knowledge base search tools
โ โโโ character/
โ โ โโโ CharacterAgent.java # Character management agent
โ โ โโโ CharacterTools.java # Character CRUD & inventory tools
โ โ โโโ characters.json # Persistent character storage
โ โโโ gamemaster/
โ โโโ GameMasterOrchestrator.java # Spring Boot app with A2A + MCP
โ โโโ GameMasterService.java # Agent discovery & orchestration
โ โโโ GameMasterController.java # REST API endpoints
โโโ test/
โ โโโ test.http # HTTP test requests
โโโ utils/
โโโ CreateKnowledgeBase.java # PDF โ vector store ingestion
main()sample-once-upon-spring-ai/
โโโ chapter1-maven/ # Mirror of chapter1 โ runs GameMasterSimple
โโโ chapter2-maven/ # Mirror of chapter2 โ runs GameMasterWithBuiltInTools
โโโ chapter3-maven/ # Mirror of chapter3 โ runs GameMasterWithCustomTools
โโโ chapter4-maven-server/ # MCP server (DiceRollMcpServer + application.properties)
โโโ chapter4-maven-client/ # MCP client (GameMasterMCPClient)
โโโ chapter5-maven/ # Multi-module Maven project for the A2A council
โโโ rules/ # โ RulesAgent, RulesTools
โโโ character/ # โ CharacterAgent, CharacterTools, characters.json
โโโ gamemaster/ # โ GameMasterOrchestrator, Service, Controller
โโโ utils/ # โ CreateKnowledgeBase
๐ก Chapter 4 is split into two Maven projects (
-serverand-client) because MCP requires the server and client to run as independent processes โ each gets its ownpom.xmland IntelliJ run config. Chapter 5 is a single multi-module project so the four agents share dependencies and can be launched from one IntelliJ window.
You must have permissions to Amazon Bedrock in an AWS account. You can use any model available in your Bedrock console โ simply update the model ID in each chapter's source file to match your preferred model.
This content default to:
By completing this workshop, you'll master:
ChatClient@Toolvar, and JBangThis workshop is a low-bar, practical intro. Spring AI has many more abstractions than we could cover in five chapters. If you want to go deeper, here's a curated path โ grouped so you can dive into whatever caught your interest.
MessageChatMemoryAdvisor)@Tool / @ToolParam model from Chapters 3โ4SimpleVectorStore for OpenSearch, pgvector, and moreagent-utils (Chapter 2) and the A2A bindings (Chapter 5) live hereBedrockProxyChatModel calls under the hoodio.modelcontextprotocol client/server library you usedChatClientvoid main() works without a classRemember, the most epic adventures are the ones you create yourself. Whether you're building the next great AI application or just exploring the boundaries of what's possible, you now have the tools and knowledge to make it happen.
May your agents be wise, your tools be sharp, and your code compile on the first try! ๐ฒโจ
"The best way to predict the future is to build the agents that will create it." - Modern Developer Wisdom
Happy coding, Agent Master! ๐โ๏ธ๐งโโ๏ธ
Java
97.0%
Shell
3.0%