Skip to content

Conversation

xiaorenwu234
Copy link

【Feature】Add A2A Protocol Client Adaptation to spring-ai-alibaba-graph-core

1. PR Basic Information

  • Related Issue: None
  • Module Path: spring-ai-alibaba-graph-core
  • Core Changes: Added A2A protocol client component, supporting consistent Agent creation method with regular Agents, automatically parsing AgentCard URL and loading configurations
  • Submitter: xiaorenwu234
  • Submission Date: August 25, 2025

2. Feature Background and Goals

In the existing spring-ai-alibaba-graph-core module, Agents all use in-process multi-Agent interaction. To meet the requirements of remote multi-Agent scenarios and adapt to cross-service Agent calling scenarios using A2A (Agent-to-Agent) protocol, this development adds A2A protocol Client with the following core goals:

  1. Maintain consistency in Agent creation process, allowing developers to use A2A protocol Agents without learning new APIs
  2. Support automatic request initiation and response parsing through AgentCard URL, reducing manual configuration costs
  3. Be compatible with existing Agent lifecycle management logic

3. Core Implementation Details

3.1 New Component Structure

spring-ai-alibaba-graph-core/
├── src/main/java/com/alibaba/cloud/ai/graph/agent/a2a
│   ├── A2aNode.java       // A2A node core processing layer
│   ├── A2aRemoteAgent.java  // Agent construction and invocation encapsulation
│   └── RemoteAgentCard.java   // AgentCard parser
├── src/test/java/com/alibaba/cloud/ai/graph/agent
│   ├── RemoteAgentTest.java	// Remote Agent test

3.2 Key Logic Explanation

  1. AgentCard Creation Process Extension:
  • In RemoteAgentCard.java, pull the agent card by passing in the agent card URL
  • Parse the content in the agent card to construct an A2A AgentCard instance
  1. A2A Client Core Capabilities:
  • Construct an A2aRemoteAgent instance through the passed agent card
  • Call the apply function of A2aNode, convert formats through adaptation functions before and after sending requests, and add the corresponding results to OverAllState after processing

4. Code Level (Consistent with Regular Agent Creation)

A2aRemoteAgent remoteWriterAgent = A2aRemoteAgent.builder()
			.name("writer_agent")
			.agentCard(RemoteAgentCard.builder().url("http://0.0.0.0:10000").build())
			.description("Can write articles.")
			.outputKey("article")
			.build();

5. Dependency Changes

  • New Dependencies (already added in pom.xml, no conflicts):
<dependency>
    <groupId>io.github.a2asdk</groupId>
    <artifactId>a2a-java-reference-server</artifactId>
    <version>${a2a-sdk.version}</version>
</dependency>
<dependency>
    <groupId>io.github.a2asdk</groupId>
    <artifactId>a2a-java-sdk-server-common</artifactId>
    <version>${a2a-sdk.version}</version>
</dependency>
<dependency>
    <groupId>io.github.a2asdk</groupId>
    <artifactId>a2a-java-sdk-client</artifactId>
    <version>${a2a-sdk.version}</version>
</dependency>

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


500010 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants