Package org.a2aproject.sdk.compat03
Class A2A_v0_3
java.lang.Object
org.a2aproject.sdk.compat03.A2A_v0_3
Constants and utility methods related to the A2A protocol.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Message_v0_3createAgentPartsMessage(List<Part_v0_3<?>> parts, String contextId, String taskId) Create an agent message with custom parts and optional context and task IDs.static Message_v0_3createAgentTextMessage(String text, String contextId, String taskId) Create an agent message with text content and optional context and task IDs.static Message_v0_3createUserTextMessage(String text, String contextId, String taskId) Create a user message with text content and optional context and task IDs.static AgentCard_v0_3getAgentCard(String agentUrl) Get the agent card for an A2A agent.static AgentCard_v0_3Get the agent card for an A2A agent.static AgentCard_v0_3getAgentCard(A2AHttpClient httpClient, String agentUrl) Get the agent card for an A2A agent.static AgentCard_v0_3getAgentCard(A2AHttpClient httpClient, String agentUrl, String relativeCardPath, Map<String, String> authHeaders) Get the agent card for an A2A agent.static Message_v0_3toAgentMessage(String text) Convert the given text to an agent message.static Message_v0_3toAgentMessage(String text, String messageId) Convert the given text to an agent message.static Message_v0_3toUserMessage(String text) Convert the given text to a user message.static Message_v0_3toUserMessage(String text, String messageId) Convert the given text to a user message.
-
Constructor Details
-
A2A_v0_3
public A2A_v0_3()
-
-
Method Details
-
toUserMessage
Convert the given text to a user message.- Parameters:
text- the message text- Returns:
- the user message
-
toUserMessage
Convert the given text to a user message.- Parameters:
text- the message textmessageId- the message ID to use- Returns:
- the user message
-
toAgentMessage
Convert the given text to an agent message.- Parameters:
text- the message text- Returns:
- the agent message
-
toAgentMessage
Convert the given text to an agent message.- Parameters:
text- the message textmessageId- the message ID to use- Returns:
- the agent message
-
createUserTextMessage
Create a user message with text content and optional context and task IDs.- Parameters:
text- the message text (required)contextId- the context ID to use (optional)taskId- the task ID to use (optional)- Returns:
- the user message
-
createAgentTextMessage
Create an agent message with text content and optional context and task IDs.- Parameters:
text- the message text (required)contextId- the context ID to use (optional)taskId- the task ID to use (optional)- Returns:
- the agent message
-
createAgentPartsMessage
public static Message_v0_3 createAgentPartsMessage(List<Part_v0_3<?>> parts, String contextId, String taskId) Create an agent message with custom parts and optional context and task IDs.- Parameters:
parts- the message parts (required)contextId- the context ID to use (optional)taskId- the task ID to use (optional)- Returns:
- the agent message
-
getAgentCard
public static AgentCard_v0_3 getAgentCard(String agentUrl) throws A2AClientError_v0_3, A2AClientJSONError_v0_3 Get the agent card for an A2A agent.- Parameters:
agentUrl- the base URL for the agent whose agent card we want to retrieve- Returns:
- the agent card
- Throws:
A2AClientError_v0_3- If an HTTP error occurs fetching the cardA2AClientJSONError_v0_3- If the response body cannot be decoded as JSON or validated against the AgentCard schema
-
getAgentCard
public static AgentCard_v0_3 getAgentCard(A2AHttpClient httpClient, String agentUrl) throws A2AClientError_v0_3, A2AClientJSONError_v0_3 Get the agent card for an A2A agent.- Parameters:
httpClient- the http client to useagentUrl- the base URL for the agent whose agent card we want to retrieve- Returns:
- the agent card
- Throws:
A2AClientError_v0_3- If an HTTP error occurs fetching the cardA2AClientJSONError_v0_3- If the response body cannot be decoded as JSON or validated against the AgentCard schema
-
getAgentCard
public static AgentCard_v0_3 getAgentCard(String agentUrl, String relativeCardPath, Map<String, String> authHeaders) throws A2AClientError_v0_3, A2AClientJSONError_v0_3Get the agent card for an A2A agent.- Parameters:
agentUrl- the base URL for the agent whose agent card we want to retrieverelativeCardPath- optional path to the agent card endpoint relative to the base agent URL, defaults to ".well-known/agent-card.json"authHeaders- the HTTP authentication headers to use- Returns:
- the agent card
- Throws:
A2AClientError_v0_3- If an HTTP error occurs fetching the cardA2AClientJSONError_v0_3- If the response body cannot be decoded as JSON or validated against the AgentCard schema
-
getAgentCard
public static AgentCard_v0_3 getAgentCard(A2AHttpClient httpClient, String agentUrl, String relativeCardPath, Map<String, String> authHeaders) throws A2AClientError_v0_3, A2AClientJSONError_v0_3Get the agent card for an A2A agent.- Parameters:
httpClient- the http client to useagentUrl- the base URL for the agent whose agent card we want to retrieverelativeCardPath- optional path to the agent card endpoint relative to the base agent URL, defaults to ".well-known/agent-card.json"authHeaders- the HTTP authentication headers to use- Returns:
- the agent card
- Throws:
A2AClientError_v0_3- If an HTTP error occurs fetching the cardA2AClientJSONError_v0_3- If the response body cannot be decoded as JSON or validated against the AgentCard schema
-