Skip to main content
Orion-2 (vlmrun-orion-2) writes and runs Python in a sandbox. One execute_code call runs the pipeline. Orion-1 calls one tool per model round-trip.

When to Use Orion-2

How It Works

Orion-2 turns the request into Python. It runs that code in a sandbox. It retries until the program finishes. Independent calls run concurrently. There is no model round-trip between tools.
Architecture, benchmarks, and examples: Orion-2 blog post. Mastra agents with hybrid client and server tools: Mastra Compatibility.

Orion-1 vs. Orion-2

Orion-1 — one LLM round-trip per tool:
Orion-2 — one program, parallel dispatch:

Available Libraries

Load libraries with ctx.import_lib(...). Stdlib modules (json, math, re, pathlib, asyncio, and others) use a normal import.

VLM Run Proxy API

vlmrun.llm.extract

Runs text-only LLM extraction inside the sandbox. A json_schema returns a validated dict matching the schema. No schema returns free-form JSON parsed from the model response.

Example: Chat Completion with Orion-2

The agent writes and runs code like this:

Skills with Orion-2

Attached skills land at <workspace>/skills/<skill-name>/. Read SKILL.md, schemas, and templates with vlmrun.io.read_file or cv2.imread.
Skills work with Orion-1 and Orion-2. Orion-1 injects skill instructions into the system prompt. Orion-2 writes skill files into the workspace.

Program Execution

After an Orion-2 skill runs once, pipeline.py is cached in the skill bundle. Later runs execute that file in the sandbox and skip the LLM agent loop.

How it works

  1. First run (authoring): The agent plans and writes pipeline.py. The code is stored in the skill bundle.
  2. Subsequent runs (replay): Cached pipeline.py runs through CodeExecutionRunner. If execution fails or no cached pipeline exists, the system falls back to the full agent loop.

Controlling execution mode

mode is program (default) or agent.
The response field execution_mode records the path:
The Node.js SDK cannot select mode yet. AgentExecutionConfig drops a mode key before the request is sent. The response still includes execution_mode. See the Node.js agent reference.
Program execution preserves structured output validation, grounding metadata, and billing accuracy. Billing covers sandbox and tool costs only. LLM orchestration tokens are zero.

Performance

In testing, a medical-referral document extraction skill finished in ~13s in program mode and ~160s with full agent orchestration.

Security

  • Import restrictions: Only allowlisted libraries (cv2, numpy, matplotlib, vlmrun, ffmpeg) via ctx.import_lib(), plus Python stdlib. Dangerous modules (os, io, shutil, importlib) are blocked at AST parse time.
  • Workspace confinement: All file operations are restricted to the session workspace. Symlink traversal and absolute path escapes are rejected.
  • Introspection blocking: Builtins like eval, exec, compile, getattr, and __import__ are blocked to prevent sandbox escape.

Model Variants

Every model ID below uses the same harness and runtime.