类 RequestStopEvent
java.lang.Object
io.agentscope.core.event.AgentEvent
io.agentscope.core.event.RequestStopEvent
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(String reason) Create a stop request with the defaultGenerateReason.MIDDLEWARE_STOP_REQUESTED.RequestStopEvent(String reason, GenerateReason generateReason) Create a stop request with an explicit generate reason.RequestStopEvent(String id, String createdAt, String reason, GenerateReason generateReason) -
方法概要
修饰符和类型方法说明TheGenerateReasonto assign to the returned Msg.Human-readable description of why the stop was requested.getType()从类继承的方法 io.agentscope.core.event.AgentEvent
getCreatedAt, getId, getMetadata, getSource, toString, withMetadata, withSource
-
构造器详细资料
-
RequestStopEvent
-
RequestStopEvent
Create a stop request with the defaultGenerateReason.MIDDLEWARE_STOP_REQUESTED.- 参数:
reason- human-readable description of why the stop was requested
-
RequestStopEvent
Create a stop request with an explicit generate reason. Used internally by Permission HITL to surfaceGenerateReason.PERMISSION_ASKING.- 参数:
reason- human-readable descriptiongenerateReason- the reason to set on the returned Msg
-
-
方法详细资料
-
getType
- 指定者:
getType在类中AgentEvent
-
getReason
Human-readable description of why the stop was requested. -
getGenerateReason
TheGenerateReasonto assign to the returned Msg.
-