Skip to main content

Availability

Signature verification of OCI plugins needs the Enterprise Edition. Tyk AI Studio supports three plugin deployment methods: local filesystem (file://), remote gRPC (grpc://), and OCI registry (oci://).

Deployment Methods Comparison

An administrator can turn off a deployment method. Set AI_STUDIO_PLUGIN_ALLOWED_SOURCES on AI Studio and PLUGINS_ALLOWED_SOURCES on each Edge Gateway. Refer to Restrict Plugin Sources.

file:// - Local Filesystem

Deploy plugins from the local filesystem.

Building Your Plugin

Creating Plugin via API

Important: Use absolute paths with file://:
AI Studio runs plugin binaries only from allowed directories. For the built-in directories and AI_STUDIO_PLUGIN_ALLOWED_DIRS, refer to Restrict Plugin Sources.

Docker Deployment

When deploying with Docker, mount plugins into the container:
Then register with container path:

Kubernetes Deployment

Mount plugins via ConfigMap or PersistentVolume:
Expandable

grpc:// - Remote gRPC

Deploy plugins as remote gRPC services.

Running Plugin as gRPC Server

Your plugin already implements gRPC via go-plugin. To run it as a remote service, you need a gRPC wrapper:
Expandable

Deploying with Docker

Register Remote Plugin

Network Configuration

Internal Network Access

From Tyk AI Studio 2.3.0, AI Studio and the Edge Gateway refuse a grpc:// plugin at an internal address. Examples are a private IP address or a cluster-internal service name. To allow one host, turn on Allow internal host on the plugin, or add the host to LLM_UPSTREAM_ALLOWED_INTERNAL_HOSTS. Refer to Internal Registries and Hosts.

Load Balancing

Use Kubernetes services for load balancing:
Register with service DNS:

oci:// - OCI Registry

Deploy plugins as OCI artifacts in container registries.

Prerequisites

  • Docker or Podman
  • OCI-compatible registry, such as Docker Hub, GHCR, ECR, GCR, or Harbor
  • Registry credentials configured

Packaging Plugin as OCI Artifact

AI Studio reads the first layer of the artifact as the plugin binary. Push the binary with ORAS. Do not push it as a Docker image. For the commands, signing, and marketplace listing, refer to Publish Plugins.

Registering OCI Plugin

Registry Authentication

Set OCI registry authentication with environment variables of this pattern:
<REGISTRY_NAME> is the registry hostname with dots changed to underscores. For example, docker.tyk.io becomes DOCKER_TYK_IO.

Authentication Methods

Entitlement Token (Cloudsmith and similar registries):
Username + Password:
OAuth2/Bearer Token:

AI Studio vs Edge Gateway

Both runtimes use the same OCI_PLUGINS_REGISTRY_* environment variables for auth. The difference is in how OCI support is enabled: Important: AI_STUDIO_OCI_CACHE_DIR must be set for OCI plugin support to be enabled in AI Studio. Without it, OCI plugins cannot be installed or loaded, and registry auth configuration is ignored.

Plugin Size Limit

AI Studio and the Edge Gateway stream plugin layers directly from the registry. To change the maximum layer size, set AI_STUDIO_OCI_MAX_PLUGIN_SIZE on AI Studio or OCI_PLUGINS_MAX_PLUGIN_SIZE on the Edge Gateway.

Signature Verification

From Tyk AI Studio 2.3.0, AI Studio and the Edge Gateway require a valid signature on each OCI plugin by default (Enterprise Edition). The Helm charts also require signatures by default. For the signature settings, the public keys, and how to load unsigned plugins during development, refer to Signature Verification. To sign a plugin, refer to Sign the Plugin.

Cloudsmith-Specific Notes

For Cloudsmith with a custom Docker domain, such as docker.tyk.io, use entitlement auth:
  • Entitlements bypass the Docker token exchange. This avoids scope issues with the namespace-level scope requirements of Cloudsmith.
  • Each Cloudsmith repository has its own entitlement tokens. Use repository-level entitlements.
  • The ENTITLEMENT auth type sends Basic auth directly on every request, which Cloudsmith supports natively.

Version Management

Use tags for version management:

Caching

AI Studio and the Edge Gateway pull OCI plugins and cache them locally:
From Tyk AI Studio 2.3.0, the host checks each cached binary against its SHA-256 hash. For the effect on the first load after an upgrade, refer to Cached Plugin Binaries.

Security Considerations

Plugins run as separate processes with the privileges of the host. Install only plugins that you trust. For the complete security model, refer to Plugin Security.

Command Validation

The platform validates plugin commands:
  1. Absolute Paths: file:// commands must use absolute paths. The path must be in an allowed directory (AI_STUDIO_PLUGIN_ALLOWED_DIRS).
  2. Internal Hosts: Refer to Internal Network Access. PLUGIN_BLOCK_INTERNAL_URLS is deprecated.
  3. Allowlist: PLUGIN_COMMAND_ALLOWLIST is advisory. The host logs a warning for a command that does not match it, but it still accepts the command. Its entries are comma-separated substrings.

Production Security

Follow the Production Checklist. For an example configuration, refer to Restrict Plugin Sources.

Plugin Process Environment

From Tyk AI Studio 2.3.0, file:// and oci:// plugins do not inherit the environment of their host. They get only an allowlist of variables. To pass more host variables, set PLUGIN_ENV_PASSTHROUGH. Refer to Plugin Environment. The GitHub RAG ingest plugin reads GITHUB_RAG_SECRET_ENCRYPTION_KEY and GITHUB_RAG_KNOWN_HOSTS from its environment.
  • If you set either variable, add GITHUB_RAG_* to PLUGIN_ENV_PASSTHROUGH before you upgrade. As an alternative, set secret_encryption_key and known_hosts_path in the plugin configuration.
  • Without the key, repositories with encrypted credentials do not sync, and the plugin stores new credentials unencrypted.

Plugin Message Size

The host and the plugin exchange each hook call as one gRPC message. The message holds the body, the headers and the context. From Tyk AI Studio 2.3.0, plugins built on the 2.3.0 SDK accept the host limit. Set the limit on the host with PLUGIN_GRPC_MAX_MSG_BYTES on AI Studio or PLUGIN_GRPC_MAX_MSG_BYTES on the Edge Gateway. The host passes it to each plugin that it starts. On an Edge Gateway LLM with pre_auth, auth or post_auth plugins, the gateway refuses a request body over this limit with 413. A plugin built on an SDK before 2.3.0 accepts only 4 MiB. When such a plugin refuses a larger message:
  • For pre_auth, auth and post_auth plugins, the gateway returns 413 with request too large for the gateway's plugins (<bytes> bytes). It does not forward the request. The log names the plugin.
  • For response plugins, the gateway sends the response without the changes of that plugin. It logs the plugin name and the size.
Rebuild your request-path plugins on the 2.3.0 SDK. A grpc:// plugin sets its own server limit. Calls from a plugin to the Service API are limited to 8 MiB for each message.

Troubleshooting

Symptoms: Plugin shows as inactive, errors in logsSolutions:
  • Verify plugin binary has execute permissions (chmod +x)
  • Check absolute path is correct for file://
  • Verify network connectivity for grpc://
  • Check registry authentication for oci://
  • Check that the plugin is signed and that its key is configured, for oci:// (Enterprise Edition)
  • Check that AI_STUDIO_PLUGIN_ALLOWED_SOURCES or PLUGINS_ALLOWED_SOURCES allows the source
  • Look for log lines that start with plugin host "<host>" is an internal address
  • Review plugin logs for initialization errors
On an Edge Gateway, requests to an LLM with a plugin that cannot load get 503 with the error code plugin_load_failed. Refer to When a Plugin Cannot Be Loaded.
Symptoms: Requests with large bodies, such as screenshots or PDF documents, fail with 413 and request too large for the gateway's pluginsSolutions:
  • Rebuild the plugins of the LLM on the 2.3.0 SDK. The log names the plugin.
  • Upgrade the shipped plugins to their 2.3.0 releases.
  • Check PLUGIN_GRPC_MAX_MSG_BYTES. Refer to Plugin Message Size.
Symptoms: “Permission denied” error when loading pluginSolutions:
Symptoms: “connection refused”, “no route to host” for grpc://Solutions:
  • Verify plugin server is running: telnet plugin-host 50051
  • Check firewall rules
  • Verify Kubernetes service is created
  • Check DNS resolution
  • Enable internal network access if needed (development only)
Symptoms: “Failed to pull image”, “authentication required”Solutions:
  • Verify registry URL is correct
  • Check credentials are configured
  • Test manual pull: docker pull registry.example.com/plugins/my-plugin:v1.0.0
  • Check registry permissions
  • Verify image exists with correct tag
Symptoms: Plugin loads but immediately crashesSolutions:
  • Check plugin logs for panics
  • Verify Go version compatibility
  • Check for missing dependencies
  • Test plugin standalone: ./my-plugin
  • Review initialization code for errors

Best Practices

Development Workflow

  1. Local Development: Use file:// for fast iteration
  2. Reload Loop: Use POST /api/v1/plugins/{id}/reload to test changes instantly
  3. Testing: Deploy to staging with grpc:// or oci://
  4. Production: Use oci:// with versioned tags
For setup, helper scripts, and the fastest development loop, refer to Plugin Development Workflow.

Versioning Rules

  1. Use semantic versioning
  2. Tag releases in Git and OCI registry
  3. Never reuse tags (immutable releases)
  4. Document breaking changes

Deployment Pipeline

Expandable

Monitoring

  • Monitor plugin health via /api/v1/plugins/{id}/health
  • Track plugin performance metrics
  • Set up alerts for plugin failures
  • Log all plugin operations