Availability
Studio Services are available to plugins that run in AI Studio.
Studio Services give a plugin access to the management API of AI Studio. They are available when
ctx.Runtime == plugin_sdk.RuntimeStudio. Call them through ctx.Services.Studio(), or call the functions of the ai_studio_sdk package. Each call needs a scope in the plugin manifest. Refer to Scopes. For RAG and datasource calls, refer to RAG and Datasource Services.
LLM Operations
Requires:llms.read scope to list and get LLMs. llms.proxy scope to call an LLM.
List LLMs
Expandable
Get LLM
Call LLM (Streaming)
Requires:llms.proxy scope
Expandable
Call LLM (Simple)
Convenience method for a non-streaming call. It returns the content of the response.Get LLMs Count
Model Prices
Studio plugins can list model prices from the control plane. Requires:pricing.read scope.
Tool Operations
Requires:tools.read scope to list and get tools.
List Tools
Get Tool by ID
Execute Tool
Requires:tools.call scope.
ExecuteTool runs an operation of a tool for an agent plugin. AI Studio adds the authentication of the tool to the call. The tool must belong to the App in the agent configuration of the plugin. Otherwise the call returns PermissionDenied.
The ai_studio_sdk package has no wrapper function for this call. Call the ExecuteTool RPC of the management service with an ExecuteToolRequest:
The
ExecuteToolResponse has Success, ResultJson, ErrorMessage, and the HTTP StatusCode of the upstream call.
Plugin Operations
Requires:plugins.read scope, except for calls on the own plugin ID of the caller. Refer to Plugin Scopes.
List Plugins
Get Plugin by ID
Get Plugins Count
GetPluginsCount calls ListPlugins for one row. A plugin without the plugins.read scope still gets the count, with no plugin rows. To warm up the broker connection, use GetLicenseInfo, which needs no scope.
App Operations
Requires:apps.read scope to list and get Apps. apps.write scope to change App metadata.
List Apps
List Apps with Filters
ListAppsOptions supports filtering by:
IsActive *bool: Filter by active/inactive statusNamespace string: Filter by namespace (empty = all namespaces)UserID *uint32: Filter by owner user ID
ListApps(ctx, page, limit) function is still available for backward compatibility and returns all apps without filtering.
Get App by ID
Patch App Metadata
UpdateAppWithMetadata for concurrent modifications since it uses database-level transactions with row locking.
Requires: apps.write scope. The key governance_flags is reserved and returns InvalidArgument.
Set a metadata key (value must be JSON-encoded):
Notifications
Plugins can create in-app notifications. AI Studio shows them in the notification bell, and also sends them by email when SMTP is configured. A notification can go to all administrators, to one user, or to both. Requires:notifications.write scope. Studio only.
Resource Type Registration (Runtime)
AI Studio registers the resource types in the manifest when the plugin loads. If the plugin defines its types at runtime (for example, administrators define them inside the plugin), register the types withSyncResourceTypes.
Requires: resource-types.manage scope. Studio only.
ListResourceInstances method for each type. Do not hold locks that this method needs. For more information, refer to Resource Provider Plugins.
Permission Resources (Runtime)
Every plugin with an admin UI has a row in the role editor:plugin:<manifest id>, with read, write, and execute. Declare sub-resources that you know in advance in the rbac block of the manifest. Refer to Permissions (RBAC) Block. Register resources that exist only at runtime with RegisterPermissionResources.
Requires: rbac.register scope. Studio only.
plugins:execute have every plugin permission. Grants for each plugin limit access further.
To check a permission in an RPC handler, implement UserAwareRPCHandler and use the user context:
Can also accepts platform permissions, for example user.Can("llms:read"). AI Studio gives the plugin the permissions of the caller, with the plugin’s own grants included. For this reason, users with plugins:execute and full administrators pass the check. On a host that does not support permissions for each plugin, Can uses IsAdmin. AI Studio checks the admin RPC methods in the rbac.rpc_methods block of the manifest before the call reaches the plugin. Methods that are not in the list need the base write permission of the plugin.
Team Access to Resource Instances (Runtime)
A plugin can control which Teams see its resource instances. By default, AI Studio grants every active instance of a plugin resource type to the Default Team. Every user is a member of this Team, so every user sees the instance in the AI Portal. For a type whose instances must reach only specific Teams, register the type withDefaultAccess: plugin_sdk.DefaultAccessExplicit (manifest: "default_access": "explicit"). The plugin then manages the grants itself.
Requires: resource-access.manage scope. Studio only. Each call works only for resource types that this plugin registered. Other calls return PermissionDenied.
- These grants are the same grants that the Teams page edits. The calls read the changes that an administrator makes on the Teams page.
- An instance must be active (
ResourceInstance.IsActive) to appear anywhere. - The Community Edition has no Team segmentation. It ignores
explicit, and instances always join the Default Team. - Active instances of
autotypes (the default) join the Default Team at registration. They also join it when the plugin reports a change withNotifyResourceInstanceChanged.
Governed Metadata (Enterprise)
Studio plugins can read, validate, write, and delete the governed metadata of LLMs, tools, data sources, and plugin resource types that support metadata. For schemas, enforcement, and the compliance report, refer to Governed Metadata.- Object types are
llm,tool,datasource, orplugin_resource:<plugin_id>:<slug>. For its own resource types, a plugin can useplugin_resource:self:<slug>(plugin_sdk.SelfResourceObjectType), and AI Studio resolves it. - Object IDs are the numeric ID as a string, or the resource instance ID.
- Scopes:
metadata.read(get, resolve schema, validate, and read the change history) andmetadata.write(set and delete). Declare them underpermissions.servicesin the manifest. - In the Community Edition, writes fail with
FailedPrecondition.
- If the
governed_metadataobject hook of another plugin rejects a write, the call returnsPermissionDenied. - AI Studio audits every successful write or delete with the source
plugin:<id>, and emitssystem.governed_metadata.updatedorsystem.governed_metadata.deleted. - If you use
plugin_resource:self:without a plugin context, the call returnsInvalidArgument. - In the Community Edition,
ListObjectMetadataAuditreturns an empty list.
Governance Reads (Enterprise)
Governance plugins can read the parts of AI Studio objects and their audit records. For example, an asset catalog can map which agents depend on which LLMs, tools, and MCP servers. Studio only.ListAuditRecordsuses the resource type names of the audit trail:llm,tool,datasource,mcp_server,model_router,semantic_router, andapp.- The Community Edition returns
Unimplementedfor the audit trail and routers. A node that does not store audit records in the database returnsFailedPrecondition. GetAppandListApps(apps.read) return every binding of the App:LlmIds,ToolIds,DatasourceIds,McpServerIds,ModelRouterIds,SemanticRouterIds, andPluginResources({PluginId, ResourceTypeSlug, InstanceId}).
App Lifecycle Control
A governance plugin can suspend or reactivate an App, and set flags on it. For example, an asset catalog can suspend the App of an agent when its review lapses. The plugin cannot change what the App can access. Bindings, credentials, and budgets needapps.write, and a governance plugin must not ask for that scope.
Requires: apps.lifecycle scope. Studio only.
- If
isActiveisnil, the App state does not change. You can send only flags. - AI Studio stores flags on the App under
metadata.governance_flags.<name>, as{value, reason, set_by: "plugin:<id>", at}. The App details page shows them. - A call can set a maximum of 16 flags. Flag names can have a maximum of 64 characters, without spaces. Values can have a maximum of 256 characters.
- The
governance_flagskey is reserved. App edits keep the stored flags, App creation drops a suppliedgovernance_flags, andPatchAppMetadatarefuses the key withInvalidArgument. - AI Studio writes each change to the audit trail as
Plugin Update App Governance State, with the reason. - A state change emits
system.app.updated. A plugin that subscribes to this topic also receives its own changes, so its handler must be idempotent.
Schedule Management
Scope Required:scheduler.manage
Available in: AI Studio only
Plugins can programmatically manage their scheduled tasks using the Schedule Management API. This complements manifest-based schedule declarations.
Schedule Types
Schedules can be created in two ways:- Manifest Schedules: Declared in
plugin.manifest.json, auto-registered when plugin loads - API Schedules: Created programmatically via SDK during
Initialize()or at runtime
ExecuteScheduledTask() capability method.
CreateSchedule
Create a new schedule for your plugin:*mgmtpb.ScheduleInfo with schedule details
Errors: AlreadyExists if schedule_id already exists for this plugin
GetSchedule
Retrieve schedule details by manifest schedule ID:*mgmtpb.ScheduleInfo
Errors: NotFound if schedule doesn’t exist
ListSchedules
Get all schedules for your plugin:[]*mgmtpb.ScheduleInfo array
UpdateSchedule
Update schedule fields (all fields optional):*mgmtpb.ScheduleInfo with updated schedule
Errors: NotFound if schedule doesn’t exist
DeleteSchedule
Remove a schedule:NotFound if schedule doesn’t exist
Complete Example
Expandable
Manifest vs API Schedules
Use Manifest When:- Schedule is core to plugin functionality
- Configuration is static
- Want schedules registered automatically
- Schedules are dynamic (based on external data)
- Need runtime modification
- Want conditional schedule creation
- Building schedule management UI
Data Types
Theai_studio_sdk functions return the protobuf types of the ai_studio_management package (mgmtpb in the examples). The main fields are: