Interface RunExecutionInterceptor
ExecutionBlockedException; returning normally allows execution to proceed.
This is a control seam — distinct from the passive LlmCallObserver, which only
watches completed calls. It carries no tenant, billing, or cost concepts; an embedding application (for example a
budget enforcer) registers an implementation and derives those itself. Both methods default to no-ops, so when
nothing is registered the runtime behaves exactly as before.
A single instance is shared across all runs and driving threads, so implementations must be thread-safe.
When a hook throws ExecutionBlockedException the runtime records a neutral
WorkflowEventType.RUN_BLOCKED audit event and transitions the run to
WorkflowStatus.PAUSED; the embedding application resolves the block
(resume or cancel). OSS performs no terminal transition. See ExecutionBlockedException for the additional
STEP_FAILED event a beforeLlmCall(com.agentforge4j.runtime.interceptor.LlmCallContext) veto records ahead of RUN_BLOCKED.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RunExecutionInterceptorCanonical no-op interceptor — both hooks allow; the default when nothing is registered. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidbeforeLlmCall(LlmCallContext context) Invoked immediately before each LLM provider call, after model resolution and before dispatch.default voidbeforeMainExecution(RunExecutionContext context) Invoked once, when a run first enters main execution (not on resume).
-
Field Details
-
NO_OP
Canonical no-op interceptor — both hooks allow; the default when nothing is registered.
-
-
Method Details
-
beforeMainExecution
Invoked once, when a run first enters main execution (not on resume). May throwExecutionBlockedExceptionto block the run before any step runs.- Parameters:
context- the run entering main execution
-
beforeLlmCall
Invoked immediately before each LLM provider call, after model resolution and before dispatch. May throwExecutionBlockedExceptionto block the call.- Parameters:
context- the imminent call
-