docs: add LangChain guardrails documentation [AL-437]#862
Merged
Conversation
valentinabojan
approved these changes
May 20, 2026
e73ebf4 to
4f816eb
Compare
|
|
||
| | Class | Supported scopes | Stage support | Extra parameters | | ||
| |---|---|---|---| | ||
| | `UiPathPIIDetectionMiddleware` | AGENT, LLM, TOOL | PRE + POST | `entities`, `tools` | |
Contributor
There was a problem hiding this comment.
for stage, would it be more clear to be PRE / POST / PRE_AND_POST?
Covers the middleware pattern (UiPathPIIDetectionMiddleware, UiPathHarmfulContentMiddleware, UiPathUserPromptAttacksMiddleware, UiPathIntellectualPropertyMiddleware, UiPathDeterministicGuardrailMiddleware, custom hooks) and the decorator pattern extended to LangChain/LangGraph target types (LLM factory, agent factory, LangGraph nodes, @tool). Excludes deprecated PromptInjection middleware. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… fix - Add UiPathPromptInjectionMiddleware to middleware table and imports (threshold float 0–1) - Clarify that PII and HarmfulContent support TOOL scope (fixed in PR #868 via _run_tool_guardrail) - Reformat middleware table with Supported scopes / Stage support / Extra parameters columns - Add ## Reference section with complete value tables for GuardrailScope, GuardrailExecutionStage, LoggingSeverityLevel, PIIDetectionEntityType (19 values), HarmfulContentEntityType, and IntellectualPropertyEntityType including threshold constraints Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tage notation to PRE / POST Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add scripts/gen_guardrail_enums.py that regenerates the PIIDetectionEntityType, HarmfulContentEntityType, and IntellectualPropertyEntityType value tables in docs/guardrails.md by reading the installed uipath package at runtime. Tables are wrapped with <!-- BEGIN/END ENUM <Name> --> markers so the script can target them precisely. A local pre-commit hook wires the script to run automatically whenever docs/guardrails.md or enums.py is staged, ensuring the tables stay in sync when new entity types are added upstream. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
9f7c275 to
ae69d37
Compare
…ions Replace generated markdown tables (and the gen script + pre-commit hook) with ::: directives for PIIDetectionEntityType, HarmfulContentEntityType, and IntellectualPropertyEntityType. The parent uipath-python docs site already uses mkdocstrings[python] and symlinks these docs at build time, so enum members are rendered directly from the installed package with no manual maintenance needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…r enum tables Replace ::: directives (which rendered verbosely as class-attribute blocks) with <!-- ENUM dotted.path.ClassName --> placeholders. A MkDocs on_page_markdown hook (docs/hooks/enum_lists.py) expands each placeholder into a | Value | table by importing the enum class at build time, giving the same table format as LoggingSeverityLevel with zero static content to maintain. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ware Both classes accept a stage parameter (PRE / POST / PRE_AND_POST, default PRE_AND_POST) for TOOL scope, matching the implementation in _base.py and the usage in samples/joke-agent. Update table and parameter description. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
valentinabojan
approved these changes
May 22, 2026
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.



What changed?
Added
docs/guardrails.md— a new documentation page for guardrails in the UiPath LangChain SDK.Covers two patterns:
Middleware (LangChain-native):
UiPathPIIDetectionMiddleware,UiPathHarmfulContentMiddleware,UiPathUserPromptAttacksMiddleware,UiPathIntellectualPropertyMiddleware,UiPathDeterministicGuardrailMiddleware) with parameters, scopes, and stage supportAgentMiddlewarehooks (before_agent,after_agent,before_model,after_model,wrap_tool_call)Decorator (LangChain-specific targets):
@tool, agent factory, and LangGraph nodesPromptInjectionValidatorComparison table and sample agent links (
samples/joke-agent,samples/joke-agent-decorator) included.How has this been tested?
Rendered locally via
mkdocs servewith theuipath-pythondocs site (langchain docs are symlinked in at build time). All pages load without errors.Are there any breaking changes?