类 InterruptContext

java.lang.Object
io.agentscope.core.interruption.InterruptContext

public class InterruptContext extends Object
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();
 
  • 方法详细资料

    • getSource

      public InterruptSource getSource()
      Get the source of the interruption.
      返回:
      The interrupt source
    • getTimestamp

      public Instant getTimestamp()
      Get the timestamp when the interruption occurred.
      返回:
      The interrupt timestamp
    • getUserMessage

      public Msg getUserMessage()
      Get the user message that triggered the interruption (if any).
      返回:
      The user message, or null if not applicable
    • getPendingToolCalls

      public List<ToolUseBlock> getPendingToolCalls()
      Get the list of tool calls that were pending when the interruption occurred.
      返回:
      Immutable list of pending tool calls
    • builder

      public static InterruptContext.Builder builder()
      Create a new builder for InterruptContext.
      返回:
      A new builder instance
    • toString

      public String toString()
      Returns a string representation of the interrupt context.

      The string includes the interrupt source, timestamp, user message presence, and count of pending tool calls in a compact format.

      覆盖:
      toString 在类中 Object
      返回:
      A formatted string representation of the interrupt context