A Spring AI library that brings Claude Code-inspired tools and agent skills to your AI applications.
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.
spring-ai-agent-utils/
├── spring-ai-agent-utils/ # Agent Utils Core library
│ ├── src/ # Agent Tool Utils implementation
│ ├── docs/ # Agent Tool documentation
│ └── README.md # Detailed library documentation
│
└── 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/ # Extensible sub-agent example
These are the agent tools needed to implement any agentic behavior
- AgentEnvironment - Dynamic agent context utility that provides runtime environment information and git repository status to system prompts
- FileSystemTools - Read, write, and edit files with precise control
- ShellTools - Execute shell commands with timeout control, background process management, and regex output filtering
- GrepTool - Pure Java grep implementation for code search with regex, glob filtering, and multiple output modes
- GlobTool - Fast file pattern matching tool for finding files by name patterns with glob syntax
- SmartWebFetchTool - AI-powered web content summarization with caching
- BraveWebSearchTool - Web search with domain filtering
- AskUserQuestionTool - Ask users clarifying questions with multiple-choice options during agent execution
- SkillsTool - Extend AI agent capabilities with reusable, composable knowledge modules defined in Markdown with YAML front-matter
- TodoWriteTool - Structured task management with state tracking
- TaskTools - Extensible sub-agent system for delegating complex tasks to specialized agents with multi-model routing and pluggable backends
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.
- Agent Utils Library Documentation - Complete API reference, tool capabilities, and skills development guide
- Example Applications - Working demos showcasing different use cases
1. Add dependency:
<dependency>
<groupId>org.springaicommunity</groupId>
<artifactId>spring-ai-agent-utils</artifactId>
<version>0.4.1</version>
</dependency>Note: You need Sping-AI version
2.0.0-SNAPSHOTor2.0.0-M2when released.
2. Configure your agent:
@SpringBootApplication
public class Application {
@Bean
CommandLineRunner demo(ChatClient.Builder chatClientBuilder,
@Value("${BRAVE_API_KEY}") String braveApiKey,
@Value("classpath:/prompt/MAIN_AGENT_SYSTEM_PROMPT_V2.md") Resource agentSystemPrompt) {
return args -> {
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"))
// Sub-Agents (with multi-model support)
.defaultToolCallbacks(TaskToolCallbackProvider.builder()
.chatClientBuilder("default", chatClientBuilder.clone())
.subagentReferences(ClaudeSubagentReferences.fromRootDirectory(".claude/agents"))
.skillsDirectories(".claude/skills")
.build())
// Skills
.defaultToolCallbacks(SkillsTool.builder()
.addSkillsDirectory(".claude/skills")
.build())
// Core Tools
.defaultTools(
ShellTools.builder().build(),
FileSystemTools.builder().build(),
GrepTool.builder().build(),
GlobTool.builder().build(),
SmartWebFetchTool.builder(chatClient).build(),
BraveWebSearchTool.builder(braveApiKey).build())
// Task orchestration
.defaultTools(TodoWriteTool.builder().build())
// User feedback tool
.defaultTools(AskUserQuestionTool.builder()
.questionHandler(questions -> handleUserQuestions(questions))
.build())
// Advisors
.defaultAdvisors(
ToolCallAdvisor.builder().conversationHistoryEnabled(false).build(), // Tool Calling
MessageChatMemoryAdvisor.builder(MessageWindowChatMemory.builder().maxMessages(500).build()).build()) // Memory
.build();
String response = chatClient
.prompt("Search for Spring AI documentation and summarize it")
.call()
.content();
};
}
}This project reimplements key Claude Code features based on:
- Claude Code Documentation
- Claude Code Agent Skills
- Claude Code Internals - Reverse engineering prompt augmentation
- Claude Code Skills - Implementation patterns
- Java 17+
- Spring Boot 3.x / 4.x
- Spring AI 2.0.0-SNAPSHOT (or 2.0.0-M2 when released)
- Maven 3.6+
# Build the entire project
mvn clean install
# Run an example
cd examples/code-agent-demo # or examples/skills-demo
mvn spring-boot:run| Example | Description |
|---|---|
| code-agent-demo | Full-featured AI coding assistant with interactive CLI, all tools, and multi-model support |
| todo-demo | Structured task management with TodoWriteTool and real-time progress tracking |
| subagent-demo | Hierarchical sub-agent system with custom sub-agents and TaskTools integration |
| skills-demo | SkillsTool system with custom skill development and the ai-tuto example |
| ask-user-question-demo | Interactive agent-user communication with AskUserQuestionTool |
See examples/README.md for setup and usage details.
Apache License 2.0
Contributions are welcome! Please feel free to submit issues or pull requests.
