AI-Generated Placeholder Documentation
This documentation page has been automatically generated by a Large Language Model (LLM) and serves as placeholder content. The information provided here may be incomplete, inaccurate, or subject to change.
For accurate and complete information, please refer to the Vanna source code on GitHub.
UI Feature Flags
Control which UI features are visible to which users through group-based access control.
UiFeatures Configuration
UI features use the same permission model as tools - group-based access control:
from vanna.core.agent import AgentConfig, UiFeatures
config = AgentConfig(
ui_features=UiFeatures(
feature_group_access={
'tool_names': ['admin', 'developer'],
'tool_arguments': ['admin'],
'tool_error': ['admin', 'support'],
'tool_invocation_message_in_chat': [] # All users
}
)
)
agent = Agent(
llm_service=llm,
sql_runner=sql_runner,
config=config
) Built-in UI Features
tool_names
Shows the names of tools when theyβre invoked.
# Only admins and developers see tool names
'tool_names': ['admin', 'developer']
# All users see tool names
'tool_names': [] tool_arguments
Displays the arguments passed to tools.
# Only admins see tool arguments
'tool_arguments': ['admin'] Privacy consideration: Tool arguments may contain sensitive user data.
tool_error
Shows detailed error messages when tools fail.
# Admins and support see detailed errors
'tool_error': ['admin', 'support']
# Other users see generic "something went wrong" message tool_invocation_message_in_chat
Shows a message in the chat when tools are invoked.
# Everyone sees tool invocation messages
'tool_invocation_message_in_chat': []
# Only admins see them
'tool_invocation_message_in_chat': ['admin'] Default UI Features
Vanna provides sensible defaults:
DEFAULT_UI_FEATURES = {
'tool_names': ['admin', 'user'],
'tool_arguments': ['admin'],
'tool_error': ['admin'],
'tool_invocation_message_in_chat': ['admin'],
} Custom UI Features
Register custom UI features for your application:
ui_features = UiFeatures()
# Register a custom feature
ui_features.register_feature(
name='export_data',
access_groups=['admin', 'analyst']
)
ui_features.register_feature(
name='advanced_filters',
access_groups=['power_user']
)
config = AgentConfig(ui_features=ui_features) Checking Feature Access
The UI can check if a user has access to a feature:
from vanna.core.user import User
user = User(
id="123",
username="alice",
group_memberships=['user', 'analyst']
)
# Check if user can access a feature
can_export = config.ui_features.can_user_access_feature('export_data', user)
# Returns True (user is in 'analyst' group)
can_see_errors = config.ui_features.can_user_access_feature('tool_error', user)
# Returns False (user not in 'admin' group) Use Cases
Progressive Disclosure
Show advanced features only to power users:
feature_group_access={
'sql_editor': ['developer', 'data_analyst'],
'raw_json_view': ['developer'],
'query_explain': ['developer', 'data_analyst'],
'export_csv': [], # Everyone
'export_excel': ['premium_user']
} Debug Mode
Show debug information to developers:
feature_group_access={
'tool_names': ['developer'],
'tool_arguments': ['developer'],
'tool_error': ['developer'],
'execution_time': ['developer'],
'llm_tokens_used': ['developer']
} Role-Based UI
Different experiences for different roles:
feature_group_access={
# Analysts see SQL
'sql_editor': ['analyst'],
'query_history': ['analyst'],
# Executives see insights
'executive_summary': ['executive'],
'trend_analysis': ['executive'],
# Everyone sees charts
'charts': [],
'data_export': []
} Frontend Integration
In your Svelte/React frontend, check feature access:
// Svelte example
<script>
import { page } from '$app/stores';
$: user = $page.data.user;
$: uiFeatures = $page.data.uiFeatures;
$: canSeeToolArgs = uiFeatures.tool_arguments.includes(user.group);
</script>
{#if canSeeToolArgs}
<div class="tool-arguments">
{JSON.stringify(toolArgs)}
</div>
{/if} Server-Side Enforcement
The server enforces feature access when returning responses:
# In your chat handler
response = await agent.chat(message, user)
# Features are filtered based on user's groups
# The UI receives only what the user is allowed to see Audit Logging
Track UI feature access checks:
config = AgentConfig(
ui_features=ui_features,
audit_config=AuditConfig(
log_ui_feature_checks=True # Log feature access attempts
)
) Best Practices
- Empty list = accessible to all - Use
[]for public features - Principle of least privilege - Only grant access when needed
- Group-based not user-based - Use groups for easier management
- Document custom features - Keep a registry of custom features
- Test with different user types - Verify access controls work
- Consider privacy - Donβt expose sensitive data through UI features