Skip to content

Conversation

@andreiancuta-uipath
Copy link
Contributor

@andreiancuta-uipath andreiancuta-uipath commented Jan 16, 2026

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.

@andreiancuta-uipath andreiancuta-uipath force-pushed the feat/guardrail-state-inputs branch 4 times, most recently from 717c7bf to 6c78148 Compare January 19, 2026 10:31
@andreiancuta-uipath andreiancuta-uipath force-pushed the feat/guardrail-state-inputs branch from 6c78148 to dd4e0c8 Compare January 19, 2026 11:22
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
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_node we could move fields from top level to this agent_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

@andreiancuta-uipath andreiancuta-uipath force-pushed the feat/guardrail-state-inputs branch from aec1a9b to e73ec93 Compare January 19, 2026 12:04
@andreiancuta-uipath andreiancuta-uipath merged commit 7cfce44 into main Jan 19, 2026
39 checks passed
@andreiancuta-uipath andreiancuta-uipath deleted the feat/guardrail-state-inputs branch January 19, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants