Skip to content

Python: use FOUNDRY_* settings in the red teaming sample README - #9781

Open
NingLin Liu (ninglinLiu) wants to merge 12 commits into
microsoft:mainfrom
ninglinLiu:docs/red-teaming-foundry-env
Open

NingLin Liu (ninglinLiu) wants to merge 12 commits into
microsoft:mainfrom
ninglinLiu:docs/red-teaming-foundry-env

Conversation

@ninglinLiu

Copy link
Copy Markdown
Contributor

Motivation & Context

The red teaming sample (python/samples/05-end-to-end/evaluation/red_teaming) builds its agent with FoundryChatClient(credential=credential) and passes no model. That client reads FOUNDRY_PROJECT_ENDPOINT and FOUNDRY_MODEL (env_prefix="FOUNDRY_") and ignores AZURE_OPENAI_*. The README, .env.example and the comment above the constructor still ask for AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_MODEL and an optional AZURE_OPENAI_API_KEY, and never mention FOUNDRY_MODEL. Following them fails at startup with Model is required. Set via 'model' parameter or 'FOUNDRY_MODEL' environment variable.

Description & Review Guide

  • What are the major changes?
    • README.md: the environment section lists FOUNDRY_PROJECT_ENDPOINT (used by both the agent and RedTeam) and FOUNDRY_MODEL, with the https://<resource>.services.ai.azure.com/api/projects/<project> endpoint format used by the other Foundry samples; the prerequisites and "The sample will" list describe a model deployed in the Foundry project / FoundryChatClient instead of Azure OpenAI.
    • .env.example: same variables.
    • red_team_agent_sample.py: the comment now says the constructor reads FOUNDRY_PROJECT_ENDPOINT, FOUNDRY_MODEL.
  • What is the impact of these changes? Documentation/comments only; sample behavior is unchanged.
  • What do you want reviewers to focus on? RawFoundryChatClient.__init__ in packages/foundry/agent_framework_foundry/_chat_client.py (env_prefix="FOUNDRY_", the FOUNDRY_MODEL error).

Related Issue

N/A - trivial change. Stale environment-variable names in one sample's README, .env.example and a comment; the correction follows what the sample already reads, with no behavior change.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: finding the mismatch (README variables vs. the client settings the sample uses), the documentation edit, and this PR description.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels Oct 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the documentation and comment updates aligning the sample’s setup with Foundry configuration.

No open issues 🎉

What changed in this PR

This PR aligns the Python red teaming sample’s setup instructions with the FOUNDRY_* settings used by FoundryChatClient. Changes are limited to documentation and comments; runtime behavior is unchanged.

Changes:

  • Replace stale AZURE_OPENAI_* settings with FOUNDRY_PROJECT_ENDPOINT and FOUNDRY_MODEL.
  • Document the Foundry project endpoint format and Azure CLI authentication.
  • Update prerequisites and the constructor comment to match the existing client.
File Description
python/​samples/​05-end-to-end/​evaluation/​red_teaming/​red_team_agent_sample.py Corrects the environment-variable names in the constructor comment.
python/​samples/​05-end-to-end/​evaluation/​red_teaming/​README.md Aligns setup instructions and prerequisites with Foundry configuration.
python/​samples/​05-end-to-end/​evaluation/​red_teaming/​.env.example Provides the required Foundry settings and endpoint template.

Review effort: Balanced

@ninglinLiu

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

This branch was previously deployed

1 inactive deployment
github-app-auth — dc294571 Deployed Oct 30, 2026 by ninglinLiu via add_label #26745
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants