AS AgentScopeAPI 手册 / API Reference

AguiAgentAutoRegistration

public class AguiAgentAutoRegistration implements BeanFactoryAware, InitializingBean
源码Source io/agentscope/spring/boot/agui/common/AguiAgentAutoRegistration.java:75–213

AGUI 智能体 Auto 注册,承载智能体的部署、调度与服务化运行。位于 io.agentscope.spring.boot.agui.common 包,实现 BeanFactoryAware、InitializingBean。核心成员包括 setBeanFactory、aguiAgentAutoRegistrar、afterPropertiesSet、AguiAgentAutoRegistration。

A Scanner class for automatically registering Agent beans with the AguiAgentRegistry.

This configuration scans all Agent beans in the application context and registers them with the registry. It supports both singleton and prototype scoped beans:

  • Singleton beans: The bean instance is registered directly

  • Prototype beans: A factory is registered that creates new instances per request (thread-safe)

Agent ID Resolution:

  • AguiAgentId annotation on the bean method or class

  • Bean name (default)

Usage:

`// Singleton bean (shared instance)
@Bean
public Agent chatAgent() {
return ReActAgent.builder().name("Chat").model(model).build();
}

// Prototype bean (new instance per request - thread-safe)
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public Agent isolatedAgent() {
return ReActAgent.builder().name("Isolated").model(model).build();
}

// Custom agent ID
@Bean
@AguiAgentId("custom-id")
public Agent myAgent() {
return ReActAgent.builder().name("Custom").model(model).build();
}
`

构造器摘要Constructor Summary

构造器Constructor说明Description
public AguiAgentAutoRegistration(AguiAgentRegistry registry)
创建新的AguiAgentAutoRegistration。
Creates a new AguiAgentAutoRegistration.

方法摘要Method Summary

方法Method说明Description
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
设置 `setBeanFactory`。
Sets the bean factory.
protected void aguiAgentAutoRegistrar()
执行 `aguiAgentAutoRegistrar` 方法。
Registers all Agent beans with the AguiAgentRegistry.
public void afterPropertiesSet() throws Exception
在属性设置后调用。
Invoke `#aguiAgentAutoRegistrar()` after all properties are set.

构造器详情Constructor Detail

AguiAgentAutoRegistration

public AguiAgentAutoRegistration(AguiAgentRegistry registry)

创建新的AguiAgentAutoRegistration。

Creates a new AguiAgentAutoRegistration.

参数Parameters
名称Name类型Type说明Description
registryAguiAgentRegistry智能体注册表。The agent registry
源码Source io/agentscope/spring/boot/agui/common/AguiAgentAutoRegistration.java:88–90

方法详情Method Detail

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory) throws BeansException

设置 setBeanFactory。

Sets the bean factory.

参数Parameters
名称Name类型Type说明Description
beanFactoryBeanFactorybean 工厂(类型 `BeanFactory`)。The bean factory.
抛出Throws
  • BeansException 可能抛出 `BeansException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/spring/boot/agui/common/AguiAgentAutoRegistration.java:92–97

aguiAgentAutoRegistrar

protected void aguiAgentAutoRegistrar()

执行 aguiAgentAutoRegistrar 方法。

Registers all Agent beans with the AguiAgentRegistry.

源码Source io/agentscope/spring/boot/agui/common/AguiAgentAutoRegistration.java:104–141

afterPropertiesSet

public void afterPropertiesSet() throws Exception

在属性设置后调用。

Invoke #aguiAgentAutoRegistrar() after all properties are set.

抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/spring/boot/agui/common/AguiAgentAutoRegistration.java:209–212
基于官方固定版本源码静态生成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.