diff --git a/sdk/ai/azure-ai-projects/.env.template b/sdk/ai/azure-ai-projects/.env.template index 71237c4c0e44..a89bd766f143 100644 --- a/sdk/ai/azure-ai-projects/.env.template +++ b/sdk/ai/azure-ai-projects/.env.template @@ -46,9 +46,14 @@ SHAREPOINT_USER_INPUT= FABRIC_USER_INPUT= BING_CUSTOM_USER_INPUT= A2A_USER_INPUT= +A2A_ENDPOINT= EVALUATOR_NAME= DATASET_NAME= DATASET_VERSION= +DATASET_VERSION_1= +DATASET_VERSION_2= +DATA_FOLDER= +DOWNLOAD_FOLDER= POLL_INTERVAL_SECONDS= EVAL_MODEL= OPTIMIZATION_MODEL= @@ -57,6 +62,44 @@ WORK_IQ_PROJECT_CONNECTION_ID= WORK_IQ_USER_INPUT= FABRIC_IQ_PROJECT_CONNECTION_ID= FABRIC_IQ_USER_INPUT= +AI_SEARCH_CONNECTION_NAME= +INDEX_NAME= +INDEX_VERSION= +FILE_PATH= +AGENT_ID= +APPINSIGHTS_RESOURCE_ID= +TRACE_LOOKBACK_HOURS= +FOUNDRY_AGENT_VERSION= +FOUNDRY_CONVERSATION_IDS= +FOUNDRY_TRACE_IDS= +FOUNDRY_INSTANT_MODEL_NAME= +FOUNDRY_REFERENCE_DATASET_NAME= +FOUNDRY_REFERENCE_DATASET_VERSION= +FOUNDRY_TRACES_WINDOW_DAYS= +AZURE_AI_PROJECT_ENDPOINT= +AZURE_AI_MODEL_DEPLOYMENT_NAME= +AZURE_AI_MODEL_DEPLOYMENT_NAME_FOR_AUDIO= +ENDPOINT_URL= +ENDPOINT_API_KEY= +ENDPOINT_APP_ID= +AZURE_RESOURCE_GROUP_NAME= +MODEL_PUBLISHER= +MODEL_VERSION= +MODEL_ENDPOINT= +MODEL_API_KEY= +COMPUTER_USE_MODEL_DEPLOYMENT_NAME= +STORAGE_INPUT_QUEUE_NAME= +STORAGE_OUTPUT_QUEUE_NAME= +STORAGE_QUEUE_SERVICE_ENDPOINT= +DELEGATED_USER_IDENTITY= +DELEGATED_USER_IDENTITY_2= +FOUNDRY_HOSTED_AGENT_REMOTE_BUILD= +GITHUB_CONNECTION_NAME= +GITHUB_PAT_TOKEN= +GITHUB_REPOSITORY_NAME= +GITHUB_USERNAME= +TEAMS_CONNECTION_NAME= +TEAMS_CHANNEL_URL= ####################################################################### # diff --git a/sdk/ai/azure-ai-projects/samples/agents/sample_agent_basic.py b/sdk/ai/azure-ai-projects/samples/agents/sample_agent_basic.py index ed5a094a4fb0..ce6fca327e74 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/sample_agent_basic.py +++ b/sdk/ai/azure-ai-projects/samples/agents/sample_agent_basic.py @@ -45,7 +45,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" with ( DefaultAzureCredential() as credential, diff --git a/sdk/ai/azure-ai-projects/samples/agents/sample_agent_retrieve_basic.py b/sdk/ai/azure-ai-projects/samples/agents/sample_agent_retrieve_basic.py index 98fb61604346..0d221d8b177c 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/sample_agent_retrieve_basic.py +++ b/sdk/ai/azure-ai-projects/samples/agents/sample_agent_retrieve_basic.py @@ -40,7 +40,7 @@ endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] model = os.environ["FOUNDRY_MODEL_NAME"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" with ( DefaultAzureCredential() as credential, AIProjectClient(endpoint=endpoint, credential=credential) as project_client, diff --git a/sdk/ai/azure-ai-projects/samples/agents/sample_agent_retrieve_basic_async.py b/sdk/ai/azure-ai-projects/samples/agents/sample_agent_retrieve_basic_async.py index 94cafecfbb91..135ea9ed217f 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/sample_agent_retrieve_basic_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/sample_agent_retrieve_basic_async.py @@ -47,7 +47,7 @@ endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] model = os.environ["FOUNDRY_MODEL_NAME"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" async def main(): diff --git a/sdk/ai/azure-ai-projects/samples/agents/sample_agent_stream_events.py b/sdk/ai/azure-ai-projects/samples/agents/sample_agent_stream_events.py index f62263413ad6..1e8918f93e2c 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/sample_agent_stream_events.py +++ b/sdk/ai/azure-ai-projects/samples/agents/sample_agent_stream_events.py @@ -38,7 +38,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" with ( DefaultAzureCredential() as credential, diff --git a/sdk/ai/azure-ai-projects/samples/agents/sample_agent_structured_output.py b/sdk/ai/azure-ai-projects/samples/agents/sample_agent_structured_output.py index ed7f5cb01917..ac3520b3cefa 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/sample_agent_structured_output.py +++ b/sdk/ai/azure-ai-projects/samples/agents/sample_agent_structured_output.py @@ -54,7 +54,7 @@ class CalendarEvent(BaseModel): endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" with ( DefaultAzureCredential() as credential, diff --git a/sdk/ai/azure-ai-projects/samples/agents/telemetry/sample_agent_basic_with_azure_monitor_tracing.py b/sdk/ai/azure-ai-projects/samples/agents/telemetry/sample_agent_basic_with_azure_monitor_tracing.py index 251bd4a8fe0e..984fd972c116 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/telemetry/sample_agent_basic_with_azure_monitor_tracing.py +++ b/sdk/ai/azure-ai-projects/samples/agents/telemetry/sample_agent_basic_with_azure_monitor_tracing.py @@ -43,7 +43,7 @@ load_dotenv() agent = None -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" with ( DefaultAzureCredential() as credential, diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_ai_search.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_ai_search.py index 6eb6cbc49694..77c672838cbe 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_ai_search.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_ai_search.py @@ -44,7 +44,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool = AzureAISearchTool( diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_azure_function.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_azure_function.py index 5a7729dbf78f..d3ed1f546a49 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_azure_function.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_azure_function.py @@ -47,7 +47,7 @@ agent = None endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool = AzureFunctionTool( diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_bing_custom_search.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_bing_custom_search.py index 1ba8ddba0f8f..7fd09361524e 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_bing_custom_search.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_bing_custom_search.py @@ -53,7 +53,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool = BingCustomSearchPreviewTool( diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_bing_grounding.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_bing_grounding.py index 8fbf96112bfc..61399fa276e8 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_bing_grounding.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_bing_grounding.py @@ -58,7 +58,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool = BingGroundingTool( diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_browser_automation.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_browser_automation.py index 57645de43e4e..25585081f81b 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_browser_automation.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_browser_automation.py @@ -42,7 +42,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool = BrowserAutomationPreviewTool( diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_code_interpreter.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_code_interpreter.py index 90de218037b1..3703d2a8a8e7 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_code_interpreter.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_code_interpreter.py @@ -34,7 +34,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" with ( DefaultAzureCredential() as credential, diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_code_interpreter_async.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_code_interpreter_async.py index 0c54d31371fd..7b002282df3b 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_code_interpreter_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_code_interpreter_async.py @@ -35,7 +35,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" async def main() -> None: diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_code_interpreter_with_files_async.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_code_interpreter_with_files_async.py index 49a7f1112856..fcd5b87c7c6a 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_code_interpreter_with_files_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_code_interpreter_with_files_async.py @@ -58,7 +58,7 @@ async def main() -> None: # Create agent with code interpreter tool agent = await project_client.agents.create_version( - agent_name=os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent"), + agent_name=os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent", definition=PromptAgentDefinition( model=os.environ["FOUNDRY_MODEL_NAME"], instructions="You are a helpful assistant.", diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_computer_use.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_computer_use.py index 27e46a98d574..0f2a733df0dc 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_computer_use.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_computer_use.py @@ -48,7 +48,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" # Initialize state machine current_state = SearchState.INITIAL diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_computer_use_async.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_computer_use_async.py index f4fcbd193e76..79960c8162c2 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_computer_use_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_computer_use_async.py @@ -48,7 +48,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" async def main(): diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_fabric.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_fabric.py index dc192ccfe614..bebed4e9a33d 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_fabric.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_fabric.py @@ -42,7 +42,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool = MicrosoftFabricPreviewTool( fabric_dataagent_preview=FabricDataAgentToolParameters( diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_fabric_iq.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_fabric_iq.py index 98eb521f9968..7c2d134925dd 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_fabric_iq.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_fabric_iq.py @@ -36,7 +36,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool_payload = FabricIQPreviewTool( project_connection_id=os.environ["FABRIC_IQ_PROJECT_CONNECTION_ID"], diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_file_search_structured_inputs.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_file_search_structured_inputs.py index c2e04b85efa5..6e24325aa01f 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_file_search_structured_inputs.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_file_search_structured_inputs.py @@ -84,7 +84,7 @@ # Create agent with file search tool agent = project_client.agents.create_version( - agent_name=os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent"), + agent_name=os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent", definition=agent_definition, description="File search agent for product information queries.", ) diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_function_tool.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_function_tool.py index 10ab7d0a258e..e6e9a9d417bf 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_function_tool.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_function_tool.py @@ -36,7 +36,7 @@ load_dotenv() -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" def get_horoscope(sign: str) -> str: diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py index 408f13a33150..7dbf7ff139c4 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py @@ -57,7 +57,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" image_generation_model = os.environ["IMAGE_GENERATION_MODEL_DEPLOYMENT_NAME"] tool = ImageGenTool( diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation_async.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation_async.py index 2912dd74ee1a..5a7a034cf02f 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation_async.py @@ -57,7 +57,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" image_generation_model = os.environ["IMAGE_GENERATION_MODEL_DEPLOYMENT_NAME"] diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_mcp.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_mcp.py index 03ba643cf794..47844b570f30 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_mcp.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_mcp.py @@ -35,7 +35,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" mcp_tool = MCPTool( server_label="api-specs", diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_mcp_async.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_mcp_async.py index 83eb878eb648..a3f12af3b7cd 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_mcp_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_mcp_async.py @@ -36,7 +36,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" async def main(): diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_mcp_with_project_connection.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_mcp_with_project_connection.py index 69816267de85..5af6fb5756b6 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_mcp_with_project_connection.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_mcp_with_project_connection.py @@ -37,7 +37,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool = MCPTool( diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_memory_search.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_memory_search.py index da339d10d3bd..a0dbfaec6ddf 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_memory_search.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_memory_search.py @@ -50,7 +50,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -AGENT_NAME = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +AGENT_NAME = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" credential = DefaultAzureCredential() project_client = AIProjectClient(endpoint=endpoint, credential=credential) diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_memory_search_async.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_memory_search_async.py index 7f151e983e4c..102be3034bb1 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_memory_search_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_memory_search_async.py @@ -49,7 +49,7 @@ load_dotenv() -AGENT_NAME = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +AGENT_NAME = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" async def main() -> None: diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_openapi.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_openapi.py index 068205c2c0e9..4003b68019e0 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_openapi.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_openapi.py @@ -42,7 +42,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" weather_asset_file_path = Path(__file__).resolve().parent / "../assets/weather_openapi.json" openapi_weather = cast(dict[str, Any], jsonref.loads(weather_asset_file_path.read_text(encoding="utf-8"))) diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_openapi_with_project_connection.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_openapi_with_project_connection.py index 03e3cb47836e..e48d5d83760e 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_openapi_with_project_connection.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_openapi_with_project_connection.py @@ -46,7 +46,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tripadvisor_asset_file_path = Path(__file__).resolve().parent / "../assets/tripadvisor_openapi.json" openapi_tripadvisor = cast(dict[str, Any], jsonref.loads(tripadvisor_asset_file_path.read_text(encoding="utf-8"))) diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_sharepoint.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_sharepoint.py index 77027e023598..d89890e835cb 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_sharepoint.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_sharepoint.py @@ -42,7 +42,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool = SharepointPreviewTool( sharepoint_grounding_preview=SharepointGroundingToolParameters( diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_to_agent.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_to_agent.py index e1287eb17f74..e7505acb3e7d 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_to_agent.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_to_agent.py @@ -44,7 +44,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool = A2APreviewTool( project_connection_id=os.environ["A2A_PROJECT_CONNECTION_ID"], diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_web_search.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_web_search.py index 91ff1fa42dbc..595fa2bf2dad 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_web_search.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_web_search.py @@ -49,7 +49,7 @@ endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool = WebSearchTool(user_location=WebSearchApproximateLocation(country="GB", city="London", region="London")) with ( diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_web_search_preview.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_web_search_preview.py index 9ad225b182b7..819847e6379e 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_web_search_preview.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_web_search_preview.py @@ -45,7 +45,7 @@ endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool = WebSearchPreviewTool(user_location=ApproximateLocation(country="GB", city="London", region="London")) with ( diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_web_search_with_custom_search.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_web_search_with_custom_search.py index 04d94babb8c4..48a94b24d6fc 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_web_search_with_custom_search.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_web_search_with_custom_search.py @@ -54,7 +54,7 @@ endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool = WebSearchTool( custom_search_configuration=WebSearchConfiguration( diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_work_iq.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_work_iq.py index c5b48b80932f..2540a5b04d67 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_work_iq.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_work_iq.py @@ -36,7 +36,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" tool_payload = WorkIQPreviewTool( project_connection_id=os.environ["WORK_IQ_PROJECT_CONNECTION_ID"], diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search.py index cc0bc3269510..49afda0725b7 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search.py @@ -56,7 +56,7 @@ INNER_MCP_LABEL = "github" INNER_MCP_URL = "https://api.githubcopilot.com/mcp" TOOLBOX_MCP_LABEL = "search-tool" -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" with ( diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_async.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_async.py index c5694a779f7d..575d0faf52b8 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_async.py @@ -57,7 +57,7 @@ INNER_MCP_LABEL = "github" INNER_MCP_URL = "https://api.githubcopilot.com/mcp" TOOLBOX_MCP_LABEL = "search-tool" -agent_name = os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent") +agent_name = os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent" async def main() -> None: diff --git a/sdk/ai/azure-ai-projects/samples/evaluations/sample_agent_evaluation.py b/sdk/ai/azure-ai-projects/samples/evaluations/sample_agent_evaluation.py index 9c9f48b5f6a4..0a8562aa44bc 100644 --- a/sdk/ai/azure-ai-projects/samples/evaluations/sample_agent_evaluation.py +++ b/sdk/ai/azure-ai-projects/samples/evaluations/sample_agent_evaluation.py @@ -54,7 +54,7 @@ project_client.get_openai_client() as openai_client, ): agent = project_client.agents.create_version( - agent_name=os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent"), + agent_name=os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent", definition=PromptAgentDefinition( model=model_deployment_name, instructions="You are a helpful assistant that answers general questions", diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/github_routine_util.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/github_routine_util.py new file mode 100644 index 000000000000..56c9e5f6b95d --- /dev/null +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/github_routine_util.py @@ -0,0 +1,57 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + +import json +import threading +import time +import urllib.error +import urllib.request +from urllib.parse import urlparse + +from azure.core.exceptions import ResourceNotFoundError + +from azure.ai.projects import AIProjectClient + + +def create_github_issue(owner: str, repository: str, token: str, *, title: str, assignee: str) -> None: + """Create and assign a GitHub issue using the REST API.""" + request = urllib.request.Request( + url=f"https://api.github.com/repos/{owner}/{repository}/issues", + data=json.dumps({"title": title, "assignees": [assignee]}).encode("utf-8"), + headers={ + "Accept": "application/vnd.github+json", + "Authorization": f"Bearer {token}", + "User-Agent": "azure-ai-projects-sample", + "X-GitHub-Api-Version": "2022-11-28", + }, + method="POST", + ) + + with urllib.request.urlopen(request, timeout=30) as response: + issue = json.load(response) + + print(f"Created GitHub issue #{issue['number']}: {issue['html_url']}") + + +def start_issue_creation_thread( + owner: str, repository: str, token: str | None, assignee: str, *, title: str = "Testing routine" +) -> threading.Thread | None: + """Create the trigger issue in parallel so polling can begin immediately.""" + if not token: + print("GITHUB_PAT_TOKEN is not set; skipping automatic issue creation.") + return None + + def worker() -> None: + try: + create_github_issue(owner, repository, token, title=title, assignee=assignee) + except urllib.error.HTTPError as exc: + details = exc.read().decode("utf-8", errors="replace") + print(f"Failed to create GitHub issue: {exc.code} {exc.reason} {details}") + except Exception as exc: # pylint: disable=broad-except + print(f"Failed to create GitHub issue: {exc}") + + thread = threading.Thread(target=worker, name="github-issue-trigger", daemon=True) + thread.start() + return thread diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/hosted_agents_util.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/hosted_agents_util.py index 36391144a2e9..7c64763a23e2 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/hosted_agents_util.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/hosted_agents_util.py @@ -1,4 +1,5 @@ import asyncio +import os import sys import time from contextlib import asynccontextmanager, contextmanager diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py index c1720fe35eb8..811db9151027 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py @@ -64,7 +64,7 @@ endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] model_name = os.environ["FOUNDRY_MODEL_NAME"] use_remote_build = os.environ.get("FOUNDRY_HOSTED_AGENT_REMOTE_BUILD", "true").strip().lower() == "true" -agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME", "MyHostedAgent") +agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME") or "MyHostedAgent" dependency_resolution, code_zip_stream = select_basic_agent_code_zip(use_remote_build) original_agent_endpoint = None diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_dispatch.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_dispatch.py index 408ffe971161..a875e1ee3c90 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_dispatch.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_dispatch.py @@ -67,7 +67,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME", "MyHostedAgent") +agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME") or "MyHostedAgent" model_name = os.environ["FOUNDRY_MODEL_NAME"] dependency_resolution, code_zip_stream = select_basic_agent_code_zip(True) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_github_issue_trigger.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_github_issue_trigger.py index d7a836f83bb3..a8e00cd2e5ea 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_github_issue_trigger.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_github_issue_trigger.py @@ -14,9 +14,11 @@ version, routes the configured hosted agent name to that version, and then creates a routine configured with a `GitHubIssueRoutineTrigger`. The trigger uses a GitHub-compatible Foundry RemoteTool connection supplied through - `GITHUB_CONNECTION_NAME`. After creating the routine, open an issue in the - configured repository to fire it. The sample polls the routine run history - for a short period and then deletes the routine and hosted-agent version. + `GITHUB_CONNECTION_NAME`. If `GITHUB_PAT_TOKEN` is set, the sample also + creates a GitHub issue titled `Testing routine` and assigns it to the + configured owner to trigger the routine automatically; otherwise you can + open an issue manually. The sample polls the routine run history for a + short period and then deletes the routine and hosted-agent version. Routines are currently a preview feature. In the Python SDK, you access these operations via `project_client.beta.routines`. @@ -38,9 +40,12 @@ 4) GITHUB_CONNECTION_NAME - The Foundry GitHub RemoteTool connection name. The connection must be GitHub-compatible and use PAT or OAuth2 credentials. 5) GITHUB_USERNAME - The GitHub owner or organization name. - 6) GITHUB_REPOSITORY - The GitHub repository name in the format of https://github.com/xxx/xxx.git. + 6) GITHUB_REPOSITORY_NAME - The GitHub repository name from `https://github.com//`. 7) POLL_INTERVAL_SECONDS - Optional. Seconds to sleep between run-history polls. - Defaults to 10. + Defaults to 10. + 8) GITHUB_PAT_TOKEN - Optional. GitHub personal access token with permission + to create and assign issues. If set, the sample creates a `Testing routine` + issue and assigns it to `GITHUB_USERNAME` automatically. """ import json @@ -63,22 +68,25 @@ RoutineRun, ) +from github_routine_util import start_issue_creation_thread from hosted_agents_util import create_version_from_code, select_basic_agent_code_zip load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME", "MyHostedAgent") +agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME") or "MyHostedAgent" model_name = os.environ["FOUNDRY_MODEL_NAME"] github_connection_name = os.environ["GITHUB_CONNECTION_NAME"] poll_interval_seconds = int(os.environ.get("POLL_INTERVAL_SECONDS", "10")) +github_pat_token = os.environ.get("GITHUB_PAT_TOKEN") github_owner = os.environ["GITHUB_USERNAME"] -github_repository = os.environ["GITHUB_REPOSITORY"] +github_repository_name = os.environ["GITHUB_REPOSITORY_NAME"] def main() -> None: dependency_resolution, code_zip_stream = select_basic_agent_code_zip(True) + issue_thread = None with ( code_zip_stream as code_stream, @@ -107,7 +115,7 @@ def main() -> None: ): routine_name = "sample-routine-github-issue" - print(f"Preparing routine `{routine_name}` for {github_repository}.") + print(f"Preparing routine `{routine_name}` for {github_repository_name}.") try: print(f"Deleting any existing routine `{routine_name}`.") project_client.beta.routines.delete(routine_name) @@ -124,19 +132,27 @@ def main() -> None: "on-issue": GitHubIssueRoutineTrigger( connection_id=github_connection_name, # Currently accepts a connection name. owner=github_owner, - repository=github_repository, + repository=github_repository_name, issue_event=GitHubIssueEvent.OPENED, ), }, action=InvokeAgentResponsesApiRoutineAction(agent_name=agent_name), ) + time.sleep(5) print( f"Created routine: {created.name} enabled={created.enabled} " - f"repo={github_owner}/{github_repository} event={GitHubIssueEvent.OPENED}" + f"repo={github_owner}/{github_repository_name} event={GitHubIssueEvent.OPENED}" ) - print(f"Open a GitHub issue in {github_repository} to fire the routine.") - print("Waiting for a routine run for up to 10 minutes...") + issue_thread = start_issue_creation_thread( + github_owner, + github_repository_name, + github_pat_token, + github_owner, + ) + print(f"Open a GitHub issue in {github_owner}/{github_repository_name} to fire the routine.") + + print("Waiting for a routine run for up to 10 minutes...") try: seen_phases: dict[str, str] = {} final_run: RoutineRun | None = None @@ -174,6 +190,8 @@ def main() -> None: except KeyboardInterrupt: print("Interrupted by user; cleaning up routine before exiting.") finally: + if issue_thread is not None: + issue_thread.join(timeout=5) try: project_client.beta.routines.delete(routine_name) print("Routine deleted") diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_schedule_trigger.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_schedule_trigger.py index 533581ebe8eb..ccb08ff99229 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_schedule_trigger.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_schedule_trigger.py @@ -71,7 +71,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME", "MyHostedAgent") +agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME") or "MyHostedAgent" model_name = os.environ["FOUNDRY_MODEL_NAME"] poll_interval_seconds = int(os.environ.get("POLL_INTERVAL_SECONDS", "15")) dependency_resolution, code_zip_stream = select_basic_agent_code_zip(True) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_teams_message_trigger.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_teams_message_trigger.py index bf7daba193a9..41f84c043a56 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_teams_message_trigger.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_teams_message_trigger.py @@ -86,7 +86,7 @@ def parse_teams_channel_url(channel_url: str) -> tuple[str | None, str | None]: load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME", "MyHostedAgent") +agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME") or "MyHostedAgent" model_name = os.environ["FOUNDRY_MODEL_NAME"] teams_connection_name = os.environ.get("TEAMS_CONNECTION_NAME", "teams-conn") teams_channel_url = os.environ["TEAMS_CHANNEL_URL"] diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_timer_trigger.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_timer_trigger.py index b9b8256b4d4d..28a21e1b88da 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_timer_trigger.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_routines_with_timer_trigger.py @@ -63,7 +63,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME", "MyHostedAgent") +agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME") or "MyHostedAgent" model_name = os.environ["FOUNDRY_MODEL_NAME"] dependency_resolution, code_zip_stream = select_basic_agent_code_zip(True) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream.py index ead42d994d88..b86587c910b7 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream.py @@ -44,7 +44,7 @@ load_dotenv() endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] -agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME", "MyHostedAgent") +agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME") or "MyHostedAgent" model_name = os.environ["FOUNDRY_MODEL_NAME"] hosted_agent_source_dir = Path(__file__).parent / "assets" / "basic-agent" diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py index e8df03ad07d0..f2d484081c53 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py @@ -49,7 +49,7 @@ async def main(): endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] - agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME", "MyHostedAgent") + agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME") or "MyHostedAgent" model_name = os.environ["FOUNDRY_MODEL_NAME"] hosted_agent_source_dir = Path(__file__).parent / "assets" / "basic-agent" diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolbox_with_skill.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolbox_with_skill.py index 430f8fd0e46a..4b4101c90762 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolbox_with_skill.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolbox_with_skill.py @@ -64,7 +64,7 @@ endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] model_name = os.environ["FOUNDRY_MODEL_NAME"] subscription_id = os.environ["AZURE_SUBSCRIPTION_ID"] -agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME", "MyHostedAgent") +agent_name = os.environ.get("FOUNDRY_HOSTED_AGENT_NAME") or "MyHostedAgent" _HOSTED_AGENT_SOURCE_DIR = Path(__file__).parent / "assets" / "toolbox-agent"