[Agents extension] Adding /invocations support#7422
Conversation
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support to the azure.ai.agents extension for invoking agents via the new /invocations protocol, including protocol auto-detection from agent.yaml and improved session handling, while also updating the existing /responses remote route to use the newer agent endpoint URL shape.
Changes:
- Add
invocationsas a supported agent protocol and route invoke execution to either/responsesor/invocationsbased onagent.yaml. - Add
--input-file/-fto send a file body for invoke calls (primarily for structured invocations payloads). - Normalize ACR login server values when setting
AZURE_CONTAINER_REGISTRY_ENDPOINT, plus unit tests for the normalization helper.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/models.go |
Adds the invocations protocol constant for protocol switching. |
cli/azd/extensions/azure.ai.agents/internal/exterrors/codes.go |
Adds validation codes used by new CLI argument validation paths. |
cli/azd/extensions/azure.ai.agents/internal/cmd/invoke.go |
Implements invocations local/remote flows, protocol routing, file-body support, and LRO/SSE/sync response handlers. |
cli/azd/extensions/azure.ai.agents/internal/cmd/invoke_test.go |
Adds unit tests for invocations response handling and file/message body resolution. |
cli/azd/extensions/azure.ai.agents/internal/cmd/helpers.go |
Updates session persistence behavior, adds OpenAPI spec caching, invocation ID persistence, and protocol detection from agent.yaml. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers.go |
Normalizes ACR endpoints before lookup and before persisting to env vars. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers_test.go |
Adds tests for normalizeLoginServer. |
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
jongio
left a comment
There was a problem hiding this comment.
Solid dispatch architecture for the invocations protocol - the sync/SSE/LRO handler split is clean.
Issues to address:
- invoke.go:441,535 - session ID concatenated into URLs without encoding; user-provided --session values can corrupt the query string
- invoke.go:703 - handleInvocationLRO has zero test coverage despite being the most complex new code path
therealjohn
left a comment
There was a problem hiding this comment.
Would it make sense to also tackle #7419 in this?
Update to the --session and --conversation flags to be --session-id and --conversation-id?
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
…ure-dev into trangevi/new-invoke-api
Adding support for the new /invocations API. This uses the new agent endpoint route, and updates the /responses handling to do the same.
/invocations calls can accept any input, based on the agent, so we do no validation on it and instead just pass it along to the agent, relying on the agent to handle it.