---
title: "Runtime capabilities"
canonical: https://docs.qvac.tether.io/sdk/runtime/capabilities/
collection: "SDK"
package: "@qvac/sdk"
line: v0.25
current_line: true
---

# Runtime capabilities (/sdk/runtime/capabilities)



## Overview

An app built and released separately from the runtime it talks to cannot assume which operations that runtime serves: the runtime may have been assembled with a reduced plugin set, or with plugins from another vendor. [`getRuntimeCapabilities()`](/sdk/reference/api#getruntimecapabilities) lists the capability contracts the runtime's registered plugins declare, so the app can check for the contracts it needs before it loads a model.

Each entry names a contract and its major version:

```ts
{
  id: string                  // for example 'transcription'
  version: number             // major version, from 1
  operations: string[]        // every plugin that provides the contract implements these
  partialOperations: string[] // only some of those plugins implement these
}
```

The list is sorted by `id` and then `version`. A session handle has the same method and gets the same list. An empty list means the request succeeded and no registered plugin declares a contract. A runtime released before `getRuntimeCapabilities` rejects the request with an error instead, so treat an error as "capabilities unknown", not as "nothing available".

## Contracts

A contract groups the operations whose schemas share a core. QVAC defines these contracts, all at major 1:

| ID                        | Operations                                 | Optional operations                   |
| ------------------------- | ------------------------------------------ | ------------------------------------- |
| `completion`              | `completionStream`                         | `batchCompletionStream`, `calcTokens` |
| `fine-tuning`             | `finetune`                                 |                                       |
| `translation`             | `translate`                                |                                       |
| `embedding`               | `embed`, `embedBatch`                      |                                       |
| `reranking`               | `rerank`                                   |                                       |
| `decision`                | `decide`                                   |                                       |
| `classification`          | `classify`                                 |                                       |
| `transcription`           | `transcribe`                               | `transcribeStream`                    |
| `bci-transcription`       | `bciTranscribe`                            | `bciTranscribeStream`                 |
| `text-to-speech`          | `textToSpeech`                             | `textToSpeechStream`                  |
| `ocr`                     | `ocrStream`                                |                                       |
| `stereo-depth-estimation` | `estimateDisparity`                        |                                       |
| `image-generation`        | `diffusionStream`                          |                                       |
| `image-upscaling`         | `upscaleStream`                            |                                       |
| `video-generation`        | `videoStream`                              |                                       |
| `world-simulation`        | `worldStepStream`, `worldSceneStream`      |                                       |
| `audio-generation`        | `audioGenStream`                           | `audioEditStream`                     |
| `audio-understanding`     | `audioUnderstand`                          |                                       |
| `vision-language-action`  | `vlaRun`, `vlaHparams`, `vlaSetEmbodiment` |                                       |

A contract with a dotted ID, such as `acme.diarization`, is defined by a third-party plugin rather than by QVAC. A third-party plugin can also provide a QVAC contract.

Contract IDs are also the keys of the runtime's [deadline configuration](/sdk/runtime/deadlines#configuration).

An optional operation appears in `operations` when every plugin that provides the contract implements it, and in `partialOperations` when only some do. With the default plugin set, `transcribeStream` is in `partialOperations`: Whisper and Parakeet stream, MOSS does not. A call goes to the plugin of the model it names, so `transcribeStream` on a MOSS model still fails.

A contract names operations, not the inputs a provider accepts. `embedding@1` is provided by both a text embedding plugin and an image embedding plugin, so the model you load decides whether text or images work.

## Versions

Match on `id` and `version` together. A contract's major increases only on a change that breaks callers, such as removing an operation or changing a field's type. New optional fields and new optional operations do not change the major, and neither do SDK or addon releases.

An entry means that a registered plugin declares that major. The runtime checks that the plugin has a handler for each required operation, called the way the contract calls it, but not what the handler returns. When two majors of one contract are listed, each is a separate declaration: a call reaches the major that the plugin of the selected model serves.

## Limits

The list comes from plugin registration only. It loads no model, and it does not check:

* that a plugin's native addon loads on this device;
* that model files exist, or that the device has the memory to load them;
* which operations a particular model supports. A diffusion model, for example, still refuses `videoStream` although its plugin provides `video-generation`.

A call can therefore still fail with an error such as `ModelOperationNotSupportedError`.

A plugin that declares no contracts is not listed, and its operations can still be called as before.

## Example

The following script lists the contracts the runtime provides and checks for the ones the app needs:

<Tabs>
  <Tab value="js" label="JavaScript" default>
    <WrapCode>
      ```js file=<rootDir>/packages/sdk/dist/examples/runtime-capabilities.js title="runtime-capabilities.js" lineNumbers
      import { CAPABILITY_CONTRACTS, getRuntimeCapabilities } from '@qvac/sdk';
      // The contracts and majors this app was built against.
      const REQUIRED = [CAPABILITY_CONTRACTS.completion, CAPABILITY_CONTRACTS.transcription];
      function describe(capability) {
          const partial = capability.partialOperations.length
              ? `; only some plugins: ${capability.partialOperations.join(', ')}`
              : '';
          return `${capability.id}@${capability.version}: ${capability.operations.join(', ')}${partial}`;
      }
      try {
          const capabilities = await getRuntimeCapabilities();
          console.log('▸ Capability contracts the runtime provides');
          for (const capability of capabilities)
              console.log(`  ${describe(capability)}`);
          const missing = REQUIRED.filter((required) => !capabilities.some((capability) => capability.id === required.id && capability.version === required.version));
          if (missing.length > 0) {
              console.error(`✖ Missing: ${missing.map((m) => `${m.id}@${m.version}`).join(', ')}`);
              process.exit(1);
          }
          console.log('\n▸ Every required contract is available.');
          process.exit(0);
      }
      catch (error) {
          console.error('✖', error);
          process.exit(1);
      }
      ```
    </WrapCode>
  </Tab>

  <Tab value="ts" label="TypeScript">
    <WrapCode>
      ```ts file=<rootDir>/packages/sdk/examples/runtime-capabilities.ts title="runtime-capabilities.ts" lineNumbers
      import { CAPABILITY_CONTRACTS, getRuntimeCapabilities, type RuntimeCapability } from '@qvac/sdk'

      // The contracts and majors this app was built against.
      const REQUIRED = [CAPABILITY_CONTRACTS.completion, CAPABILITY_CONTRACTS.transcription]

      function describe(capability: RuntimeCapability) {
        const partial = capability.partialOperations.length
          ? `; only some plugins: ${capability.partialOperations.join(', ')}`
          : ''
        return `${capability.id}@${capability.version}: ${capability.operations.join(', ')}${partial}`
      }

      try {
        const capabilities = await getRuntimeCapabilities()

        console.log('▸ Capability contracts the runtime provides')
        for (const capability of capabilities) console.log(`  ${describe(capability)}`)

        const missing = REQUIRED.filter(
          (required) =>
            !capabilities.some(
              (capability) => capability.id === required.id && capability.version === required.version
            )
        )
        if (missing.length > 0) {
          console.error(`✖ Missing: ${missing.map((m) => `${m.id}@${m.version}`).join(', ')}`)
          process.exit(1)
        }

        console.log('\n▸ Every required contract is available.')
        process.exit(0)
      } catch (error) {
        console.error('✖', error)
        process.exit(1)
      }
      ```
    </WrapCode>
  </Tab>

  <Tab value="python" label="Python">
    <WrapCode>
      ```python file=<rootDir>/packages/sdk-python/examples/runtime_capabilities.py title="runtime_capabilities.py" lineNumbers
      """Python port of packages/sdk/examples/runtime-capabilities.ts.

      List the capability contracts the runtime provides, then check for the
      contracts and majors this app was built against. `get_runtime_capabilities`
      reads plugin registration only; it loads no model.

      RUN: python examples/runtime_capabilities.py
      """

      from __future__ import annotations

      import asyncio
      import sys

      from tetherto.qvac_sdk import (
          CapabilityId,
          Client,
          GetRuntimeCapabilitiesRequest,
          get_runtime_capabilities,
      )

      # The contracts and majors this app was built against.
      REQUIRED = [(CapabilityId.completion.value, 1), (CapabilityId.transcription.value, 1)]


      async def main() -> int:
          async with Client() as client:
              response = await get_runtime_capabilities(
                  client.transport, GetRuntimeCapabilitiesRequest()
              )

          print("▸ Capability contracts the runtime provides")
          for capability in response.capabilities:
              partial = (
                  f"; only some plugins: {', '.join(capability.partial_operations)}"
                  if capability.partial_operations
                  else ""
              )
              operations = ", ".join(capability.operations)
              print(f"  {capability.id}@{capability.version}: {operations}{partial}")

          provided = {(c.id, c.version) for c in response.capabilities}
          missing = [
              f"{name}@{version}"
              for name, version in REQUIRED
              if (name, version) not in provided
          ]
          if missing:
              print(f"✖ Missing: {', '.join(missing)}", file=sys.stderr)
              return 1

          print("\n▸ Every required contract is available.")
          return 0


      if __name__ == "__main__":
          sys.exit(asyncio.run(main()))
      ```
    </WrapCode>
  </Tab>

  <Tab value="kotlin" label="Kotlin">
    <WrapCode>
      ```kotlin file=<rootDir>/packages/sdk-kotlin/examples/src/RuntimeCapabilities.kt title="RuntimeCapabilities.kt" lineNumbers
      // Kotlin port of packages/sdk/examples/runtime-capabilities.ts.
      //
      // List the capability contracts the runtime provides, then check for the
      // contracts and majors this app was built against. `client.system
      // .runtimeCapabilities()` reads plugin registration only; it loads no model.
      //
      // RUN: ./gradlew -p examples run -Pexample=RuntimeCapabilities

      import io.tether.qvac.sdk.QvacClient
      import io.tether.qvac.sdk.declares
      import io.tether.qvac.sdk.generated.schema.CapabilityId
      import io.tether.qvac.sdk.jvm.JvmBareKitTransport
      import io.tether.qvac.sdk.system
      import io.tether.qvac.sdk.wireId
      import kotlinx.coroutines.runBlocking
      import kotlin.system.exitProcess

      // The contracts and majors this app was built against.
      private val REQUIRED = listOf(CapabilityId.COMPLETION to 1L, CapabilityId.TRANSCRIPTION to 1L)

      fun main(): Unit = runBlocking {
          val client = QvacClient(JvmBareKitTransport.connect())
          val missing = try {
              val response = client.system.runtimeCapabilities()

              println("▸ Capability contracts the runtime provides")
              for (capability in response.capabilities) {
                  val partial = if (capability.partialOperations.isEmpty()) "" else
                      "; only some plugins: ${capability.partialOperations.joinToString(", ")}"
                  println("  ${capability.id}@${capability.version}: ${capability.operations.joinToString(", ")}$partial")
              }

              REQUIRED.filter { (id, version) -> !response.declares(id, version) }
          } finally {
              client.close()
          }

          if (missing.isNotEmpty()) {
              System.err.println("✖ Missing: ${missing.joinToString(", ") { (id, version) -> "${id.wireId}@$version" }}")
              exitProcess(1)
          }
          println("\n▸ Every required contract is available.")
      }
      ```
    </WrapCode>
  </Tab>
</Tabs>

<Callout type="success">
  **Tip:** all examples throughout this documentation are self-contained and runnable. For instructions on how to run them, see the [JS/TS quickstart](/sdk/js-ts-sdk#quickstart), the [Python quickstart](/sdk/python-sdk#quickstart), or the [Kotlin quickstart](/sdk/kotlin-sdk#quickstart).
</Callout>
