AS AgentScopeAPI 手册 / API Reference

AgentProtocolAutoConfiguration

@AutoConfiguration @EnableConfigurationProperties(AgentProtocolProperties.class) @ConditionalOnProperty(prefix = "agentscope.agent-protocol", name = "enabled", havingValue = "true") public class AgentProtocolAutoConfiguration
源码Source 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说明Description
public AgentProtocolEventBus agentProtocolEventBus(AgentProtocolProperties properties)
设置智能体协议事件总线。
Performs the agent protocol event bus operation.
public AgentFactory agentProtocolAgentFactory(ObjectProvider<HarnessAgent> agentProvider)
设置智能体协议智能体工厂。
Performs the agent protocol agent factory operation.
public ProtocolTaskRepository agentProtocolTaskRepository(AgentProtocolProperties properties)
设置智能体协议任务仓库。
Performs the agent protocol task repository operation.
public AgentProtocolTaskStore agentProtocolTaskStore(AgentFactory agentFactory, ProtocolTaskRepository taskRepository, AgentProtocolEventBus eventBus, AgentProtocolProperties properties, ObjectProvider<RuntimeContextCustomizer> runtimeContextCustomizers)
执行智能体协议任务存储相关操作。
Performs the agent protocol task store operation.
public AgentProtocolController agentProtocolController(AgentProtocolTaskStore store, AgentProtocolProperties properties)
执行智能体协议控制器相关操作。
Performs the agent protocol controller operation.

方法详情Method Detail

agentProtocolEventBus

public AgentProtocolEventBus agentProtocolEventBus(AgentProtocolProperties properties)

设置智能体协议事件总线。

Performs the agent protocol event bus operation.

参数Parameters
名称Name类型Type说明Description
propertiesAgentProtocolProperties属性(类型 `AgentProtocolProperties`)。The properties.
返回Returns AgentProtocolEventBus
返回AgentProtocolEventBus。Returns agent protocol event bus.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolAutoConfiguration.java:55–59

agentProtocolAgentFactory

public AgentFactory agentProtocolAgentFactory(ObjectProvider<HarnessAgent> agentProvider)

设置智能体协议智能体工厂。

Performs the agent protocol agent factory operation.

参数Parameters
名称Name类型Type说明Description
agentProviderObjectProvider<HarnessAgent>智能体提供者(类型 `ObjectProvider`)。The agent provider.
返回Returns AgentFactory
返回AgentFactory。Returns agent factory.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolAutoConfiguration.java:61–66

agentProtocolTaskRepository

public ProtocolTaskRepository agentProtocolTaskRepository(AgentProtocolProperties properties)

设置智能体协议任务仓库。

Performs the agent protocol task repository operation.

参数Parameters
名称Name类型Type说明Description
propertiesAgentProtocolProperties属性(类型 `AgentProtocolProperties`)。The properties.
返回Returns ProtocolTaskRepository
返回ProtocolTaskRepository。Returns protocol task repository.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolAutoConfiguration.java:68–72

agentProtocolTaskStore

public AgentProtocolTaskStore agentProtocolTaskStore(AgentFactory agentFactory, ProtocolTaskRepository taskRepository, AgentProtocolEventBus eventBus, AgentProtocolProperties properties, ObjectProvider<RuntimeContextCustomizer> runtimeContextCustomizers)

执行智能体协议任务存储相关操作。

Performs the agent protocol task store operation.

参数Parameters
名称Name类型Type说明Description
agentFactoryAgentFactory智能体工厂(类型 `AgentFactory`)。The agent factory.
taskRepositoryProtocolTaskRepository任务仓库(类型 `ProtocolTaskRepository`)。The task repository.
eventBusAgentProtocolEventBus事件总线(类型 `AgentProtocolEventBus`)。The event bus.
propertiesAgentProtocolProperties属性(类型 `AgentProtocolProperties`)。The properties.
runtimeContextCustomizersObjectProvider<RuntimeContextCustomizer>运行时上下文 Customizers(类型 `ObjectProvider`)。The runtime context customizers.
返回Returns AgentProtocolTaskStore
返回AgentProtocolTaskStore。Returns agent protocol task store.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolAutoConfiguration.java:74–88

agentProtocolController

public AgentProtocolController agentProtocolController(AgentProtocolTaskStore store, AgentProtocolProperties properties)

执行智能体协议控制器相关操作。

Performs the agent protocol controller operation.

参数Parameters
名称Name类型Type说明Description
storeAgentProtocolTaskStore存储实例(类型 `AgentProtocolTaskStore`)。The store.
propertiesAgentProtocolProperties属性(类型 `AgentProtocolProperties`)。The properties.
返回Returns AgentProtocolController
返回AgentProtocolController。Returns agent protocol controller.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolAutoConfiguration.java:90–95
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.