Skip to main content
Use JevEvidenceProcessor to distinguish relevant material, supporting evidence, conflicting premises and prompt injection. Process authorized passages directly or register the search_evidence tool. Response middleware separately checks whether the final answer is supported.

Example: are all refunds guaranteed to succeed?

Retrieval returns a private policy, a passage containing an “ignore the rules” instruction, and a public policy stating that eligibility and human review are required. The last passage contradicts the question’s premise but is essential evidence, not irrelevant material. First remove unauthorized internal policy with ACLs. Then let JEV distinguish injection, relevant evidence and conflicting premises. Generate from the retained policy and review the answer’s grounding separately.

1. Configure the processor and observe first

Initialize client as in Client setup. SHADOW preserves authorized material and records suggestions only:
demonstration() supplies uncalibrated example thresholds. 0.0 disables further pruning by minimum reranking score. Five seconds bounds one processing operation. After validating against samples, use ENFORCE to apply suggestions to downstream input.

2. Supply candidates, authorization and the question

These candidates match the offline example. The demo ACL permits public material only. Replace it with a real check bound to the current user and tenant. context is the invocation’s RuntimeContext.
The ACL runs per subscription and per candidate. Denied passages never reach the model. In SHADOW, delivered remains the original authorized candidates; only ENFORCE filters material such as injections. Expect policy-7 to be retained as evidence contradicting “refunds are guaranteed,” but inspect the report for the actual decision. Supply a Supplier<Mono<List<JevPassage>>> to include retrieval in the shared budget. IDs and versions must be bounded and nonempty; visible IDs must be unique. Attributes remain host-side and are not sent to the decision model.

3. Distinguish absent evidence from processing failure

Report separates delivered (actual downstream input), suggested (recommended topK), assessments (per passage), calls (status and usage), complete and applied. Classes include INCLUDED, CONFLICTING, EXCLUDED, INCONCLUSIVE, ERROR and UNSCREENED. A null score is unknown, not zero or irrelevant. OFF still runs retrieval and ACLs without semantic calls. SHADOW returns authorized candidates in original order up to topK and records suggestions separately. ENFORCE applies classification/reranking and excludes rejected, uncertain, erroneous and unscreened passages from delivered. A reranking error does not invalidate a successful classification; place the passage after scored items. No candidates means no model request. An empty result and incomplete processing do not both mean “the knowledge base has no answer.” Defaults: 32 visible candidates, 16,000 characters per passage, 8,000 per query, 32,000 per request state and 64 requests. Exceeding aggregate limits prevents semantic processing; an oversized passage is UNSCREENED rather than silently truncated. Filtering and reranking use separate sequential requests per passage. Timeout preserves the partial report. Cancellation stops retrieval, in-flight requests and further dispatch but cannot guarantee remote billing stops. Observer exceptions do not change results. OFF propagates retrieval/ACL failures as application errors.

4. Register a read-only search tool

Register search_evidence with the same processor. The example reuses the candidates and demo ACL above. Replace the Source’s read function with your retrieval backend and derive identity from runtime context.
Pass runContext to the Agent. Do not keep a cross-user Source or identity in shared variables. The only tool argument is query; 32 bounds candidates read and 2 bounds passages delivered. Read-only tools still follow permissions; missing user, session or Source produces an explicit error. The Agent receives only delivered passage IDs, versions, text and optional classes/scores. Results omit rejected text, private ACL attributes and the full report. SHADOW tool output matches OFF; ENFORCE adds classes and scores. EVIDENCE_REVIEW_INCOMPLETE marks partial processing and NO_EVIDENCE a complete empty result. The model still answers from evidence and cites IDs/versions; the tool itself neither reviews the final answer nor verifies citations.

Combine retrieval with final draft review

JevResponseMiddleware.qualityState(input, answer) builds user_question, assistant_answer, ID-paired tool_calls, supporting_context from successful results, and trace_issues from actual messages. It retains compatibility fields prompt / answer. Check grounded and answers_question separately; a relevant answer can be unsupported. Metadata and reasoning are not evidence. A tool result in supporting_context still needs verification. Duplicate/missing call IDs or orphan results cause INCONCLUSIVE / INCOMPLETE_JUDGING_EVIDENCE instead of guessed pairing. Serialized state exceeding maxChars returns JUDGE_STATE_LIMIT without silent truncation. ENFORCE withholds these drafts; SHADOW retains original events. Pre-publication review uses existing buffers and budgets. Only FAIL triggers bounded, tool-free revision; ERROR, INCONCLUSIVE or exhausted revisions withhold the draft. Executed tools do not rerun, and a still-failing answer is never published as a fallback. See Final draft review. The application owns deterministic checks of citation format, ID and version; the example preserves citations and reviews grounding without implementing a universal citation parser.

Runnable example

JevEvidenceExample provides all three candidates and the retrieval, answer and revision workflow. Set JEV_CP using the build instructions, then run:
No credentials are required. A real ReActAgent, Toolkit and ResponseMiddleware exclude the private passage via ACL, filter the injection and retain the conflicting policy. Only the draft falsely promising a refund is revised. Expect retrievals=1, modelCalls=3, judgmentRequests=5, one correctly paired tool result and no exposure of the original draft. Scripted judgments and generation verify execution boundaries, not model accuracy.