-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Cognitive Services} az cognitiveservices agent logs show: Support console log streaming
#32701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…agent logs show` Add console log streaming commands and options for hosted agents: - Add new `az cognitiveservices agent logs show` command to stream console output (stdout/stderr) or system events from agent containers - Add --show-logs flag to `az cognitiveservices agent create` to stream logs during deployment for troubleshooting - Add --show-logs and --timeout flags to `az cognitiveservices agent start` to stream logs during startup Implementation details: - Implement _stream_agent_logs() using HTTP streaming with Bearer auth - Create _BackgroundLogStreamer context manager for reusable log streaming - Add retry logic to handle container startup delays - Extract helper functions for auth and URL building - Add unit tests for new functionality
️✔️AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| cognitiveservices agent create | cmd cognitiveservices agent create added parameter show_logs |
||
| cognitiveservices agent logs | sub group cognitiveservices agent logs added |
||
| cognitiveservices agent start | cmd cognitiveservices agent start added parameter show_logs |
||
| cognitiveservices agent start | cmd cognitiveservices agent start added parameter timeout |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds console log streaming capabilities for hosted Cognitive Services agents in Azure CLI, enabling users to stream container logs for troubleshooting during deployment and startup, and via a dedicated logs command.
Changes:
- Introduces
_stream_agent_logsand_BackgroundLogStreamerto implement HTTP log streaming with retry logic, plus a newagent_logs_showcustom command andcognitiveservices agent logscommand group. - Extends
agent_createandagent_startwith--show-logsand--timeoutoptions, wiring them into_deploy_agent_versionand background log streaming for richer troubleshooting during deployment/startup. - Adds CLI argument wiring, help text, and both unit and live scenario tests to cover new signatures, options, and end-to-end log streaming behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py |
Implements log streaming helpers, background log streamer context manager, integrates streaming into agent_create deployment path and agent_start, and adds the agent_logs_show handler. |
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_agent.py |
Adds unit tests for new function signatures and live scenario tests for agent logs show and agent start --show-logs. |
src/azure-cli/azure/cli/command_modules/cognitiveservices/commands.py |
Registers the new cognitiveservices agent logs show custom command on the cf_ai_projects client. |
src/azure-cli/azure/cli/command_modules/cognitiveservices/_params.py |
Wires new --show-logs, --timeout, and log-streaming-specific arguments (--type, --tail, --follow) into the corresponding commands. |
src/azure-cli/azure/cli/command_modules/cognitiveservices/_help.py |
Updates help text and examples for agent create, agent start, and adds help for the new agent logs group and agent logs show command. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Distinguish transient errors (ConnectionError, Timeout) from unexpected errors - Track last error and show warning to user after all retries exhausted - Provides actionable feedback when --show-logs cannot establish connection
az cognitiveservices agent logs showaz cognitiveservices agent logs show: Support console log streaming
az cognitiveservices agent logs show: Support console log streamingaz cognitiveservices agent logs show: Support console log streaming
Add console log streaming commands and options for hosted agents:
az cognitiveservices agent logs showcommand to stream console output (stdout/stderr) or system events from agent containersaz cognitiveservices agent createto stream logs during deployment for troubleshootingaz cognitiveservices agent startto stream logs during startupImplementation details:
Related command
az cognitiveservices agent logs showaz cognitiveservices agent createaz cognitiveservices agent startDescription
Add console log streaming support for hosted agents in AI Foundry. This enables users to troubleshoot agent startup issues and monitor agent behavior by streaming container logs in real-time.
Key features:
az cognitiveservices agent logs showcommand to stream console output (stdout/stderr) or system events from agent containers--show-logsflag onaz cognitiveservices agent createto stream logs during deployment--show-logsand--timeoutflags onaz cognitiveservices agent startto stream logs during startupTesting Guide
History Notes
[Cognitive Services]
az cognitiveservices agent logs show: Add console log streaming for hosted agents[Cognitive Services]
az cognitiveservices agent create: Add--show-logsflag for deployment troubleshooting[Cognitive Services]
az cognitiveservices agent start: Add--show-logsand--timeoutflagsThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.