Skip to content

feat: attach hosted provider Skills to code-execution / shell tools#695

Merged
AlemTuzlak merged 5 commits into
mainfrom
feat/provider-skills
Jun 4, 2026
Merged

feat: attach hosted provider Skills to code-execution / shell tools#695
AlemTuzlak merged 5 commits into
mainfrom
feat/provider-skills

Conversation

@AlemTuzlak
Copy link
Copy Markdown
Contributor

@AlemTuzlak AlemTuzlak commented Jun 3, 2026

Summary

Adds support for attaching hosted, provider-managed Agent Skills to the server-side execution tool that runs them, for both Anthropic and OpenAI.

  • AnthropiccodeExecutionTool(config, { skills: [{ type: 'anthropic', skill_id: 'pptx', version: 'latest' }] }). The adapter lifts the skills into the request's top-level container.skills (preserving any container.id) and auto-attaches the required beta headers — code-execution-2025-08-25 (or code-execution-2025-05-22 for the legacy code_execution_20250522 variant) plus skills-2025-10-02 — on both the streaming and structuredOutput paths.
  • OpenAIshellTool({ environment: { type: 'container_auto', skills: [{ type: 'skill_reference', skill_id: '...', version: '2' }] } }), threaded through the Responses-API shell tool.

Skills are configured on the execution-tool factory (not a top-level prop), so they cannot be passed without the tool that runs them, and there's no name collision with the unrelated @tanstack/ai-code-mode-skills (local TS functions). Scope: hosted/managed skills referenced by id + version (inline bundles / local paths / the upload API are out of scope).

Setting skills via Anthropic's modelOptions.container.skills is now deprecated in favor of codeExecutionTool(config, { skills }).

Dependency note

Bumps the openai SDK ^6.9.1 → ^6.41.0 (required for the typed shell environment.skills surface) across ai-openai, openai-base, ai-grok, ai-groq, with the small SDK-compat adjustments the bump requires.

openai 6.41 also switched videos.create to multipart/form-data, which the pinned @copilotkit/aimock@1.27.0 only JSON-parsed — breaking the existing video-gen E2E. This PR adds a committed pnpm patch teaching aimock's video handler to parse multipart (reusing its existing transcription helpers) so the suite stays green. Follow-up: upstream the same fix to @copilotkit/aimock and drop the patch.

Test Plan

  • Unit tests: tool factories + converters, the container-lift, version-aware computeAnthropicBetas, skills/lift agreement across multi-tool configs, skill_id validation
  • E2E (aimock + Playwright): wire-assertion specs proving Anthropic container.skills + beta headers and OpenAI tools[].environment.skills reach the real serialized request
  • pnpm test:pr green across all affected projects (sherif, knip, docs, eslint, lib, types, build)
  • Full E2E suite green (incl. the previously-broken video-gen after the aimock patch)
  • Docs added (docs/tools/provider-skills.md + adapter cross-links) and the tool-calling agent skill updated

Known limitations / follow-ups

  • Skills + outputSchema together on Anthropic: the structured-output path uses the forced-tool-use workaround (replaces tools with the forced structured_output tool), so the code_execution tool isn't present alongside the schema. Pre-existing design, documented here for awareness.
  • Drop the aimock pnpm patch once @copilotkit/aimock ships multipart video-create parsing.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added Provider Skills support enabling hosted/managed skills to attach to Anthropic's code execution tool and OpenAI's shell tool, configurable via tool options.
    • Expanded OpenAI shell tool to accept environment configuration for skills.
  • Documentation

    • Added comprehensive Provider Skills setup guides for both Anthropic and OpenAI adapters.
    • Updated tool documentation with skill attachment examples and constraints.
  • Deprecations

    • Marked Anthropic's legacy modelOptions.container.skills path as deprecated; use tool-level configuration instead.
  • Dependencies

    • Updated OpenAI SDK to version 6.41.0 across packages.

Add an optional `environment` config to `shellTool()` (ShellToolFactoryConfig)
so hosted provider Skills can ride the OpenAI Responses shell tool, e.g.
`shellTool({ environment: { type: 'container_auto', skills: [...] } })`. The
converter now passes `environment` through to the request.

Bumps the openai SDK to ^6.41.0 (required for the typed shell environment.skills
surface) across ai-openai, openai-base, ai-grok, and ai-groq, with the small
SDK-compat adjustments the bump requires (ComputerUsePreviewTool import; dropped
now-redundant casts in image.ts/video.ts).
… beta headers

Add an optional `{ skills }` to `codeExecutionTool(config, options)`. The adapter
lifts those skills into the request's top-level `container.skills` (preserving any
`container.id`) and attaches the required beta headers via `computeAnthropicBetas`:
`code-execution-2025-08-25` (or `code-execution-2025-05-22` for the legacy
`code_execution_20250522` variant) plus `skills-2025-10-02` when skills are present.
Betas are now applied on both the streaming and structuredOutput request paths.

Skills set via `modelOptions.container.skills` are deprecated in favor of the tool
option. Adds unit tests for the lift, the version-aware betas, the skills/lift
agreement across multi-tool configs, and skill_id validation.
…ltipart

Add wire-assertion E2E for both providers (Anthropic container.skills + beta
headers; OpenAI shell environment.skills) plus the docs page (docs/tools/
provider-skills.md, nav + cross-links) and the tool-calling agent skill section.

The openai 6.41 bump makes videos.create send multipart/form-data, which the
pinned @copilotkit/aimock (1.27.0) only JSON-parses; add a pnpm patch teaching
its video handler to parse multipart (reusing the existing transcription
helpers), and give the video-gen fixture the id/status the flow needs. The same
fix should be upstreamed to @copilotkit/aimock so the patch can be dropped.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4062c034-4141-4f8f-a19d-b8f3ea328318

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds Provider Skills support for both Anthropic and OpenAI, enabling developers to attach hosted/provider-managed skills to execution tools. Anthropic skills are lifted into container.skills with computed beta headers, while OpenAI skills are wired through shellTool environment configuration. The implementation includes type contracts, factory updates with validation, request mapping logic, comprehensive tests, and new E2E validation routes.

Changes

Provider Skills Feature Implementation

Layer / File(s) Summary
Anthropic provider skills: Types, factory, and request mapping
packages/ai-anthropic/src/tools/code-execution-tool.ts, packages/ai-anthropic/src/adapters/text.ts, packages/ai-anthropic/src/text/text-provider-options.ts, packages/ai-anthropic/src/tools/index.ts
Introduces AnthropicContainerSkill and CodeExecutionToolOptions types, extends codeExecutionTool to accept optional skills with validation (max 8, 1–64 character skill_id), adds readCodeExecutionConfig and readCodeExecutionSkills helpers, implements computeAnthropicBetas to include skills-related betas, and lifts skills into container.skills during request mapping while preserving existing container configuration.
Anthropic skills unit and integration tests
packages/ai-anthropic/tests/code-execution-tool.test.ts, packages/ai-anthropic/tests/text.skills.test.ts, packages/ai-anthropic/tests/utils/logger.ts
Validates code execution tool factory behavior with skills (wire format, storage, validation bounds), tests skills lifting and container preservation in request mapping, and verifies beta computation for code-execution, skills, and interleaved-thinking combinations.
OpenAI provider skills: Base and adapter implementation
packages/openai-base/src/tools/shell-tool.ts, packages/ai-openai/src/tools/shell-tool.ts
Adds ShellToolFactoryConfig type for optional environment configuration, updates convertShellToolToAdapterFormat to preserve environment from tool metadata, extends shellTool factory in both openai-base and ai-openai to accept and conditionally wire environment configuration containing skill references.
OpenAI skills unit tests
packages/openai-base/tests/shell-tool.test.ts
Validates shell tool factory default behavior (bare shell tool) and environment passthrough behavior for container_auto with nested skill references.
Documentation and release notes
.changeset/provider-skills.md, docs/adapters/anthropic.md, docs/adapters/openai.md, docs/config.json, docs/tools/provider-skills.md, docs/tools/provider-tools.md, packages/ai/skills/ai-core/tool-calling/SKILL.md
Documents provider skills concept, step-by-step setup for both Anthropic and OpenAI with code examples, deprecation guidance for legacy modelOptions.container.skills, scope limitations, and adds Provider Skills navigation entry.
E2E test infrastructure and validation specs
testing/e2e/src/routes/api.anthropic-skills-wire.ts, testing/e2e/src/routes/api.openai-shell-skills-wire.ts, testing/e2e/tests/anthropic-skills-wire.spec.ts, testing/e2e/tests/openai-shell-skills-wire.spec.ts, testing/e2e/src/routeTree.gen.ts
Creates two test routes /api/anthropic-skills-wire and /api/openai-shell-skills-wire that capture outgoing SDK requests with skills configuration, and Playwright specs that assert correct wire format including beta headers, container structure, and environment fields.
Supporting infrastructure: SDK upgrades, type cleanup, route registration, and test utilities
packages/openai-base/package.json, packages/ai-openai/package.json, packages/ai-grok/package.json, packages/ai-groq/package.json, packages/ai-openai/src/adapters/image.ts, packages/ai-openai/src/adapters/video.ts, packages/openai-base/src/tools/computer-use-tool.ts, testing/e2e/fixtures/video-gen/basic.json, testing/e2e/package.json
Bumps openai SDK from 6.9.1 to 6.41.0 across packages, removes unnecessary type casts in image/video adapters, registers new E2E routes in routeTree, updates video test fixture, and provides silent logger utility for unit tests.

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested reviewers

  • tombeckenham
  • crutchcorn

🐰 Hop hop, the skills are here!
Both Claude and OpenAI can now share,
Provider-managed magic in the sandbox air,
With betas and environments they declare,
A powerful dance beyond compare!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding support for attaching hosted provider skills to code-execution and shell tools for both Anthropic and OpenAI.
Description check ✅ Passed The PR description is comprehensive and well-structured, covering changes, test plan, known limitations, and dependency updates. It follows the repository template with the required sections.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/provider-skills

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

🚀 Changeset Version Preview

5 package(s) bumped directly, 0 bumped as dependents.

🟨 Minor bumps

Package Version Reason
@tanstack/ai-anthropic 0.14.0 → 0.15.0 Changeset
@tanstack/ai-openai 0.13.0 → 0.14.0 Changeset
@tanstack/openai-base 0.7.0 → 0.8.0 Changeset

🟩 Patch bumps

Package Version Reason
@tanstack/ai-grok 0.11.0 → 0.11.1 Changeset
@tanstack/ai-groq 0.4.0 → 0.4.1 Changeset

@socket-security
Copy link
Copy Markdown

socket-security Bot commented Jun 3, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedopenai@​6.41.078100100100100

View full report

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jun 3, 2026

View your CI Pipeline Execution ↗ for commit dfc7b98

Command Status Duration Result
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 1m 15s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-04 09:38:49 UTC

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jun 3, 2026

View your CI Pipeline Execution ↗ for commit e3f5d7f

Command Status Duration Result
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 57s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-03 15:45:37 UTC

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 3, 2026

Open in StackBlitz

@tanstack/ai

npm i https://pkg.pr.new/@tanstack/ai@695

@tanstack/ai-anthropic

npm i https://pkg.pr.new/@tanstack/ai-anthropic@695

@tanstack/ai-client

npm i https://pkg.pr.new/@tanstack/ai-client@695

@tanstack/ai-code-mode

npm i https://pkg.pr.new/@tanstack/ai-code-mode@695

@tanstack/ai-code-mode-skills

npm i https://pkg.pr.new/@tanstack/ai-code-mode-skills@695

@tanstack/ai-devtools-core

npm i https://pkg.pr.new/@tanstack/ai-devtools-core@695

@tanstack/ai-elevenlabs

npm i https://pkg.pr.new/@tanstack/ai-elevenlabs@695

@tanstack/ai-event-client

npm i https://pkg.pr.new/@tanstack/ai-event-client@695

@tanstack/ai-fal

npm i https://pkg.pr.new/@tanstack/ai-fal@695

@tanstack/ai-gemini

npm i https://pkg.pr.new/@tanstack/ai-gemini@695

@tanstack/ai-grok

npm i https://pkg.pr.new/@tanstack/ai-grok@695

@tanstack/ai-groq

npm i https://pkg.pr.new/@tanstack/ai-groq@695

@tanstack/ai-isolate-cloudflare

npm i https://pkg.pr.new/@tanstack/ai-isolate-cloudflare@695

@tanstack/ai-isolate-node

npm i https://pkg.pr.new/@tanstack/ai-isolate-node@695

@tanstack/ai-isolate-quickjs

npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs@695

@tanstack/ai-ollama

npm i https://pkg.pr.new/@tanstack/ai-ollama@695

@tanstack/ai-openai

npm i https://pkg.pr.new/@tanstack/ai-openai@695

@tanstack/ai-openrouter

npm i https://pkg.pr.new/@tanstack/ai-openrouter@695

@tanstack/ai-preact

npm i https://pkg.pr.new/@tanstack/ai-preact@695

@tanstack/ai-react

npm i https://pkg.pr.new/@tanstack/ai-react@695

@tanstack/ai-react-ui

npm i https://pkg.pr.new/@tanstack/ai-react-ui@695

@tanstack/ai-solid

npm i https://pkg.pr.new/@tanstack/ai-solid@695

@tanstack/ai-solid-ui

npm i https://pkg.pr.new/@tanstack/ai-solid-ui@695

@tanstack/ai-svelte

npm i https://pkg.pr.new/@tanstack/ai-svelte@695

@tanstack/ai-utils

npm i https://pkg.pr.new/@tanstack/ai-utils@695

@tanstack/ai-vue

npm i https://pkg.pr.new/@tanstack/ai-vue@695

@tanstack/ai-vue-ui

npm i https://pkg.pr.new/@tanstack/ai-vue-ui@695

@tanstack/openai-base

npm i https://pkg.pr.new/@tanstack/openai-base@695

@tanstack/preact-ai-devtools

npm i https://pkg.pr.new/@tanstack/preact-ai-devtools@695

@tanstack/react-ai-devtools

npm i https://pkg.pr.new/@tanstack/react-ai-devtools@695

@tanstack/solid-ai-devtools

npm i https://pkg.pr.new/@tanstack/solid-ai-devtools@695

commit: dfc7b98

…rop stopgap patch

@copilotkit/aimock now parses multipart/form-data video-create bodies natively
(CopilotKit/aimock#247), so the local pnpm patch is no longer needed. Bump the
e2e dependency to ^1.28.1 (the release carrying that fix) and remove the patch
file + patchedDependencies entry.

Note: CI is expected to be RED until @copilotkit/aimock >=1.28.1 is published —
the lockfile still resolves 1.27.0 and the unpatched mock 400s video-create.
Once the release is out, `pnpm install` refreshes the lockfile to 1.28.1 and the
video-gen E2E goes green.
AlemTuzlak added a commit to CopilotKit/aimock that referenced this pull request Jun 4, 2026
## Release 1.29.0

Cuts the accumulated `[Unreleased]` changes as **1.29.0** (semver minor
— there are `Added` + `Deprecated` entries). Bumps `package.json`
`1.28.0 → 1.29.0` and moves the CHANGELOG `[Unreleased]` section under
`## [1.29.0] - 2026-06-04`.

**Merging to `main` triggers the Release workflow to publish `1.29.0` to
npm** (the workflow publishes when `package.json`'s version isn't yet on
the registry).

### What ships in 1.29.0

**Added**
- `POST /__aimock/reset/fixtures` and `POST /__aimock/reset/journal`
- `aimock-pytest`: `reset_fixtures()` / `reset_journal()`
- Control API reference docs

**Changed**
- `engines.node` lowered to `>=20.15.0`

**Deprecated**
- `POST /__aimock/reset` (alias for `/reset/fixtures`)

**Fixed**
- **Video** — `POST /v1/videos` now parses `multipart/form-data` bodies
(OpenAI SDK ≥6.28 sends video-create as multipart) — #247
- `aimock-pytest` per-fixture option forwarding +
startup-timeout/teardown hardening
- `DELETE /v1/_requests` clears only journal entries (preserves fixture
match-counts)

### Downstream
Unblocks **TanStack/ai#695**, which pins `@copilotkit/aimock: ^1.28.1`
and drops its temporary local video-multipart patch — once 1.29.0 is on
npm, that PR's E2E goes green.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
1.29.0 is published with native multipart/form-data video-create parsing,
satisfying the ^1.28.1 spec. Refreshes the lockfile off the now-removed local
patch; video-gen E2E passes natively against the published mock.
Copy link
Copy Markdown
Contributor

@tombeckenham tombeckenham left a comment

Choose a reason for hiding this comment

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

Nice and clean

@AlemTuzlak AlemTuzlak merged commit 786b3e4 into main Jun 4, 2026
10 checks passed
@AlemTuzlak AlemTuzlak deleted the feat/provider-skills branch June 4, 2026 10:21
@github-actions github-actions Bot mentioned this pull request Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants