Skip to main content

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

Alternative (direct SDK call):
Example:
Expandable

Get LLM

Alternative (direct SDK call):

Call LLM (Streaming)

Requires: llms.proxy scope
Example:
Expandable

Call LLM (Simple)

Convenience method for a non-streaming call. It returns the content of the response.
Example:

Get LLMs Count

Example:

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

Example:

Get Tool by ID

Example:

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

Example:

Get Plugin by ID

Example:

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.
Example:

App Operations

Requires: apps.read scope to list and get Apps. apps.write scope to change App metadata.

List Apps

Example:

List Apps with Filters

ListAppsOptions supports filtering by:
  • IsActive *bool: Filter by active/inactive status
  • Namespace string: Filter by namespace (empty = all namespaces)
  • UserID *uint32: Filter by owner user ID
Example: list only the current user’s apps:
Example: list active apps in a namespace:
The original ListApps(ctx, page, limit) function is still available for backward compatibility and returns all apps without filtering.

Get App by ID

Example:

Patch App Metadata

Atomically updates a single metadata key on an app without requiring a full app update. This is safer than 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):
Set complex values:
Delete a metadata key:
Via the plugin_sdk interface:

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 with SyncResourceTypes. Requires: resource-types.manage scope. Studio only.
AI Studio takes the plugin ID from the authenticated connection, so a plugin can manage only its own types. During the call, AI Studio calls your 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.
The new rows appear under the plugin in the role editor immediately. AI Studio also updates the computed system roles (Editor, Viewer, and Auditor). Administrators and users with 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 with DefaultAccess: 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 auto types (the default) join the Default Team at registration. They also join it when the plugin reports a change with NotifyResourceInstanceChanged.

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, or plugin_resource:<plugin_id>:<slug>. For its own resource types, a plugin can use plugin_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) and metadata.write (set and delete). Declare them under permissions.services in the manifest.
  • In the Community Edition, writes fail with FailedPrecondition.
  • If the governed_metadata object hook of another plugin rejects a write, the call returns PermissionDenied.
  • AI Studio audits every successful write or delete with the source plugin:<id>, and emits system.governed_metadata.updated or system.governed_metadata.deleted.
  • If you use plugin_resource:self: without a plugin context, the call returns InvalidArgument.
  • In the Community Edition, ListObjectMetadataAudit returns 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.
  • ListAuditRecords uses the resource type names of the audit trail: llm, tool, datasource, mcp_server, model_router, semantic_router, and app.
  • The Community Edition returns Unimplemented for the audit trail and routers. A node that does not store audit records in the database returns FailedPrecondition.
  • GetApp and ListApps (apps.read) return every binding of the App: LlmIds, ToolIds, DatasourceIds, McpServerIds, ModelRouterIds, SemanticRouterIds, and PluginResources ({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 need apps.write, and a governance plugin must not ask for that scope. Requires: apps.lifecycle scope. Studio only.
  • If isActive is nil, 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_flags key is reserved. App edits keep the stored flags, App creation drops a supplied governance_flags, and PatchAppMetadata refuses the key with InvalidArgument.
  • 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:
  1. Manifest Schedules: Declared in plugin.manifest.json, auto-registered when plugin loads
  2. API Schedules: Created programmatically via SDK during Initialize() or at runtime
Both types execute via the ExecuteScheduledTask() capability method.

CreateSchedule

Create a new schedule for your plugin:
Returns: *mgmtpb.ScheduleInfo with schedule details Errors: AlreadyExists if schedule_id already exists for this plugin

GetSchedule

Retrieve schedule details by manifest schedule ID:
Returns: *mgmtpb.ScheduleInfo Errors: NotFound if schedule doesn’t exist

ListSchedules

Get all schedules for your plugin:
Returns: []*mgmtpb.ScheduleInfo array

UpdateSchedule

Update schedule fields (all fields optional):
Returns: *mgmtpb.ScheduleInfo with updated schedule Errors: NotFound if schedule doesn’t exist

DeleteSchedule

Remove a schedule:
Errors: 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
Use API When:
  • Schedules are dynamic (based on external data)
  • Need runtime modification
  • Want conditional schedule creation
  • Building schedule management UI
Example: Plugin manifest declares one immutable daily report, creates hourly syncs via API based on configured data sources.

Data Types

The ai_studio_sdk functions return the protobuf types of the ai_studio_management package (mgmtpb in the examples). The main fields are:

LLMMessage

LLMTool (for Tool Calling)

ToolInfo

PluginInfo

AppInfo