Skip to content

feat(toolboxes): support skills on toolbox versions#8396

Merged
trangevi merged 10 commits into
mainfrom
zhihuan/feat-toolbox-skills
May 28, 2026
Merged

feat(toolboxes): support skills on toolbox versions#8396
trangevi merged 10 commits into
mainfrom
zhihuan/feat-toolbox-skills

Conversation

@hund030
Copy link
Copy Markdown
Collaborator

@hund030 hund030 commented May 27, 2026

Summary

Adds skills support on toolbox versions, per the new optional field on ToolboxVersionObject / CreateToolboxVersionRequest in the Foundry spec. Follow-up to #8322.

Changes

  • internal/pkg/azure: Skills []map[string]any on CreateToolboxVersionRequest (omitempty) and ToolboxVersionObject (always serialized, matching service behavior). []map[string]any keeps future ToolboxSkill discriminator variants forward-compatible.
  • internal/cmd/toolbox_skill.go: name validator (mirrors azure.ai.skills' regex, documented), parseSkillFlag, buildSkillEntry, validateNoDuplicateSkills.
  • toolbox create --from-file: optional skills[] block in the input file.
  • toolbox skill add | remove | list: new subgroup. Each mutation publishes a new immutable toolbox version via createToolboxVersion; no dedicated REST endpoint exists. skill remove allows removing the last skill (skills are optional content, unlike connections).
  • connection add / connection remove: carry skills forward verbatim into the new version.
  • toolbox show / toolbox version list: surface skill count and a per-skill table / skills_count column.

Validation

  • Unit tests cover the new helpers, the create skills-from-file path, carry-forward on connection add/remove, and all three skill verbs.
  • Live e2e against a Skills-enabled Foundry project: create with skill → connection peel preserves skill → skill remove → empty list → skill add republishes. Full Test_CLI_Toolbox_Smoke flow green.

Adds the skills field to ToolboxVersionObject and CreateToolboxVersionRequest, plumbed through:

- toolbox create --from-file: accepts an optional skills[] block.

- toolbox skill add/remove/list: post-creation mutation subgroup (no dedicated REST endpoint; each mutation publishes a new immutable version via createToolboxVersion). skill remove allows removing the last skill (skills are optional content).

- connection add/remove: carry forward existing skills verbatim into new versions.

- toolbox show / toolbox version list: surface skill count + per-skill table.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “skills” support to the azure.ai.toolboxes extension so toolbox versions can reference Foundry Skills (create-time via --from-file, plus new toolbox skill add/remove/list verbs), and surfaces skill counts/details in listing/show commands.

Changes:

  • Extends Foundry toolbox version request/response models to include skills.
  • Adds azd ai toolbox skill {add,remove,list} commands with local validation + tests.
  • Propagates skills across connection add/remove version publishing; updates show and version list output to include skill info.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
cli/azd/extensions/azure.ai.toolboxes/internal/pkg/azure/foundry_toolsets_client.go Adds Skills to toolbox version create request + version response models.
cli/azd/extensions/azure.ai.toolboxes/internal/exterrors/codes.go Adds new validation/error codes for skill operations.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_version_list.go Adds skills_count to JSON output and SKILLS column to table output.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill.go New helpers for parsing/validating skill specs and building wire entries.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill_verbs_test.go New tests covering skill add/remove/list flows and edge cases.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill_test.go Unit tests for skill parsing, entry building, and duplicate detection.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill_remove.go Implements toolbox skill remove (publishes new version + promotes default).
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill_list.go Implements toolbox skill list and row extraction for output.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill_group.go Adds toolbox skill command group and shared list helpers.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill_add.go Implements toolbox skill add (publishes new version + promotes default).
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_show.go Surfaces skill count and renders a skills table in toolbox show.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_help.go Updates --from-file shape docs to include skills.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_files.go Extends create-file shape with skills; improves parse error suggestions.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_create.go Accepts skills[] from create file and validates duplicates.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_connection_remove.go Carries skills forward when publishing a version during connection removal.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_connection_add.go Carries skills forward when publishing a version during connection addition.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_commands_test.go Adds tests for skills-from-file and skills carry-forward semantics.
cli/azd/extensions/azure.ai.toolboxes/internal/cmd/root.go Registers the new toolbox skill command group.

Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill.go
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_show.go
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_files.go Outdated
Replace strings.IndexByte/slicing with strings.Cut in parseSkillFlag, and string-append loops with strings.Builder in the over/exactly-64-chars tests. CI enforces these via 'go fix ./...'.
@github-actions github-actions Bot added the ext-agents azure.ai.{agents,connections,inspector,projects,routines,skills,toolboxes} extensions label May 27, 2026
@hund030 hund030 linked an issue May 27, 2026 that may be closed by this pull request
- parseSkillFlag now trims the name portion after splitting on '@' so input like 'my-skill @2' yields Name:'my-skill' instead of leaving a trailing space (which would break duplicate / remove lookups).

- runSkillRemoveWith normalizes skillName with TrimSpace at the top, mirroring validateSkillName's internal trim so a user input of ' beta ' matches the canonical stored entry.

- toolbox show skills table reuses extractSkillRows so malformed entries are skipped consistently with skill list.

- toolbox create file parse-error hint points users at 'skill add' / 'skill remove' instead of implying create-time is the only way to attach skills.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 27, 2026

📋 Prioritization Note

Thanks for the contribution! The linked issue isn't in the current milestone yet.
Review may take a bit longer — reach out to @rajeshkamal5050 or @kristenwomack if you'd like to discuss prioritization.

Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_files.go Outdated
Copy link
Copy Markdown
Member

@trangevi trangevi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking this PR while I get some clarity on the API surface

Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill_group.go Outdated
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill_add.go Outdated
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill_add.go Outdated
hund030 added 2 commits May 28, 2026 16:53
Addresses two open review comments on PR #8396:

- therealjohn: drop the 'in v1' phrasing from user-facing strings; it's not a CLI versioning concern, it's a service-side constraint.

- trangevi: support batching on mutation verbs so users don't churn versions one item at a time:

  - toolbox connection remove: variadic positionals (one or many connection names).

  - toolbox skill add: gains a --from-file mode (skills[] block) alongside the single positional.

  - toolbox skill remove: variadic positionals.

  Each invocation publishes exactly one new toolbox version covering the whole batch.

Also tightens internal docs to drop a few TypeSpec-name leaks (buildSkillEntry, the parse-error suggestion text) so the verb files don't reach for terms users won't recognize.
… publish

Addresses trangevi's review on PR #8396: toolboxes are shared resources, so a connection-add or skill-mutation should not silently redirect every other consumer to the new version. The PATCH that promotes a version is now a deliberate user gesture via the new toolbox publish verb.

- connection add, connection remove, skill add, skill remove: drop the SetDefaultVersion call after publishing a new toolbox version.

- Rename toolbox update <name> --default-version <v> to toolbox publish <name> <version> (positional shape matches trangevi's wording).

- Mutation success messages now say 'Published toolbox <name> version <v>' and append 'The default version is unchanged; run azd ai toolbox publish ... to promote.'

- All error suggestions and help text that mentioned 'toolbox update --default-version' now point at 'toolbox publish'.

- Drop two error codes that are no longer reachable (CodeMissingUpdateField, CodeSetDefaultVersionFailed).

- Tests: invert setDefaultCalls length-1 assertions to assert.Empty, replace runToolboxUpdate test with the equivalent for runToolboxPublish, update the delete-suggestion substring check.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

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

Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/root.go
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_connection_add.go Outdated
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill_group.go Outdated
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill_add.go Outdated
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_create.go Outdated
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_commands_test.go Outdated
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_commands_test.go Outdated
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_commands_test.go Outdated
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_commands_test.go Outdated
…ename to publish

Reverts only the verb rename from PR review comment #4. The behavior change (no auto-promote default on mutation verbs) and the help/error/success-message rewording stay.

Rationale: toolbox update --default-version <v> is a superset of a hypothetical publish <v> (extensible to future patchable fields). It also parallels azure.ai.skills' skill update --set-default-version, which keeps the two extensions visually consistent.

Behavior unchanged from previous commit:

- connection add/remove, skill add/remove still publish new versions without promoting.

- All mutation success messages still tell the user the default is unchanged and point at the explicit promote step (now spelled 'azd ai toolbox update <name> --default-version <v>').

- Help text on root.go, connection group, skill group, connection add, skill add all reflect 'default unchanged' semantics.

Restores: toolbox_update.go, runToolboxUpdate, toolboxUpdateFlags, CodeMissingUpdateField, TestRunToolboxUpdate_MissingDefaultVersion. Removes: toolbox_publish.go and its newToolboxPublishCommand.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.

Comments suppressed due to low confidence (2)

cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_help.go:61

  • The help text points users to azd ai agent connection list, but the connections command is azd ai connection list (and other suggestions in this extension already use that). Update the referenced command so users aren’t sent to a non-existent subcommand.
  skills          Optional. Existing project skills to attach by reference.
                  Each entry needs 'name'; 'version' is optional (omit to
                  follow the skill's default version).

Project connections must already exist on the Foundry project; this command
does not create them. Run 'azd ai agent connection list' to see available
connections.`

cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_help.go:100

  • The help text points users to azd ai agent connection list, but the connections command is azd ai connection list (and other suggestions in this extension already use that). Update the referenced command so users aren’t sent to a non-existent subcommand.
The toolbox's existing description is carried forward unchanged; the
description is set at create time and cannot be changed later.

Project connections must already exist on the Foundry project; this command
does not create them. Run 'azd ai agent connection list' to see available
connections.`

Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill.go
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill.go Outdated
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/root.go Outdated
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_connection.go Outdated
Comment thread cli/azd/extensions/azure.ai.toolboxes/internal/cmd/toolbox_skill_group.go Outdated
- parseSkillFlag / validateNoDuplicateSkills error messages and suggestions no longer reference a non-existent --skill flag (skills are positional or in skills[] of --from-file).

- runConnectionRemoveWith now trims whitespace from each connection name (parity with skill remove). User input '  foo  ' now matches the stored entry.

- Root, connection group, and skill group help text now show the full 'azd ai toolbox update <toolbox> --default-version <version>' form so it's copy-pastable.
Signed-off-by: trangevi <trangevi@microsoft.com>
…oolbox. `update` can be added back if toolboxes ever become mutable. This provides consistency with other UX experience

Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
@trangevi
Copy link
Copy Markdown
Member

/check-enforcer override

@trangevi trangevi enabled auto-merge (squash) May 28, 2026 20:42
@trangevi trangevi merged commit b05df4b into main May 28, 2026
26 of 27 checks passed
@hund030 hund030 deleted the zhihuan/feat-toolbox-skills branch June 3, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-agents azure.ai.{agents,connections,inspector,projects,routines,skills,toolboxes} extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support attaching Foundry Skills to toolbox versions in azd ai toolbox

5 participants