Conversation
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
- Remove ToolboxToolDefinition struct (replaced by []any tools) - Remove deriveConnectionName (orphaned after init refactor) - Migrate ToolKind constants to snake_case, remove converter functions - Remove 7 dead functions from service_target_agent.go (deployToolboxes, enrichToolboxFromConnections, resolveToolboxEnvironmentVariables, resolveMapValues, resolveAnyValue, upsertToolset, registerToolboxEnvironmentVariables) and their tests - Fix provision path: correct FOUNDRY_TOOLBOX_* env var prefix, add env var resolution and connection enrichment, update-on-conflict for upsertToolset (409 -> update instead of skip) - Extract marshalAndSetEnvVar shared helper to reduce duplication - Consolidate toolboxMCPEndpointEnvKey (remove duplicate from init.go) - Fix GetValues API call to use correct GetEnvironmentRequest type Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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>
Signed-off-by: trangevi <trangevi@microsoft.com>
There was a problem hiding this comment.
Pull request overview
Adds “toolbox” (Foundry Toolsets) support to the azure.ai.agents extension so toolboxes and their backing connections can be defined in manifests / project config and provisioned automatically as part of agent creation.
Changes:
- Extends agent/project configuration & schema to support
toolboxes,toolConnections, and projectconnections. - Implements post-provision toolbox provisioning (Toolsets API) and env-var wiring for connections/toolboxes.
- Enhances agent manifest parsing (new resource kinds, new tool kinds) and manifest parameter handling (including
secret: true).
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/pkg/azapi/azure_resource_types.go | Adds a resource-type constant/display name for Foundry project connections. |
| cli/azd/extensions/azure.ai.agents/schemas/azure.ai.agent.json | Extends JSON schema with toolboxes/toolConnections/connections definitions. |
| cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent.go | Auto-injects toolbox MCP endpoint env vars during hosted agent deploy. |
| cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent_test.go | Adds tests for toolbox/service env-var key normalization. |
| cli/azd/extensions/azure.ai.agents/internal/project/config.go | Adds strongly-typed config models for toolboxes and connections. |
| cli/azd/extensions/azure.ai.agents/internal/project/config_test.go | Adds round-trip tests for toolbox/toolConnection config serialization. |
| cli/azd/extensions/azure.ai.agents/internal/pkg/azure/foundry_toolsets_client.go | Introduces a Toolsets/Toolboxes API client for create/get/delete. |
| cli/azd/extensions/azure.ai.agents/internal/pkg/agents/registry_api/helpers.go | Adds masked prompting support for secret: true manifest parameters. |
| cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/yaml.go | Adds new resource/tool kinds and supports record-format parameter schemas. |
| cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/yaml_test.go | Adds JSON round-trip tests for new YAML model types. |
| cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/parse.go | Parses toolbox/connection resources and new tool kinds. |
| cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/parse_test.go | Adds parsing tests for toolbox/connection resources and parameters layouts. |
| cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/map.go | Updates default protocol version mapping for hosted agents. |
| cli/azd/extensions/azure.ai.agents/internal/exterrors/codes.go | Adds toolbox/connection error codes and operation identifiers. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/listen.go | Adds postprovision toolbox provisioning + connection env-var serialization helpers. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/listen_test.go | Adds unit tests for credential normalization and connection-id resolution helpers. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init.go | Moves parameter processing earlier; extracts toolboxes/connections into azure.yaml config; injects toolbox env vars. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_test.go | Adds tests for toolbox/connection extraction and env-var injection behaviors. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go | Updates offered/default protocol versions. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code_test.go | Updates tests to match protocol version changes. |
Signed-off-by: trangevi <trangevi@microsoft.com>
* Add unit tests and testdata for azure.ai.agents extension Add 86 new unit tests across 5 previously untested or undertested packages in the azure.ai.agents extension, raising total test count from 183 to 269. Coverage improvements: - agent_yaml: 23.1% -> 53.8% (map.go YAML-to-API mapping fully tested) - registry_api: 0% -> 28.8% (tool conversion, parameter conversion, merge) - agent_api: 0% -> tested (JSON round-trip for all model types) - cmd: 23.0% -> 23.6% (copyDirectory, copyFile, buildAgentEndpoint) New test files: - agent_yaml/map_test.go: 44 tests for YAML-to-API transform functions - registry_api/helpers_test.go: 35 tests for pure conversion helpers - agent_api/models_test.go: 24 JSON serialization round-trip tests - cmd/init_copy_test.go: directory/file copy logic tests - cmd/agent_context_test.go: endpoint construction test - agent_yaml/testdata_test.go: fixture-based parsing + regression tests New testdata fixtures (7 YAML files): - 3 valid agents (minimal prompt, full prompt, hosted) - 1 MCP tools agent - 3 invalid manifests (no kind, no model, empty template) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * refactor: replace ptr[T] helper with Go 1.26 new(val) in tests Replace the generic ptr[T](v T) *T helper function with Go 1.26's built-in new(val) pattern in models_test.go and helpers_test.go, consistent with map_test.go and AGENTS.md conventions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * remove outdated comment --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
)" This reverts commit af85a8f.
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 foundation for toolbox support. A few items beyond what the bot flagged - mostly around a breaking change in tool kind names, some credential handling gaps, and a couple of data-loss edges.
Signed-off-by: trangevi <trangevi@microsoft.com>
…ionResource and Connection structs (#7668) * fix: add OAuth URL, audience, connectorName fields and authType constants Add missing fields to ConnectionResource (yaml.go), Connection (config.go), and the extractConnectionConfigs mapping in init.go so that all properties defined in azure.yaml are passed through to the Bicep ARM deployment without being silently dropped by the Go YAML unmarshaler. New fields added to both ConnectionResource and project.Connection: - AuthorizationUrl (OAuth2 authorization endpoint) - TokenUrl (OAuth2 token endpoint) - RefreshUrl (OAuth2 refresh endpoint) - Scopes (OAuth2 requested scopes) - Audience (token audience for UserEntraToken / AgenticIdentity) - ConnectorName (managed connector for OAuth2 managed connectors) New AuthType constants added to yaml.go (mirroring REST API values): UserEntraToken, AgenticIdentity, ManagedIdentity, ServicePrincipal, UsernamePassword, AccessKey, AccountKey, SAS * fix: add missing connection fields (authorizationUrl, tokenUrl, refreshUrl, scopes, audience, connectorName) to azure.ai.agent JSON schema and inline aiAgentConfig in azure.yaml.json to eliminate VS Code YAML validation errors * fix: correct Audience and ConnectorName field comments in ConnectionResource * revert: restore azure.yaml.json external schema ref (remove inline aiAgent* definitions) * test: add JSON round-trip tests for 6 new ConnectionResource fields * Update yaml.go * Update yaml.go * Update azure.ai.agent.json * Update azure.ai.agent.json
Signed-off-by: trangevi <trangevi@microsoft.com>
…into trangevi/toolbox
Signed-off-by: trangevi <trangevi@microsoft.com>
jongio
left a comment
There was a problem hiding this comment.
Five additional findings from deeper analysis - focused on runtime bugs and backward-compat gaps not covered by my previous comments.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jongio
left a comment
There was a problem hiding this comment.
Follow-up review - 3 new findings beyond my previous inline comments.
CI is still red: cspell (9 unknown words), gofmt (3 files not formatted), gosec (2 G101 false positives in test files need nolint), go-fix (manual for-range loops should use maps.Copy). These need to be fixed before merge.
Many of my earlier comments from April 11-13 still appear unaddressed - please take a pass through those as well.
Signed-off-by: trangevi <trangevi@microsoft.com>
…into trangevi/toolbox
Signed-off-by: trangevi <trangevi@microsoft.com>
jongio
left a comment
There was a problem hiding this comment.
All 16 of my previous inline comments are addressed in the latest commits - nice work. The fixes look solid (maps.Clone for credential isolation, index-based connName dedup, proper regex sanitization, reserved key validation, NormalizeToolKind in prompt path, etc).
CI is still red - same issues from my last review:
- cspell: 12 unknown words - add Alphanum, CLIENTSECRET, Toolsets, ADLS, Qdrant to the cspell overrides; change "normalises" to "normalizes"
- gofmt: 3 files need formatting - run
gofmt -s -won init_test.go, listen.go, foundry_toolsets_client_test.go - gosec: 2 G101 false positives in yaml_test.go - add
//nolint:goseccomments - go-fix: init.go has a manual
for k, v := range toolMaploop - replace withmaps.Copy(tool, toolMap)
Once CI is green I'm happy to approve.
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
* Maybe working changes for tools Signed-off-by: trangevi <trangevi@microsoft.com> * Attempting to handle new yaml Signed-off-by: trangevi <trangevi@microsoft.com> * Clean up dead/duplicated code after toolbox merge - Remove ToolboxToolDefinition struct (replaced by []any tools) - Remove deriveConnectionName (orphaned after init refactor) - Migrate ToolKind constants to snake_case, remove converter functions - Remove 7 dead functions from service_target_agent.go (deployToolboxes, enrichToolboxFromConnections, resolveToolboxEnvironmentVariables, resolveMapValues, resolveAnyValue, upsertToolset, registerToolboxEnvironmentVariables) and their tests - Fix provision path: correct FOUNDRY_TOOLBOX_* env var prefix, add env var resolution and connection enrichment, update-on-conflict for upsertToolset (409 -> update instead of skip) - Extract marshalAndSetEnvVar shared helper to reduce duplication - Consolidate toolboxMCPEndpointEnvKey (remove duplicate from init.go) - Fix GetValues API call to use correct GetEnvironmentRequest type Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Missing test file Signed-off-by: trangevi <trangevi@microsoft.com> * Some more fixes Signed-off-by: trangevi <trangevi@microsoft.com> * Fix merge Signed-off-by: trangevi <trangevi@microsoft.com> * More fixes Signed-off-by: trangevi <trangevi@microsoft.com> * Add connection resource type for provisioning Signed-off-by: trangevi <trangevi@microsoft.com> * Move to /toolboxes api Signed-off-by: trangevi <trangevi@microsoft.com> * Add version Signed-off-by: trangevi <trangevi@microsoft.com> * Add unit tests and testdata for azure.ai.agents extension (Azure#7634) * Add unit tests and testdata for azure.ai.agents extension Add 86 new unit tests across 5 previously untested or undertested packages in the azure.ai.agents extension, raising total test count from 183 to 269. Coverage improvements: - agent_yaml: 23.1% -> 53.8% (map.go YAML-to-API mapping fully tested) - registry_api: 0% -> 28.8% (tool conversion, parameter conversion, merge) - agent_api: 0% -> tested (JSON round-trip for all model types) - cmd: 23.0% -> 23.6% (copyDirectory, copyFile, buildAgentEndpoint) New test files: - agent_yaml/map_test.go: 44 tests for YAML-to-API transform functions - registry_api/helpers_test.go: 35 tests for pure conversion helpers - agent_api/models_test.go: 24 JSON serialization round-trip tests - cmd/init_copy_test.go: directory/file copy logic tests - cmd/agent_context_test.go: endpoint construction test - agent_yaml/testdata_test.go: fixture-based parsing + regression tests New testdata fixtures (7 YAML files): - 3 valid agents (minimal prompt, full prompt, hosted) - 1 MCP tools agent - 3 invalid manifests (no kind, no model, empty template) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * refactor: replace ptr[T] helper with Go 1.26 new(val) in tests Replace the generic ptr[T](v T) *T helper function with Go 1.26's built-in new(val) pattern in models_test.go and helpers_test.go, consistent with map_test.go and AGENTS.md conventions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * remove outdated comment --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Revert "Add unit tests and testdata for azure.ai.agents extension (Azure#7634)" This reverts commit af85a8f. * PR comments part 1 Signed-off-by: trangevi <trangevi@microsoft.com> * Update feature header Signed-off-by: trangevi <trangevi@microsoft.com> * PR comment Signed-off-by: trangevi <trangevi@microsoft.com> * fix(agents): add OAuth URL, audience, connectorName fields to ConnectionResource and Connection structs (Azure#7668) * fix: add OAuth URL, audience, connectorName fields and authType constants Add missing fields to ConnectionResource (yaml.go), Connection (config.go), and the extractConnectionConfigs mapping in init.go so that all properties defined in azure.yaml are passed through to the Bicep ARM deployment without being silently dropped by the Go YAML unmarshaler. New fields added to both ConnectionResource and project.Connection: - AuthorizationUrl (OAuth2 authorization endpoint) - TokenUrl (OAuth2 token endpoint) - RefreshUrl (OAuth2 refresh endpoint) - Scopes (OAuth2 requested scopes) - Audience (token audience for UserEntraToken / AgenticIdentity) - ConnectorName (managed connector for OAuth2 managed connectors) New AuthType constants added to yaml.go (mirroring REST API values): UserEntraToken, AgenticIdentity, ManagedIdentity, ServicePrincipal, UsernamePassword, AccessKey, AccountKey, SAS * fix: add missing connection fields (authorizationUrl, tokenUrl, refreshUrl, scopes, audience, connectorName) to azure.ai.agent JSON schema and inline aiAgentConfig in azure.yaml.json to eliminate VS Code YAML validation errors * fix: correct Audience and ConnectorName field comments in ConnectionResource * revert: restore azure.yaml.json external schema ref (remove inline aiAgent* definitions) * test: add JSON round-trip tests for 6 new ConnectionResource fields * Update yaml.go * Update yaml.go * Update azure.ai.agent.json * Update azure.ai.agent.json * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> * Remove credential from azure.yaml file Signed-off-by: trangevi <trangevi@microsoft.com> * Update azure.ai.agent.json * Update azure.ai.agent.json (Azure#7696) * Fix json Signed-off-by: trangevi <trangevi@microsoft.com> * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Test update Signed-off-by: trangevi <trangevi@microsoft.com> * PR comments Signed-off-by: trangevi <trangevi@microsoft.com> * A couple of build failure fixes Signed-off-by: trangevi <trangevi@microsoft.com> * modernization fix Signed-off-by: trangevi <trangevi@microsoft.com> --------- Signed-off-by: trangevi <trangevi@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Glenn Harper <64209257+glharper@users.noreply.github.com> Co-authored-by: Linda Li <139801625+lindazqli@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Adding the ability to create a toolbox as a part of agent creation.