Skip to content

[Content Safety] Evolve Unified Moderate to Agent Hooks-native preview - #47138

Merged
liamcrumm merged 63 commits into
swagger-agent/CogSvc-2026-11-15-preview-typespecfrom
liamcrumm/contentsafety-agent-hooks-native-20261101
Oct 19, 2026
Merged

liamcrumm merged 63 commits into
swagger-agent/CogSvc-2026-11-15-preview-typespecfrom
liamcrumm/contentsafety-agent-hooks-native-20261101

Conversation

@liamcrumm

@liamcrumm liamcrumm commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds 2026-10-15-preview to the existing POST /contentsafety/content:unifiedModerate route. Earlier API versions and the UnifiedOperations_UnifiedModerate operation ID are unchanged.

The request uses the Agent Hooks 0.1 AgentContext. The response contains a closed Agent Hooks verdict and a separate evaluation receipt.

Policy selection

The operation supports two mutually exclusive selector profiles:

  • Foundry project requests use targetResourceId with the complete selectedPolicyId, selectedPolicyRevision, and selectedPolicySemanticDigest tuple.
  • Named policy requests use policyId.

Foundry requests evaluate the selected Guardrail and any administrator policies bound to the target hierarchy. Each evaluated policy remains a separate receipt layer.

Evaluation receipt

The receipt includes:

  • the evaluation profile, identifier, and attempt
  • an RFC 8785 SHA-256 binding to the API version, request body, and selectors
  • the resource ID, revision, semantic digest, activated artifact digest, decision, and role of each evaluated policy
  • the evaluated intervention point and required intervention points
  • the AACS host profile and authenticated producer
  • public harm results when available
  • the project resource ID and project incarnation for Foundry requests

The selected-policy fields replace the previous developerPolicy* selectors. manifestRegoDigest is renamed to activatedArtifactDigest. Generated-policy identity, appliedGeneration, bindingEpoch, readinessEpoch, capabilityVersion, and supportedInterventionPoints are removed from the receipt.

Eight-point authoring

The 2026-11-15-preview control-plane models support these ACS intervention bindings:

  • agent_startup: $snap.agent_init (agent_init)
  • input: $snap.input (user_input)
  • pre_model_call: $snap.messages (messages)
  • post_model_call: $snap.response (model_response)
  • pre_tool_call: $snap.tool_call.args (tool_args)
  • post_tool_call: $snap.tool_result.value (tool_result)
  • output: $snap.output (assistant_output)
  • agent_shutdown: $snap.summary (agent_summary)

The four added lifecycle and model binding models use their point-specific target and target kind. The existing 2026-09-15-preview input, output, and tool binding schemas remain unchanged. In 2026-11-15-preview, tool-name selectors remain available on the pre-tool and post-tool bindings. The RaiPolicyContentSource model includes AgentStartup, PreModelCall, PostModelCall, and AgentShutdown while retaining Prompt, Completion, PreToolCall, PostToolCall, PreRun, and PostRun.

Examples and validation support

  • Adds 14 successful Unified Moderate examples covering all eight intervention points, Foundry and named-policy selection, transforms, approvals, and AACS subject roles.
  • Adds semantic checks for selector combinations, exact selected-policy revisions, project and policy changes, unavailable policy layers, host capability requirements, and route availability.
  • Adds mutation checks for mismatched receipt points, missing point payloads, and invalid selector combinations.
  • Runs source semantic checks during TypeSpec compilation and leaves generated-file parity to the post-emission repository validation step.
  • Expands the ACS policy example to include all eight intervention bindings.

Add a separate AgentContext-in/Verdict-out operation and client in 2026-11-01-preview. Preserve published Unified Moderate contracts and generate OpenAPI plus native lifecycle and verdict examples.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3ef7356a-fe29-4fdb-99eb-5dcdb03e8e7c
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Next Steps to Merge

Next steps that must be taken to merge this PR:
  • ❌ Your PR requires an API stewardship review as it introduces a new data-plane API version (label: data-plane-review-requested). A data-plane API reviewer is assigned from the pool and unblocks merge by applying the protected data-plane-review-signoff label. To request or expedite the offline REST API review, email azureapirbcore@microsoft.com with your PR link.
  • ❌ This PR is in purview of the ARM review (label: ARMReview). This PR must get ARMSignedOff label from an ARM reviewer.
    This PR is not ready for ARM review (label: NotReadyForARMReview). This PR will not be reviewed by ARM until relevant problems are fixed. Consult the rest of this Next Steps to Merge comment for details.
    Once the blocking problems are addressed, add to the PR a comment with contents /azp run. Automation will re-evaluate this PR and if everything looks good, it will add WaitForARMFeedback label which will put this PR on the ARM review queue.
    For details of the ARM review, see aka.ms/azsdk/pr-arm-review

Important checks have failed. As of today they are not blocking this PR, but in near future they may.
Addressing the following failures is highly recommended:
  • ⚠️ The check named Swagger BreakingChange has failed. To unblock this PR, follow the process at aka.ms/brch.


Comment generated by summarize-checks workflow run.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Contributor readiness: required access

Warning

Access issues can block approvals, Azure DevOps pipelines, or labeling.

User / area Access issue PR impact
🔴 vishal-kadam Azure membership not public. Not determined.
🔴 zubairabid Azure membership not public. Not determined.

Internal contributors: set up / renew access. Recheck: /azsdk check-access.

Contributors with verified access (18)

Public Azure membership and repository write access verified.

User Roles
ArcturusZhang commit author
audunn commit author
berndverst commit author
catalinaperalta commit author
cxznmhdcxz commit author
haolingdong-msft commit author
jhendrixMSFT approved reviewer
kazrael2119 commit author
liamcrumm PR author, commit author, committer
nasc17 commit author
radhikajain99 commit author
samvaity commit author
sandeepsnairms commit author
timotheeguerin commit author
v-jiaodi commit author
v-shubhamti-microsoft commit author
vedkale commit author
vikeshi26 commit author

Non-blocking check; fix access issues to unblock affected actions.

Last updated: 2026-10-19T17:06:22.977Z

@github-actions github-actions Bot added the typespec-suppressions-review-required PR reviewer must review all reported typespec suppressions label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

TypeSpec suppressions requiring review

Status: ❌ Approval required — 14 suppressions

This PR adds or updates the TypeSpec suppressions listed below. Suppressions are strongly discouraged — they bypass linter rules that protect API quality and consistency. Authors should avoid adding new suppressions and prefer fixing the underlying issue; reviewers should approve only when there is a clear, compelling justification and no reasonable alternative. Review each linked rule and source location, then apply typespec-suppressions-approved only if every justification is acceptable. The Status column shows ✅ once the label is applied and ❌ while approval is pending.

New suppressions (14)

StatusRuleSourceJustification
❌@azure-tools/typespec-azure-core/no-closed-literal-union
Unions of literals should include the base scalar type to mark them as open enum.
agent-hooks.tsp#L897These literals declare HTTP transport status codes, not an extensible body enum.
❌@azure-tools/typespec-azure-core/no-closed-literal-union
Unions of literals should include the base scalar type to mark them as open enum.
agent-hooks.tsp#L112The external Agent Hooks 0.1 actor kind contract is closed.
❌@azure-tools/typespec-azure-core/no-closed-literal-union
Unions of literals should include the base scalar type to mark them as open enum.
agent-hooks.tsp#L126Agent Hooks 0.1 requires allow, deny or transform; an unknown decision must fail closed.
❌@azure-tools/typespec-azure-core/no-closed-literal-union
Unions of literals should include the base scalar type to mark them as open enum.
agent-hooks.tsp#L747The October hosted transport admits exactly the Foundry-project and named-policy profiles. Local in-process integrations do not call this route.
❌@azure-tools/typespec-azure-core/no-closed-literal-union
Unions of literals should include the base scalar type to mark them as open enum.
agent-hooks.tsp#L84The external Agent Hooks 0.1 input role contract is closed.

Showing 5 of 14 suppressions. See the full analysis log for the complete list.

For an overview of TypeSpec linting rules click here.
For a mapping from ARM lintdiff rules to corresponding TypeSpec linting rules click here.

💬 Have feedback on the TypeSpec suppression flow? Let us know.

@github-actions github-actions Bot added data-plane TypeSpec Authored with TypeSpec labels Oct 8, 2026
Keep all explicit older version tags while pointing the default tag to the newly generated November preview, as required by Avocado.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3ef7356a-fe29-4fdb-99eb-5dcdb03e8e7c
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

API Change Check

APIView identified API level changes in this PR and created the following API reviews

Language API Review for Package
Python azure-ai-contentsafety
C# Azure.AI.ContentSafety
Java com.azure:azure-ai-contentsafety
JavaScript @azure/ai-content-safety
Go sdk/resourcemanager/cognitiveservices/armcognitiveservices
Python azure-mgmt-cognitiveservices
Java com.azure.resourcemanager:azure-resourcemanager-cognitiveservices
JavaScript @azure/arm-cognitiveservices
C# Azure.ResourceManager.CognitiveServices

Comment generated by After APIView workflow run.

liamcrumm and others added 3 commits October 8, 2026 19:49
Rename only the unpublished native evaluation preview and regenerate its OpenAPI and examples. Preserve published contracts and the existing client's September dependency.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3ef7356a-fe29-4fdb-99eb-5dcdb03e8e7c
Use the existing operation and route in the October preview, preserve released contracts byte-for-byte, and remove the separate evaluation operation/client. Retain only a namespaced AACS classifier-role bridge grounded in existing non-Hooks flows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3ef7356a-fe29-4fdb-99eb-5dcdb03e8e7c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3ef7356a-fe29-4fdb-99eb-5dcdb03e8e7c
@liamcrumm liamcrumm changed the title [Content Safety] Add Agent Hooks-native evaluation preview [Content Safety] Evolve Unified Moderate to Agent Hooks-native preview Oct 8, 2026
liamcrumm and others added 3 commits October 8, 2026 22:48
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3ef7356a-fe29-4fdb-99eb-5dcdb03e8e7c
Expand Azure AI Content Safety and Azure OpenAI in new public descriptions. Distinguish protected-resource targets from policy and binding objects, document paired selectors and authenticated scope, and preserve canonical wire names, schema shapes and released versions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3ef7356a-fe29-4fdb-99eb-5dcdb03e8e7c
Restore the protected root spelling configuration and keep the service acronym in the Cognitive Services dictionary. Document AACS effective-policy composition separately from host composition and enforcement; preserve all wire shapes and transform/null semantics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3ef7356a-fe29-4fdb-99eb-5dcdb03e8e7c
@liamcrumm
liamcrumm marked this pull request as ready for review October 9, 2026 23:16
@github-actions github-actions Bot added data-plane-review-requested Data-plane API review requested/needed: pending Azure API Stewardship + service team review. new-api-version labels Oct 9, 2026
@azure-sdk-automation
azure-sdk-automation Bot requested review from a team and Joel Hendrix (jhendrixMSFT) and removed request for a team October 9, 2026 23:20
@liamcrumm liamcrumm added the PublishToCustomers Acknowledgement the changes will be published to Azure customers. label Oct 12, 2026
liamcrumm and others added 2 commits October 12, 2026 16:28
Keep the canonical Agent Hooks Verdict closed inside a versioned transport result, require exact developer-policy revision selection, and define the policy/readiness receipt and fail-closed error contract. Preserve the existing public ordinal harm summaries as receipt metadata.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3ef7356a-fe29-4fdb-99eb-5dcdb03e8e7c
Avoid the recursive Azure inner-error projection that produces unresolved client placeholders while retaining typed actionable error codes and nested details.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3ef7356a-fe29-4fdb-99eb-5dcdb03e8e7c
@liamcrumm
liamcrumm changed the base branch from main to swagger-agent/CogSvc-2026-11-15-preview-typespec October 16, 2026 20:35
@github-actions github-actions Bot added RPaaS BreakingChangeReviewRequired <valid label in PR review process>add this label when breaking change review is required and removed new-api-version ARMReview RPaaS BreakingChangeReviewRequired <valid label in PR review process>add this label when breaking change review is required labels Oct 16, 2026
Use the existing yaml runtime dependency and cover policy-file loading with regression tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2c14a849-7b23-4efc-bf0f-4e287ef79986
@github-actions github-actions Bot added the BreakingChangeReviewRequired <valid label in PR review process>add this label when breaking change review is required label Oct 16, 2026
@github-actions

This comment has been minimized.

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

Copilot-Session: f1082e96-4bbf-4958-b7a0-39f2d6368808
@github-actions github-actions Bot removed the BreakingChangeReviewRequired <valid label in PR review process>add this label when breaking change review is required label Oct 16, 2026
@github-actions

Copy link
Copy Markdown

Data-Plane API Review

Automated advisory review by Copilot. This is one non-deterministic pass over a
narrow semantic scope and does not replace complete human API review.

No findings in the reviewed scope.

Not reviewed: deterministic compiler/linter concerns, naming and
documentation quality, grey-area design questions, runtime behavior, SDK
customizations, and unchanged API surface.

🔍 Automated data-plane API review by Data-Plane API Review. Advisory only.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note that when you merge these changes to main you'll want to separate your ARM and data-plane content into separate PRs.

@liamcrumm
liamcrumm merged commit ff7cc34 into swagger-agent/CogSvc-2026-11-15-preview-typespec Oct 19, 2026
63 of 69 checks passed
@liamcrumm
liamcrumm deleted the liamcrumm/contentsafety-agent-hooks-native-20261101 branch October 19, 2026 19:16
using Azure.ClientGenerator.Core;

@TypeSpec.Versioning.useDependency(ContentSafety.Versions.v2026_09_01_preview)
@TypeSpec.Versioning.useDependency(ContentSafety.Versions.v2026_10_15_preview)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment 3 — Green .NET validation contains a failed build

Content Safety client.tsp:6

The .NET SDK validation check is green, but its generation log contains Build FAILED. PreviewOperationsTests.cs:43–61 fails with CS0246/CS0103 because the regenerated surface no longer contains UnifiedModerateConfig, UnifiedModerateSource, UnifiedModerateResult, UnifiedModerateVerdict, and AcsDecision.

The package is subsequently classified as result [warning], so the successful overall check conceals a real SDK test-project compilation failure associated with switching the client to the October preview.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cognitive Services data-plane data-plane-review-requested Data-plane API review requested/needed: pending Azure API Stewardship + service team review. NotReadyForARMReview PublishToCustomers Acknowledgement the changes will be published to Azure customers. resource-manager SuppressionReviewRequired TypeSpec Authored with TypeSpec typespec-suppressions-review-required PR reviewer must review all reported typespec suppressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.