Skip to main content
Glama

Run job (async)

run_job

Run a shell command as a background job in a fresh sandbox and return a job_id immediately (state queued or running). The job keeps running without this connection, up to timeout_s; the sandbox is removed when it ends, but the log, the result files and an execution receipt are kept. Use it for work longer than about a minute or when you do not want to wait; a quick command in a sandbox you keep working in is better run interactively. Only files matching artifacts (or ./output/ with save_artifacts) are kept – everything else is deleted with the sandbox. Billed per second of run time. With max_cost the job is refused up front if its worst case (timeout_s at the class price) could exceed the limit – lower timeout_s or raise the limit; it is also refused when the account's monthly or daily budget would be exceeded. If no server of the requested compute class is free, the job waits queued and is never moved to a weaker class. Repeating the call with the same idempotency_key returns the same job instead of starting a second one.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "run_job"
  }
}

Input Schema

NameRequiredDescriptionDefault
ipNoOptional IP version of the job's sandbox: ipv4 (default), dual or ipv6.
cwdNoWorking directory (default /home/user).
envNoEnvironment variables (e.g. API keys). Values are masked in the log and not stored after the job ends.
wasmNoOnly with runtime wasi: the WebAssembly module to run and its arguments, standard input and memory limit. The module has no network and no shell, sees only /input, /output and /tmp, and command is not needed.
allowNoAllow only these destinations (web traffic on ports 80/443 by hostname, or IP ranges).
inputsNoResult files of your earlier finished jobs to give this job (copied to ./input/<as>, checked by SHA-256). In run_batch, from_index refers to another job of the same batch and makes this job wait for it.
commandNoShell command, e.g. 'pip install -r requirements.txt && python analyze.py'. Required, except with runtime wasi.
runtimeNofirecracker (default, full Linux microVM) or wasi (WebAssembly module: no network, fast start; needs wasm).
internetNoInternet access (default true).
max_costNoOptional hard price limit in your account's billing currency, e.g. "0.10". The job is refused if the worst case could exceed it.
templateNoTemplate (default 'base').
artifactsNoResult files to keep, as glob patterns relative to the working directory, e.g. ["output/", "*.csv"].
placementNoOptional node choice: auto (default), fast (fastest node) or spread.
timeout_sNoTime limit for the command in seconds (default 3600, max 86400).
webhook_urlNoOptional public https:// URL that gets a signed POST (job.finished) with the result when the job ends.
max_attemptsNoRun again automatically after a platform failure, up to this many attempts (default 1).
optimize_forNoOptional: pick the server inside the compute class by price, balanced or performance. Never changes the class or its price.
compute_classNoOptional performance class: economy, balanced, performance, memory (dedicated if your organization has reserved servers). Without it your account's default class is used. The class is never downgraded; the job waits if no server of the class is free.
save_artifactsNoKeep everything the command writes to ./output/ (used when artifacts is empty).
idempotency_keyNoOptional: the same key returns the same job instead of starting a new one (safe to retry this call).
dependency_cacheNoUse the node's verified package cache for pip/npm/Go (default true when enabled by the operator).
required_artifactsNoResult files that must be saved for the job to count as completed, e.g. ["output/report.csv"].

Output Schema

NameRequiredDescriptionDefault
idYesJob ID (job_…).
statusYesJob state, e.g. queued or running.
max_costNoCost as an object with amount and currency, or null.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / command / description
      Previous value: -"Shell command, e.g. 'pip install -r requirements.txt && python analyze.py'"New value: +"Shell command, e.g. 'pip install -r requirements.txt && python analyze.py'. Required, except with runtime wasi."
    • removedInput schema / properties / max_cost_eur
      Removed value: -{
      -  "description": "Optional hard price limit in EUR – only for accounts billed in EUR; prefer max_cost.",
      -  "type": "string"
      -}
    • addedInput schema / properties / wasm / description
      Added value: +"Only with runtime wasi: the WebAssembly module to run and its arguments, standard input and memory limit. The module has no network and no shell, sees only /input, /output and /tmp, and command is not needed."
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds substantial behavior beyond the annotations: the sandbox is destroyed at job end and only artifacts/save_artifacts matches survive, the job survives connection loss up to timeout_s, billing is per second, and no compute-class downgrade occurs while queued. It also discloses cost-refusal and budget-refusal conditions up front, which is exactly the kind of operational detail annotations (readOnlyHint=false, destructiveHint=false, openWorldHint=true) do not convey. The disclosed in-sandbox deletion is scoped to an ephemeral sandbox this call creates, so it does not contradict destructiveHint=false.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose, return value, and lifetime before the pricing and queueing details, and every sentence carries a distinct constraint rather than filler. It is dense — the billing, max_cost, budget, queueing, and idempotency rules arrive as one long run-on block, which costs some scannability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 22-parameter tool with nested objects, the description covers the decision-critical unknowns: lifetime, artifact retention, cost ceiling, queue behavior, and retry safety. With an output schema present it need not describe return values, and the remaining gaps (failure/retry outcome reporting, the retained execution receipt's contents) are minor.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description genuinely adds meaning: the interaction between artifacts and save_artifacts ("Only files matching artifacts (or ./output/ with save_artifacts) are kept"), the worst-case cost rule for max_cost tied to timeout_s and class price, and the no-downgrade semantics of compute_class. Remaining parameters (wasm, inputs, env, placement) are handled adequately by the schema, not the prose.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ("Run a shell command as a background job in a fresh sandbox") plus the return contract ("return a job_id immediately (state queued or running)"). It also distinguishes itself from the interactive path ("a quick command in a sandbox you keep working in is better run interactively"), so an agent can separate it from run_command/create_sandbox without opening another schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit selection threshold ("work longer than about a minute or when you do not want to wait") and an explicit anti-case ("a quick command in a sandbox you keep working in is better run interactively"). It also states the retry rule (same idempotency_key returns the same job) and what to do when max_cost refuses a job ("lower timeout_s or raise the limit").

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources