feat(human_approval): add Colang v2 human-in-the-loop output approval rail#2132
Draft
MuneezaAzmat wants to merge 1 commit into
Draft
feat(human_approval): add Colang v2 human-in-the-loop output approval rail#2132MuneezaAzmat wants to merge 1 commit into
MuneezaAzmat wants to merge 1 commit into
Conversation
… rail Add a library rail that gates bot output behind configurable regex patterns and an interactive approve/reject flow using Colang v2 output rails. Rejection completes without abort so output rails keep firing on later turns (workaround for NVIDIA-NeMo#2067). Includes HumanApprovalConfig, example config, unit tests, and v2 integration tests. Signed-off-by: Muneeza Azmat <muneezaazmat@utexas.edu> Co-authored-by: Cursor <cursoragent@cursor.com>
|
This is a useful HITL output-rail shape. The one boundary I would make explicit before merge is that the approval should bind to the exact proposed bot output, not just to the reviewer keyword. A concrete acceptance shape:
That keeps the rail focused: pattern matching decides when review is needed; the approval artifact decides exactly which output may be released. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a Colang v2 human-in-the-loop output approval library rail. When bot output matches configurable regex patterns, the flow pauses and asks a human reviewer to approve or reject before the original text is released.
What's included
nemoguardrails/library/human_approval/:HumanApprovalCheckAction— pattern matching against bot outputHumanApprovalMatchesKeywordsAction— keyword-based approve/reject parsinghuman approval on bot output $output_textHumanApprovalConfigonRailsConfigData(patterns,approval_keywords, messages)examples/configs/human_approval_v2/Design notes
import guardrails+ customflow output rails).abort; it sets$bot_messageto the rejection message and completes normally so output rails keep firing on later turns (workaround for bug(v2): output rails silently stop firing after first abort in multi-turn conversations. #2067 until upstream fixes$output_rails_in_progresscleanup for other rails that still abort).Usage (Colang v2)
Related Issue(s)
guardrails.coflag cleanup; this rail avoidsaborton reject)Verification
poetry run pre-commit run --all-files— passedpoetry run pytest tests/test_human_approval.py tests/v2_x/test_human_approval.py tests/v2_x/test_human_approval_multiturn_2067.py -v— 20 passedexamples/configs/human_approval_v2/+ Ollamaqwen2.5:14b(approve/reject/multi-turn)make test— not run locallyAI Assistance
Checklist
Made with Cursor