Skip to content

feat(ai): add Invocations protocol lifecycle support - #9901

Open
Wei Meng (m5i-work) wants to merge 4 commits into
mainfrom
m5i/9676-invocations-primitives
Open

feat(ai): add Invocations protocol lifecycle support#9901
Wei Meng (m5i-work) wants to merge 4 commits into
mainfrom
m5i/9676-invocations-primitives

Conversation

@m5i-work

@m5i-work Wei Meng (m5i-work) commented Sep 7, 2026

Copy link
Copy Markdown
Member

Summary

Extends the shared lifecycle command group from #9900 with support for the Invocations wire protocol. It does not introduce another command group.

  • routes invocations show --protocol invocations to one GET
  • routes invocations cancel --protocol invocations to the cancel POST
  • accepts the shared --id selector; protocol can instead be inferred from the selected agent or --agent-endpoint
  • saves only the current Invocation ID, separately from the current Response ID
  • preserves existing synchronous, SSE, raw, and 202 Accepted polling behavior on create, including the accepted-body restoration used for ID extraction
  • rejects invocations follow --protocol invocations and invoke --long-running --protocol invocations for now
  • keeps new Invocations lifecycle/identity/state helpers in invoke_invocation.go and shared command dispatch in invocations.go; existing create, sync/SSE, and polling methods stay in invoke.go to avoid relocation-only diff
  • preserves explicit target selection without changing current state

CLI

azd ai agent invoke "message" --protocol invocations
azd ai agent invocations show --protocol invocations [--id <id>]
azd ai agent invocations cancel --protocol invocations [--id <id>]

The protocol need not be repeated when inferable. Explicit IDs work with protocol endpoint URLs without local state. Lifecycle requests do not inherit a saved session or create context.

Validation

  • go test ./...
  • go build ./...
  • go fix ./...
  • focused race tests
  • shared resolver tests verify endpoint-derived protocol selection and independent current IDs
  • scripted HTTP dispatch tests verify Invocations GET/cancel methods and rejection of unsupported follow without network requests
  • existing ID extraction, body restoration, raw, and LRO tests

Earlier live validation against the supplied Invocations reference agent passed create/poll and one-shot retrieval. That reference agent returns cancel_invocation not implemented for cancel, so successful cancellation cannot be live-validated against it.

Base: #9900
Fixes #9780
Part of #9676
Supersedes #9706.

Interactive scenarios

Uses the offline invocation help/validation scenarios introduced in #9900. Shared PR impact mapping changes are deferred to #9996. No new live/cloud test infrastructure or scenario execution is included.

Approval boundary

This PR no longer changes .github/skills/foundry-extension-scenario-pr-regression/references/impact-mapping.md. All mapping additions and its line-ending cleanup are isolated in follow-up #9996, so separate .github/ owner approval does not block this feature PR.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 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.

@m5i-work

Copy link
Copy Markdown
Member Author

Live E2E validation

Built and installed the full stack with azd x build, then tested against the supplied longrun-invocations-v2-ref endpoint using {"steps":3,"delay_ms":200}.

Passed:

  • existing 202 Accepted behavior captured the Invocation ID, polled, and completed all 3 steps
  • invocations show --invocation-id ... --output table returned the completed Invocation
  • implicit invocations show selected the saved current Invocation and returned the full JSON result
  • lifecycle GET worked using only the Invocation ID/current endpoint, without persisted session context

Reference-agent limitation:

  • POST /invocations/{id}/cancel returned HTTP 404 with cancel_invocation not implemented. The CLI surfaced a classified cancellation failure. This supplied reference agent validates create/poll and one-shot GET, but cannot validate the successful cancel path; that path remains unit-tested.

@m5i-work
Wei Meng (m5i-work) force-pushed the m5i/9676-invocations-primitives branch 2 times, most recently from 646639b to 7e303a9 Compare September 8, 2026 08:15
@m5i-work
Wei Meng (m5i-work) force-pushed the m5i/9676-invocations-primitives branch from 7e303a9 to 08a31fc Compare September 9, 2026 06:39
@m5i-work Wei Meng (m5i-work) changed the title feat(ai): add orthogonal Invocations primitives feat(ai): add Invocations protocol lifecycle support Sep 9, 2026
@m5i-work
Wei Meng (m5i-work) force-pushed the m5i/9676-invocations-primitives branch 5 times, most recently from 0a7758c to 0538801 Compare September 10, 2026 04:48

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

A new Go line exceeds the repo’s enforced 125-character limit (lll) and is expected to fail linting until wrapped.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 1
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 10, 2026 06:04
@m5i-work
Wei Meng (m5i-work) force-pushed the m5i/9676-invocations-primitives branch from 4a1187a to 4b64798 Compare September 10, 2026 06:04

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.

🟢 Approval recommended

The implementation is coherent and well-covered by targeted tests, with only minor documentation wording to consider.

Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread cli/azd/extensions/azure.ai.agents/docs/specs/long-running-agent-invoke.md Outdated

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

There is a concrete resource-handling issue in invoke.go where defer resp.Body.Close() is registered before invocationIDFromResponse may replace resp.Body, leading to inconsistent closing behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/invoke.go
@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/9901/azure-ai-agents.zip"
  • Version: 1.0.0-beta.14.pr.9901.6809401
  • Merge commit: 8978295

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/invoke_invocation.go Outdated

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.

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

@m5i-work
Wei Meng (m5i-work) force-pushed the m5i/9676-invocations-primitives branch from c27f607 to 326c28c Compare September 11, 2026 01:37
Base automatically changed from m5i/9676-responses-primitives to main September 11, 2026 04:01
@m5i-work
Wei Meng (m5i-work) force-pushed the m5i/9676-invocations-primitives branch from 326c28c to b176807 Compare September 11, 2026 04:01
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.

Retrieve the latest saved Invocation

3 participants