Python: Fix samples (#4980)

* First samples 1st batch

* Fix sample paths

* Fix workflow samples

* Fix workflow dependency

* Correct env vars

* Increase idle timeout

* Fix workflows HIL sample

* Fix more workflow samples
This commit is contained in:
Tao Chen
2026-03-31 08:20:35 -07:00
committed by GitHub
Unverified
parent 0f81c277d9
commit 016daf3b98
69 changed files with 234 additions and 306 deletions
@@ -204,7 +204,7 @@ async def main():
# Create Azure OpenAI Responses client
chat_client = FoundryChatClient(
project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"],
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
model=os.environ["FOUNDRY_MODEL"],
credential=AzureCliCredential(),
)
@@ -173,7 +173,7 @@ async def main() -> None:
project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"],
# This sample has been tested only on `gpt-5.1` and may not work as intended on other models
# This sample is known to fail on `gpt-5-mini` reasoning input (GH issue #4059)
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
model=os.environ["FOUNDRY_MODEL"],
credential=AzureCliCredential(),
)
@@ -29,10 +29,11 @@ from agent_framework import Agent
from agent_framework.declarative import WorkflowFactory
from agent_framework.foundry import FoundryChatClient
from azure.identity import AzureCliCredential
from dotenv import load_dotenv
from pydantic import BaseModel, Field
# Copyright (c) Microsoft. All rights reserved.
# Load environment variables from .env file
load_dotenv()
# Agent Instructions
RESEARCH_INSTRUCTIONS = """In order to help begin addressing the user request, please answer the following pre-survey to the best of your ability.
@@ -126,7 +127,7 @@ async def main() -> None:
# Create Azure OpenAI client
client = FoundryChatClient(
project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"],
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
model=os.environ["FOUNDRY_MODEL"],
credential=AzureCliCredential(),
)
@@ -71,7 +71,7 @@ async def main():
# Create agent with tools
client = FoundryChatClient(
project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"],
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
model=os.environ["FOUNDRY_MODEL"],
credential=AzureCliCredential(),
)
menu_agent = Agent(
@@ -56,7 +56,7 @@ async def main() -> None:
"""Run the marketing workflow with real Azure AI agents."""
client = FoundryChatClient(
project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"],
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
model=os.environ["FOUNDRY_MODEL"],
credential=AzureCliCredential(),
)
@@ -16,7 +16,7 @@ Prerequisites:
- Azure OpenAI deployment with chat completion capability
- Environment variables:
FOUNDRY_PROJECT_ENDPOINT: Your Azure AI Foundry Agent Service (V2) project endpoint
AZURE_AI_MODEL_DEPLOYMENT_NAME: Your model deployment name
FOUNDRY_MODEL: Your model deployment name
"""
import asyncio
@@ -27,8 +27,10 @@ from agent_framework import Agent
from agent_framework.declarative import WorkflowFactory
from agent_framework.foundry import FoundryChatClient
from azure.identity import AzureCliCredential
from dotenv.main import load_dotenv
# Copyright (c) Microsoft. All rights reserved.
# Load environment variables from .env file
load_dotenv()
STUDENT_INSTRUCTIONS = """You are a curious math student working on understanding mathematical concepts.
@@ -58,7 +60,7 @@ async def main() -> None:
# Create chat client
client = FoundryChatClient(
project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"],
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
model=os.environ["FOUNDRY_MODEL"],
credential=AzureCliCredential(),
)