diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index ad77ed9537..b6c9d27683 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -1964,6 +1964,8 @@ USER_PERMISSIONS_FEATURES_API_KEYS = os.getenv('USER_PERMISSIONS_FEATURES_API_KE USER_PERMISSIONS_FEATURES_MEMORIES = os.getenv('USER_PERMISSIONS_FEATURES_MEMORIES', 'True').lower() == 'true' +USER_PERMISSIONS_FEATURES_SUBAGENTS = os.getenv('USER_PERMISSIONS_FEATURES_SUBAGENTS', 'True').lower() == 'true' + USER_PERMISSIONS_FEATURES_AUTOMATIONS = os.getenv('USER_PERMISSIONS_FEATURES_AUTOMATIONS', 'False').lower() == 'true' USER_PERMISSIONS_FEATURES_CALENDAR = os.getenv('USER_PERMISSIONS_FEATURES_CALENDAR', 'True').lower() == 'true' @@ -2052,6 +2054,7 @@ DEFAULT_USER_PERMISSIONS = { 'image_generation': USER_PERMISSIONS_FEATURES_IMAGE_GENERATION, 'code_interpreter': USER_PERMISSIONS_FEATURES_CODE_INTERPRETER, 'memories': USER_PERMISSIONS_FEATURES_MEMORIES, + 'subagents': USER_PERMISSIONS_FEATURES_SUBAGENTS, 'automations': USER_PERMISSIONS_FEATURES_AUTOMATIONS, 'calendar': USER_PERMISSIONS_FEATURES_CALENDAR, 'webhooks': USER_PERMISSIONS_FEATURES_USER_WEBHOOKS, diff --git a/backend/open_webui/routers/users.py b/backend/open_webui/routers/users.py index 7c810d7b92..1c55b77f01 100644 --- a/backend/open_webui/routers/users.py +++ b/backend/open_webui/routers/users.py @@ -265,6 +265,7 @@ class FeaturesPermissions(BaseModel): image_generation: bool = True code_interpreter: bool = True memories: bool = True + subagents: bool = True automations: bool = False calendar: bool = True webhooks: bool = False diff --git a/backend/open_webui/utils/tools.py b/backend/open_webui/utils/tools.py index 37c4aefa1e..55b594876c 100644 --- a/backend/open_webui/utils/tools.py +++ b/backend/open_webui/utils/tools.py @@ -798,6 +798,7 @@ async def get_builtin_tools( and getattr(request.state, 'internal', False) is not True and getattr(request.state, 'direct', False) is not True and not is_temporary_chat_id(metadata.get('chat_id')) + and await has_user_permission('subagents') ): builtin_functions.extend([delegate_task, timer]) diff --git a/src/lib/components/admin/Users/Groups/Permissions.svelte b/src/lib/components/admin/Users/Groups/Permissions.svelte index b5255f6b20..336c7fbd9d 100644 --- a/src/lib/components/admin/Users/Groups/Permissions.svelte +++ b/src/lib/components/admin/Users/Groups/Permissions.svelte @@ -1182,6 +1182,24 @@ {/if} + {#if $config?.features?.enable_subagents} +
+
+
+ {$i18n.t('Sub-agents')} +
+ +
+ {#if defaultPermissions?.features?.subagents && !permissions.features.subagents} +
+
+ {$i18n.t('This is a default user permission and will remain enabled.')} +
+
+ {/if} +
+ {/if} + {#if $config?.features?.enable_automations}