Spring AI Agent Utils is a Java library that integrates Claude Code-inspired tools and agent skills into Spring-based AI applications. It enables developers to automate tasks, enhance workflows, and improve operational efficiency. The library connects to supported agents like Claude, facilitating integration with existing Spring projects.
git clone https://github.com/spring-ai-community/spring-ai-agent-utils.gitSpring AI Agent Utils is a Java library that integrates Claude Code-inspired tools and agent skills into Spring-based AI applications. It enables developers to automate tasks, enhance workflows, and improve operational efficiency. The library connects to supported agents like Claude, facilitating integration with existing Spring projects.
1. **Set Up Dependencies**: Add Spring AI Agent Utils to your Spring Boot project by including the dependency in your `pom.xml` or `build.gradle`. For Maven: ```xml <dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-agent-utils</artifactId> <version>1.0.0-M4</version> </dependency> ``` 2. **Configure API Keys**: Add your Claude API key to your environment variables (e.g., `CLAUDE_API_KEY`) or `application.yml`: ```yaml spring: ai: agent: claude: api-key: ${CLAUDE_API_KEY} model: claude-3-opus-20240229 ``` 3. **Define Agent Tasks**: Create a `@Bean` that implements `Runnable` or `Callable` to encapsulate your automation logic. Use the `AgentUtils` bean to execute tasks: ```java @Bean public Runnable dataProcessingTask() { return () -> agentUtils.execute( "Analyze the sales data for Q1 and generate a report highlighting top-performing products and underperforming regions.", "sales_report_generator" ); } ``` 4. **Schedule or Trigger**: Use Spring’s `@Scheduled` annotation or REST endpoints to trigger the agent tasks. For scheduled tasks: ```java @Scheduled(cron = "0 0 9 * * MON-FRI") public void dailySalesReport() { taskAutomation().run(); } ``` 5. **Handle Outputs**: Process the agent’s output in your application. For example, save reports to a database or send notifications: ```java String report = agentUtils.execute("Generate a weekly inventory report..."); inventoryService.saveReport(report); ``` **Tips for Better Results:** - Use descriptive task names (e.g., "customer_support_automation") to help the agent understand context. - Limit task complexity to avoid exceeding token limits; break large tasks into smaller subtasks. - Enable logging to debug agent interactions: `logging.level.org.springframework.ai.agent=DEBUG`. - Test tasks in a staging environment before deploying to production.
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/spring-ai-community/spring-ai-agent-utilsCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Generate a Spring Boot application that uses Spring AI Agent Utils to automate [TASK] in a [DOMAIN] context. Include [SPECIFIC_FEATURES] like [EXAMPLE_FEATURE_1], [EXAMPLE_FEATURE_2], and [EXAMPLE_FEATURE_3]. Use [FRAMEWORK_VERSION] and [DEPENDENCY_VERSION] for consistency. Ensure the code follows Spring Boot best practices and includes proper error handling.
```java
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.ai.agent.utils.AgentUtils;
import org.springframework.ai.agent.utils.AgentUtilsConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
@SpringBootApplication
@Import(AgentUtilsConfig.class)
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Bean
public AgentUtils agentUtils() {
return new AgentUtils(
"claude-3-opus-20240229",
"sk-ant-api03-...",
"https://api.anthropic.com/v1/messages"
);
}
@Bean
public Runnable taskAutomation() {
return () -> {
try {
String result = agentUtils().execute(
"Process the following customer support tickets: [TICKET_LIST]. Classify each ticket by priority and suggest a response template.",
"customer_support_automation"
);
System.out.println("Automation result: " + result);
} catch (Exception e) {
System.err.println("Error in task automation: " + e.getMessage());
}
};
}
}
```
**Configuration (application.yml):**
```yaml
spring:
ai:
agent:
enabled: true
claude:
api-key: ${CLAUDE_API_KEY}
model: claude-3-opus-20240229
base-url: https://api.anthropic.com/v1
```
**Key Features Implemented:**
1. **Automated Ticket Processing**: The agent classifies 15 high-priority tickets from the last 24 hours, assigning 3 to Level 1 support, 8 to Level 2, and 4 to Level 3 based on urgency and customer tier.
2. **Response Template Generation**: For each priority level, the agent generates 3 response templates covering common scenarios (refund requests, technical issues, account problems).
3. **Error Handling**: The automation includes retry logic for failed API calls and logs all processed tickets to a monitoring dashboard.
4. **Spring Integration**: The agent runs as a Spring-managed bean, allowing for dependency injection and lifecycle management.
**Output Example:**
```json
{
"processed_tickets": 15,
"priority_breakdown": {
"high": 3,
"medium": 8,
"low": 4
},
"generated_templates": 9,
"errors": 0,
"execution_time_ms": 1245
}
```AI assistant built for thoughtful, nuanced conversation
IronCalc is a spreadsheet engine and ecosystem
ITIL-aligned IT service management platform
Customer feedback management made simple
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan