spring-ai-agent-utils
A Spring AI library that brings Claude Code-inspired tools and agent skills to your AI applications.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Check it deeper on your machine
It has changed since its scan on 11 Nov 2026.
As a Claude Code plugin, install it and then ask Claude Code:
/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/spring-ai-community/spring-ai-agent-utils with scanskillsafety
Or from a terminal, clone it and run it:
git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/spring-ai-community/spring-ai-agent-utils'
It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.
Badge for your README
Markdown
[](/listings/spring-ai-community--spring-ai-agent-utils)HTML
<a href="/listings/spring-ai-community--spring-ai-agent-utils"><img src="/api/listings/spring-ai-community--spring-ai-agent-utils/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
**1. Add dependency:**
Use the BOM to manage versions consistently across all modules:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springaicommunity</groupId>
<artifactId>spring-ai-agent-utils-bom</artifactId>
<version>0.13.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springaicommunity</groupId>
<artifactId>spring-ai-agent-utils</artifactId>
</dependency>
</dependencies>Or add the core library directly:
<dependency>
<groupId>org.springaicommunity</groupId>
<artifactId>spring-ai-agent-utils</artifactId>
<version>0.13.0</version>
</dependency>_Check the latest version:_ [](https://central.sonatype.com/artifact/org.springaicommunity/spring-ai-agent-utils)
> **Note:** You need Spring AI version `` or later.
**2. Configure your agent:**
@SpringBootApplication
public class Application {
@Bean
CommandLineRunner demo(ChatClient.Builder chatClientBuilder,
@Value("${BRAVE_API_KEY}") String braveApiKey,
@Value("${agent.skills.paths}") List<Resource> skillPaths,
@Value("classpath:/prompt/MAIN_AGENT_SYSTEM_PROMPT_V2.md") Resource agentSystemPrompt) {
return args -> {
// Configure Task tool with Claude sub-agents
var taskTool = TaskTool.builder()
.subagentTypes(ClaudeSubagentType.builder()
.chatClientBuilder("default", chatClientBuilder.clone())
.skillsResources(skillPaths)
.braveApiKey(braveApiKey)
.build())
.build();
ChatClient chatClient = chatClientBuilder
// Main agent prompt
.defaultSystem(p -> p.text(agentSystemPrompt) // system prompt
.param(AgentEnvironment.ENVIRONMENT_INFO_KEY, AgentEnvironment.info())
.param(AgentEnvironment.GIT_STATUS_KEY, AgentEnvironment.gitStatus())
.param(AgentEnvironment.AGENT_MODEL_KEY, "claude-sonnet-4-5-20250929")
.param(AgentEnvironment.AGENT_MODEL_KNOWLEDGE_CUTOFF_KEY, "2025-01-01"))
.defaultTools(
// Sub-Agents
taskTool,
// Skills
SkillsTool.builder()
.addSkillsResources(skillPaths)
.build()
// Core Tools
ShellTools.builder().build(),
FileSystemTools.builder().build(),
GrepTool.builder().build(),
GlobTool.builder().build(),
SmartWebFetchTool.builder(chatClientBuilder.clone().build()).build(),
BraveWebSearchTool.builder(braveApiKey).build(),
// Task orchestration
TodoWriteTool.builder().build()
// User feedback tool (use CommandLineQuestionHandler for CLI apps)
AskUserQuestionTool.builder()
.questionHandler(new CommandLineQuestionHandler())
.build())
// Advisors
.defaultAdvisors(
MessageChatMemoryAdvisor.builder(MessageWindowChatMemory.builder().maxMessages(500).build()).build()) // Memory
.build();
String response = chatClient
.prompt("Search for Spring AI documentation and summarize it")
.advisors(a -> a.param(ChatMemory.CONVERSATION_ID, "session-1"))
.call()
.content();
};
}
}What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
README.md · README · 267 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.
- # Spring AI Agent Utils
- [](https://opensource.org/licenses/Apache-2.0)
- [](https://central.sonatype.com/artifact/org.springaicommunity/spring-ai-agent-utils)
- [](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
- A [Spring AI](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/index.html) library that brings [Claude Code](https://code.claude.com/docs/en/settings#tools-available-to-claude)-inspired tools and agent skills to your AI applications.
- ## Overview
- <img style="display: block; margin: auto;" align="left" src="docs/images/spring-ai-agent-utils-logo.png" width="250" />
- Spring AI Agent Utils reimplements core Claude Code capabilities as Spring AI tools, enabling sophisticated agentic workflows with file operations, shell execution, web access, task management, and extensible agent skills.
- This project demonstrates how to reverse-engineer and reimplement Claude Code's powerful features within the Spring AI ecosystem, making them available to Java developers building AI agents.
- ## Project Structure
- ```
- spring-ai-agent-utils/
- ├── spring-ai-agent-utils-common/ # Shared subagent SPI (interfaces & records)
- ├── spring-ai-agent-utils/ # Core library (tools, advisors, skills, Claude subagents)
- ├── spring-ai-agent-utils-a2a/ # A2A protocol subagent implementation
- ├── spring-ai-agent-utils-bom/ # Bill of Materials for version management
- │
- └── examples/
- ├── code-agent-demo/ # Full-featured AI coding assistant
- ├── ask-user-question-demo/ # Interactive question-answer demo
- ├── skills-demo/ # Focused skills system demo
- ├── subagent-demo/ # Markdown-defined local sub-agents
- ├── subagent-a2a-demo/ # A2A protocol remote sub-agents
- ├── todo-demo/ # TodoWriteTool task management demo
- └── memory/
- ├── memory-tools-demo/ # Long-term memory with AutoMemoryTools (manual setup)
- ├── memory-filesystem-tools-demo/# Long-term memory with general FileSystemTools
- └── memory-tools-advisor-demo/ # Long-term memory via AutoMemoryToolsAdvisor
- ```
- ## Agentic Utils
- These are the agent tools needed to implement any agentic behavior
- #### Core Tools
- - **[AgentEnvironment](docs/tools/AgentEnvironment.md)** - Dynamic agent context utility that provides runtime environment information and git repository status to system prompts
- - **[FileSystemTools](docs/tools/FileSystemTools.md)** - Read, write, and edit files with precise control
- - **[ShellTools](docs/tools/ShellTools.md)** - Execute shell commands with timeout control, background process management, and regex output filtering
- - **[GrepTool](docs/tools/GrepTool.md)** - Pure Java grep implementation for code search with regex, glob filtering, and multiple output modes
- - **[GlobTool](docs/tools/GlobTool.md)** - Fast file pattern matching tool for finding files by name patterns with glob syntax
- - **[SmartWebFetchTool](docs/tools/SmartWebFetchTool.md)** - AI-powered web content summarization with caching
- - **[BraveWebSearchTool](docs/tools/BraveWebSearchTool.md)** - Web search with domain filtering
- #### User feedback
- - **[AskUserQuestionTool](docs/tools/AskUserQuestionTool.md)** - Ask users clarifying questions with multiple-choice options during agent execution
- #### Agent Skills
- - **[SkillsTool](docs/tools/SkillsTool.md)** - Extend AI agent capabilities with reusable, composable knowledge modules defined in Markdown with YAML front-matter
- #### Long-term memory
- - **[AutoMemoryTools](docs/tools/AutoMemoryTools.md)** - Persistent, file-based long-term memory that survives across conversations. Agents store typed memory files (`user`, `feedback`, `project`, `reference`) in a sandboxed directory and navigate them via a `MEMORY.md` index. Requires the companion `classpath:/prompt/AUTO_MEMORY_TOOLS_SYSTEM_PROMPT.md` system prompt (bundled in the jar) to instruct the agent on when and how to use the tools. Inspired by [Claude Code memory](https://code.claude.com/docs/en/memory) and the [Claude API SDK memory tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool).
- - **[AutoMemoryToolsAdvisor](docs/tools/AutoMemoryToolsAdvisor.md)** - A `ChatClient` advisor that wires `AutoMemoryTools` and its companion system prompt into the request pipeline automatically. Eliminates manual tool and prompt registration, deduplicates callbacks, and supports an optional `memoryConsolidationTrigger` to prompt the model to summarise and clean up memories on a schedule.
- #### Task orchestration & multi-agent
- - **[TodoWriteTool](docs/tools/TodoWriteTool.md)** - Structured task management with state tracking
- - **[TaskTools](docs/tools/TaskTools.md)** - Extensible sub-agent system for delegating complex tasks to specialized agents with multi-model routing and pluggable backends
- #### Agent loop control & observability
- - **[InterruptAdvisor](docs/tools/InterruptAdvisor.md)** - Cooperative cancellation of a running agent turn: a "stop" button, a deadline or a budget guard stops the tool-calling loop before its next model request
- - **[ToolCallListener](docs/tools/ToolCallListener.md)** - Observe every tool invocation (audit logs, progress streaming, metrics) and choose whether a tool failure is reported to the model or rethrown
- While these tools can be used standalone, truly agentic behavior emerges when they are combined. SkillsTool naturally pairs with FileSystemTools and ShellTools to execute domain-specific workflows. BraveWebSearchTool and SmartWebFetchTool provide your AI application with access to real-world information. TaskTools orchestrates complex operations by delegating to specialized sub-agents, each equipped with a tailored subset of these tools.
- ### Detailed Documentation
- | Module | Description |
- |--------|-------------|
- | [**spring-ai-agent-utils**](spring-ai-agent-utils/README.md) | Core library - tools, skills, Claude subagents, and full API reference |
- | [**spring-ai-agent-utils-common**](spring-ai-agent-utils-common/README.md) | Shared subagent SPI (SubagentDefinition, SubagentResolver, SubagentExecutor, SubagentType) |
- | [**spring-ai-agent-utils-a2a**](spring-ai-agent-utils-a2a/README.md) | A2A protocol subagent for remote agent orchestration |
- | [**spring-ai-agent-utils-docker-cli**](docs/tools/DockerCliExecBackend.md) | Docker ExecBackend - run agent shell commands inside a sandbox container (in `exec-backends/`) |
- | [**spring-ai-agent-utils-bom**](spring-ai-agent-utils-bom/pom.xml) | Bill of Materials for consistent version management across all modules |
- | [**Examples**](#examples) | Working demos showcasing different use cases |
- ## Quick Start
- **1. Add dependency:**
- Use the BOM to manage versions consistently across all modules:
- ```xml
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springaicommunity</groupId>
- <artifactId>spring-ai-agent-utils-bom</artifactId>
- <version>0.13.0</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springaicommunity</groupId>
- <artifactId>spring-ai-agent-utils</artifactId>
- </dependency>
- </dependencies>
- ```
- Or add the core library directly:
- ```xml
- <dependency>
- <groupId>org.springaicommunity</groupId>
- <artifactId>spring-ai-agent-utils</artifactId>
- <version>0.13.0</version>
- </dependency>
- ```
- _Check the latest version:_ [](https://central.sonatype.com/artifact/org.springaicommunity/spring-ai-agent-utils)
- > **Note:** See [Requirements](#requirements) for the supported Spring AI version.
- **2. Configure your agent:**
- ```java
- @SpringBootApplication
- public class Application {
- @Bean
- CommandLineRunner demo(ChatClient.Builder chatClientBuilder,
- @Value("${BRAVE_API_KEY}") String braveApiKey,
- @Value("${agent.skills.paths}") List<Resource> skillPaths,
- @Value("classpath:/prompt/MAIN_AGENT_SYSTEM_PROMPT_V2.md") Resource agentSystemPrompt) {
- return args -> {
- // Configure Task tool with Claude sub-agents
- var taskTool = TaskTool.builder()
- .subagentTypes(ClaudeSubagentType.builder()
- .chatClientBuilder("default", chatClientBuilder.clone())
- .skillsResources(skillPaths)
- .braveApiKey(braveApiKey)
- .build())
- .build();
- // Conversation memory: an in-memory session store
- SessionService sessionService = DefaultSessionService.builder()
- .sessionRepository(InMemorySessionRepository.builder().build())
- .build();
- ChatClient chatClient = chatClientBuilder
- // Main agent prompt
- .defaultSystem(p -> p.text(agentSystemPrompt) // system prompt
- .param(AgentEnvironment.ENVIRONMENT_INFO_KEY, AgentEnvironment.info())
- .param(AgentEnvironment.GIT_STATUS_KEY, AgentEnvironment.gitStatus())
- .param(AgentEnvironment.AGENT_MODEL_KEY, "claude-sonnet-4-5-20250929")
- .param(AgentEnvironment.AGENT_MODEL_KNOWLEDGE_CUTOFF_KEY, "2025-01-01"))
- .defaultTools(
- // Sub-Agents
- taskTool,
- // Skills
- SkillsTool.builder()
- .addSkillsResources(skillPaths)
- .build()
- // Core Tools
- ShellTools.builder().build(),
- FileSystemTools.builder().build(),
- GrepTool.builder().build(),
- GlobTool.builder().build(),
- SmartWebFetchTool.builder(chatClientBuilder.clone().build()).build(),
- BraveWebSearchTool.builder(braveApiKey).build(),
- // Task orchestration
- TodoWriteTool.builder().build()
- // User feedback tool (use CommandLineQuestionHandler for CLI apps)
- AskUserQuestionTool.builder()
- .questionHandler(new CommandLineQuestionHandler())
- .build())
- // Conversation memory
- .defaultAdvisors(SessionAdvisors.builder(sessionService).build())
- .build();
- String response = chatClient
- .prompt("Search for Spring AI documentation and summarize it")
- .advisors(SessionAdvisors.session("session-1"))
- .call()
- .content();
- };
- }
- }
- ```
- The conversation memory in this example comes from Spring AI's session module: add `org.springframework.ai:spring-ai-session-advisor` (its version comes from the Spring AI BOM, and it brings in `spring-ai-session`). See [Session Memory](https://docs.spring.io/spring-ai/reference/api/session.html) for persistent stores and compaction.
- ## References
- This project reimplements key Claude Code features based on:
- - [Claude Code Documentation](https://code.claude.com/docs/en/overview)
- - [Claude Code Agent Skills](https://code.claude.com/docs/en/skills#agent-skills)
- - [Claude Code Internals](https://agiflow.io/blog/claude-code-internals-reverse-engineering-prompt-augmentation/) - Reverse engineering prompt augmentation
- - [Claude Code Skills](https://mikhail.io/2025/10/claude-code-skills/) - Implementation patterns
- ## Requirements
- - Java 17+
- - Spring Boot 4.2 or later (the version Spring AI 2.1 is built on)
- - Spring AI 2.1 or later
- - Maven 3.6+
- ## Building
- ```bash
- # Build the entire project
- mvn clean install
- # Run an example
- cd examples/code-agent-demo # or examples/skills-demo
- mvn spring-boot:run
- ```
- ## Examples
- | Example | Description |
- |---------|-------------|
- | [code-agent-demo](examples/code-agent-demo) | Full-featured AI coding assistant with interactive CLI, all tools, and multi-model support |
- | [todo-demo](examples/todo-demo) | Structured task management with `TodoWriteTool` and real-time progress tracking |
- | [subagent-demo](examples/subagent-demo) | Hierarchical sub-agent system with Markdown-defined local sub-agents |
- | [subagent-a2a-demo](examples/subagent-a2a-demo) | A2A protocol integration for delegating tasks to remote agents |
- | [skills-demo](examples/skills-demo) | SkillsTool system with custom skill development and the ai-tuto example |
- | [ask-user-question-demo](examples/ask-user-question-demo) | Interactive agent-user communication with `AskUserQuestionTool` |
- | [memory/memory-tools-demo](examples/memory/memory-tools-demo) | Long-term memory across conversations using dedicated, sandboxed `AutoMemoryTools` (manual setup) |
- | [memory/memory-filesystem-tools-demo](examples/memory/memory-filesystem-tools-demo) | Long-term memory using general-purpose `FileSystemTools` — no dedicated memory tooling required |
- | [memory/memory-tools-advisor-demo](examples/memory/memory-tools-advisor-demo) | Long-term memory via `AutoMemoryToolsAdvisor` — advisor-based setup with consolidation trigger |
- See [examples/README.md](examples/README.md) for setup and usage details.
- ## License
- Apache License 2.0
- ## Links
- - [Documentation](https://springaicommunity.mintlify.app/projects/incubating/spring-ai-agent-utils)
- - [GitHub Repository](https://github.com/spring-ai-community/spring-ai-agent-utils)
- - [Issue Tracker](https://github.com/spring-ai-community/spring-ai-agent-utils/issues)
- - [Spring AI Documentation](https://docs.spring.io/spring-ai/reference/)
- - [Claude Code Documentation](https://code.claude.com/docs/en/overview)
- ## Contributing
- Contributions are welcome! Please feel free to submit issues or pull requests.
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.