Howie/print - #48377
Conversation
…est, add new hosted agent samples for Teams message trigger and reminder preview (#48234) * Remove sample_agent_toolbox_skill.py per bakcned folks and Linda request, add new hosted agent samples for Teams message trigger and reminder preview * change log
… usage; update assets.json tag
* Refactor agent name retrieval to use a fallback mechanism
- Updated multiple sample scripts to change the way the agent name is retrieved from environment variables.
- Replaced the default value assignment using `os.environ.get("FOUNDRY_AGENT_NAME", "MyAgent")` with a more concise approach using `os.environ.get("FOUNDRY_AGENT_NAME") or "MyAgent"`.
- This change ensures that if the environment variable is not set, the fallback value "MyAgent" is still used, while improving code readability.
- The affected files include various agent tools and hosted agent samples across the project.
* rever dataset generation job polling and update assistant prompt
…produce output txt file. The challenge is to determine whether the print is from sample but not from SDK. Adding console_print can help: - Introduced a new `_console.py` module with a `console_print` function to capture SDK print staement. During recording and llm-analysis used by FHD, capture content of print and console_print, then write both into log files but write only content of print to output txt. - Modified sample scripts to utilize new logging mechanisms and environment variables for better output management. - Enhanced error handling and output file generation in sample executors.
|
Azure Pipelines: Successfully started running 1 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Improves azure-ai-projects sample diagnostics, LLM analysis, environment handling, and GitHub-triggered routine automation while preparing version 2.5.0.
Changes:
- Captures SDK/sample console output and generates live-run artifacts.
- Enhances the LLM analysis CLI and GitHub issue-trigger sample.
- Standardizes empty agent-name fallbacks and updates release documentation.
Reviewed changes
Copilot reviewed 59 out of 59 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
tests/samples/sample_executor.py |
Adds console capture and artifact generation. |
tests/samples/README.md |
Documents automatic live artifacts. |
tests/samples/llm-analyze.py |
Expands CLI configuration and JSON output. |
samples/hosted_agents/sample_toolbox_with_skill.py |
Handles empty agent names. |
samples/hosted_agents/sample_sessions_files_upload_download_async.py |
Handles empty agent names. |
samples/hosted_agents/sample_session_log_stream.py |
Handles empty agent names. |
samples/hosted_agents/sample_routines_with_timer_trigger.py |
Handles empty agent names. |
samples/hosted_agents/sample_routines_with_teams_message_trigger.py |
Handles empty agent names. |
samples/hosted_agents/sample_routines_with_schedule_trigger.py |
Handles empty agent names. |
samples/hosted_agents/sample_routines_with_github_issue_trigger.py |
Adds automatic trigger-issue creation. |
samples/hosted_agents/sample_routines_with_dispatch.py |
Handles empty agent names. |
samples/hosted_agents/sample_create_hosted_agent_from_code.py |
Handles empty agent names. |
samples/hosted_agents/hosted_agents_util.py |
Updates utility imports. |
samples/hosted_agents/github_routine_util.py |
Adds GitHub issue creation helper. |
samples/evaluations/sample_agent_evaluation.py |
Handles empty agent names. |
samples/agents/tools/sample_toolboxes_with_search.py |
Handles empty agent names. |
samples/agents/tools/sample_toolboxes_with_search_async.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_work_iq.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_web_search.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_web_search_with_custom_search.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_web_search_preview.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_to_agent.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_sharepoint.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_openapi.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_openapi_with_project_connection.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_memory_search.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_memory_search_async.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_mcp.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_mcp_with_project_connection.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_mcp_async.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_image_generation.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_image_generation_async.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_function_tool.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_file_search_structured_inputs.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_fabric.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_fabric_iq.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_computer_use.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_computer_use_async.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_code_interpreter.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_code_interpreter_with_files_async.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_code_interpreter_async.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_browser_automation.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_bing_grounding.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_bing_custom_search.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_azure_function.py |
Handles empty agent names. |
samples/agents/tools/sample_agent_ai_search.py |
Handles empty agent names. |
samples/agents/telemetry/sample_agent_basic_with_azure_monitor_tracing.py |
Handles empty agent names. |
samples/agents/sample_agent_structured_output.py |
Handles empty agent names. |
samples/agents/sample_agent_stream_events.py |
Handles empty agent names. |
samples/agents/sample_agent_retrieve_basic.py |
Handles empty agent names. |
samples/agents/sample_agent_retrieve_basic_async.py |
Handles empty agent names. |
samples/agents/sample_agent_basic.py |
Handles empty agent names. |
docs/tool-classes-removed-properties.md |
Documents removed tool properties. |
CHANGELOG.md |
Adds the 2.5.0 release section. |
azure/ai/projects/aio/_patch.py |
Routes asynchronous SDK prints through console helper. |
azure/ai/projects/_version.py |
Bumps the package to 2.5.0. |
azure/ai/projects/_patch.py |
Routes synchronous SDK prints through console helper. |
azure/ai/projects/_console.py |
Adds the console-print wrapper. |
.env.template |
Adds sample environment variables. |
Comments suppressed due to low confidence (1)
sdk/ai/azure-ai-projects/samples/hosted_agents/github_routine_util.py:15
- These imports (
urlparse,ResourceNotFoundError, andAIProjectClient) are all unused and will fail the package's Pylint validation.
| from azure.core.tracing.decorator import distributed_trace | ||
| from azure.core.credentials import TokenCredential | ||
| from azure.identity import get_bearer_token_provider | ||
| from ._console import console_print as print |
| from azure.core.tracing.decorator import distributed_trace | ||
| from azure.core.credentials_async import AsyncTokenCredential | ||
| from azure.identity.aio import get_bearer_token_provider | ||
| from .._console import console_print as print |
| except Exception as ex: # pylint: disable=broad-exception-caught | ||
| report = {"correct": False, "reason": f"Sample execution failed: {type(ex).__name__}: {ex}"} | ||
| return _build_result(report, log_file=executor.log_file_path, start_time=start_time) | ||
| sample_duration = 0.0 |
| except Exception as ex: # pylint: disable=broad-exception-caught | ||
| report = {"correct": False, "reason": f"Sample execution failed: {type(ex).__name__}: {ex}"} | ||
| return _build_result(report, log_file=executor.log_file_path, start_time=start_time) | ||
| sample_duration = 0.0 |
| @@ -1,4 +1,5 @@ | |||
| import asyncio | |||
| import os | |||
| def _get_log_file_path(self, suffix: str) -> Optional[str]: | ||
| """Get and prepare a log file path in the temp directory for live runs.""" | ||
| if not _is_live_mode(): | ||
| return None |
|
|
||
| import json | ||
| import threading | ||
| import time |
| issue_thread = start_issue_creation_thread( | ||
| github_owner, | ||
| github_repository_name, | ||
| github_pat_token, | ||
| github_owner, | ||
| ) |
| | `MCPTool` | `tool_configs: Optional[dict[str, ToolConfig]]` | | ||
| | `OpenApiTool` | `tool_configs: Optional[dict[str, ToolConfig]]` | | ||
| | `WebSearchTool` | `name: Optional[str]`, `description: Optional[str]`, `tool_configs: Optional[dict[str, ToolConfig]]` | | ||
| v |
| ### Features Added | ||
|
|
||
| Placeholder |
This comment has been minimized.
This comment has been minimized.
[Pilot] PR Pipeline Failure AnalysisA CI pipeline failed on this pull request. Here is an automated analysis of what went wrong and how to get the build green. What failedThe pylint check for
Recommended next steps
Raw pipeline analysis (azsdk ci analyze)
|
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines