Skip to content

Howie/print - #48377

Open
howieleung wants to merge 33 commits into
mainfrom
howie/print
Open

Howie/print#48377
howieleung wants to merge 33 commits into
mainfrom
howie/print

Conversation

@howieleung

Copy link
Copy Markdown
Member

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:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

dargilco and others added 30 commits July 1, 2026 15:27
…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
* 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.
Copilot AI review requested due to automatic review settings July 30, 2026 18:04
@azure-pipelines

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and AIProjectClient) 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
Comment on lines 349 to +351
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
Comment on lines 372 to +374
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
Comment on lines +345 to +348
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
Comment on lines +147 to +152
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
Comment on lines +5 to +7
### Features Added

Placeholder
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor
[Pilot] PR Pipeline Failure Analysis

A CI pipeline failed on this pull request. Here is an automated analysis of what went wrong and how to get the build green.

What failed

The pylint check for sdk/ai/azure-ai-projects failed with exit code 16 (build link). Two violations were found in azure/ai/projects/_console.py at line 13:

  • C4739 docstring-missing-param: Parameter values is missing from the docstring of console_print.
  • C4758 docstring-keyword-should-match-keyword-only: Keywords flush, file, end, sep are referenced in the docstring but not present as keyword-only arguments in the method signature (or vice versa).

Recommended next steps

  • In sdk/ai/azure-ai-projects/azure/ai/projects/_console.py, update the console_print docstring to document the values parameter and align :keyword: entries with the actual keyword-only arguments in the signature.
  • Run azpysdk pylint . locally from sdk/ai/azure-ai-projects/ to verify the fix before pushing.
  • See the CI troubleshooting guide: https://aka.ms/ci-fix
  • Push new commits to address the failures; this comment updates automatically on the next failing run.
Raw pipeline analysis (azsdk ci analyze)
Failed Tasks
### Errors:
[azure-ai-projects :: pylint] ************* Module azure.ai.projects._console
azure/ai/projects/_console.py:13: [C4739(docstring-missing-param), console_print] Params missing in docstring: "values". See details: (azure.github.io/redacted)
azure/ai/projects/_console.py:13: [C4758(docstring-keyword-should-match-keyword-only), console_print] "flush, file, end, sep" missing in docstring or in method signature. There should be a direct correlation between :keyword: arguments in the docstring and keyword-only arguments in method signature. See details: (azure.github.io/redacted)

[ERROR] azure-sdk-tools: azure-ai-projects main package exited with linting error 16.
Please see: https://aka.ms/azsdk/python/pylint-guide

SUMMARY:
/mnt/vss/_work/1/s/sdk/ai/azure-ai-projects  pylint  FAIL(16)  38.53s
Total checks: 1 | Failed: 1 | Worst exit code: 16

Pipeline: https://dev.azure.com/azure-sdk/public/_build/results?buildId=6641047

Copilot detected the failing pipeline and generated the analysis above. To have it attempt a fix automatically, reply with @copilot please fix the failing pipeline on this PR.

Generated by Pipeline Analysis - Next Steps · 30 AIC · ⌖ 6.2 AIC · ⊞ 6.6K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants