Feat: Guardrail support #96
Merged
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.
This pull request adds support for input and output guardrails to the agent workflows and OpenAI provider interfaces, enabling validation and control over agent inputs and outputs. It introduces a sample "spaghetti" input guardrail in the tutorial workflow and updates both function signatures and agent instantiation logic to accept and pass guardrail objects throughout the stack.
Guardrail Integration
InputGuardrailandOutputGuardrailparameters to all OpenAI provider agent run methods (run_agent,run_agent_auto_send,run_agent_streamed,run_agent_streamed_auto_send) insrc/agentex/lib/adk/providers/_modules/openai.pyandsrc/agentex/lib/core/services/adk/providers/openai.py, including updates to docstrings and argument passing. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]Agentconstructor if provided. [1] [2] [3]Tutorial Workflow Enhancements
check_spaghetti_guardrailand a correspondingTemporalInputGuardrailinstance (SPAGHETTI_GUARDRAIL) to the tutorial agent chat workflow, demonstrating how to block or flag user inputs containing the word "spaghetti".run_agent_streamed_auto_send, ensuring the guardrail is enforced during agent interaction.Code Quality and Documentation
These changes collectively make it possible to add custom validation logic at both input and output stages of agent workflows, improving safety and reliability.