Skip to content

feat: tool execution approval for dynamic tools#9518

Merged
lgrammel merged 21 commits intomainfrom
lg/dmOkgcD
Oct 15, 2025
Merged

feat: tool execution approval for dynamic tools#9518
lgrammel merged 21 commits intomainfrom
lg/dmOkgcD

Conversation

@lgrammel
Copy link
Copy Markdown
Collaborator

@lgrammel lgrammel commented Oct 15, 2025

Background

Tool execution approvals were introduced for static tools in #8541 . Dynamic tools need to support tool execution approvals as well, in particular in preparation for provider-executed MCP servers.

Summary

Add tool execution approval support for dynamic tools.

Manual Verification

  • run examples/ai-core/src/generate-text/openai-tool-approval-dynamic-tool.ts
    • with positive approval responses and follow up message
    • with negative approval responses and follow up message
  • run examples/ai-core/src/stream-text/openai-tool-approval-dynamic-tool.ts
    • with positive approval responses and follow up message
    • with negative approval responses and follow up message
  • run UI test next-openai http://localhost:3000/test-tool-approval-dynamic
    • approved with follow up message
    • denied with follow up message
    • multiple approvals in one message

Tasks

  • add generateText example
  • change dynamic tool signatures
  • fix invalid prompt error for generate with negative response and follow up message
  • add streamText example
  • add UI example
  • add approval UI message states to dynamic tool parts
  • process ui stream: parse dynamic tool approvals
  • chat submission
  • ui message validation
  • convert to model messages
  • changeset

Related Issues

Builds on #8541

@lgrammel lgrammel marked this pull request as draft October 15, 2025 07:49
@lgrammel lgrammel changed the title dynamic tool approvals feat: tool execution approval for dynamic tools Oct 15, 2025
lgrammel added a commit that referenced this pull request Oct 15, 2025
…9519)

## Background

When `sendAutomaticallyWhen` is configured and the server responds with
an error, an infinite client-server loop is triggered (see #9384 ).

## Summary

Only resubmit automatically when there is no error.

## Manual Verification

Fix manually verified as part of #9518

## Related Issues

Fixes #9384
vercel-ai-sdk bot pushed a commit that referenced this pull request Oct 15, 2025
…9519)

## Background

When `sendAutomaticallyWhen` is configured and the server responds with
an error, an infinite client-server loop is triggered (see #9384 ).

## Summary

Only resubmit automatically when there is no error.

## Manual Verification

Fix manually verified as part of #9518

## Related Issues

Fixes #9384
@lgrammel lgrammel marked this pull request as ready for review October 15, 2025 12:36
@lgrammel lgrammel merged commit 703459a into main Oct 15, 2025
18 checks passed
@lgrammel lgrammel deleted the lg/dmOkgcD branch October 15, 2025 12:50
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