AS AgentScopeAPI 手册 / API Reference

RunnerStartListener

@Component public class RunnerStartListener implements ApplicationListener<ContextRefreshedEvent>
源码Source io/agentscope/runtime/lifecycle/RunnerStartListener.java:54–118

运行器启动监听器,承载智能体的部署、调度与服务化运行。位于 io.agentscope.runtime.lifecycle 包,实现 ApplicationListener<ContextRefreshedEvent>。核心成员包括 onApplicationEvent、RunnerStartListener。

Spring Boot lifecycle listener for Runner.

It handles application startup and shutdown lifecycle events, calling the registered lifecycle handlers in Runner.

Lifecycle flow:

  • On startup (ContextRefreshedEvent):

  • Call before_start callback (if registered)

  • Call init_handler (if registered via app.init())

  • Initialize and start the Runner

  • On shutdown (ContextClosedEvent):

  • Stop the Runner

  • Call shutdown_handler (if registered via app.shutdown())

  • Call after_finish callback (if registered)

This listener is automatically registered when Runner is available as a Spring bean.

构造器摘要Constructor Summary

构造器Constructor说明Description
public RunnerStartListener(Runner runner)
初始化 `RunnerStartListener` 实例。
Constructor with Runner dependency injection.

方法摘要Method Summary

方法Method说明Description
public void onApplicationEvent(ContextRefreshedEvent event)
处理应用启动事件。
Handle application startup event.

构造器详情Constructor Detail

RunnerStartListener

public RunnerStartListener(Runner runner)

初始化 RunnerStartListener 实例。

Constructor with Runner dependency injection.

参数Parameters
名称Name类型Type说明Description
runnerRunner运行器(类型 `Runner`)。the Runner instance (optional, may be null if not configured)
源码Source io/agentscope/runtime/lifecycle/RunnerStartListener.java:68–71

方法详情Method Detail

onApplicationEvent

public void onApplicationEvent(ContextRefreshedEvent event)

处理应用启动事件。

Handle application startup event.

参数Parameters
名称Name类型Type说明Description
eventContextRefreshedEvent事件(类型 `ContextRefreshedEvent`)。the context refreshed event
源码Source io/agentscope/runtime/lifecycle/RunnerStartListener.java:80–117
基于官方固定版本源码静态生成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.