AgentProtocolAutoConfiguration
@AutoConfiguration @EnableConfigurationProperties(AgentProtocolProperties.class) @ConditionalOnProperty(prefix = "agentscope.agent-protocol", name = "enabled", havingValue = "true") public class AgentProtocolAutoConfiguration
io/agentscope/extensions/agentprotocol/AgentProtocolAutoConfiguration.java:50–96智能体协议 Auto 配置,保存相关配置项。位于 io.agentscope.extensions.agentprotocol 包。核心成员包括 agentProtocolEventBus、agentProtocolAgentFactory、agentProtocolTaskRepository、agentProtocolTaskStore、agentProtocolController。
Registers task protocol REST endpoints when enabled.
ConditionalOnBean is applied at the @Bean method level (not class level) to
avoid Spring Boot auto-configuration ordering issues: class-level @ConditionalOnBean on
@AutoConfiguration classes may evaluate before user-defined beans are registered.
Agent selection goes through AgentFactory. Without a user-defined bean, the default
factory resolves the single HarnessAgent bean for every task; define an
AgentFactory bean to route per agent_id or submission context.
Protocol task metadata is persisted through ProtocolTaskRepository,
rooted at AgentProtocolProperties#getTaskStorePath() by default — not through any
execution agent's workspace.
All RuntimeContextCustomizer beans are applied, in @Order, to the runtime
context of every task run.
For concurrent task execution, register the HarnessAgent bean as
@Scope("prototype") so that each task obtains its own instance. Alternatively, configure
the singleton with checkRunning(false) if concurrent access is otherwise safe.
方法摘要Method Summary
方法详情Method Detail
agentProtocolEventBus
public AgentProtocolEventBus agentProtocolEventBus(AgentProtocolProperties properties)
设置智能体协议事件总线。
Performs the agent protocol event bus operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
properties | AgentProtocolProperties | 属性(类型 `AgentProtocolProperties`)。The properties. |
AgentProtocolEventBusio/agentscope/extensions/agentprotocol/AgentProtocolAutoConfiguration.java:55–59agentProtocolAgentFactory
public AgentFactory agentProtocolAgentFactory(ObjectProvider<HarnessAgent> agentProvider)
设置智能体协议智能体工厂。
Performs the agent protocol agent factory operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentProvider | ObjectProvider<HarnessAgent> | 智能体提供者(类型 `ObjectProvider`)。The agent provider. |
AgentFactoryio/agentscope/extensions/agentprotocol/AgentProtocolAutoConfiguration.java:61–66agentProtocolTaskRepository
public ProtocolTaskRepository agentProtocolTaskRepository(AgentProtocolProperties properties)
设置智能体协议任务仓库。
Performs the agent protocol task repository operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
properties | AgentProtocolProperties | 属性(类型 `AgentProtocolProperties`)。The properties. |
ProtocolTaskRepositoryio/agentscope/extensions/agentprotocol/AgentProtocolAutoConfiguration.java:68–72agentProtocolTaskStore
public AgentProtocolTaskStore agentProtocolTaskStore(AgentFactory agentFactory, ProtocolTaskRepository taskRepository, AgentProtocolEventBus eventBus, AgentProtocolProperties properties, ObjectProvider<RuntimeContextCustomizer> runtimeContextCustomizers)
执行智能体协议任务存储相关操作。
Performs the agent protocol task store operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentFactory | AgentFactory | 智能体工厂(类型 `AgentFactory`)。The agent factory. |
taskRepository | ProtocolTaskRepository | 任务仓库(类型 `ProtocolTaskRepository`)。The task repository. |
eventBus | AgentProtocolEventBus | 事件总线(类型 `AgentProtocolEventBus`)。The event bus. |
properties | AgentProtocolProperties | 属性(类型 `AgentProtocolProperties`)。The properties. |
runtimeContextCustomizers | ObjectProvider<RuntimeContextCustomizer> | 运行时上下文 Customizers(类型 `ObjectProvider`)。The runtime context customizers. |
AgentProtocolTaskStoreio/agentscope/extensions/agentprotocol/AgentProtocolAutoConfiguration.java:74–88agentProtocolController
public AgentProtocolController agentProtocolController(AgentProtocolTaskStore store, AgentProtocolProperties properties)
执行智能体协议控制器相关操作。
Performs the agent protocol controller operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
store | AgentProtocolTaskStore | 存储实例(类型 `AgentProtocolTaskStore`)。The store. |
properties | AgentProtocolProperties | 属性(类型 `AgentProtocolProperties`)。The properties. |
AgentProtocolControllerio/agentscope/extensions/agentprotocol/AgentProtocolAutoConfiguration.java:90–95