Class A2aAgent.Builder

java.lang.Object
io.agentscope.core.a2a.agent.A2aAgent.Builder
Enclosing class:
A2aAgent

public static class A2aAgent.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • name

      public A2aAgent.Builder name(String name)
      Set the name of the A2aAgent.
      Parameters:
      name - the name to set
      Returns:
      the current Builder instance for method chaining
    • agentCard

      public A2aAgent.Builder agentCard(io.a2a.spec.AgentCard agentCard)
      Set the AgentCard for the A2aAgent.

      It will be auto-generated to FixedAgentCardResolver.

      Parameters:
      agentCard - the AgentCard to set
      Returns:
      the current Builder instance for method chaining
      See Also:
    • agentCardResolver

      public A2aAgent.Builder agentCardResolver(AgentCardResolver agentCardResolver)
      Set the AgentCardResolver for the A2aAgent.

      When both agentCard(AgentCard) and this method are called on the same builder, the later call will override the earlier one.

      Parameters:
      agentCardResolver - the AgentCardResolver to set, null value will be ignored.
      Returns:
      the current Builder instance for method chaining
    • a2aAgentConfig

      public A2aAgent.Builder a2aAgentConfig(A2aAgentConfig a2aAgentConfig)
      Set the A2aAgentConfig for the A2aAgent.
      Parameters:
      a2aAgentConfig - the A2aAgentConfig to set
      Returns:
      the current Builder instance for method chaining
    • memory

      public A2aAgent.Builder memory(io.agentscope.core.memory.Memory memory)
      Set the Memory for the A2aAgent.

      Default is InMemoryMemory

      Parameters:
      memory - the Memory to set
      Returns:
      the current Builder instance for method chaining
    • checkRunning

      public A2aAgent.Builder checkRunning(boolean checkRunning)
      Set whether to check the running status of the A2aAgent.

      Default is true

      Parameters:
      checkRunning - true to check the running status, false to ignore
      Returns:
      the current Builder instance for method chaining
    • hook

      public A2aAgent.Builder hook(io.agentscope.core.hook.Hook hook)
      Add a Hook to the A2aAgent.
      Parameters:
      hook - the Hook to add
      Returns:
      the current Builder instance for method chaining
    • hooks

      public A2aAgent.Builder hooks(List<io.agentscope.core.hook.Hook> hooks)
      Add multiple Hooks to the A2aAgent.
      Parameters:
      hooks - the list of Hooks to add
      Returns:
      the current Builder instance for method chaining
    • build

      public A2aAgent build()
      Build the A2aAgent instance.
      Returns:
      the built A2aAgent instance
      Throws:
      IllegalArgumentException - if agentCardResolver is not set