Add generic policies list to AgentDefinition schema#101
Open
amitbhave10 wants to merge 3 commits into
Open
Conversation
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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).