Skip to content

docs(ai-agent): standardize help and explain environments in azd ai agent - #10057

Open
FanH (Siglud) wants to merge 2 commits into
Azure:mainfrom
Siglud:siglud/ai-agent-help
Open

FanH (Siglud) wants to merge 2 commits into
Azure:mainfrom
Siglud:siglud/ai-agent-help

Conversation

@Siglud

@Siglud FanH (Siglud) commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #8506 Part.1

Summary

Partially addresses #8506, scoped to azd ai agent and its descendants. Other azd ai namespaces are intentionally unchanged.

  • Document existing core help conventions, especially azd --help, in the CLI style guide and link them from the contributor command guide.
  • Apply a shared, inherited agent help renderer: consistent bold/underlined headings, aligned command and flag descriptions, highlighted commands/flags/placeholders/links, full azd ai agent usage paths, and examples for every public command. Retain the root banner and simplify duplicated eval command guidance.
  • Add Environments & Environment Variables to root agent help, explaining environment creation/selection, .azure/<environment>/.env, azd env set/get-values, Foundry project and per-service deployment values, and service-level runtime env substitutions.

The renderer keeps Cobra metadata intact and routes through the SDK's UsageFunc, preserving per-command output formats/defaults. Examples retain command ordering, quoting, and multiline continuations. Help does not require Azure authentication or inspect user configuration.

Verification

Using Go 1.26.4 from the agent extension directory:

  • go build
  • go test ./internal/helpformat ./internal/cmd -short -count=1
  • Help snapshots for all 51 public command paths, plus colored/no-color, nested/runnable-group usage, flag override, and example-preservation coverage.
  • golangci-lint on the formatter and changed command code; scoped spelling checks.
  • Compared before/after extension metadata: command structure and flags are unchanged apart from descriptions/examples.

Reused azd's snapshot helper, adding its existing cupaloy dependency to this extension's module.

Interactive scenario

Updated tests/cli-interactive-tester-scenarios/tier0/0.02-help-root.yaml to cover consistent formatting and environment guidance. It was not run because these scenarios require the interactive tester setup. For terminal visual validation, use the foundry-extension-scenario-orchestrator agent with the foundry-extension-scenario-pr-regression skill.

Comparison

Before
image
After
image

Document core azd help conventions and apply inherited styled help to all agent commands. Add environment context and help snapshots without changing command behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
21 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added the ext-agents azure.ai.agents extension label Sep 16, 2026

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.

🔵 Needs a closer look

Two moderate findings and one nit remain unresolved.

Pull request overview

This PR standardizes azd ai agent help output and documents environment behavior across the agent extension.

Changes:

  • Adds inherited, color-aware help formatting with full usage paths, aligned flags, and examples.
  • Adds environment, deployment, and runtime-variable guidance.
  • Updates command help, snapshots, tests, documentation, spelling configuration, and dependencies.
File summaries
File Summary
docs/guides/adding-a-new-command.md Links contributor guidance to help conventions.
cli/azd/extensions/azure.ai.agents/tests/cli-interactive-tester-scenarios/tier0/0.02-help-root.yaml Updates root-help scenario expectations.
cli/azd/extensions/azure.ai.agents/internal/helpformat/helpformat.go Implements shared help rendering. moderate (1 vote): shell-style placeholders are not highlighted. moderate (1 vote): uncaptained eval generate examples render without captions.
cli/azd/extensions/azure.ai.agents/internal/helpformat/helpformat_test.go Adds formatter coverage.
cli/azd/extensions/azure.ai.agents/internal/cmd/version.go Updates version-command help.
cli/azd/extensions/azure.ai.agents/internal/cmd/update.go Updates command help and examples.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-version.snap Updates version help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-toolbox.snap Updates toolbox help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-toolbox_add.snap Updates toolbox-add help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-show.snap Updates show help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-sessions.snap Updates sessions help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-sessions_stop.snap Updates session-stop help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-sessions_show.snap Updates session-show help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-sessions_list.snap Updates session-list help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-sessions_delete.snap Updates session-delete help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-sessions_create.snap Updates session-create help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-sample.snap Updates sample help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-sample_list.snap Updates sample-list help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-run.snap Updates run help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-root.snap Updates root help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-publish.snap Updates publish help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-pack.snap Updates pack help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-optimize.snap Updates optimize help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-optimize_status.snap Updates optimize-status help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-optimize_list.snap Updates optimize-list help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-optimize_deploy.snap Updates optimize-deploy help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-optimize_cancel.snap Updates optimize-cancel help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-optimize_apply.snap Updates optimize-apply help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-monitor.snap Updates monitor help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-invoke.snap Updates invoke help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-invocations.snap Updates invocations help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-invocations_show.snap Updates invocation-show help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-invocations_follow.snap Updates invocation-follow help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-invocations_cancel.snap Updates invocation-cancel help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-init.snap Updates init help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-files.snap Updates files help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-files_upload.snap Updates file-upload help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-files_stat.snap Updates file-stat help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-files_mkdir.snap Updates file-mkdir help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-files_list.snap Updates file-list help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-files_download.snap Updates file-download help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-files_delete.snap Updates file-delete help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-eval.snap Updates evaluation help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-eval_update.snap Updates evaluation-update help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-eval_show.snap Updates evaluation-show help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-eval_run.snap Updates evaluation-run help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-eval_list.snap Updates evaluation-list help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-eval_generate.snap Updates evaluation-generation help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-endpoint.snap Updates endpoint help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-endpoint_update.snap Updates endpoint-update help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-endpoint_show.snap Updates endpoint-show help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-doctor.snap Updates doctor help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-delete.snap Updates delete help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-connection.snap Updates connection help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-connection_add.snap Updates connection-add help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-code.snap Updates code help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelp-code_download.snap Updates code-download help snapshot.
cli/azd/extensions/azure.ai.agents/internal/cmd/session.go Updates session command help.
cli/azd/extensions/azure.ai.agents/internal/cmd/sample.go Updates sample command help.
cli/azd/extensions/azure.ai.agents/internal/cmd/root.go Installs the shared help renderer.
cli/azd/extensions/azure.ai.agents/internal/cmd/invoke.go Updates invoke command help.
cli/azd/extensions/azure.ai.agents/internal/cmd/invocations.go Updates invocation lifecycle help.
cli/azd/extensions/azure.ai.agents/internal/cmd/init.go Updates initialization help.
cli/azd/extensions/azure.ai.agents/internal/cmd/help.go Adds environment guidance. nit (1 vote): azd env set should use <key> <value> notation.
cli/azd/extensions/azure.ai.agents/internal/cmd/help_test.go Adds help snapshot and color coverage.
cli/azd/extensions/azure.ai.agents/internal/cmd/files.go Updates file-operation help.
cli/azd/extensions/azure.ai.agents/internal/cmd/eval.go Updates evaluation help.
cli/azd/extensions/azure.ai.agents/internal/cmd/eval_update.go Updates evaluator-update help.
cli/azd/extensions/azure.ai.agents/internal/cmd/eval_show.go Updates evaluation-display help.
cli/azd/extensions/azure.ai.agents/internal/cmd/eval_run.go Updates evaluation-run help.
cli/azd/extensions/azure.ai.agents/internal/cmd/eval_list.go Updates evaluation-list help.
cli/azd/extensions/azure.ai.agents/internal/cmd/doctor.go Updates diagnostic help.
cli/azd/extensions/azure.ai.agents/internal/cmd/code.go Updates code-management help.
cli/azd/extensions/azure.ai.agents/internal/cmd/add.go Updates dependency help.
cli/azd/extensions/azure.ai.agents/go.sum Records dependency checksums.
cli/azd/extensions/azure.ai.agents/go.mod Adds snapshot-testing dependency metadata.
cli/azd/extensions/azure.ai.agents/cspell.yaml Adds extension spelling configuration.
cli/azd/docs/style-guidelines/azd-style-guide.md Documents help standards and renderer usage.
cli/azd/.vscode/cspell.yaml Adds shared spelling terms.
Review details

Suppressed comments (3)

cli/azd/extensions/azure.ai.agents/internal/cmd/help.go:12

  • azd env set takes an environment-variable key as its first positional argument, not an environment name; the selected environment is chosen separately via select or --environment. Using <name> here conflicts with the preceding environment-name examples and can lead users to run the wrong command. Please use the same <key> <value> notation as the core command help.
  Use 'azd env set <name> <value>' to save a value and 'azd env get-values' to

cli/azd/extensions/azure.ai.agents/internal/helpformat/helpformat.go:50

  • The new root footer contains ${FOUNDRY_PROJECT_ENDPOINT} and ${VARIABLE_NAME}, but this token pattern only recognizes angle- and square-bracket placeholders. As a result, shell-style environment substitutions remain unhighlighted in colored help even though the renderer promises placeholder highlighting and styles the surrounding command/flag tokens. Add an environment-variable placeholder token and route it through WithWarningFormat (with coverage for the footer form).
    cli/azd/extensions/azure.ai.agents/internal/helpformat/helpformat.go:181
  • The new help conventions require a short # caption above each copyable command, but this fallback renders every non-caption line as a command. The existing eval generate metadata has four command lines with no captions, so its new snapshot is an undifferentiated block unlike the other public commands. Add captions to that example metadata (and refresh its snapshot), or otherwise reject/handle uncaptained examples consistently.
  • Files reviewed: 78/79 changed files
  • Comments generated: 0
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Resolve the invoke help conflict by retaining upstream platform latency diagnostics and the existing long-running invocation guidance. Refresh the invoke help snapshot for the added flag and example.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 17, 2026 03:20

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.

🟡 Changes recommended

Two review follow-ups remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 78/79 changed files
  • Comments generated: 2
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.

Use 'azd env new <name>' to create one, 'azd env select <name>' to change the
default, or --environment <name> (-e) to select one for a command.

Use 'azd env set <name> <value>' to save a value and 'azd env get-values' to
Comment on lines +33 to +37
Examples
azd ai agent eval generate
azd ai agent eval generate --gen-instruction "This agent handles restaurant reservations." --eval-model gpt-4o --max-samples 50
azd ai agent eval generate --gen-instruction-file ./instructions.md --eval-model gpt-4o
azd ai agent eval generate --dataset ./tests/golden.jsonl --evaluator builtin.intent_resolution
@azure-sdk-automation

Copy link
Copy Markdown
Contributor

azure.ai.agents PR build

Note

This is an unsigned development build. Install it only if you trust this PR.

Install the extension:

azd ext install "https://azuresdkartifacts.z5.web.core.windows.net/azd/extensions/pr/10057/azure-ai-agents.zip"
  • Version: 1.0.0-beta.15.pr.10057.6846954
  • Merge commit: f28b1e8

@Siglud
FanH (Siglud) enabled auto-merge (squash) September 17, 2026 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-agents azure.ai.agents extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add additional help context to azd ai

4 participants