Skip to content

Add generic policies (rai_policy) support to agent.yaml for hosted agents#8521

Merged
trangevi merged 2 commits into
Azure:mainfrom
amitbhave10:feature/agents-rai-config-yaml
Jun 4, 2026
Merged

Add generic policies (rai_policy) support to agent.yaml for hosted agents#8521
trangevi merged 2 commits into
Azure:mainfrom
amitbhave10:feature/agents-rai-config-yaml

Conversation

@amitbhave10
Copy link
Copy Markdown
Contributor

@amitbhave10 amitbhave10 commented Jun 2, 2026

Add support for a generic policies list in the azure.ai.agents extension's agent.yaml manifest so users can attach governance policies to hosted agents.
Each entry has a type discriminator; type: rai_policy attaches a Responsible AI (content safety) guardrail via rai_policy_name, the full ARM resource ID of the RAI policy.
azd deploy flattens a rai_policy entry into the Foundry data-plane rai_config.rai_policy_name field (unchanged on the wire).
The typed-list shape keeps the manifest extensible to future policy types.
Updates yaml.go (Policy/PolicyType + Policies []Policy), map.go (mapRaiConfig), parse.go validation, fixture, CHANGELOG, and unit tests.
Paired with microsoft/AgentSchema#101 (microsoft/AgentSchema#101).

Add support for the policies.rai_config.rai_policy_name field in the
azure.ai.agents extension's agent.yaml manifest so users can attach a
Responsible AI (content safety) guardrail policy to hosted agents. The
value is the full ARM resource ID of the RAI policy, which azd deploy
forwards to the Foundry data plane via the existing rai_config field.

- yaml.go: add RaiConfig and AgentPolicies manifest structs and a
  Policies field on ContainerAgent
- map.go: add mapRaiConfig helper and wire it into both the
  container/image and code-deploy request builders
- parse.go: validate rai_policy_name is non-empty when present
- tests + testdata fixture covering image, code, and validation paths
- CHANGELOG entry

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for the policies.rai_config.rai_policy_name field in the agent.yaml manifest for hosted agents in the azure.ai.agents extension, allowing users to attach a Responsible AI (content safety) policy whose value is the full ARM resource ID of the RAI policy. The new manifest field is mapped to the existing agent_api.RaiConfig data-plane structure via a small helper and validated during parse.

Changes:

  • Introduce RaiConfig and AgentPolicies YAML structs and a Policies field on ContainerAgent.
  • Add mapRaiConfig helper and wire it into both image-based and code-deploy hosted-agent API request builders, plus parse-time validation that rai_policy_name is non-empty when rai_config is present.
  • Add unit tests and a YAML fixture covering valid, missing, and absent policy cases, plus a CHANGELOG entry.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/yaml.go Adds RaiConfig/AgentPolicies types and Policies field on ContainerAgent.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/map.go Adds mapRaiConfig helper and wires it into both image and code hosted-agent request builders.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/parse.go Validates that rai_policy_name is non-empty when rai_config is present.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/parse_test.go Tests validation across valid, missing-name, and absent-policies cases.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/map_test.go Tests RaiConfig mapping for image, code, no-rai paths, and the helper directly.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/testdata_test.go Registers the new fixture in the YAML round-trip tests.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/testdata/hosted-agent-with-rai.yaml New fixture exercising policies.rai_config.rai_policy_name.
cli/azd/extensions/azure.ai.agents/CHANGELOG.md Documents the new manifest field under Unreleased.

@github-actions github-actions Bot added the ext-agents azure.ai.{agents,connections,inspector,projects,routines,skills,toolboxes} extensions label Jun 2, 2026
Replace the nested `policies.rai_config.rai_policy_name` object with a generic
`policies` list of typed entries. Each entry has a `type` discriminator;
`type: rai_policy` attaches a Responsible AI (content safety) guardrail via
`rai_policy_name` (full ARM resource ID of the RAI policy).

This keeps the manifest authoring shape extensible to future policy types
while the mapping layer continues to flatten a `rai_policy` entry into the
data-plane `rai_config.rai_policy_name` that the Foundry hosted-agent API
expects (unchanged on the wire).

Updates the yaml model (Policy / PolicyType), mapRaiConfig, manifest
validation (known type + required rai_policy_name), the test fixture,
CHANGELOG, and unit tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@amitbhave10 amitbhave10 changed the title Expose policies.rai_config in agent.yaml for hosted agents Add generic policies (rai_policy) support to agent.yaml for hosted agents Jun 3, 2026
@trangevi trangevi linked an issue Jun 4, 2026 that may be closed by this pull request
@trangevi trangevi enabled auto-merge (squash) June 4, 2026 15:49
@trangevi
Copy link
Copy Markdown
Member

trangevi commented Jun 4, 2026

/check-enforcer override

@trangevi trangevi merged commit 27b7ca3 into Azure:main Jun 4, 2026
25 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-agents azure.ai.{agents,connections,inspector,projects,routines,skills,toolboxes} extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Agents Extension] Add RAI policy support

4 participants