AS AgentScopeAPI 手册 / API Reference

InterruptControl

public final class InterruptControl
源码Source io/agentscope/core/interruption/InterruptControl.java:23–74

中断 Control,为框架提供通用类型与基础能力。位于 io.agentscope.core.interruption 包。核心成员包括 trigger、isInterrupted、getSource、getUserMessage、reset、toContext。

A runtime-only cooperative interrupt signal owned by one execution, never by a session.

方法摘要Method Summary

方法Method说明Description
public void trigger(InterruptSource src, Msg msg)
执行 `trigger` 方法。
Raise the interrupt signal.
public boolean isInterrupted()
判断是否 `isInterrupted`。
Returns whether the interrupted.
public InterruptSource getSource()
获取来源。
Returns the source.
public Msg getUserMessage()
获取用户消息。
Returns the user message.
public void reset()
清空或重置内部状态。
Clear the interrupt signal back to its initial (non-interrupted) state.
public InterruptContext toContext()
返回到上下文。
Build an `InterruptContext` snapshot of the current signal.

方法详情Method Detail

trigger

public void trigger(InterruptSource src, Msg msg)

执行 trigger 方法。

Raise the interrupt signal.

参数Parameters
名称Name类型Type说明Description
srcInterruptSourcesrc(类型 `InterruptSource`)。the interrupt source; `null` is treated as `InterruptSource#USER`
msgMsg消息(类型 `Msg`)。an optional user message associated with the interruption (ignored when ` null`)
源码Source io/agentscope/core/interruption/InterruptControl.java:37–43

isInterrupted

public boolean isInterrupted()

判断是否 isInterrupted。

Returns whether the interrupted.

返回Returns boolean
返回布尔值,表示判断结果。`true` if this execution has been interrupted and not yet reset
源码Source io/agentscope/core/interruption/InterruptControl.java:46–48

getSource

public InterruptSource getSource()

获取来源。

Returns the source.

返回Returns InterruptSource
当前中断来源。the current interrupt source
源码Source io/agentscope/core/interruption/InterruptControl.java:51–53

getUserMessage

public Msg getUserMessage()

获取用户消息。

Returns the user message.

返回Returns Msg
返回消息。the user message associated with the interruption, or `null`
源码Source io/agentscope/core/interruption/InterruptControl.java:56–58

reset

public void reset()

清空或重置内部状态。

Clear the interrupt signal back to its initial (non-interrupted) state.

源码Source io/agentscope/core/interruption/InterruptControl.java:61–65

toContext

public InterruptContext toContext()

返回到上下文。

Build an InterruptContext snapshot of the current signal.

返回Returns InterruptContext
返回InterruptContext。Returns interrupt context.
源码Source io/agentscope/core/interruption/InterruptControl.java:68–73
基于官方固定版本源码静态生成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.