feat: move guardrail state to inner_state; add inputs to guardrail state#420
Merged
andreiancuta-uipath merged 2 commits intomainfrom Jan 19, 2026
Merged
feat: move guardrail state to inner_state; add inputs to guardrail state#420andreiancuta-uipath merged 2 commits intomainfrom
andreiancuta-uipath merged 2 commits intomainfrom
Conversation
717c7bf to
6c78148
Compare
6c78148 to
dd4e0c8
Compare
Comment on lines
29
to
+50
| @@ -38,8 +45,9 @@ class AgentGraphState(BaseModel): | |||
| class AgentGuardrailsGraphState(AgentGraphState): | |||
| """Agent Guardrails Graph state for guardrail subgraph.""" | |||
|
|
|||
| guardrail_validation_result: Optional[str] = None | |||
| agent_result: Optional[dict[str, Any]] = None | |||
| inner_state: Annotated[InnerAgentGuardrailsGraphState, merge_objects] = Field( | |||
| default_factory=InnerAgentGuardrailsGraphState | |||
| ) | |||
Contributor
There was a problem hiding this comment.
I don't really see an easier way of passing the agent input other than doing the same type inheritance at runtime shenanigans.
Possible alternative:
sandbox the input
We don't have the same restrictions here as we did for agent input. We could theoretically add an agent_input field to the SubGraph state. The problem is what we do later:
- we also need to add it to the main state. in
init_nodewe could move fields from top level to thisagent_input - change wrapper/all other places that need the input to look into agent_input. This is easier than modifying the subgraph to extract them top level. Unfortunately this makes our things less reusable
aec1a9b to
e73ec93
Compare
andreitava-uip
approved these changes
Jan 19, 2026
valentinabojan
approved these changes
Jan 19, 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.
Static args needs to read the agent inputs in the LLM node and in tool nodes. When these nodes are wrapped in the guardrail subgraph, the state is of type AgentGuardrailGraphState.
This PR modifies the guardrail subgraph state to contain the agent inputs, by creating a new "complete" state model using the input schema (similar to the main graph's state).
I also moved the guardrail-specific state properties inside inner_state, to avoid collisions with the agent input schema.