How rohan-girsa/agentic-ai-spring-boot-gemini works
This Spring Boot agent accepts a chat request, runs an agent loop that exchanges content with Gemini, dispatches requested Java tools, and returns the model’s final answer. The tool catalog spans calculations, data and text transforms, utility functions, filesystem access, and network/weather lookup. The README documents the main flow and configuration roles; source excerpts were unavailable, so relationships not stated there are omitted.
Main entry points: ToolRegistry.java Tool Registry · AgentService.java Agent Loop · GeminiClient.java Gemini Client · application.yml Application Settings
Components 26
Chat API
- Chat Controller
src/main/java/com/example/agent/controller/AgentController.java
Agent Orchestration
- Agent Loop
src/main/java/com/example/agent/agent/AgentService.java
Gemini Integration
- Gemini Client
src/main/java/com/example/agent/service/GeminiClient.java
Java Tools
- Tool Registry
src/main/java/com/example/agent/service/tools/ToolRegistry.java - Tool Interface
src/main/java/com/example/agent/service/tools/AgentTool.java - Calculator
src/main/java/com/example/agent/service/tools/CalculatorTool.java - Weather Lookup
src/main/java/com/example/agent/service/tools/WeatherTool.java - HTTP Fetch
src/main/java/com/example/agent/service/tools/HttpGetTool.java - Current Time
src/main/java/com/example/agent/service/tools/CurrentTimeTool.java - Unit Conversion
src/main/java/com/example/agent/service/tools/UnitConvertTool.java - UUID Generation
src/main/java/com/example/agent/service/tools/UuidGenerateTool.java - Text Hashing
src/main/java/com/example/agent/service/tools/HashTextTool.java - Base64 Encode
src/main/java/com/example/agent/service/tools/Base64EncodeTool.java - Base64 Decode
src/main/java/com/example/agent/service/tools/Base64DecodeTool.java - JSON Formatting
src/main/java/com/example/agent/service/tools/JsonFormatTool.java - Word Count
src/main/java/com/example/agent/service/tools/WordCountTool.java - String Replace
src/main/java/com/example/agent/service/tools/StringReplaceTool.java - Regex Extract
src/main/java/com/example/agent/service/tools/RegexExtractTool.java - Random Number
src/main/java/com/example/agent/service/tools/RandomNumberTool.java - File Read
src/main/java/com/example/agent/service/tools/ReadFileTool.java - File Write
src/main/java/com/example/agent/service/tools/WriteFileTool.java
Configuration
- Gemini Properties
src/main/java/com/example/agent/config/GeminiProperties.java - App Configuration
src/main/java/com/example/agent/config/AppConfig.java - Application Settings
src/main/resources/application.yml
Other components
- User
- Gemini API
Connections 27
- User → Chat Controller: submits chat
README.md - Chat Controller → Agent Loop: invokes chat
README.md - Agent Loop → Gemini Client: requests generation
README.md - Gemini Client → Gemini API: calls generateContent
README.md - Gemini API → Agent Loop: returns tool calls or answer
README.md - Agent Loop → Tool Registry: executes tool calls
README.md - Tool Registry → Agent Loop: returns tool results
README.md - Tool Interface → Tool Registry: implements discovery contract
README.md - Tool Registry → Calculator: discovers and executes
README.md - Tool Registry → Weather Lookup: discovers and executes
README.md - Tool Registry → HTTP Fetch: discovers and executes
README.md - Tool Registry → Current Time: discovers and executes
README.md - Tool Registry → Unit Conversion: discovers and executes
README.md - Tool Registry → UUID Generation: discovers and executes
README.md - Tool Registry → Text Hashing: discovers and executes
README.md - Tool Registry → Base64 Encode: discovers and executes
README.md - Tool Registry → Base64 Decode: discovers and executes
README.md - Tool Registry → JSON Formatting: discovers and executes
README.md - Tool Registry → Word Count: discovers and executes
README.md - Tool Registry → String Replace: discovers and executes
README.md - Tool Registry → Regex Extract: discovers and executes
README.md - Tool Registry → Random Number: discovers and executes
README.md - Tool Registry → File Read: discovers and executes
README.md - Tool Registry → File Write: discovers and executes
README.md - Application Settings → Gemini Properties: supplies settings
README.md - Application Settings → App Configuration: configures application
README.md - App Configuration → Gemini Client: provides HTTP client
README.md