Skip to content

Add content safety guardrail hosted-agent sample (16-content-safety-guardrail)#772

Closed
amitbhave10 wants to merge 1 commit into
microsoft-foundry:mainfrom
amitbhave10:add-content-safety-guardrail-sample
Closed

Add content safety guardrail hosted-agent sample (16-content-safety-guardrail)#772
amitbhave10 wants to merge 1 commit into
microsoft-foundry:mainfrom
amitbhave10:add-content-safety-guardrail-sample

Conversation

@amitbhave10

Copy link
Copy Markdown
Contributor

Summary

Adds a new azd-deployable hosted-agent sample, 16-content-safety-guardrail, demonstrating how to attach a Responsible AI content safety guardrail (rai_config / policies with rai_policy_name) to a hosted agent so the platform screens prompts and responses against a safety policy.

What's included

  • samples/python/hosted-agents/agent-framework/responses/16-content-safety-guardrail/ (derived from 01-basic):
    • agent.yaml with a top-level policies: block (RAI policy ARM ID placeholder)
    • agent.manifest.yaml with the policies: block under template:
    • README.md (prerequisites, azd + VS Code deploy, runtime verification)
    • main.py, Dockerfile, requirements.txt, .env.example, .azdignore, .dockerignore
  • Catalog entry Create LocalFunctionCalling.md #12 added to samples/python/hosted-agents/README.md.

Validation

  • Validated against the real azd Go manifest parser (LoadAndValidateAgentManifest + ExtractAgentDefinition).
  • Live end-to-end azd deploy (code mode): agent created active with rai_config persisted; benign prompt -> HTTP 200, harmful prompt -> HTTP 400 content_filter.

Diff scope

Only the 10 new sample files + 1 catalog README line. No unrelated/infra changes.

Add a new Agent Framework / Responses hosted-agent sample that attaches a
Responsible AI content safety guardrail via a definition-level policies block
(type: rai_policy, rai_policy_name = full ARM resource ID). Includes a README
covering prerequisites, azd and VS Code deploy paths, and runtime verification
(benign prompt returns 200, a blocked prompt returns 400 content_filter). Add a
learning-path entry to the hosted-agents catalog README.

Verified end-to-end with azd deploy: the deployed agent reaches active with the
rai_config persisted, and a harmful prompt is blocked at the input stage.

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

Copy link
Copy Markdown
Contributor

👋 Thanks for your contribution, @amitbhave10!

This repository is read-only. If you are contributing on behalf of Microsoft, please submit your PR to the private staging repository instead:

👉 foundry-samples-pr

See CONTRIBUTING.md for full instructions.

@github-actions github-actions Bot closed this Jun 11, 2026
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