feat(tool-rails): add support for tool output rails and validation - #1382
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces support for tool output/input rails configuration and Colang flows for tool call validation and parameter security checks. It also enables BotToolCall event emission in passthrough mode, allowing tool call guardrails to be executed before tool execution.
- Adds ToolOutputRails and ToolInputRails configuration classes with flows support
- Implements tool output rails flows execution in the Colang runtime
- Creates BotToolCall events when tool_calls are detected in passthrough mode, bypassing output rails
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_tool_output_rails.py | Test suite for tool output rails functionality with validation flows |
| tests/test_tool_calls_event_extraction.py | Tests for tool_calls preservation and event-based extraction |
| tests/test_tool_calling_passthrough_only.py | Tests verifying tool calling only works in passthrough mode |
| tests/test_tool_calling_passthrough_integration.py | Integration tests for passthrough mode tool calling |
| tests/test_output_rails_tool_calls.py | Tests verifying output rails are bypassed for tool calls |
| tests/test_bot_tool_call_events.py | Tests for BotToolCall event handling |
| tests/runnable_rails/test_tool_calling.py | RunnableRails integration tests for tool calling |
| nemoguardrails/rails/llm/options.py | Added tool_output and tool_input options to GenerationRailsOptions |
| nemoguardrails/rails/llm/llmrails.py | Modified to use extract_tool_calls_from_events instead of contextvar |
| nemoguardrails/rails/llm/llm_flows.co | Added tool output rails flow processing |
| nemoguardrails/rails/llm/config.py | Added ToolOutputRails and ToolInputRails configuration classes |
| nemoguardrails/actions/llm/utils.py | Added extract_tool_calls_from_events function |
| nemoguardrails/actions/llm/generation.py | Modified to emit BotToolCall events in passthrough mode |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Pouyanpi
force-pushed
the
feat/tool-output-rails
branch
from
September 15, 2025 09:38
df75862 to
56cb9dd
Compare
Pouyanpi
force-pushed
the
feat/runnable-rails-streaming-metadata
branch
2 times, most recently
from
September 15, 2025 09:45
49b63a8 to
a50901b
Compare
Pouyanpi
force-pushed
the
feat/tool-output-rails
branch
from
September 15, 2025 09:47
56cb9dd to
44a25f3
Compare
Pouyanpi
force-pushed
the
feat/runnable-rails-streaming-metadata
branch
2 times, most recently
from
September 15, 2025 09:53
a0c0e24 to
d256fe3
Compare
Pouyanpi
force-pushed
the
feat/tool-output-rails
branch
from
September 15, 2025 09:54
44a25f3 to
c8a4959
Compare
tgasser-nv
approved these changes
Sep 19, 2025
Pouyanpi
force-pushed
the
feat/runnable-rails-streaming-metadata
branch
2 times, most recently
from
September 22, 2025 08:52
3ac1414 to
1e2f0eb
Compare
Base automatically changed from
feat/runnable-rails-streaming-metadata
to
develop
September 22, 2025 09:00
Introduce tool output/input rails configuration and Colang flows for tool call validation and parameter security checks. Add support for BotToolCall event emission in passthrough mode, enabling tool call guardrails before execution.
Pouyanpi
force-pushed
the
feat/tool-output-rails
branch
from
September 22, 2025 09:03
c8a4959 to
e17edb2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
tgasser-nv
pushed a commit
that referenced
this pull request
Sep 22, 2025
…1382) Introduce tool output/input rails configuration and Colang flows for tool call validation and parameter security checks. Add support for BotToolCall event emission in passthrough mode, enabling tool call guardrails before execution.
tgasser-nv
pushed a commit
that referenced
this pull request
Sep 22, 2025
…1382) Introduce tool output/input rails configuration and Colang flows for tool call validation and parameter security checks. Add support for BotToolCall event emission in passthrough mode, enabling tool call guardrails before execution.
Pouyanpi
added a commit
that referenced
this pull request
Oct 1, 2025
…1382) Introduce tool output/input rails configuration and Colang flows for tool call validation and parameter security checks. Add support for BotToolCall event emission in passthrough mode, enabling tool call guardrails before execution.
tgasser-nv
pushed a commit
that referenced
this pull request
Oct 14, 2025
…1382) Introduce tool output/input rails configuration and Colang flows for tool call validation and parameter security checks. Add support for BotToolCall event emission in passthrough mode, enabling tool call guardrails before execution.
tgasser-nv
pushed a commit
that referenced
this pull request
Oct 14, 2025
…1382) Introduce tool output/input rails configuration and Colang flows for tool call validation and parameter security checks. Add support for BotToolCall event emission in passthrough mode, enabling tool call guardrails before execution.
tgasser-nv
pushed a commit
that referenced
this pull request
Oct 14, 2025
…1382) Introduce tool output/input rails configuration and Colang flows for tool call validation and parameter security checks. Add support for BotToolCall event emission in passthrough mode, enabling tool call guardrails before execution.
tgasser-nv
pushed a commit
that referenced
this pull request
Oct 28, 2025
…1382) Introduce tool output/input rails configuration and Colang flows for tool call validation and parameter security checks. Add support for BotToolCall event emission in passthrough mode, enabling tool call guardrails before execution.
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.
Introduce tool output/input rails configuration and Colang flows for tool call validation and parameter security checks. Add support for BotToolCall event emission in passthrough mode, enabling tool call guardrails before execution.
must be merged after #1370 #1369 #1366