Skip to content

Ask before every tool call in the web chat - #119

Open
arefbehboudi wants to merge 6 commits into
mainfrom
feature/tool-approval
Open

arefbehboudi wants to merge 6 commits into
mainfrom
feature/tool-approval

Conversation

@arefbehboudi

Copy link
Copy Markdown
Collaborator

Every tool call now needs the owner's confirmation. The turn parks with Spring AI's tool call confirmation and the Session Extensions turn advisor; the web chat shows the pending call with Allow and Deny and resumes the turn. A parked turn survives a restart. Where nobody can be asked (messaging channels, scheduled tasks, Vaadin) the calls are denied right away.

Part of #100.

Every tool call now needs the owner's confirmation. The turn parks with
Spring AI's tool call confirmation and the Session Extensions turn advisor;
the web chat shows the pending call with Allow and Deny and resumes the turn.
A parked turn survives a restart. Where nobody can be asked (messaging
channels, scheduled tasks, Vaadin) the calls are denied right away.

Part of #100.
agent.approval.allow lists the tools that run without the owner's
confirmation (read-only tools by default) and agent.approval.deny the
tools that never run. Every other tool still asks in the web chat and is
denied where nobody can be asked. Unknown names in either list are logged
at startup.

Part of #100.
A pending tool call in the web chat can now be allowed or denied for good.
The decision is stored as a grant in the sessions database and applies
everywhere, including messaging channels and scheduled tasks. Grants are
listed on the settings page and can be revoked there.

Part of #100.
In a private chat with the owner (Telegram, Discord, WhatsApp, Teams), a
tool call that needs confirmation now sends a request with /approve_<id>
and /deny_<id> commands, and the turn resumes in the same chat. The id is
derived from the tool call, so it works after a restart. Group chats and
server channels still deny right away.

Part of #100.
ToolGrants returned the clock's time but stored it in a TIMESTAMP column,
which keeps microseconds. Where the clock has nanoseconds (Linux), a grant
read back differed from the one returned. Every time it stores is now cut
to milliseconds, so both are equal.

Part of #100.
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