Runner
public class Runner
io/agentscope/runtime/engine/Runner.java:50–281运行器,承载智能体的部署、调度与服务化运行。位于 io.agentscope.runtime.engine 包。核心成员包括 init、start、stop、shutdown、streamQuery、isHealthy。
Runner class that proxies calls to AgentAdapter.
It acts as a proxy to AgentAdapter, managing the lifecycle and query processing.
Key responsibilities:
-
Delegate lifecycle methods (init, start, stop, shutdown) to AgentAdapter
-
Process stream queries by delegating to AgentAdapter
-
Manage health status
-
Handle sequence numbers for events
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public Runner(AgentHandler adapter) | 初始化 `Runner` 实例。 Constructor with AgentAdapter. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public void init() | 初始化 `Runner` 实例。 Initialize the runner by calling the adapter's init method. |
public void start() | 执行启动相关操作。 Start the runner by calling the adapter's start method. |
public void stop() | 执行停止相关操作。 Stop the runner by calling the adapter's stop method. |
public void shutdown() | 关闭资源并释放连接。 Shutdown the runner by calling the adapter's shutdown method. |
public Flux<Event> streamQuery(AgentRequest request) | 执行查询。 Stream query by delegating to the adapter. |
public boolean isHealthy() | 判断是否 `isHealthy`。 Check if the runner is healthy. |
public AgentHandler getAgent() | 获取智能体。 Get the underlying adapter. |
public SandboxService getSandboxService() | 获取沙箱服务。 Returns the sandbox service. |
构造器详情Constructor Detail
Runner
public Runner(AgentHandler adapter)
初始化 Runner 实例。
Constructor with AgentAdapter.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
adapter | AgentHandler | AgentAdapter 实例到代理。the AgentAdapter instance to proxy |
io/agentscope/runtime/engine/Runner.java:62–67方法详情Method Detail
init
public void init()
初始化 Runner 实例。
Initialize the runner by calling the adapter's init method.
io/agentscope/runtime/engine/Runner.java:74–76start
public void start()
执行启动相关操作。
Start the runner by calling the adapter's start method.
io/agentscope/runtime/engine/Runner.java:85–89stop
public void stop()
执行停止相关操作。
Stop the runner by calling the adapter's stop method.
io/agentscope/runtime/engine/Runner.java:94–98shutdown
public void shutdown()
关闭资源并释放连接。
Shutdown the runner by calling the adapter's shutdown method.
io/agentscope/runtime/engine/Runner.java:105–108streamQuery
public Flux<Event> streamQuery(AgentRequest request)
执行查询。
Stream query by delegating to the adapter.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
request | AgentRequest | 智能体请求。the agent request |
Flux<Event>IllegalStateException可能抛出 `IllegalStateException`。if the runner is not healthy or framework type is invalidRuntimeException可能抛出 `RuntimeException`。if framework type is invalid or not set
io/agentscope/runtime/engine/Runner.java:134–246isHealthy
public boolean isHealthy()
判断是否 isHealthy。
Check if the runner is healthy.
booleanio/agentscope/runtime/engine/Runner.java:264–266getAgent
public AgentHandler getAgent()
获取智能体。
Get the underlying adapter.
AgentHandlerio/agentscope/runtime/engine/Runner.java:273–275getSandboxService
public SandboxService getSandboxService()
获取沙箱服务。
Returns the sandbox service.
SandboxServiceio/agentscope/runtime/engine/Runner.java:277–279