Python: [BREAKING] Remove deprecated Python OpenAI/Azure AI surfaces (#4990)

* [BREAKING] Remove deprecated Python OpenAI/Azure AI surfaces

Also clean up follow-on docs, environment guidance, package metadata, and lab test stability.

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

* Fix deleted semantic-kernel sample links

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

* Address PR review feedback

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

* improve foundry language

* Fix A2A Foundry sample regression

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

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Eduard van Valkenburg
2026-03-31 22:36:21 +02:00
committed by GitHub
Unverified
parent a5eacbbe65
commit 3a49b1d6dd
144 changed files with 669 additions and 18739 deletions
@@ -185,7 +185,7 @@ Create a file named `server.py`:
import os
from agent_framework import Agent
from agent_framework.azure import AzureOpenAIChatClient
from agent_framework.openai import OpenAIChatCompletionClient
from agent_framework.ag_ui import add_agent_framework_fastapi_endpoint
from fastapi import FastAPI
@@ -205,9 +205,9 @@ if not api_key:
agent = Agent(
name="AGUIAssistant",
instructions="You are a helpful assistant.",
client=AzureOpenAIChatClient(
endpoint=endpoint,
deployment_name=deployment_name,
client=OpenAIChatCompletionClient(
azure_endpoint=endpoint,
model=deployment_name,
api_key=api_key,
),
)
@@ -230,7 +230,7 @@ if __name__ == "__main__":
- **`Agent`**: The agent that will handle incoming requests
- **FastAPI Integration**: Uses FastAPI's native async support for streaming responses
- **Instructions**: The agent is created with default instructions, which can be overridden by client messages
- **Configuration**: `AzureOpenAIChatClient` can read from environment variables (`AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_CHAT_DEPLOYMENT_NAME`, `AZURE_OPENAI_API_KEY`) or accept parameters directly
- **Configuration**: `OpenAIChatCompletionClient` can read from environment variables (`AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_DEPLOYMENT_NAME`, `AZURE_OPENAI_API_KEY`) or accept parameters directly
**Alternative (simpler)**: Use environment variables only:
@@ -239,7 +239,7 @@ if __name__ == "__main__":
agent = Agent(
name="AGUIAssistant",
instructions="You are a helpful assistant.",
client=AzureOpenAIChatClient(), # Reads from environment automatically
client=OpenAIChatCompletionClient(), # Reads from environment automatically
)
```
@@ -249,7 +249,7 @@ Set the required environment variables:
```bash
export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
export AZURE_OPENAI_CHAT_DEPLOYMENT_NAME="gpt-4o-mini"
export AZURE_OPENAI_DEPLOYMENT_NAME="gpt-4o-mini"
# Optional: Set API key if not using DefaultAzureCredential
# export AZURE_OPENAI_API_KEY="your-api-key"
```
@@ -9,7 +9,7 @@ import os
from agent_framework import Agent, tool
from agent_framework.ag_ui import add_agent_framework_fastapi_endpoint
from agent_framework.azure import AzureOpenAIChatClient
from agent_framework.openai import OpenAIChatCompletionClient
from dotenv import load_dotenv
from fastapi import Depends, FastAPI, HTTPException, Security
from fastapi.security import APIKeyHeader
@@ -26,12 +26,12 @@ logger = logging.getLogger(__name__)
# Read required configuration
endpoint = os.environ.get("AZURE_OPENAI_ENDPOINT")
deployment_name = os.environ.get("AZURE_OPENAI_CHAT_DEPLOYMENT_NAME")
deployment_name = os.environ.get("AZURE_OPENAI_DEPLOYMENT_NAME")
if not endpoint:
raise ValueError("AZURE_OPENAI_ENDPOINT environment variable is required")
if not deployment_name:
raise ValueError("AZURE_OPENAI_CHAT_DEPLOYMENT_NAME environment variable is required")
raise ValueError("AZURE_OPENAI_DEPLOYMENT_NAME environment variable is required")
# ============================================================================
@@ -119,9 +119,9 @@ def get_time_zone(location: str) -> str:
agent = Agent(
name="AGUIAssistant",
instructions="You are a helpful assistant. Use get_weather for weather and get_time_zone for time zones.",
client=AzureOpenAIChatClient(
endpoint=endpoint,
deployment_name=deployment_name,
client=OpenAIChatCompletionClient(
azure_endpoint=endpoint,
model=deployment_name,
),
tools=[get_time_zone], # ONLY server-side tools
)