类 RequestStopEvent

java.lang.Object
io.agentscope.core.event.AgentEvent
io.agentscope.core.event.RequestStopEvent

public class RequestStopEvent extends AgentEvent
Requests the agent to pause execution after the current phase completes.

Emit this event from a MiddlewareBase (e.g. inside onReasoning or onActing) to stop the agent loop. The agent finishes the in-flight step, then returns a Msg whose GenerateReason is set to generateReason (defaults to GenerateReason.MIDDLEWARE_STOP_REQUESTED).

The pending state is persisted via ToolCallState in AgentState.context, so callers can resume by issuing a second agent.call(...) — pending tool calls will be picked up automatically and execution continues.

Typical use cases:

  • Cost / budget guards (stop when token usage exceeds a threshold)
  • Audit / compliance checkpoints (manual review before destructive actions)
  • Debug stepping (pause every iteration)
  • Content moderation gates
  • 构造器详细资料

    • RequestStopEvent

      public RequestStopEvent(String id, String createdAt, String reason, GenerateReason generateReason)
    • RequestStopEvent

      public RequestStopEvent(String reason)
      Create a stop request with the default GenerateReason.MIDDLEWARE_STOP_REQUESTED.
      参数:
      reason - human-readable description of why the stop was requested
    • RequestStopEvent

      public RequestStopEvent(String reason, GenerateReason generateReason)
      Create a stop request with an explicit generate reason. Used internally by Permission HITL to surface GenerateReason.PERMISSION_ASKING.
      参数:
      reason - human-readable description
      generateReason - the reason to set on the returned Msg
  • 方法详细资料