Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: interruptible tool handler functions #992

Open
benjamincburns opened this issue Mar 14, 2025 · 0 comments
Open

Feature: interruptible tool handler functions #992

benjamincburns opened this issue Mar 14, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@benjamincburns
Copy link
Collaborator

Per #975, there are way too many complex concepts to understand if you want to implement a human-in-the-loop process for approving tool calls, especially in the case when you want to allow parallel tool calls and execute all approved tool calls (as opposed to a denial of one call blocking execution of all parallel calls on the AIMessage).

It would be so much nicer if user code could simply call interrupt from within tool handler functions. Doing this today requires extra steps (e.g. fanning out individual tool calls to ToolNode), as otherwise you'll repeat the execution of all previously-approved tool calls on every resume.

A better approach (credit to @hinthornw for the idea) would be if within ToolNode we wrapped calls to tool handler functions with the task decorator from the functional API. This would allow individual tool handlers to interrupt and resume without re-executing other handlers that are running in parallel.

One caveat, however: task currently relies on the node:async_hooks module for AsyncLocalStorage, which isn't available in browser or react native environments. We'll need to address that prior to implementing this feature.

@benjamincburns benjamincburns added the enhancement New feature or request label Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant