Class AgentCapabilities.Builder

java.lang.Object
org.a2aproject.sdk.spec.AgentCapabilities.Builder
Enclosing class:
AgentCapabilities

public static class AgentCapabilities.Builder extends Object
Builder for constructing immutable AgentCapabilities instances.

The Builder pattern provides a fluent API for setting capability flags. All capabilities default to false if not explicitly set.

Example usage:


 AgentCapabilities capabilities = AgentCapabilities.builder()
     .streaming(true)
     .pushNotifications(false)
     .build();
 
  • Method Details

    • streaming

      public AgentCapabilities.Builder streaming(boolean streaming)
      Sets whether the agent supports streaming responses.

      When enabled, clients can subscribe to task updates and receive incremental artifacts as the agent produces them.

      Parameters:
      streaming - true if streaming is supported, false otherwise
      Returns:
      this builder for method chaining
    • pushNotifications

      public AgentCapabilities.Builder pushNotifications(boolean pushNotifications)
      Sets whether the agent supports push notifications.

      When enabled, the agent can proactively notify clients of task state changes, eliminating the need for polling.

      Parameters:
      pushNotifications - true if push notifications are supported, false otherwise
      Returns:
      this builder for method chaining
    • extendedAgentCard

      public AgentCapabilities.Builder extendedAgentCard(boolean extendedAgentCard)
      Sets whether the agent supports an extended agent card. state transition history.
      Parameters:
      extendedAgentCard - true if an extended agent card is supported, false otherwise
      Returns:
      this builder for method chaining
    • extensions

      public AgentCapabilities.Builder extensions(List<AgentExtension> extensions)
      Sets the list of custom extensions supported by the agent.

      Extensions allow agents to advertise proprietary or experimental capabilities beyond the core A2A Protocol.

      Parameters:
      extensions - list of agent extensions (optional)
      Returns:
      this builder for method chaining
      See Also:
    • build

      public AgentCapabilities build()
      Builds an immutable AgentCapabilities from the current builder state.
      Returns:
      a new AgentCapabilities instance