Skip to content

Fix AI Gateway ignoring ToolSelection - #365

Merged
anbuzin merged 1 commit into
mainfrom
fix-gateway-tool-selection
Nov 18, 2026
Merged

anbuzin merged 1 commit into
mainfrom
fix-gateway-tool-selection

Conversation

@anbuzin

@anbuzin anbuzin commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

ToolSelection didn't do anything on the gateway. We sent the subset as activeTools, but that's a generateText option in the AI SDK, not part of the v3/v4 protocol, so the gateway ignores it and the model still sees every tool. The AI SDK filters the tools itself before the request, so now we do the same: only the selected tools go out, and activeTools is gone.

Checked against the live gateway with a get_weather-only subset and a prompt asking for the time: it used to call get_time, now it calls get_weather.

Found while looking into #363.

The Gateway ignores `activeTools`, so a tool subset did not limit the tools. Send only the selected tools and stop sending `activeTools`.
@anbuzin anbuzin added the fix Bug fix label Nov 17, 2026
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ai-python Ready Ready Preview, v0 Nov 17, 2026 6:05pm UTC

@anbuzin
anbuzin merged commit c877bb9 into main Nov 18, 2026
14 checks passed
@anbuzin
anbuzin deleted the fix-gateway-tool-selection branch November 18, 2026 00:22

This branch was successfully deployed

1 active deployment
Preview — 1c9df38c Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants