Skip to main content
Code Runner executes Python and JavaScript code in a sandboxed environment. Perfect for calculations, data transformation, and quick automation.

Key Features

  • Python 3.11+ - Full Python stdlib
  • JavaScript/Node.js - Modern ES6+ support
  • Sandboxed - Isolated from system and other sessions
  • 30-second timeout - Prevents runaway code
  • No Network Access - Isolated from external services
  • Input/Output Handling - Pass data to code and capture results
  • No Dependencies - Core libraries only (upgrade to Sandbox for pip/npm)

How to Enable

For Agents

  1. Agents > Select Agent > Settings > Capabilities
  2. Attach Code Runner

For MCP Gateways

  1. Gateways > Select Gateway > Capabilities
  2. Attach Code Runner

Usage Examples

Python Calculation

Output:

JavaScript Data Processing

Output:

JSON Parsing

Output:

Input/Output

Pass Data to Code

Return Structured Data

Available Libraries

Python Standard Library

  • json, csv, re, datetime, math, statistics
  • collections, itertools, functools
  • hashlib, urllib, base64
  • logging, pprint, sys, os (limited)

JavaScript Standard Library

  • All ES6+ features
  • JSON, Math, Date, RegExp
  • Array methods, String methods
  • No external npm packages

Resource Limits

Limitations

  • No network access
  • No file I/O (use Files capability instead)
  • No package installation (use Sandbox for pip/npm)
  • No background processes
  • No system calls

Cost

For current pricing details, see Pricing. Monitor in Account > Usage dashboard.

Common Recipes

Format Data

Calculate Statistics

Transform JSON

Troubleshooting

Timeout Error

Code ran longer than 30 seconds. Optimize for speed or use Sandbox for heavy computation.

Memory Error

Exceeded 128MB memory limit. Reduce data size or process in chunks.

Module Not Found

Only stdlib available. For third-party packages, use Sandbox instead.

No Output Captured

Ensure you print() or return results. Code without output shows success but no data.

When to Use

Next Steps