Package io.agentscope.core.a2a.agent
Class A2aAgent.Builder
java.lang.Object
io.agentscope.core.a2a.agent.A2aAgent.Builder
- Enclosing class:
A2aAgent
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiona2aAgentConfig(A2aAgentConfig a2aAgentConfig) Set theA2aAgentConfigfor the A2aAgent.agentCard(io.a2a.spec.AgentCard agentCard) Set theAgentCardfor the A2aAgent.agentCardResolver(AgentCardResolver agentCardResolver) Set theAgentCardResolverfor the A2aAgent.build()Build the A2aAgent instance.checkRunning(boolean checkRunning) Set whether to check the running status of the A2aAgent.hook(io.agentscope.core.hook.Hook hook) Add aHookto the A2aAgent.Add multipleHooks to the A2aAgent.memory(io.agentscope.core.memory.Memory memory) Set theMemoryfor the A2aAgent.Set the name of the A2aAgent.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
name
Set the name of the A2aAgent.- Parameters:
name- the name to set- Returns:
- the current Builder instance for method chaining
-
agentCard
Set theAgentCardfor 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
Set theAgentCardResolverfor 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
Set theA2aAgentConfigfor the A2aAgent.- Parameters:
a2aAgentConfig- the A2aAgentConfig to set- Returns:
- the current Builder instance for method chaining
-
memory
Set theMemoryfor the A2aAgent.Default is
InMemoryMemory- Parameters:
memory- the Memory to set- Returns:
- the current Builder instance for method chaining
-
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
Add aHookto the A2aAgent.- Parameters:
hook- the Hook to add- Returns:
- the current Builder instance for method chaining
-
hooks
Add multipleHooks to the A2aAgent.- Parameters:
hooks- the list of Hooks to add- Returns:
- the current Builder instance for method chaining
-
build
Build the A2aAgent instance.- Returns:
- the built A2aAgent instance
- Throws:
IllegalArgumentException- if agentCardResolver is not set
-