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:Available Libraries
Load libraries withctx.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. Ajson_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
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.
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
- First run (authoring): The agent plans and writes
pipeline.py. The code is stored in the skill bundle. - Subsequent runs (replay): Cached
pipeline.pyruns throughCodeExecutionRunner. 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.
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) viactx.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.