Skip to content

Conversation

xuehuitian45
Copy link
Contributor

@xuehuitian45 xuehuitian45 commented Aug 25, 2025

【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,mind that you need to start a server at the specific url before you try the 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

CLAassistant commented Aug 25, 2025

CLA assistant check
All committers have signed the CLA.

@xuehuitian45 xuehuitian45 changed the title feat(core):Add A2A Remote Agent Client feat (core):Add A2A Remote Agent Client Aug 25, 2025
@xuehuitian45 xuehuitian45 changed the title feat (core):Add A2A Remote Agent Client feat(core): Add A2A Remote Agent Client Aug 25, 2025
@xuehuitian45 xuehuitian45 changed the title feat(core): Add A2A Remote Agent Client feat(core): add A2A Remote Agent Client Aug 25, 2025
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.

2 participants