Skip to content

fix: Vercel AI SDK parallel tool results + Anthropic base URL hint#55

Merged
luokerenx4 merged 2 commits intomasterfrom
dev
Mar 14, 2026
Merged

fix: Vercel AI SDK parallel tool results + Anthropic base URL hint#55
luokerenx4 merged 2 commits intomasterfrom
dev

Conversation

@luokerenx4
Copy link
Contributor

Summary

  • fix(pipeline): batch parallel tool results into a single user message — resolves MissingToolResultsError when Vercel AI SDK backend uses parallel tool calls (issue 使用Vercel AI SDK 的兼容api遇到问题 #50)
  • fix(ui): add inline hint in channel config modal that Anthropic-compatible base URLs must end with /v1 when using Vercel AI SDK backend

Root Cause

@ai-sdk/anthropic constructs request URLs as ${baseURL}/messages (assuming /v1 is already in the base URL), whereas the Anthropic SDK appends /v1/messages automatically. This means the same base URL works with Agent SDK but returns 404 with Vercel AI SDK.

Test plan

  • pnpm test — A16 parallel tool call persistence test added
  • Verify parallel tool calls no longer throw MissingToolResultsError with Vercel AI SDK
  • Verify Anthropic-compatible API (e.g. MiniMax) works with Vercel AI SDK after updating base URL to include /v1

🤖 Generated with Claude Code

luokerenx4 and others added 2 commits March 14, 2026 10:57
Parallel tool calls (multiple tool_use in one step) previously flushed
each tool_result as a separate user message. On the next turn,
toModelMessages() would reconstruct a history where the assistant had
N tool calls but each result was its own message, causing Vercel AI SDK
to throw MissingToolResultsError.

Fix: accumulate tool results and only flush when the next round begins
(new tool_use or text event), so all results land in one user message.

Adds A16 (persistence) and parallel tool call test (agent.spec) to pin
the correct behaviour.

Fixes #50

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ai-sdk/anthropic constructs request URLs as `${baseURL}/messages`,
so the baseURL must already include /v1 — unlike the Anthropic SDK
which appends /v1 automatically. Added an inline hint in the channel
config modal when the anthropic provider is selected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@luokerenx4 luokerenx4 merged commit 50ecabc into master Mar 14, 2026
2 checks passed
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.

1 participant