-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Cognitiveservices] Adding agent create to az cognitiveservices command for hosted agents: az cognitiveservices agent create #32430
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
base: dev
Are you sure you want to change the base?
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @eamonoreilly, |
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| cognitiveservices agent create | cmd cognitiveservices agent create added |
||
| cognitiveservices agent delete | cmd cognitiveservices agent delete update parameter project_name: updated property options from ['--project-name'] to ['--project-name', '-p'] |
||
| cognitiveservices agent delete-deployment | cmd cognitiveservices agent delete-deployment update parameter project_name: updated property options from ['--project-name'] to ['--project-name', '-p'] |
||
| cognitiveservices agent list | cmd cognitiveservices agent list update parameter project_name: updated property options from ['--project-name'] to ['--project-name', '-p'] |
||
| cognitiveservices agent list-versions | cmd cognitiveservices agent list-versions update parameter project_name: updated property options from ['--project-name'] to ['--project-name', '-p'] |
||
| cognitiveservices agent show | cmd cognitiveservices agent show update parameter project_name: updated property options from ['--project-name'] to ['--project-name', '-p'] |
||
| cognitiveservices agent start | cmd cognitiveservices agent start update parameter project_name: updated property options from ['--project-name'] to ['--project-name', '-p'] |
||
| cognitiveservices agent stop | cmd cognitiveservices agent stop update parameter project_name: updated property options from ['--project-name'] to ['--project-name', '-p'] |
||
| cognitiveservices agent update | cmd cognitiveservices agent update update parameter project_name: updated property options from ['--project-name'] to ['--project-name', '-p'] |
|
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 the az cognitiveservices agent create command to enable creation and deployment of hosted agents in Azure AI Foundry. The implementation supports both using existing container images and building from source code, with automatic image building via local Docker or Azure Container Registry Tasks.
Key changes:
- New
agent_createcommand with comprehensive parameter validation and error handling - Image building support with local Docker fallback to ACR Task for remote builds
- ACR access validation to ensure project managed identity has pull permissions
- Deployment waiting mechanism with progress indicators and configurable timeouts
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| test_agent.py | Comprehensive test suite with 9 unit tests for helper functions and 8 integration tests for agent lifecycle operations |
| custom.py | Core implementation including parameter validation, image building/pushing, ACR access checks, and deployment orchestration |
| commands.py | Command registration for agent create in the cognitiveservices command group |
| _params.py | Parameter definitions including environment variable parsing and extensive argument help text |
| _help.py | Detailed documentation with examples covering various usage scenarios |
Comments suppressed due to low confidence (1)
src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py:1
- Line 1539 has a missing
fprefix for the f-string. It should bef\"Unable to verify ACR access: {str(e)}. \"to properly interpolate the exception message. Without thefprefix, the literal string{str(e)}will be displayed instead of the actual error message.
# --------------------------------------------------------------------------------------------
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py
Outdated
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py
Outdated
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py
Outdated
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py
Outdated
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_agent.py
Outdated
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_agent.py
Outdated
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_agent.py
Outdated
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_agent.py
Outdated
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/cognitiveservices/_params.py
Outdated
Show resolved
Hide resolved
- Fix suspicious patterns validation: remove ../ and ~/ (legitimate paths), only check shell expansion - Improve Windows path handling with pathlib.Path().as_posix() - Document sys.executable ACR login approach for dev/prod compatibility - Move PACK_TASK_YAML constant to module level for maintainability - Rename protocol_records to protocol_record (singular, more accurate) - Add Limitations section to _check_project_acr_access docstring - Fix test exception types: CLIError → InvalidArgumentValueError (7 assertions) - Fix capitalization: 'AI Project name' → 'AI project name' All tests passing: azdev style, azdev linter, unit tests (17/17)
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
@kairu-ms , do you know if there is anything else I need to do in order to get this merged into the CLI? Please let me know if I can do anything else to help. Thanks for the help in getting this merged. |
Related command
az cognitiveservices
Description
This adds the ability to create and deploy hosted agents in AI Foundry. It enables customers to upload and build their local agent code to Azure Container Registry or point to an existing container image on ACR to use as part of the hosted agent creation. It can be used in conjunction with existing az cognitive services agent * commands to manage a hosted agent within AI Foundry.
Testing Guide
History Notes
[cognitiveservices] az cognitiveservices agent create: Adds ability to create and deploy hosted agent in AI Foundry
This 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.