Skip to content

feat(ai-agents): CLI surface for managed harness agents (3/4) - #9756

Merged
Zhijie Huang (hund030) merged 20 commits into
Azure:feature/managed-harness-agentsfrom
kshitij-microsoft:kchawla/mha-3-cli
Aug 31, 2026
Merged

feat(ai-agents): CLI surface for managed harness agents (3/4)#9756
Zhijie Huang (hund030) merged 20 commits into
Azure:feature/managed-harness-agentsfrom
kshitij-microsoft:kchawla/mha-3-cli

Conversation

@kshitij-microsoft

@kshitij-microsoft Kshitij Chawla (kshitij-microsoft) commented Aug 27, 2026

Copy link
Copy Markdown
Member

Summary

Part 3 of 4 of the managed harness agents (MHA) work for the azure.ai.agents extension.

Builds on PR 2 (kchawla/mha-2-prompt-deploy) and adds the CLI surface — this is the PR
where the feature becomes user-visible.

Reviewing the incremental diff
kshitij-microsoft/azure-dev@kchawla/mha-2-prompt-deploy...kchawla/mha-3-cli

What's in this PR

New commands (internal/cmd)

  • deploy.goazd ai agent deploy.
  • list.goazd ai agent list.
  • invoke_managed.go — managed-agent invocation, including the streaming path.
  • prompt_service.go — service resolution shared by the above.

Init flows

  • init_managed.go / init_managed_foundry.go — scaffolding for prompt agents.
  • init_rai_policy.go — interactive RAI policy selection.
  • Updates to init.go, init_adopt.go, init_from_code.go, init_infra.go, and
    init_from_templates_helpers.go to route the new kind.
  • A preview warning is emitted on every init path that can produce a managed harness agent.

Synthesis

  • synthesis/synthesizer.goProjectEndpoint gains an env-map parameter so generated
    infrastructure carries the prompt agent's environment through. (This is why synthesis ships with
    the CLI stage rather than with PR 2 — the call sites are in init_infra.go.)

DocsREADME.md and CHANGELOG.md updated; .agentignore added.

Behavioral notes for reviewers

  • The harness type is github_copilot_preview. The earlier ghcp abbreviation is rejected at parse
    time with a message that shows the correct replacement.
  • managed is not an agent kind. The kind is prompt; "managed harness" describes the harness,
    not the kind.
  • Nil-response guards were added to both interactive selection helpers
    (init_from_templates_helpers.go, init_rai_policy.go) so a cancelled prompt returns cleanly
    instead of dereferencing a nil value.

Known follow-up

New test files in this stage contain unguarded type assertions (e.g.
managed.Tools[0].(map[string]any)) rather than require-guarded casts as AGENTS.md prescribes.
Deliberately deferred to a follow-up PR to keep this one reviewable.

Validation

Same suite as PRs 1 and 2 — gofmt, go build, go vet, go test ./internal/...,
golangci-lint (0 issues), cspell (extension + core configs), and the copyright check all pass.


The full stack

# PR Scope Size
1 #9754 agent.yaml model + Foundry service clients 28 files, +5,099 / −194
2 #9755 provision + deploy pipeline (internal/project) 31 files, +7,565 / −90
3 #9756 CLI commands, init flows, docs 36 files, +4,583 / −242
4 #9757 azure.ai.projects + registry 8 files, +294 / −138

Merge in order 1 → 2 → 3 → 4. Each PR is rebased onto main after its predecessor merges.

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/deploy.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/list.go
Comment thread cli/azd/extensions/azure.ai.agents/CHANGELOG.md
First of four stacked changes adding managed harness agent support.
This one is the data model and the HTTP clients; it adds no commands
and performs no deployment, so it can be read on its own.

agent_yaml gains the prompt agent manifest: the harness block and its
skills, environment and built-in tool controls, the memory block, tool
declarations, and the feature gate that decides which manifest features
a given harness accepts. Blocks azd interprets reject unknown keys, so
a typo such as builtin_tool for builtin_tools fails the parse instead of
deploying an agent with capabilities the author believed were off. Tools
stay untyped and pass through, so a tool newer than this build still
deploys.

agent_api gains the managed agent contract and its operations. pkg/azure
gains the Foundry data plane clients for files, projects, connections
and RAI policies; the toolsets client is removed because the service
replaced it with the connections control plane.

New spelling terms stay in the extension cspell config rather than the
shared core one, which this branch does not touch.
Second of four stacked changes. Builds on the model and clients from the
previous change and adds the service target that turns a prompt agent
manifest into deployed Foundry resources.

Deployment is graph driven. The manifest is resolved into nodes for the
agent and for every resource it depends on -- memory store, connections,
skills, RAI policy -- and the graph decides creation order and reports
per node progress. Sibling resources are reconciled rather than
recreated, so a redeploy that changes nothing makes no writes.

This package is submitted whole rather than split further. The graph
types are shared by every node implementation and the nodes are
mutually referential, so any smaller cut does not compile without a
refactor that would itself need review.
Third of four stacked changes. Adds the commands that sit on top of the
model and the deployment engine from the previous two.

azd ai agent init gains a kind and harness selection and writes the
matching manifest, including discovery of an existing Responsible AI
policy with a warn and fall back path when none can be read. list, show,
delete and invoke gain managed agent handling, with invoke supporting
streamed responses. Infrastructure synthesis learns the project endpoint
so a generated module resolves it from the environment.

Also carries the extension CHANGELOG for all four changes in this stack,
since the entries describe features that only exist once the stack is
complete.
…into kchawla/mha-3-cli

# Conflicts:
#	cli/azd/extensions/azure.ai.agents/CHANGELOG.md
#	cli/azd/extensions/azure.ai.agents/internal/cmd/init.go
#	cli/azd/extensions/azure.ai.agents/internal/cmd/init_adopt.go
#	cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/responses_operations.go
#	cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/responses_operations_test.go
#	cli/azd/extensions/azure.ai.agents/internal/project/prompt_client.go
#	cli/azd/extensions/azure.ai.agents/internal/project/prompt_client_test.go
#	cli/azd/extensions/azure.ai.agents/internal/project/prompt_inline_test.go
#	cli/azd/extensions/azure.ai.agents/internal/project/prompt_policy_node.go
#	cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent.go
#	cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent_test.go
#	cli/azd/extensions/azure.ai.agents/internal/project/service_target_prompt.go
@hund030
Zhijie Huang (hund030) changed the base branch from main to feature/managed-harness-agents August 31, 2026 05:07
@github-actions github-actions Bot added ext-agents azure.ai.agents extension ext-projects azure.ai.projects extension labels Aug 31, 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.

Pull request overview

Adds the user-facing managed harness prompt-agent CLI and integrates it with existing azd lifecycle, initialization, and synthesis flows.

Changes:

  • Adds prompt-agent initialization, Foundry/model/RAI selection, and resource scaffolding.
  • Adds list, show, invoke, delete, and lifecycle-event support.
  • Expands environment-backed endpoints during synthesis and adds coverage.

Reviewed changes

Copilot reviewed 47 out of 47 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
azure.ai.agents/.agentignore Defines deployment exclusions.
azure.ai.agents/README.md Documents RAI policy selection.
internal/cmd/agent_endpoint.go Validates explicit agent endpoints.
internal/cmd/delete.go Adds prompt-agent deletion.
internal/cmd/deploy.go Adds deprecated deploy redirect.
internal/cmd/helpers.go Adds shared command helpers.
internal/cmd/init.go Routes prompt initialization and flags.
internal/cmd/init_adopt.go Supports prompt manifest adoption.
internal/cmd/init_adopt_test.go Updates adoption tests.
internal/cmd/init_from_code.go Routes prompt code initialization.
internal/cmd/init_from_templates_helpers.go Adds kind and harness selection.
internal/cmd/init_from_templates_helpers_test.go Tests template selection.
internal/cmd/init_infra.go Passes environment into synthesis.
internal/cmd/init_managed.go Implements prompt-agent scaffolding.
internal/cmd/init_managed_flags_test.go Tests prompt init flags.
internal/cmd/init_managed_foundry.go Implements guided Foundry setup.
internal/cmd/init_managed_manifest_test.go Tests prompt manifests.
internal/cmd/init_managed_test.go Tests prompt initialization.
internal/cmd/init_rai_policy.go Implements RAI policy selection.
internal/cmd/init_rai_policy_test.go Tests policy selection.
internal/cmd/invoke.go Routes prompt invocation.
internal/cmd/invoke_managed.go Implements Responses API invocation.
internal/cmd/invoke_managed_stream_test.go Tests streaming invocation.
internal/cmd/invoke_managed_test.go Tests managed invocation.
internal/cmd/list.go Adds prompt-agent listing.
internal/cmd/listen.go Integrates lifecycle event handling.
internal/cmd/project_endpoint.go Expands endpoint validation behavior.
internal/cmd/project_endpoint_test.go Tests endpoint validation.
internal/cmd/prompt_service.go Resolves prompt service context.
internal/cmd/prompt_service_test.go Tests prompt resolution.
internal/cmd/resource_services.go Emits dependent resource services.
internal/cmd/resource_services_test.go Tests resource-service generation.
internal/cmd/root.go Registers new commands.
internal/cmd/show.go Adds prompt-agent status output.
internal/cmd/show_test.go Tests prompt status rendering.
agent_api/responses_operations.go Supports explicit Responses endpoints.
agent_api/responses_operations_test.go Tests Responses operations.
internal/project/prompt_client.go Adds credential and endpoint resolution.
internal/project/prompt_client_test.go Tests prompt client behavior.
internal/project/prompt_graph.go Updates prompt deployment graph.
internal/project/prompt_inline_test.go Updates inline prompt tests.
internal/project/prompt_skills.go Aligns skills with sibling services.
internal/project/service_target_prompt.go Uses canonical prompt target settings.
azure.ai.agents/internal/synthesis/synthesizer.go Expands environment-backed endpoints.
azure.ai.agents/internal/synthesis/synthesizer_test.go Tests endpoint expansion.
azure.ai.projects/internal/synthesis/synthesizer.go Synchronizes synthesis behavior.
azure.ai.projects/internal/synthesis/synthesizer_test.go Updates synchronized tests.
Suppressed comments (1)

cli/azd/extensions/azure.ai.agents/internal/cmd/init_managed_foundry.go:338

  • This indexes the choices slice through an unchecked nullable prompt response. A cancelled/empty response or an invalid index panics instead of returning a command error. Check resp, resp.Value, and the index bounds before reading the selected choice.
			if selected := choices[*resp.Value].Value; selected != newModelValue {

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/project_endpoint.go
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/agent_endpoint.go
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/prompt_service.go
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/prompt_service.go
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/list.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/delete.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/deploy.go Outdated
@azure-pipelines

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

@hund030
Zhijie Huang (hund030) merged commit 340fc06 into Azure:feature/managed-harness-agents Aug 31, 2026
32 checks passed
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 ext-projects azure.ai.projects extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants