agentscope.a2a¶
The A2A related modules.
- class AgentCardResolverBase[source]¶
Bases:
objectBase class for A2A agent card resolvers, responsible for fetching agent cards from various sources. Implementations must provide the get_agent_card method to retrieve the agent card.
- class FileAgentCardResolver[source]¶
Bases:
AgentCardResolverBaseAgent card resolver that loads AgentCard from a JSON file.
The JSON file should contain an AgentCard object with the following required fields:
name (str): The name of the agent
url (str): The URL of the agent
version (str): The version of the agent
capabilities (dict): The capabilities of the agent
default_input_modes (list[str]): Default input modes
default_output_modes (list[str]): Default output modes
skills (list): List of agent skills
Example JSON file content:
{ "name": "RemoteAgent", "url": "http://localhost:8000", "description": "A remote A2A agent", "version": "1.0.0", "capabilities": {}, "default_input_modes": ["text/plain"], "default_output_modes": ["text/plain"], "skills": [] }
- class WellKnownAgentCardResolver[source]¶
Bases:
AgentCardResolverBaseAgent card resolver that loads AgentCard from a well-known URL.
- __init__(base_url, agent_card_path=None)[source]¶
Initialize the WellKnownAgentCardResolver.
- Parameters:
base_url (str) – The base URL to resolve the agent card from.
agent_card_path (str | None, optional) – The path to the agent card relative to the base URL. Defaults to AGENT_CARD_WELL_KNOWN_PATH from a2a.utils.
- Return type:
None
- class NacosAgentCardResolver[source]¶
Bases:
AgentCardResolverBaseNacos-based A2A Agent Card resolver.
Nacos is a dynamic service discovery, configuration and service management platform for building cloud native applications. This resolver fetches the agent card from a Nacos server and subscribes to updates.
- __init__(remote_agent_name, nacos_client_config, version=None)[source]¶
Initialize the nacos agent card resolver.
- Parameters:
remote_agent_name (str) – Name of the remote agent in Nacos.
nacos_client_config (ClientConfig | None, optional) – Nacos client configuration, where a server_addresses parameter is required.
version (str | None, optional) – Version of the agent card to fetch. If None, fetches the latest version. This version is also used when subscribing to agent card updates. Defaults to None (latest version).
- Return type:
None