A2A Java SDK Spring
36A2A Java SDK for Spring Framework. Including server, Spring Boot auto configuration, Spring AI tools, and Spring AI examples.
Getting Started
README
A2A Java SDK for Spring Framework
This is the integration of the A2A Java SDK for Spring framework web servers. Including server, Spring Boot auto-configuration, Spring AI tools, and Spring AI examples.
This implementation is aligned with A2A Protocol Specification 1.0.0.
For more information about the A2A protocol, see here.
Getting Started
To use the A2A Java SDK in your Spring Boot application, you will need to package it as a .jar file by using supported spring-boot-autoconfigure projects.
Packaging your Spring Boot application
The key to enabling A2A in your Java application is to correctly package it. Here are the general steps you need to follow:
-
Manage Dependencies:
- Using the Spring Boot autoconfigure:
{ dependencies { implementation("io.github.goodfriend2ks:spring-a2a-server:${property("a2aSdkSpringVersion")}") implementation("io.github.goodfriend2ks:spring-a2a-server-autoconfigure:${property("a2aSdkSpringVersion")}") } }- (Optional) Using the Spring Boot autoconfigure for
Spring AIsupported Agent skill:
{ dependencies { implementation("io.github.goodfriend2ks:spring-ai-a2a-tool:${property("a2aSdkSpringVersion")}") implementation("io.github.goodfriend2ks:spring-ai-a2a-server-autoconfigure:${property("a2aSdkSpringVersion")}") } }- (Optional) Using the GRPC Spring Boot autoconfigure to support GRPC protocol:
{ dependencies { implementation("org.springframework.grpc:spring-grpc-server-spring-boot-starter:${property("springGrpcVersion")}") } } -
Provide implementations for
AgentExecutorandAgentCard: The A2A SDK requires you to provide your own implementations of theAgentExecutorandAgentCardinterfaces.2.1. Implementation for
AgentCard:- Option 1: Implement your own skills for your agent. You can find more information about them in the A2A Java SDK documentation. See examples in
spring-ai-a2a-examples/java/v1 - Option 2: Using Spring Boot autoconfigure for
Spring AIsupported Agent Skills: See examples inspring-ai-a2a-examples/java/v2.
2.2. Implementations for
AgentExecutor:- Option 1: Implement your own
AgentExecutor. You can find more information about them in the A2A Java SDK documentation. - Option 2: Use default
AgentExecutorimplementation and implementAgentExecutorHandlerto provide your agent business logic.
- Option 1: Implement your own skills for your agent. You can find more information about them in the A2A Java SDK documentation. See examples in
-
Manage Configurations:
spring: ai: a2a: server: enabled: true host: "*" ssl: false grpc: enabled: false jsonrpc: enabled: false rest: enabled: false
Examples
There are two version of Spring Boot application examples with Spring AI (in spring-ai-a2a-examples folder):