InterruptContext
public class InterruptContext
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.
InterruptSourceio/agentscope/core/interruption/InterruptContext.java:64–66getTimestamp
public Instant getTimestamp()
获取时间戳。
Get the timestamp when the interruption occurred.
Instantio/agentscope/core/interruption/InterruptContext.java:73–75getUserMessage
public Msg getUserMessage()
获取用户消息。
Get the user message that triggered the interruption (if any).
Msgio/agentscope/core/interruption/InterruptContext.java:82–84getPendingToolCalls
public List<ToolUseBlock> getPendingToolCalls()
获取待处理工具调用。
Get the list of tool calls that were pending when the interruption occurred.
List<ToolUseBlock>io/agentscope/core/interruption/InterruptContext.java:91–93builder
public static Builder builder()
创建用于InterruptContext的构建器。
Create a new builder for InterruptContext.
Builderio/agentscope/core/interruption/InterruptContext.java:100–102toString
public String toString()
返回 toString 结果。
Returns a string representation of the interrupt context.
Stringio/agentscope/core/interruption/InterruptContext.java:180–188嵌套类详情Nested Class Detail
Builder
public static class BuilderInterruptContext的构建器。位于 io.agentscope.core.interruption 包。核心成员包括 source、timestamp、userMessage、pendingToolCalls、build。
Builder for InterruptContext.