# rohan-girsa/agentic-ai-spring-boot-gemini architecture

> Architecture diagram of the GitHub repository rohan-girsa/agentic-ai-spring-boot-gemini, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rohan-girsa/agentic-ai-spring-boot-gemini
- Repository: https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini

## Overview

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: [`src/main/java/com/example/agent/service/tools/ToolRegistry.java`](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/ToolRegistry.java) (Tool Registry), [`src/main/java/com/example/agent/agent/AgentService.java`](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/agent/AgentService.java) (Agent Loop), [`src/main/java/com/example/agent/service/GeminiClient.java`](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/GeminiClient.java) (Gemini Client), [`src/main/resources/application.yml`](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/resources/application.yml) (Application Settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Chat API"]
  node_controller["Chat Controller"]
end

subgraph group_agent["Agent Orchestration"]
  node_agent_service["Agent Loop<br/>[AgentService.java]"]
end

subgraph group_model["Gemini Integration"]
  node_gemini_client["Gemini Client<br/>[GeminiClient.java]"]
end

subgraph group_tools["Java Tools"]
  node_tool_registry["Tool Registry<br/>[ToolRegistry.java]"]
  node_agent_tool["Tool Interface<br/>[AgentTool.java]"]
  node_calculator["Calculator"]
  node_weather["Weather Lookup<br/>[WeatherTool.java]"]
  node_http_get["HTTP Fetch<br/>[HttpGetTool.java]"]
  node_current_time["Current Time"]
  node_unit_convert["Unit Conversion"]
  node_uuid["UUID Generation"]
  node_hash["Text Hashing<br/>[HashTextTool.java]"]
  node_base64_encode["Base64 Encode"]
  node_base64_decode["Base64 Decode"]
  node_json_format["JSON Formatting"]
  node_word_count["Word Count<br/>[WordCountTool.java]"]
  node_string_replace["String Replace"]
  node_regex_extract["Regex Extract"]
  node_random_number["Random Number"]
  node_read_file["File Read<br/>[ReadFileTool.java]"]
  node_write_file["File Write<br/>[WriteFileTool.java]"]
end

subgraph group_config["Configuration"]
  node_gemini_properties["Gemini Properties"]
  node_app_config["App Configuration<br/>[AppConfig.java]"]
  node_application_yml["Application Settings<br/>[application.yml]"]
end

node_user(("User"))
node_gemini{{"Gemini API"}}

node_user -->|"submits chat"| node_controller
node_controller -->|"invokes chat"| node_agent_service
node_agent_service -->|"requests generation"| node_gemini_client
node_gemini_client -->|"calls generateContent"| node_gemini
node_gemini -->|"returns tool calls or answer"| node_agent_service
node_agent_service -->|"executes tool calls"| node_tool_registry
node_tool_registry -->|"returns tool results"| node_agent_service
node_agent_tool -->|"implements discovery contract"| node_tool_registry
node_tool_registry -->|"discovers and executes"| node_calculator
node_tool_registry -->|"discovers and executes"| node_weather
node_tool_registry -->|"discovers and executes"| node_http_get
node_tool_registry -->|"discovers and executes"| node_current_time
node_tool_registry -->|"discovers and executes"| node_unit_convert
node_tool_registry -->|"discovers and executes"| node_uuid
node_tool_registry -->|"discovers and executes"| node_hash
node_tool_registry -->|"discovers and executes"| node_base64_encode
node_tool_registry -->|"discovers and executes"| node_base64_decode
node_tool_registry -->|"discovers and executes"| node_json_format
node_tool_registry -->|"discovers and executes"| node_word_count
node_tool_registry -->|"discovers and executes"| node_string_replace
node_tool_registry -->|"discovers and executes"| node_regex_extract
node_tool_registry -->|"discovers and executes"| node_random_number
node_tool_registry -->|"discovers and executes"| node_read_file
node_tool_registry -->|"discovers and executes"| node_write_file
node_application_yml -->|"supplies settings"| node_gemini_properties
node_application_yml -->|"configures application"| node_app_config
node_app_config -->|"provides HTTP client"| node_gemini_client

click node_controller "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/controller/AgentController.java"
click node_agent_service "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/agent/AgentService.java"
click node_gemini_client "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/GeminiClient.java"
click node_tool_registry "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/ToolRegistry.java"
click node_agent_tool "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/AgentTool.java"
click node_calculator "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/CalculatorTool.java"
click node_weather "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/WeatherTool.java"
click node_http_get "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/HttpGetTool.java"
click node_current_time "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/CurrentTimeTool.java"
click node_unit_convert "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/UnitConvertTool.java"
click node_uuid "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/UuidGenerateTool.java"
click node_hash "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/HashTextTool.java"
click node_base64_encode "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/Base64EncodeTool.java"
click node_base64_decode "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/Base64DecodeTool.java"
click node_json_format "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/JsonFormatTool.java"
click node_word_count "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/WordCountTool.java"
click node_string_replace "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/StringReplaceTool.java"
click node_regex_extract "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/RegexExtractTool.java"
click node_random_number "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/RandomNumberTool.java"
click node_read_file "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/ReadFileTool.java"
click node_write_file "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/WriteFileTool.java"
click node_gemini_properties "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/config/GeminiProperties.java"
click node_app_config "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/config/AppConfig.java"
click node_application_yml "https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/resources/application.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_controller,node_user toneBlue
class node_agent_service toneAmber
class node_gemini_client,node_gemini toneMint
class node_tool_registry,node_agent_tool,node_calculator,node_weather,node_http_get,node_current_time,node_unit_convert,node_uuid,node_hash,node_base64_encode,node_base64_decode,node_json_format,node_word_count,node_string_replace,node_regex_extract,node_random_number,node_read_file,node_write_file toneRose
class node_gemini_properties,node_app_config,node_application_yml toneIndigo
```

## Components

### Chat API

- [Chat Controller](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/controller/AgentController.java): `src/main/java/com/example/agent/controller/AgentController.java`

### Agent Orchestration

- [Agent Loop](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/agent/AgentService.java): `src/main/java/com/example/agent/agent/AgentService.java`

### Gemini Integration

- [Gemini Client](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/GeminiClient.java): `src/main/java/com/example/agent/service/GeminiClient.java`

### Java Tools

- [Tool Registry](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/ToolRegistry.java): `src/main/java/com/example/agent/service/tools/ToolRegistry.java`
- [Tool Interface](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/AgentTool.java): `src/main/java/com/example/agent/service/tools/AgentTool.java`
- [Calculator](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/CalculatorTool.java): `src/main/java/com/example/agent/service/tools/CalculatorTool.java`
- [Weather Lookup](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/WeatherTool.java): `src/main/java/com/example/agent/service/tools/WeatherTool.java`
- [HTTP Fetch](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/HttpGetTool.java): `src/main/java/com/example/agent/service/tools/HttpGetTool.java`
- [Current Time](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/CurrentTimeTool.java): `src/main/java/com/example/agent/service/tools/CurrentTimeTool.java`
- [Unit Conversion](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/UnitConvertTool.java): `src/main/java/com/example/agent/service/tools/UnitConvertTool.java`
- [UUID Generation](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/UuidGenerateTool.java): `src/main/java/com/example/agent/service/tools/UuidGenerateTool.java`
- [Text Hashing](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/HashTextTool.java): `src/main/java/com/example/agent/service/tools/HashTextTool.java`
- [Base64 Encode](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/Base64EncodeTool.java): `src/main/java/com/example/agent/service/tools/Base64EncodeTool.java`
- [Base64 Decode](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/Base64DecodeTool.java): `src/main/java/com/example/agent/service/tools/Base64DecodeTool.java`
- [JSON Formatting](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/JsonFormatTool.java): `src/main/java/com/example/agent/service/tools/JsonFormatTool.java`
- [Word Count](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/WordCountTool.java): `src/main/java/com/example/agent/service/tools/WordCountTool.java`
- [String Replace](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/StringReplaceTool.java): `src/main/java/com/example/agent/service/tools/StringReplaceTool.java`
- [Regex Extract](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/RegexExtractTool.java): `src/main/java/com/example/agent/service/tools/RegexExtractTool.java`
- [Random Number](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/RandomNumberTool.java): `src/main/java/com/example/agent/service/tools/RandomNumberTool.java`
- [File Read](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/ReadFileTool.java): `src/main/java/com/example/agent/service/tools/ReadFileTool.java`
- [File Write](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/service/tools/WriteFileTool.java): `src/main/java/com/example/agent/service/tools/WriteFileTool.java`

### Configuration

- [Gemini Properties](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/config/GeminiProperties.java): `src/main/java/com/example/agent/config/GeminiProperties.java`
- [App Configuration](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/java/com/example/agent/config/AppConfig.java): `src/main/java/com/example/agent/config/AppConfig.java`
- [Application Settings](https://github.com/rohan-girsa/agentic-ai-spring-boot-gemini/blob/master/src/main/resources/application.yml): `src/main/resources/application.yml`

### Other components

- **User**
- **Gemini API**

## Connections

- User → Chat Controller: submits chat (evidence: `README.md`)
- Chat Controller → Agent Loop: invokes chat (evidence: `README.md`)
- Agent Loop → Gemini Client: requests generation (evidence: `README.md`)
- Gemini Client → Gemini API: calls generateContent (evidence: `README.md`)
- Gemini API → Agent Loop: returns tool calls or answer (evidence: `README.md`)
- Agent Loop → Tool Registry: executes tool calls (evidence: `README.md`)
- Tool Registry → Agent Loop: returns tool results (evidence: `README.md`)
- Tool Interface → Tool Registry: implements discovery contract (evidence: `README.md`)
- Tool Registry → Calculator: discovers and executes (evidence: `README.md`)
- Tool Registry → Weather Lookup: discovers and executes (evidence: `README.md`)
- Tool Registry → HTTP Fetch: discovers and executes (evidence: `README.md`)
- Tool Registry → Current Time: discovers and executes (evidence: `README.md`)
- Tool Registry → Unit Conversion: discovers and executes (evidence: `README.md`)
- Tool Registry → UUID Generation: discovers and executes (evidence: `README.md`)
- Tool Registry → Text Hashing: discovers and executes (evidence: `README.md`)
- Tool Registry → Base64 Encode: discovers and executes (evidence: `README.md`)
- Tool Registry → Base64 Decode: discovers and executes (evidence: `README.md`)
- Tool Registry → JSON Formatting: discovers and executes (evidence: `README.md`)
- Tool Registry → Word Count: discovers and executes (evidence: `README.md`)
- Tool Registry → String Replace: discovers and executes (evidence: `README.md`)
- Tool Registry → Regex Extract: discovers and executes (evidence: `README.md`)
- Tool Registry → Random Number: discovers and executes (evidence: `README.md`)
- Tool Registry → File Read: discovers and executes (evidence: `README.md`)
- Tool Registry → File Write: discovers and executes (evidence: `README.md`)
- Application Settings → Gemini Properties: supplies settings (evidence: `README.md`)
- Application Settings → App Configuration: configures application (evidence: `README.md`)
- App Configuration → Gemini Client: provides HTTP client (evidence: `README.md`)
