Skip to main content

Plugin Runtime Helpers

Reference for the api.runtime object injected into every plugin during registration. Use these helpers instead of importing host internals directly.
Looking for a walkthrough? See Channel Plugins or Provider Plugins for step-by-step guides that show these helpers in context.

Runtime namespaces

api.runtime.agent

Agent identity, directories, and session management.
Session store helpers are under api.runtime.agent.session:

api.runtime.agent.defaults

Default model and provider constants:

api.runtime.subagent

Launch and manage background subagent runs.
Model overrides (provider/model) require operator opt-in via plugins.entries.<id>.subagent.allowModelOverride: true in config. Untrusted plugins can still run subagents, but override requests are rejected.

api.runtime.tts

Text-to-speech synthesis.
Uses core messages.tts configuration and provider selection. Returns PCM audio buffer + sample rate.

api.runtime.mediaUnderstanding

Image, audio, and video analysis.
Returns { text: undefined } when no output is produced (e.g. skipped input).
api.runtime.stt.transcribeAudioFile(...) remains as a compatibility alias for api.runtime.mediaUnderstanding.transcribeAudioFile(...).

api.runtime.imageGeneration

Image generation.

api.runtime.webSearch

Web search.

api.runtime.media

Low-level media utilities.

api.runtime.config

Config load and write.

api.runtime.system

System-level utilities.

api.runtime.events

Event subscriptions.

api.runtime.logging

Logging.

api.runtime.modelAuth

Model and provider auth resolution.

api.runtime.state

State directory resolution.

api.runtime.tools

Memory tool factories and CLI.

api.runtime.channel

Channel-specific runtime helpers (available when a channel plugin is loaded).

Storing runtime references

Use createPluginRuntimeStore to store the runtime reference for use outside the register callback:

Other top-level api fields

Beyond api.runtime, the API object also provides: