Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
Target branch: Please verify that the pull request targets the dev branch.
Description: Provide a concise description of the changes made in this pull request.
Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
Testing: Have you written and run sufficient tests to validate the changes?
Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
BREAKING CHANGE: Significant changes that may affect compatibility
build: Changes that affect the build system or external dependencies
ci: Changes to our continuous integration processes or workflows
chore: Refactor, cleanup, or other non-functional code changes
docs: Documentation update or addition
feat: Introduces a new feature or enhancement to the codebase
fix: Bug fix or error correction
i18n: Internationalization or localization changes
perf: Performance improvement
refactor: Code restructuring for better maintainability, readability, or scalability
style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
test: Adding missing tests or correcting existing tests
WIP: Work in progress, a temporary label for incomplete or ongoing work
Changelog Entry
Description
This pull request implements a comprehensive tool approval system that allows users to control when and how AI tools are executed during conversations. The system provides both per-chat and global configuration options, with a user-friendly interface that includes real-time notifications, approval modals, and visual indicators for auto-approval status.
Added
Tool Approval Modal: Interactive modal interface for approving or denying individual tool executions with detailed tool information and parameters
Auto-Approval Badge: Visual indicator in chat input showing when auto-approval is enabled for the current chat, with toggle functionality
WebSocket Communication Layer: Real-time bidirectional communication between frontend and backend for tool approval requests and responses
Per-Chat Auto-Approval Settings: Individual chat-level configuration to automatically approve all tool executions
Global Tool Approval Toggle: Admin-level setting to enable/disable the tool approval system across the entire instance
Internationalization Support: Multi-language support for all tool approval UI elements and messages
Cross-Tab Coordination: Browser-level coordination to handle tool approvals across multiple open tabs
Event-Driven Architecture: Custom event system for real-time communication between UI components
Changed
Tool Execution Flow: Modified to include approval step before tool execution, with proper error handling and user feedback
Database Schema: Extended to support per-chat auto-approval preferences storage
WebSocket Protocol: Enhanced to handle tool approval message types and coordination
Frontend State Management: Improved reactive state handling for approval status across components
Deprecated
N/A
Removed
N/A
Fixed
N/A
Security
Tool Execution Control: Enhanced security by requiring explicit user approval before executing potentially sensitive tools
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/16913
**Author:** [@Barbaronno](https://github.com/Barbaronno)
**Created:** 8/26/2025
**Status:** 🔄 Open
**Base:** `dev` ← **Head:** `feat--human-in-the-loop`
---
### 📝 Commits (10+)
- [`259c6cd`](https://github.com/open-webui/open-webui/commit/259c6cda69b5db3c5e3c7c82c0c050d0c6e28911) Add ENABLE_TOOL_APPROVAL configuration setting
- [`c2f27ad`](https://github.com/open-webui/open-webui/commit/c2f27ad8a41963ac12641a1250dce47d1d54c010) Add ENABLE_TOOL_APPROVAL to main.py imports and app state config
- [`29ff402`](https://github.com/open-webui/open-webui/commit/29ff4023554635d501f30c0cb57e63de3d04ed83) Add ENABLE_TOOL_APPROVAL to admin config endpoints
- [`815c342`](https://github.com/open-webui/open-webui/commit/815c3422ae4f02087a6fe76ffb0f39964112c166) Add tool approval socket handlers for real-time approval management
- [`fe452ff`](https://github.com/open-webui/open-webui/commit/fe452fff5545c703caf926d7dc4dc7b01df05acb) Implement comprehensive tool approval system for native and default tool calls
- [`79585c6`](https://github.com/open-webui/open-webui/commit/79585c6f5508eeaa35ebbbbfa8d265cfefd07145) Add ToolApprovalManager for human-in-the-loop tool execution control
- [`e17058c`](https://github.com/open-webui/open-webui/commit/e17058c5f05c9ae0d3dfe1644bbf62e1d16d5519) Add Global Tool Approval toggle to admin settings UI
- [`a86faae`](https://github.com/open-webui/open-webui/commit/a86faae6be416743bae2ac900f5856357647f5a6) Integrate tool approval system into chat component
- [`743759b`](https://github.com/open-webui/open-webui/commit/743759bfee20d3fd68ac486376b0add62c0537f3) Add auto-approval status display and controls to message input
- [`9244502`](https://github.com/open-webui/open-webui/commit/92445021d64e95c60d391550a92c8828a8f93803) Add ToolApprovalModal component for human-in-the-loop tool execution
### 📊 Changes
**14 files changed** (+1842 additions, -682 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/config.py` (+6 -0)
📝 `backend/open_webui/main.py` (+2 -0)
📝 `backend/open_webui/routers/auths.py` (+4 -0)
📝 `backend/open_webui/socket/main.py` (+107 -0)
📝 `backend/open_webui/utils/middleware.py` (+256 -0)
➕ `backend/open_webui/utils/tool_approval.py` (+122 -0)
📝 `src/lib/components/admin/Settings/General.svelte` (+8 -0)
📝 `src/lib/components/chat/Chat.svelte` (+9 -0)
📝 `src/lib/components/chat/MessageInput.svelte` (+717 -682)
➕ `src/lib/components/chat/ToolApprovalModal.svelte` (+238 -0)
➕ `src/lib/stores/toolApproval.ts` (+224 -0)
📝 `src/lib/types/index.ts` (+30 -0)
➕ `src/lib/utils/toolApprovalChannel.ts` (+80 -0)
📝 `src/routes/+layout.svelte` (+39 -0)
</details>
### 📄 Description
# Pull Request Checklist
### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request.
**Before submitting, make sure you've checked the following:**
- [x] **Target branch:** Please verify that the pull request targets the `dev` branch.
- [x] **Description:** Provide a concise description of the changes made in this pull request.
- [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description.
- [x] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources?
- [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation?
- [x] **Testing:** Have you written and run sufficient tests to validate the changes?
- [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
- [x] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following:
- **BREAKING CHANGE**: Significant changes that may affect compatibility
- **build**: Changes that affect the build system or external dependencies
- **ci**: Changes to our continuous integration processes or workflows
- **chore**: Refactor, cleanup, or other non-functional code changes
- **docs**: Documentation update or addition
- **feat**: Introduces a new feature or enhancement to the codebase
- **fix**: Bug fix or error correction
- **i18n**: Internationalization or localization changes
- **perf**: Performance improvement
- **refactor**: Code restructuring for better maintainability, readability, or scalability
- **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
- **test**: Adding missing tests or correcting existing tests
- **WIP**: Work in progress, a temporary label for incomplete or ongoing work
# Changelog Entry
### Description
This pull request implements a comprehensive tool approval system that allows users to control when and how AI tools are executed during conversations. The system provides both per-chat and global configuration options, with a user-friendly interface that includes real-time notifications, approval modals, and visual indicators for auto-approval status.
### Added
- Tool Approval Modal: Interactive modal interface for approving or denying individual tool executions with detailed tool information and parameters
- Auto-Approval Badge: Visual indicator in chat input showing when auto-approval is enabled for the current chat, with toggle functionality
- WebSocket Communication Layer: Real-time bidirectional communication between frontend and backend for tool approval requests and responses
- Per-Chat Auto-Approval Settings: Individual chat-level configuration to automatically approve all tool executions
- Global Tool Approval Toggle: Admin-level setting to enable/disable the tool approval system across the entire instance
- Internationalization Support: Multi-language support for all tool approval UI elements and messages
- Cross-Tab Coordination: Browser-level coordination to handle tool approvals across multiple open tabs
- Event-Driven Architecture: Custom event system for real-time communication between UI components
### Changed
- Tool Execution Flow: Modified to include approval step before tool execution, with proper error handling and user feedback
- Database Schema: Extended to support per-chat auto-approval preferences storage
- WebSocket Protocol: Enhanced to handle tool approval message types and coordination
- Frontend State Management: Improved reactive state handling for approval status across components
### Deprecated
- N/A
### Removed
- N/A
### Fixed
- N/A
### Security
- Tool Execution Control: Enhanced security by requiring explicit user approval before executing potentially sensitive tools
### Breaking Changes
- N/A
---
### Additional Information
- Documentation ready to be merged: [Human in the loop docs](https://barbaronno.github.io/docs/features/human%20in%20the%20loop/)
- Open discussion here: [Discussion 16701](https://github.com/open-webui/open-webui/discussions/16701)
### Screenshots or Videos
<img width="1604" height="988" alt="image" src="https://github.com/user-attachments/assets/2df2fe6b-b5b9-4c55-850a-3a383edc2c50" />
<img width="2265" height="1226" alt="image" src="https://github.com/user-attachments/assets/ea9631c4-03ad-4942-b021-aca53df0e393" />
[youtube - demo video](https://www.youtube.com/watch?v=F-IUOZrHj68&ab_channel=Barbaronno)
### Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/16913
Author: @Barbaronno
Created: 8/26/2025
Status: 🔄 Open
Base:
dev← Head:feat--human-in-the-loop📝 Commits (10+)
259c6cdAdd ENABLE_TOOL_APPROVAL configuration settingc2f27adAdd ENABLE_TOOL_APPROVAL to main.py imports and app state config29ff402Add ENABLE_TOOL_APPROVAL to admin config endpoints815c342Add tool approval socket handlers for real-time approval managementfe452ffImplement comprehensive tool approval system for native and default tool calls79585c6Add ToolApprovalManager for human-in-the-loop tool execution controle17058cAdd Global Tool Approval toggle to admin settings UIa86faaeIntegrate tool approval system into chat component743759bAdd auto-approval status display and controls to message input9244502Add ToolApprovalModal component for human-in-the-loop tool execution📊 Changes
14 files changed (+1842 additions, -682 deletions)
View changed files
📝
backend/open_webui/config.py(+6 -0)📝
backend/open_webui/main.py(+2 -0)📝
backend/open_webui/routers/auths.py(+4 -0)📝
backend/open_webui/socket/main.py(+107 -0)📝
backend/open_webui/utils/middleware.py(+256 -0)➕
backend/open_webui/utils/tool_approval.py(+122 -0)📝
src/lib/components/admin/Settings/General.svelte(+8 -0)📝
src/lib/components/chat/Chat.svelte(+9 -0)📝
src/lib/components/chat/MessageInput.svelte(+717 -682)➕
src/lib/components/chat/ToolApprovalModal.svelte(+238 -0)➕
src/lib/stores/toolApproval.ts(+224 -0)📝
src/lib/types/index.ts(+30 -0)➕
src/lib/utils/toolApprovalChannel.ts(+80 -0)📝
src/routes/+layout.svelte(+39 -0)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
This pull request implements a comprehensive tool approval system that allows users to control when and how AI tools are executed during conversations. The system provides both per-chat and global configuration options, with a user-friendly interface that includes real-time notifications, approval modals, and visual indicators for auto-approval status.
Added
Changed
Deprecated
Removed
Fixed
Security
Breaking Changes
Additional Information
Screenshots or Videos
youtube - demo video
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.