Skip to main content
JevExecution.Options configures execution mode, total budget and observer for tool selection, guards, routing and other features. Observe recommendations before deciding which ones should affect the Agent.

Example: observe a refund guard before enforcing it

You want to add a pre-refund check without knowing how often it will block valid requests. Enforcing immediately can disrupt service; leaving it off yields no observations. SHADOW makes real judgments and records recommendations while passing original inputs onward. Compare suggested denials with expected business outcomes, calibrate, then switch only the refund guard to ENFORCE.

1. Set a budget and version for this purpose

Build client as in Client setup and register guard with HarnessAgent.builder().middleware(guard). Version identifies the configuration in observations. Change it when criteria or thresholds change so results remain distinguishable. Two seconds bounds all batches, client retries and backoff in one logical judgment. It excludes subsequent Agent tool execution. A per-HTTP-request timeout cannot replace this total budget.

2. Distinguish recommendations from actual actions

Credentials in the environment do not enable features. Update configuration and rebuild middleware to change modes. Modes are independent by purpose: tool selection can stay in SHADOW while the refund guard enforces.

3. Record comparable decision metadata

The observer receives the current RuntimeContext and Record: The Record omits full messages, tool arguments, credentials and raw errors. Correlate run/session through RuntimeContext. Observers should return promptly; queue database writes yourself. Observer RuntimeExceptions do not stop the Agent, but blocking work does not automatically move to the background.

Run and verify

Set JEV_CP using the example build instructions:
The offline example runs identical selection, guard and routing inputs in all three modes. A SHADOW denial still enters simulated dispatch; ENFORCE produces a denied tool result. Full source For a live comparison, see the refund guard example. Preset probabilities provide no evidence of model accuracy or latency.

Failure behavior by purpose

Shared statuses are DECIDED, INCONCLUSIVE, ERROR, CANCELLED and SKIPPED. TIMEOUT and CALL_OR_RESPONSE_ERROR are failure reasons. Cancellation notifies the observer rather than fabricating a fallback for dispatch. Whether blocking HTTP stops immediately depends on the transport. Retrospective trace evaluation and long-task supervision support only OFF/SHADOW; neither can undo completed actions. Direct application APIs such as Judge and memory review run when invoked and do not read a global mode. Put application feature switches around the complete workflow.