Skip to main content
Use run_code for language-level execution with structured outputs, logs, and error objects.

Supported Languages

  • Python
  • JavaScript

Basic Example

POST /v1/agents/runtime/{runtime_id}/code/run

Why Use Code Contexts

Code contexts let you preserve state between calls. Create a context, then pass context_id on each run_code call (Python/cURL). The CLI can create contexts with gravixlayer runtime code-context create but runtime run does not accept --context-id.

Run Python

Python execution examples

Run JavaScript

JavaScript execution examples

Create Context

Persist variables and imports across calls