Attach a Guardrail
After creating a guardrail (via portal or REST API), attach it to one of three targets:
- Hosted Agent —
agent.yamlpoliciesblock - Model Deployment — REST API or request-time header
- Toolbox —
policies.rai_config.rai_policy_namein toolbox definition
Hosted Agent
A guardrail assigned to an agent fully overrides the underlying model deployment's guardrail. If no guardrail is assigned, the agent inherits the model deployment's guardrail.
Add a policies block to agent.yaml with the guardrail's full ARM resource ID:
yaml
policies:
- type: rai_policy