Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2024-2025 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ https://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba</artifactId>
<version>${revision}</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>spring-ai-alibaba-autoconfigure-a2a-client</artifactId>

<name>Spring AI Alibaba A2A Client Autoconfiguration</name>
<description>Spring AI Alibaba A2A Client Autoconfiguration</description>
<url>https://github.com/alibaba/spring-ai-alibaba</url>
<scm>
<connection>git://github.com/alibaba/spring-ai-alibaba.git</connection>
<developerConnection>git@github.com:alibaba/spring-ai-alibaba.git</developerConnection>
<url>https://github.com/alibaba/spring-ai-alibaba</url>
</scm>

<dependencies>
<dependency>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba-a2a-common</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.cloud.ai.autoconfigure.a2a.client;

import com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties;
import com.alibaba.cloud.ai.autoconfigure.a2a.client.condition.A2aClientAgentCardWellKnownCondition;
import com.alibaba.cloud.ai.graph.agent.a2a.AgentCardProvider;
import com.alibaba.cloud.ai.graph.agent.a2a.RemoteAgentCardProvider;
import io.a2a.spec.AgentCard;

import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;

/**
* Autoconfiguration for A2A client agent card provider.
*
* @author xiweng.yy
*/
@AutoConfiguration
@EnableConfigurationProperties({ A2aClientAgentCardProperties.class })
public class A2aClientAgentCardProviderAutoConfiguration {

@Bean
@ConditionalOnClass({ AgentCardProvider.class })
@Conditional(A2aClientAgentCardWellKnownCondition.class)
public AgentCardProvider remoteAgentCardProvider(A2aClientAgentCardProperties a2aClientAgentCardProperties) {
return RemoteAgentCardProvider.newProvider(a2aClientAgentCardProperties.getWellKnownUrl());
}

@Bean
@ConditionalOnClass({ AgentCardProvider.class })
@ConditionalOnProperty(prefix = A2aClientAgentCardProperties.CONFIG_PREFIX, value = "name")
public AgentCardProvider localAgentCardProvider(A2aClientAgentCardProperties a2aClientAgentCardProperties) {
AgentCard agentCard = new AgentCard.Builder().name(a2aClientAgentCardProperties.getName())
.description(a2aClientAgentCardProperties.getDescription())
.url(a2aClientAgentCardProperties.getUrl())
.provider(a2aClientAgentCardProperties.getProvider())
.documentationUrl(a2aClientAgentCardProperties.getDocumentationUrl())
.capabilities(a2aClientAgentCardProperties.getCapabilities())
.defaultInputModes(a2aClientAgentCardProperties.getDefaultInputModes())
.defaultOutputModes(a2aClientAgentCardProperties.getDefaultOutputModes())
.skills(a2aClientAgentCardProperties.getSkills())
.supportsAuthenticatedExtendedCard(a2aClientAgentCardProperties.isSupportsAuthenticatedExtendedCard())
.securitySchemes(a2aClientAgentCardProperties.getSecuritySchemes())
.security(a2aClientAgentCardProperties.getSecurity())
.iconUrl(a2aClientAgentCardProperties.getIconUrl())
.additionalInterfaces(a2aClientAgentCardProperties.getAdditionalInterfaces())
.version(a2aClientAgentCardProperties.getVersion())
.protocolVersion(a2aClientAgentCardProperties.getProtocolVersion())
.preferredTransport(a2aClientAgentCardProperties.getPreferredTransport())
.build();
return () -> agentCard;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.cloud.ai.autoconfigure.a2a.client.condition;

import com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties;

import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.StringUtils;

/**
* Condition for {@link com.alibaba.cloud.ai.graph.agent.a2a.RemoteAgentCardProvider}.
*
* @author xiweng.yy
*/
public class A2aClientAgentCardWellKnownCondition extends SpringBootCondition {

@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
String wellKnownUrl = context.getEnvironment()
.getProperty(A2aClientAgentCardProperties.CONFIG_PREFIX + ".well-known-url", String.class);
return StringUtils.hasLength(wellKnownUrl) ? ConditionOutcome.match()
: ConditionOutcome.noMatch(A2aClientAgentCardProperties.CONFIG_PREFIX + ".wellKnownUrl not set.");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"groups": [
{
"name": "spring.ai.alibaba.a2a.client.card",
"type": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties",
"description": "Configuration properties for A2A Agent Card."
}
],
"properties": [
{
"name": "spring.ai.alibaba.a2a.client.card.name",
"type": "java.lang.String",
"description": "The name of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.description",
"type": "java.lang.String",
"description": "The description of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.url",
"type": "java.lang.String",
"description": "The url of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.provider",
"type": "io.a2a.spec.AgentProvider",
"description": "The provider information of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.documentation-url",
"type": "java.lang.String",
"description": "The documentation url of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.capabilities",
"type": "io.a2a.spec.AgentCapabilities",
"description": "The capabilities of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.default-input-modes",
"type": "java.util.List<java.lang.String>",
"description": "The default input modes of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.default-output-modes",
"type": "java.util.List<java.lang.String>",
"description": "The default output modes of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.skills",
"type": "java.util.List<io.a2a.spec.AgentSkill>",
"description": "The skills of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.supports-authenticated-extended-card",
"type": "java.lang.Boolean",
"description": "Whether the agent supports authenticated extended card.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties",
"defaultValue": false
},
{
"name": "spring.ai.alibaba.a2a.client.card.security-schemes",
"type": "java.util.Map<java.lang.String, io.a2a.spec.SecurityScheme>",
"description": "The security schemes of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.security",
"type": "java.util.List<java.util.Map<java.lang.String, java.util.List<java.lang.String>>>",
"description": "The security configuration of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.icon-url",
"type": "java.lang.String",
"description": "The icon url of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.additional-interfaces",
"type": "java.util.List<io.a2a.spec.AgentInterface>",
"description": "The additional interfaces of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.version",
"type": "java.lang.String",
"description": "The version of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.preferred-transport",
"type": "java.lang.String",
"description": "The preferred transport of the agent. enum of `JSONRPC`, `GRPC`, `HTTP+JSON`.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.protocol-version",
"type": "java.lang.String",
"description": "The protocol version of the agent.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
},
{
"name": "spring.ai.alibaba.a2a.client.card.well-known-url",
"type": "java.lang.String",
"description": "The well known url of agent card.",
"sourceType": "com.alibaba.cloud.ai.a2a.A2aClientAgentCardProperties"
}
],
"hints": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Copyright 2025-2025 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
com.alibaba.cloud.ai.autoconfigure.a2a.client.A2aClientAgentCardProviderAutoConfiguration

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2024-2025 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ https://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba</artifactId>
<version>${revision}</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>spring-ai-alibaba-autoconfigure-a2a-registry</artifactId>
<name>Spring AI Alibaba A2A Nacos Registry Autoconfiguration</name>
<description>Spring AI Alibaba A2A Nacos Registry Autoconfiguration</description>
<url>https://github.com/alibaba/spring-ai-alibaba</url>
<scm>
<connection>git://github.com/alibaba/spring-ai-alibaba.git</connection>
<developerConnection>git@github.com:alibaba/spring-ai-alibaba.git</developerConnection>
<url>https://github.com/alibaba/spring-ai-alibaba</url>
</scm>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba-autoconfigure-a2a-server</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba-autoconfigure-a2a-client</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba-a2a-registry</artifactId>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
</dependencies>

</project>
Loading
Loading