Annotation Interface A2AClientAgent
Marks a method as an A2A client agent.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionURL of the A2A server to which the requests will be sent.booleanIf true, the agent will be invoked in an asynchronous manner, allowing the workflow to continue without waiting for the agent's result.Description of the agent.Name of the agent.Key of the output variable that will be used to store the result of the agent's invocation.intNumber of seconds given to the fetch of the agent card, which happens the first time the card is needed, normally on the first invocation of the agent.Tenant identifier to include in every A2A message sent by this agent.Strongly typed key of the output variable that will be used to store the result of the agent's invocation.Description of the agent.
-
Element Details
-
a2aServerUrl
String a2aServerUrlURL of the A2A server to which the requests will be sent. If not provided, a method annotated withA2AServerUrlSuppliermust be present on the same interface.- Returns:
- URL of the A2A server.
- Default:
""
-
name
String nameName of the agent. If not provided, method name will be used. The name is also the id of the agent in the reports and in the agents list sent to a supervisor, and it never comes from the agent card, which is fetched only when the agent is first invoked.- Returns:
- name of the agent.
- Default:
""
-
value
String valueDescription of the agent. This is an alias of thedescriptionattribute, and it is possible to use either. It should be clear and descriptive to allow language model to understand the agent's purpose and its intended use. If not provided, the description is read from the agent card, which is then fetched the first time it is needed, for instance when a supervisor having this agent among its subagents is first invoked.- Returns:
- description of the agent.
- Default:
""
-
description
String descriptionDescription of the agent. This is an alias of thevalueattribute, and it is possible to use either. It should be clear and descriptive to allow language model to understand the agent's purpose and its intended use. If not provided, the description is read from the agent card, which is then fetched the first time it is needed, for instance when a supervisor having this agent among its subagents is first invoked.- Returns:
- description of the agent.
- Default:
""
-
outputKey
String outputKeyKey of the output variable that will be used to store the result of the agent's invocation.- Returns:
- name of the output variable.
- Default:
""
-
typedOutputKey
Strongly typed key of the output variable that will be used to store the result of the agent's invocation. It enforces type safety when retrieving the output from the agent's state and can be used in alternative to theoutputKey()attribute. Note that only one of those two attributes can be used at a time.- Returns:
- class representing the typed output variable.
- Default:
dev.langchain4j.agentic.Agent.NoTypedKey.class
-
async
boolean asyncIf true, the agent will be invoked in an asynchronous manner, allowing the workflow to continue without waiting for the agent's result. The result is awaited only where it is read: by another agent taking it as an argument, or by the output function or output key of the agentic system.When nothing reads the result, the call to the agentic system returns while the agent is still running, and the result or the failure of the agent is then reported only to its
AgentListener. The next call on the same memory id waits for these agents to complete before it starts.- Returns:
- true if the agent should be invoked in an asynchronous manner, false otherwise.
- Default:
false
-
tenant
String tenantTenant identifier to include in every A2A message sent by this agent.When set, the tenant is sent automatically via
MessageSendParamswithout exposing it to the LLM as a tool argument. If left empty, the tenant is extracted from the agent card URL path (pattern/.well-known/{tenant}/agent-card.json).- Returns:
- the tenant identifier, or empty to auto-detect from the URL.
- Default:
""
-
resolutionTimeoutSeconds
int resolutionTimeoutSecondsNumber of seconds given to the fetch of the agent card, which happens the first time the card is needed, normally on the first invocation of the agent. When the card is not fetched within this time the invocation fails with anA2AAgentCardExceptioncaused by aTimeoutException. Concurrent first invocations wait on the same fetch, so none of them waits longer than this time.- Returns:
- the number of seconds given to the fetch of the agent card, 0 for no limit, or -1, which is the default, for the default of 30 seconds. Any other negative value is rejected when the agent is built.
- Since:
- 1.24.0
- Default:
-1
-