AgentRun
public final class AgentRun<T>
io/agentscope/core/agent/AgentRun.java:38–141智能体运行,驱动智能体的推理、工具调用与会话执行。位于 io.agentscope.core.agent 包。核心成员包括 create、runId、status、stream、termination、cancel。
A single-use, lazy execution handle. Register it before subscribing to #stream().
Each handle owns its cancellation and status; it never registers RuntimeContext on an agent.
A second subscription is rejected, so one runId can never identify multiple executions.
Cancelling a subscription also cancels this handle. Create another handle to retry.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Status | 枚举enum | 定义状态的枚举。 Execution state. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static T AgentRun<T> create(String agentId, Supplier<? extends Publisher<T>> source)static | 创建并返回实例。 Wrap an agent invocation without starting it. |
public String runId() | 运行标识。 Stable opaque identifier for this single execution. |
public Status status() | 返回状态。 Current execution state; a cooperative interrupt may still be RUNNING until observed. |
public Flux<T> stream() | 返回流。 Subscribe once to start execution. |
public Mono<Status> termination() | 返回 `termination` 结果。 A replayable terminal-status notification; observing it does not start execution. |
public boolean cancel() | 返回取消。 Immediately cancel this run's reactive subscription, including a queued run. |
public boolean interrupt(Msg message) | 请求中断当前执行。 Cooperatively interrupt a running run, or cancel it if it has not started. |
public boolean interrupt() | 请求中断当前执行。 Cooperatively interrupt without an associated user message. |
方法详情Method Detail
create
public static T AgentRun<T> create(String agentId, Supplier<? extends Publisher<T>> source)
创建并返回实例。
Wrap an agent invocation without starting it.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentId | String | 智能体标识(类型 `String`)。The agent id. |
source | Supplier<? extends Publisher<T>> | 来源(类型 `Supplier >`)。The source. |
AgentRun<T>io/agentscope/core/agent/AgentRun.java:103–105runId
public String runId()
运行标识。
Stable opaque identifier for this single execution.
Stringio/agentscope/core/agent/AgentRun.java:108–110status
public Status status()
返回状态。
Current execution state; a cooperative interrupt may still be RUNNING until observed.
Statusio/agentscope/core/agent/AgentRun.java:113–115stream
public Flux<T> stream()
返回流。
Subscribe once to start execution.
Flux<T>io/agentscope/core/agent/AgentRun.java:118–120termination
public Mono<Status> termination()
返回 termination 结果。
A replayable terminal-status notification; observing it does not start execution.
Mono<Status>io/agentscope/core/agent/AgentRun.java:123–125cancel
public boolean cancel()
返回取消。
Immediately cancel this run's reactive subscription, including a queued run.
booleanio/agentscope/core/agent/AgentRun.java:128–130interrupt
public boolean interrupt(Msg message)
请求中断当前执行。
Cooperatively interrupt a running run, or cancel it if it has not started.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
message | Msg | 消息(类型 `Msg`)。The message. |
booleanio/agentscope/core/agent/AgentRun.java:133–135interrupt
public boolean interrupt()
请求中断当前执行。
Cooperatively interrupt without an associated user message.
booleanio/agentscope/core/agent/AgentRun.java:138–140嵌套类详情Nested Class Detail
Status
public enum Status定义状态的枚举。位于 io.agentscope.core.agent 包。核心成员包括 isTerminal、CREATED、QUEUED、RUNNING、COMPLETED、FAILED。
Execution state. QUEUED includes setup before admission to the core lifecycle.