feat(ai-agents): CLI surface for managed harness agents (3/4) - #9756
Merged
Zhijie Huang (hund030) merged 20 commits intoAug 31, 2026
Merged
Conversation
This was referenced Aug 27, 2026
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.
Kshitij Chawla (kshitij-microsoft)
force-pushed
the
kchawla/mha-3-cli
branch
from
August 27, 2026 11:06
77b8ec0 to
7a4d658
Compare
…mha-2-prompt-deploy
…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
Zhijie Huang (hund030)
changed the base branch from
main
to
feature/managed-harness-agents
August 31, 2026 05:07
Contributor
There was a problem hiding this comment.
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.
Zhijie Huang (hund030)
marked this pull request as ready for review
August 31, 2026 07:55
Zhijie Huang (hund030)
approved these changes
Aug 31, 2026
|
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. |
Zhijie Huang (hund030)
merged commit Aug 31, 2026
340fc06
into
Azure:feature/managed-harness-agents
32 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part 3 of 4 of the managed harness agents (MHA) work for the
azure.ai.agentsextension.Builds on PR 2 (
kchawla/mha-2-prompt-deploy) and adds the CLI surface — this is the PRwhere the feature becomes user-visible.
What's in this PR
New commands (
internal/cmd)deploy.go—azd ai agent deploy.list.go—azd 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.init.go,init_adopt.go,init_from_code.go,init_infra.go, andinit_from_templates_helpers.goto route the new kind.Synthesis
synthesis/synthesizer.go—ProjectEndpointgains an env-map parameter so generatedinfrastructure carries the prompt agent's environment through. (This is why
synthesisships withthe CLI stage rather than with PR 2 — the call sites are in
init_infra.go.)Docs —
README.mdandCHANGELOG.mdupdated;.agentignoreadded.Behavioral notes for reviewers
github_copilot_preview. The earlierghcpabbreviation is rejected at parsetime with a message that shows the correct replacement.
managedis not an agent kind. The kind isprompt; "managed harness" describes the harness,not the kind.
(
init_from_templates_helpers.go,init_rai_policy.go) so a cancelled prompt returns cleanlyinstead 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 thanrequire-guarded casts asAGENTS.mdprescribes.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
agent.yamlmodel + Foundry service clientsinternal/project)azure.ai.projects+ registryMerge in order 1 → 2 → 3 → 4. Each PR is rebased onto
mainafter its predecessor merges.