Files
agent-framework/python/samples/02-agents/providers
T
Evan Mattson f3db60fa65 Python: Support GPT-5 verbosity option and restore Foundry agent_reference (#5619)
* Python: Support GPT-5 verbosity option and restore Foundry agent_reference

Adds verbosity as a typed Literal["low","medium","high"] field on
OpenAIChatOptions (Responses API) and OpenAIChatCompletionOptions (Chat
Completions API), set in the same way as the existing reasoning options.
For the Responses API, top-level verbosity is translated to the nested
text.verbosity shape the OpenAI service expects. The same field flows
through to FoundryChatClient via the existing FoundryChatOptions alias.

Also fixes #5582: PR #5447 removed the agent_reference injection from
RawFoundryAgentChatClient._prepare_options, so first-turn calls against
a Foundry Prompt Agent went out without model and without agent_reference
and were rejected by the Responses API with "Missing required parameter:
'model'". Restores the injection on the non-preview path
(allow_preview=False) and adds a guard test that asserts the preview
path does not inject agent_reference, since the preview SDK injects it
via project_client.get_openai_client(agent_name=...).

Closes #5516
Closes #5582

* Python: Address Copilot review on PR #5619

- Foundry verbosity sample docstring: replace the misleading "set deployment
  name on model=" instruction with the actual env-var pattern the sample relies
  on (FOUNDRY_PROJECT_ENDPOINT and FOUNDRY_MODEL).
- _build_agent_reference docstring: clarify the helper is used for both
  Prompt Agents and HostedAgents on the non-preview path.
- Add a Responses API test that locks in the documented precedence rule:
  when both top-level verbosity and text["verbosity"] are supplied, the
  top-level value wins.

* Python: Drop redundant Foundry verbosity sample and list OpenAI sample in README

- Remove samples/02-agents/providers/foundry/foundry_chat_client_verbosity.py
  per review feedback. The verbosity functionality is identical across the
  OpenAI and Foundry clients (FoundryChatOptions is an alias of
  OpenAIChatOptions), so a single sample on the OpenAI side is sufficient.
- Add the new client_verbosity.py entry to the OpenAI samples README.
f3db60fa65 ยท 2026-05-04 21:21:40 +00:00
History
..

Provider Samples Overview

This directory groups provider-specific samples for Agent Framework.

Folder What you will find
anthropic/ Anthropic Claude samples using both AnthropicClient and ClaudeAgent, including tools, MCP, sessions, and Foundry Anthropic integration.
amazon/ AWS Bedrock samples using BedrockChatClient, including tool-enabled agent usage.
azure/ Azure OpenAI chat completion samples using OpenAIChatCompletionClient, including basic usage, explicit configuration, tools, and sessions.
copilotstudio/ Microsoft Copilot Studio agent samples, including required environment/app registration setup and explicit authentication patterns.
custom/ Framework extensibility samples for building custom BaseAgent and BaseChatClient implementations, including layer-composition guidance.
foundry/ Microsoft Foundry and Foundry Local samples using FoundryChatClient, FoundryAgent, RawFoundryAgentChatClient, and FoundryLocalClient for hosted agents, Responses API, local inference, tools, MCP, and sessions.
github_copilot/ GitHubCopilotAgent samples showing basic usage, session handling, permission-scoped shell/file/url access, and MCP integration.
ollama/ Local Ollama samples using OllamaChatClient (recommended) plus OpenAI-compatible Ollama setup, including reasoning and multimodal examples.
openai/ OpenAI provider samples for Chat and Chat Completion clients, including tools, structured output, sessions, MCP, web search, and multimodal tasks.

Each folder has its own README with setup requirements and file-by-file details.