Availability
AI Studio UI plugins extend the admin dashboard with custom interfaces using WebComponents. Build rich admin panels, custom dashboards, monitoring tools, and specialized management interfaces that integrate seamlessly with the AI Studio platform using the Unified Plugin SDK.
Looking for portal (end-user) pages? See the AI Portal UI Plugins Guide for building pages visible to portal users, not just admins.
Overview
UI plugins enable you to:- Add Custom Pages: Register new routes in the dashboard
- Extend Sidebar: Add sections, links, and navigation
- Serve WebComponents: Use any frontend framework (React, Vue, Lit, etc.)
- Call Service APIs: Access LLMs, tools, datasources, analytics, and more
- Store Plugin Data: Use built-in key-value storage
- Define RPC Methods: Create custom backend endpoints
- Multi-Capability: Combine UI with middleware hooks (PostAuth, Response, Object Hooks, etc.)
Unified SDK Integration
UI plugins use the Unified Plugin SDK (pkg/plugin_sdk) and can combine UI capabilities with other plugin capabilities like PostAuth, Response, or Object Hooks.
Key Features
- BasePlugin: Convenience struct for lifecycle management
- UIProvider: Capability for serving UI assets and RPC methods
- Context Services: Access KV storage, logging, and Studio Services
- Multi-Capability: Implement multiple interfaces in one plugin
- Broker Connection: Automatic Service API access for UI interactions
Example: Multi-Capability Plugin
A single plugin can provide both UI and middleware functionality:Expandable
examples/plugins/studio/llm-rate-limiter-multiphase/ combines UIProvider + PostAuth + Response in one plugin.
##Quick Start
1. Project Structure
2. Create Manifest
server/manifest.json:Expandable
3. Implement Plugin Server
server/main.go:Expandable
4. Create WebComponent
ui/webc/dashboard.js:
Expandable
5. Build and Deploy
Expandable
Manifest Structure
Top-Level Fields
Permissions
Expandable
UI Configuration
Expandable
Available UI Slots
sidebar.section: Add sidebar section with nested itemssidebar.link: Add individual sidebar linksettings.section: Add settings page sectionapp.detail.tab: Add tab to app detail pagellm.detail.tab: Add tab to LLM detail page
RPC Configuration
HandleCall() method.
Service API Access
The Service API provides 100+ gRPC operations accessible via the SDK:LLM Operations
Tool Operations
Plugin Operations
KV Storage Operations
App Operations
Analytics Operations
Multi-Capability Patterns
UI plugins using the unified SDK can implement multiple capabilities in a single plugin, combining dashboard UI with request/response processing, object validation, or other hooks.Combining UI + PostAuth
Create a plugin that both displays data and processes requests:Expandable
Combining UI + Object Hooks
Create a plugin that validates objects and provides an approval dashboard:Expandable
Combining UI + Response
Monitor and modify responses with a dashboard:Expandable
Benefits of Multi-Capability Plugins
- Unified State: Share data structures between UI and middleware
- Single Deployment: One plugin provides multiple features
- Consistent Configuration: Single manifest, config, and initialization
- Simplified Management: Deploy, update, and monitor as one unit
- Rich Dashboards: Display real-time data from middleware hooks
Working Example
Seeexamples/plugins/studio/llm-rate-limiter-multiphase/ for a complete multi-capability plugin that implements:
- PostAuth: Check rate limits before requests
- Response: Update counters after responses
- UI Provider: Dashboard showing rate limit status
Complete Example: Rate Limiting Dashboard
Here’s a complete example showing all features:Manifest
Expandable
RPC Methods
Expandable
Frontend Frameworks
React
Expandable
Vue
Expandable
Best Practices
Security
- Always validate inputs in RPC methods
- Use HTTPS for production deployments
- Sanitize HTML in WebComponents
- Don’t expose sensitive data in frontend
- Use CSP headers in manifest
Performance
- Lazy-load heavy components
- Cache frequently accessed data
- Use KV storage for plugin state
- Minimize Service API calls
- Bundle and minify assets
User Experience
- Show loading states
- Handle errors gracefully
- Provide feedback for actions
- Use consistent UI patterns
- Support dark mode if platform does
Development
- Use TypeScript for type safety
- Add proper error handling
- Log important operations
- Test with different data scenarios
- Document RPC methods
Troubleshooting
Plugin Not Loading
Plugin Not Loading
- Check manifest syntax (valid JSON)
- Verify
plugin_typeis"ai_studio" - Ensure
load_immediatelyistruein plugin registration - Check logs for initialization errors
WebComponent Not Rendering
WebComponent Not Rendering
- Verify asset path is correct (leading
/) - Check browser console for JS errors
- Ensure custom element is defined
- Verify mime types are correct
Service API Calls Failing
Service API Calls Failing
- Check permission scopes in manifest
- Verify SDK is initialized (
ai_studio_sdk.IsInitialized()) - Check context has valid authentication
- Review service API error messages
Assets Not Serving
Assets Not Serving
- Ensure assets are embedded (
//go:embed) - Check
GetAsset()normalizes paths correctly - Verify mime type detection
- Check asset paths in manifest match filesystem