Skip to content

Add generic policies list to AgentDefinition schema#101

Open
amitbhave10 wants to merge 3 commits into
microsoft:mainfrom
amitbhave10:feature/agent-policies-rai-config
Open

Add generic policies list to AgentDefinition schema#101
amitbhave10 wants to merge 3 commits into
microsoft:mainfrom
amitbhave10:feature/agent-policies-rai-config

Conversation

@amitbhave10
Copy link
Copy Markdown

@amitbhave10 amitbhave10 commented Jun 3, 2026

Add an optional generic policies list to the base AgentDefinition model.
Each entry is a typed Policy with a type discriminator; type: rai_policy attaches a Responsible AI (content safety) guardrail via raiPolicyName.
The typed-list shape is extensible to future policy types and mirrors the agent.yaml manifest format in the azd azure.ai.agents extension.
Defined in TypeSpec (agent.tsp); all schemas, runtime bindings (C#, Go, Python, Rust, TypeScript), and docs regenerated via npm run generate; generated Go runtime tests pass.
Propagates to ContainerAgent/PromptAgent/Workflow via allOf.
Paired with Azure/azure-dev#8521 (Azure/azure-dev#8521).

amitbhave10 and others added 2 commits June 3, 2026 08:21
Add an optional `policies` property to the base `AgentDefinition` model,
carrying a `raiConfig.raiPolicyName` (full ARM resource ID of a Responsible
AI policy) to attach content-safety guardrails to an agent. This mirrors the
hosted-agent guardrail config exposed in the azd azure.ai.agents extension.

Defined in TypeSpec (agent.tsp) as new `RaiConfig` and `AgentPolicies`
models; all schemas, runtime bindings (C#, Go, Python, Rust, TypeScript),
and reference docs regenerated via `npm run generate`. The property
propagates to ContainerAgent/PromptAgent/Workflow through allOf composition.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the nested `policies.raiConfig.raiPolicyName` object with a generic
`policies` array of typed `Policy` entries. Each policy carries a `type`
discriminator; `type: rai_policy` attaches a Responsible AI (content safety)
guardrail via `raiPolicyName` (full ARM resource ID of the RAI policy).

This is extensible to future policy types and mirrors the typed-list shape
used in the azd azure.ai.agents agent.yaml manifest, which maps a
`rai_policy` entry to the data-plane `rai_config.rai_policy_name`.

Defined in TypeSpec (agent.tsp); removed the RaiConfig/AgentPolicies models
and regenerated all schemas, runtime bindings (C#, Go, Python, Rust,
TypeScript), and reference docs via `npm run generate`. Generated Go runtime
tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@amitbhave10 amitbhave10 changed the title Add policies/rai_config to AgentDefinition schema Add generic policies (rai_policy) support to agent.yaml for hosted agents Jun 3, 2026
@amitbhave10 amitbhave10 changed the title Add generic policies (rai_policy) support to agent.yaml for hosted agents Add generic policies list to AgentDefinition schema Jun 3, 2026
The Rust generator emitted property names directly as struct field
identifiers, so a property named "type" produced "pub type: String",
which fails to compile because "type" is a Rust keyword.

Add a rustFieldIdent filter that snake-cases the property name and
escapes Rust keywords (e.g. "type" -> "r#type"), applied to field
declarations and field access. The serde/JSON wire key still uses the
original property name, so serialization is unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant