Tanvrit Compute

Templates

A template is a parameterised job spec. You define the command, the image, the resource requests, and a small set of ${placeholders} once — then anyone on your team can run it from the portal, the CLI, or the SDK without having to remember the flags.

Tanvrit Compute ships with a gallery of built-in templates and lets you fork or create your own.

The built-in gallery

There are eight built-in templates, all of which can be cloned and customised.

| Slug | What it does | | --- | --- | | android-build | Runs ./gradlew assembleRelease against a checked-out Android project, uploads the resulting APK as a job artifact. | | ios-build | Runs xcodebuild -scheme ${scheme} -configuration Release archive on a macOS agent, archives the .ipa. | | compose-desktop-build | Runs ./gradlew :composeApp:packageDistributionForCurrentOS for a Compose Multiplatform desktop project. | | llama-inference | Loads a Llama-family model on a GPU agent and serves a one-shot prompt completion. | | blender-render | Renders a .blend file on a GPU agent at the requested resolution and frame range. | | ffmpeg-transcode | Transcodes a source video to the requested codec/container/bitrate. | | pytest | Checks out a Python project, installs requirements, runs pytest with the requested args. | | k6-load-test | Runs a k6 script against a target URL with the requested VUs and duration. |

You can list them at any time:

tanvrit-compute templates

Forking a template

The easiest way to get a custom template is to clone an existing one and edit the spec. From the portal: open a built-in template, click Fork, and adjust. Or via the API:

POST /api/compute/templates/create
Content-Type: application/json
Authorization: Bearer <jwt>

{
  "name": "android-build-with-tests",
  "fromTemplate": "android-build",
  "spec": {
    "command": "./gradlew testReleaseUnitTest assembleRelease",
    "label":   "android-builders",
    "cpu":     8,
    "mem":     16384
  }
}

The new template gets its own slug and is scoped to your team.

Parameter placeholders

Anywhere in the command, image, env, or workdir fields you can use ${paramName} to mark a placeholder. Each placeholder must be declared in the template's parameters array.

{
  "name": "rust-cargo-build",
  "parameters": [
    { "name": "repoUrl",   "type": "string", "required": true },
    { "name": "ref",       "type": "string", "default":  "main" },
    { "name": "features",  "type": "string", "default":  "" }
  ],
  "spec": {
    "image":   "rust:1.78-slim",
    "command": "git clone --depth 1 --branch ${ref} ${repoUrl} src && cd src && cargo build --release --features '${features}'",
    "cpu":     4,
    "mem":     4096,
    "label":   "linux-x64"
  }
}

Supported parameter types: string, int, bool, enum. enum requires a values array.

Running a template

From the CLI:

tanvrit-compute templates run rust-cargo-build \
  --param repoUrl=https://github.com/me/myproj \
  --param ref=v1.2.3 \
  --param features=tokio,serde

From the SDK (Kotlin):

val job = compute.templates.run(
    slug = "rust-cargo-build",
    params = mapOf(
        "repoUrl" to "https://github.com/me/myproj",
        "ref"     to "v1.2.3",
    ),
)

From the portal: open the template, fill the form, click Run.

A complete custom example: rust-cargo-build

A real-world template that builds any public Rust crate.

  1. Create the template via POST /api/compute/templates/create with the JSON
  2. above.

  3. Wire it into your CI:

`` tanvrit-compute templates run rust-cargo-build \ --param repoUrl=https://github.com/me/myproj \ --param ref=$GITHUB_SHA ``

  1. Optionally schedule it nightly — see Schedules.

Templates are first-class citizens of the compute model: a scheduled job can reference a template_id, and audit logs record both the template version and the parameter values used at submission time.