Skip to main content
Use JevDraftPipeline when your application owns draft generation. It chains input checks, generation, complete-draft review and bounded revision. Only approved text appears in publishedText for the application to publish.

Example: a reply in a support console

A customer asks whether an unshipped order qualifies for a refund. Policy says they may apply but receipt depends on actual processing. A generator might instead claim “the refund has arrived.” Before showing a sendable reply, check the draft and rewrite it once if needed, without executing a refund to correct the wording. Use this pipeline when your application controls generation and publication. To intercept the Agent’s final answer directly, use response middleware.

1. Define separate checks for input and draft

Initialize judge as in Application component setup. The input check receives the original request. The output check receives request, evidence and draft; write questions about those fields:
The example buffers up to 16,000 characters, allows one revision and gives input review, generation, output review and revision 15 seconds together. Generate only if input passes. Calibrate the example probability thresholds on business samples.

2. Connect generation and publish only approved text

Fixed strings make the inputs, mistaken draft and correction visible. Replace the two Flux.just calls with your own text-only generators. JEV performs the checks through the supplied judge.
The incorrect draft should fail; publishable text returns only if the revision passes. A real model may judge differently, so inspect the outcome before sending. The reviser receives the current draft, complete review and attempt to target the failed conditions. Neither generator nor reviser should rerun an Agent with write tools. Send a message only after successful completion. Do not stream intermediate generator fragments to the customer.

3. Handle nonpublishable outcomes

Only FAIL can trigger revision; ERROR/INCONCLUSIVE cannot. On normal rejection, authorized reviewers may inspect draftText, but never publish it as a fallback. Error outcomes report zero revisions; do not infer prior call counts from it. Collect usage at the generator and client. Cancellation propagates through active generation. The component does not stream unreviewed output. Show processing status if needed, then present the approved text in full.

Run the offline example

The draft scenario in JevApplicationScenarios supplies this request, evidence and both drafts. Set JEV_CP using the build instructions, then run:
It checks three paths: one revision succeeds, an identical revision stops without publication, and rejected input skips generation. See JevApplicationScenariosTest in the examples module. Scripted generation and judgments do not measure live accuracy or latency.