Class JevAutoModeMiddleware
- All Implemented Interfaces:
io.agentscope.core.middleware.MiddlewareBase
For every tool call whose name appears in guardedTools, this middleware asks Jev a
yes/no risk question built from the conversation history and the tool input. Calls whose
P(safe) is at least safetyThreshold pass through; the rest get a synthetic
DENIED tool result written to the conversation state and are never dispatched to the
toolkit. Tool calls that were already explicitly allowed by the user (state ALLOWED)
skip the check entirely, so this guardrail cannot override a human confirmation.
The check runs in onActing(io.agentscope.core.agent.Agent, io.agentscope.core.agent.RuntimeContext, io.agentscope.core.middleware.ActingInput, java.util.function.Function<io.agentscope.core.middleware.ActingInput, reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>>), after any outer middleware that filters or rewrites
tool calls and immediately before the core permission/execution pipeline. This makes it
complementary to the deterministic PermissionEngine: a call that passes the Jev
assessment is still subject to permission deny rules inside the core acting pipeline, so this
middleware adds a model-driven pre-check for the specific tools it guards without replacing
the rule-based engine.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>onActing(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.ActingInput input, Function<io.agentscope.core.middleware.ActingInput, reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next) intorder()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.agentscope.core.middleware.MiddlewareBase
onAgent, onModelCall, onReasoning, onSystemPrompt
-
Field Details
-
DEFAULT_DENY_MESSAGE
- See Also:
-
-
Method Details
-
builder
-
order
public int order()- Specified by:
orderin interfaceio.agentscope.core.middleware.MiddlewareBase
-
onActing
public reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent> onActing(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.ActingInput input, Function<io.agentscope.core.middleware.ActingInput, reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next) - Specified by:
onActingin interfaceio.agentscope.core.middleware.MiddlewareBase
-