AS AgentScopeAPI 手册 / API Reference

InterruptContext

public class InterruptContext
源码Source io/agentscope/core/interruption/InterruptContext.java:40–189

中断上下文,为框架提供通用类型与基础能力。位于 io.agentscope.core.interruption 包。核心成员包括 getSource、getTimestamp、getUserMessage、getPendingToolCalls、builder、toString。

Context information about an interruption.

Captures metadata about when and why an interruption occurred, including the source, timestamp, user message (if any), and any pending tool calls that were interrupted.

Example usage:

`InterruptContext context = InterruptContext.builder()
.source(InterruptSource.USER)
.userMessage(userMsg)
.pendingToolCalls(toolCalls)
.build();
`

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
InterruptContext的构建器。
Builder for InterruptContext.

方法摘要Method Summary

方法Method说明Description
public InterruptSource getSource()
获取来源的中断。
Get the source of the interruption.
public Instant getTimestamp()
获取时间戳。
Get the timestamp when the interruption occurred.
public Msg getUserMessage()
获取用户消息。
Get the user message that triggered the interruption (if any).
public List<ToolUseBlock> getPendingToolCalls()
获取待处理工具调用。
Get the list of tool calls that were pending when the interruption occurred.
public static Builder builder()
static
创建用于InterruptContext的构建器。
Create a new builder for InterruptContext.
public String toString()
返回 `toString` 结果。
Returns a string representation of the interrupt context.

方法详情Method Detail

getSource

public InterruptSource getSource()

获取来源的中断。

Get the source of the interruption.

返回Returns InterruptSource
中断来源。The interrupt source
源码Source io/agentscope/core/interruption/InterruptContext.java:64–66

getTimestamp

public Instant getTimestamp()

获取时间戳。

Get the timestamp when the interruption occurred.

返回Returns Instant
中断时间戳。The interrupt timestamp
源码Source io/agentscope/core/interruption/InterruptContext.java:73–75

getUserMessage

public Msg getUserMessage()

获取用户消息。

Get the user message that triggered the interruption (if any).

返回Returns Msg
返回消息。The user message, or null if not applicable
源码Source io/agentscope/core/interruption/InterruptContext.java:82–84

getPendingToolCalls

public List<ToolUseBlock> getPendingToolCalls()

获取待处理工具调用。

Get the list of tool calls that were pending when the interruption occurred.

返回Returns List<ToolUseBlock>
待处理工具调用的不可变列出。Immutable list of pending tool calls
源码Source io/agentscope/core/interruption/InterruptContext.java:91–93

builder

public static Builder builder()
static

创建用于InterruptContext的构建器。

Create a new builder for InterruptContext.

返回Returns Builder
一种新的构建器实例。A new builder instance
源码Source io/agentscope/core/interruption/InterruptContext.java:100–102

toString

public String toString()

返回 toString 结果。

Returns a string representation of the interrupt context.

返回Returns String
返回字符串结果。A formatted string representation of the interrupt context
源码Source io/agentscope/core/interruption/InterruptContext.java:180–188

嵌套类详情Nested Class Detail

Builder

public static class Builder

InterruptContext的构建器。位于 io.agentscope.core.interruption 包。核心成员包括 source、timestamp、userMessage、pendingToolCalls、build。

Builder for InterruptContext.

基于官方固定版本源码静态生成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.