Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -635,16 +635,56 @@
--name my-agent \\
--image myregistry.azurecr.io/my-large-agent:v1.0 \\
--timeout 1200
- name: Create agent and stream container logs during deployment
text: |
az cognitiveservices agent create \\
--account-name myAccount \\
--project-name myProject \\
--name my-agent \\
--image myregistry.azurecr.io/my-agent:v1.0 \\
--show-logs
"""

helps[
"cognitiveservices agent start"
] = """
type: command
short-summary: Start a hosted agent deployment.
long-summary: |
Starts a previously stopped agent deployment. Use --show-logs to stream
container console logs during startup for troubleshooting.
examples:
- name: Start hosted agent deployment.
text: az cognitiveservices agent start --account-name myAccount --project-name myProject --name myAgent --agent-version 1
- name: Start agent and stream console logs during startup.
text: az cognitiveservices agent start --account-name myAccount --project-name myProject --name myAgent --agent-version 1 --show-logs
"""

helps[
"cognitiveservices agent logs"
] = """
type: group
short-summary: Manage hosted agent container logs.
"""

helps[
"cognitiveservices agent logs show"
] = """
type: command
short-summary: Show logs from a hosted agent container.
long-summary: |
Streams console output (stdout/stderr) or system events from an agent container.
Use --follow to stream logs in real-time, or omit it to fetch recent logs and exit.
This is useful for troubleshooting agent startup issues or monitoring agent behavior.
examples:
- name: Fetch the last 50 lines of console logs from an agent.
text: az cognitiveservices agent logs show --account-name myAccount --project-name myProject --name myAgent --agent-version 1
- name: Stream console logs in real-time.
text: az cognitiveservices agent logs show --account-name myAccount --project-name myProject --name myAgent --agent-version 1 --follow
- name: Fetch the last 100 lines of system event logs.
text: az cognitiveservices agent logs show --account-name myAccount --project-name myProject --name myAgent --agent-version 1 --type system --tail 100
- name: Stream logs with custom tail size.
text: az cognitiveservices agent logs show --account-name myAccount --project-name myProject --name myAgent --agent-version 1 --follow --tail 200
"""

helps[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,16 @@ def load_arguments(self, _):
),
default=600
)
c.argument(
'show_logs',
options_list=['--show-logs'],
action='store_true',
help=(
'Stream container console logs during deployment. '
'Shows real-time output from the agent container as it starts up. '
'Useful for debugging startup issues.'
)
)

with self.argument_context("cognitiveservices agent update") as c:
c.argument(
Expand All @@ -533,6 +543,67 @@ def load_arguments(self, _):
help="Cognitive Services hosted agent version. If not provided, deletes all versions.",
required=False,
)

with self.argument_context("cognitiveservices agent start") as c:
c.argument(
'show_logs',
options_list=['--show-logs'],
action='store_true',
help=(
'Stream container console logs during startup. '
'Shows real-time output from the agent container as it starts. '
'Useful for debugging startup issues.'
)
)
c.argument(
'timeout',
type=int,
help=(
'Maximum time in seconds to wait for deployment to be ready. '
'Default: 600 seconds (10 minutes).'
),
default=600
)

with self.argument_context("cognitiveservices agent logs") as c:
c.argument(
"account_name",
options_list=["--account-name", "-a"],
help="Cognitive service account name."
)
c.argument(
"project_name",
options_list=["--project-name", "-p"],
help="AI project name"
)
c.argument(
"agent_name",
options_list=["--name", "-n"],
help="Cognitive Services hosted agent name",
)
c.argument("agent_version", help="Cognitive Services hosted agent version")

with self.argument_context("cognitiveservices agent logs show") as c:
c.argument(
'kind',
options_list=['--type', '-t'],
help="Type of logs to stream. 'console' for stdout/stderr, 'system' for container events.",
arg_type=get_enum_type(['console', 'system']),
default='console'
)
c.argument(
'tail',
type=int,
help='Number of trailing log lines to fetch (1-300). Default: 50',
default=50
)
c.argument(
'follow',
options_list=['--follow', '-f'],
action='store_true',
help='Stream logs in real-time. Without this flag, fetches recent logs and exits.'
)

with self.argument_context('cognitiveservices') as c:
c.argument('account_name', arg_type=name_arg_type, help='cognitive service account name',
completer=get_resource_name_completion_list('Microsoft.CognitiveServices/accounts'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ def load_command_table(self, _):
g.custom_command('list', 'agent_list')
g.custom_command('list-versions', 'agent_versions_list')
g.custom_show_command('show', 'agent_show')

with self.command_group('cognitiveservices agent logs', client_factory=cf_ai_projects, is_preview=True) as g:
g.custom_show_command('show', 'agent_logs_show')

with self.command_group(
'cognitiveservices account project', projects_type,
client_factory=cf_projects) as g:
Expand Down
Loading