Python & JS Code Runner - $0.50/1K Rows, No API Key
Pricing
from $0.35 / 1,000 results
Python & JS Code Runner - $0.50/1K Rows, No API Key
Paste a transform(row) function in Python or JavaScript, give rows as JSON or an Apify dataset ID, get the returned rows in a dataset. One process per run (about 0.1 ms per row after start), per-row errors with line numbers, time and memory limits, filter/split rows, only-new mode with monitorId. Ca
Pricing
from $0.35 / 1,000 results
Rating
0.0
(0)
Developer
Martin Petrov
Maintained by CommunityActor stats
0
Bookmarked
3
Total users
2
Monthly active users
4 days ago
Last modified
Categories
Features
Share
Problem: n8n, Make, Zapier and Apify pipelines often need one small custom step: clean a name, split a field, compute a score, drop junk rows. No-code tools have no safe place for 20 lines of Python or JavaScript, so people host a Lambda or a VPS just for that.
This actor: you paste a transform(row) function, give rows (JSON or an Apify dataset ID), and get the returned rows back in a dataset. No server, no API key for any third-party service.
Quick start
Input:
{"language": "python","code": "def transform(row):\n return {\"name\": row[\"name\"].strip().title(), \"domain\": row[\"email\"].split(\"@\")[-1].lower()}","rows": [{"name": " ada lovelace ", "email": "Ada@Example.COM"}]}
Output row:
{"name": "Ada Lovelace", "domain": "example.com", "_rowIndex": 0}
JavaScript works the same way (async functions are fine):
async function transform(row) {if (!row.price) return null; // null = drop the row (filter)return { sku: row.sku, priceEur: +(row.price * 0.86).toFixed(2) };}
What your function can return
| Return value | Result |
|---|---|
| dict / object | one output row |
| list of dicts | several output rows (split one row into many) |
| None / null | row is dropped (filter) |
| a plain value | {"result": value} |
outputMode: "merge" keeps the input row and adds/overwrites the fields you return.
Errors are per row, not per run
A row that throws or runs past rowTimeoutSecs does not stop the run. It goes to the ERRORS key-value record with the error message, the line number in your code, the print() / console.log output of that row and the input row. You are not charged for error rows (unless you turn on includeErrorRows). If the code cannot even start (syntax error, no transform), the run ends cleanly with that message in the status and RUN_SUMMARY.lastError.
Speed and limits (measured 2026-11-18)
- All rows run in one child process per run: about 0.1 ms per row for a simple Python transform after start (4 rows = 0.14 s total), no cold start per row.
rowTimeoutSecs(default 10 s) stops one slow row, including endless loops in JavaScript.totalTimeoutSecsandmemoryLimitMbcap the whole step.- Python 3.12 standard library (
json,re,datetime,hashlib,csv,math,statistics,urllib...). Node.js built-ins viarequire(crypto,url,querystring...), plusfetch.
Only-new mode (repeat runs)
Set monitorId (any name, e.g. daily-leads) and optionally keyField (e.g. id). The actor remembers the output of every row; on the next run with the same ID only new or changed rows are returned, with first_seen, changed_at and is_new. Good for scheduled runs that should only push changes to your CRM or sheet.
Use from n8n / Make / Zapier / API
curl -X POST "https://api.apify.com/v2/acts/martin10291~code-runner-sandbox/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \-H "Content-Type: application/json" \-d '{"language":"javascript","code":"function transform(r){return {total: r.qty * r.price}}","rows":[{"qty":3,"price":9.5}]}'
Chain it after another actor: pass that run's defaultDatasetId as datasetId.
Use from AI agents (MCP)
Add the Apify MCP server (https://mcp.apify.com) to Claude, Cursor or any MCP client and call this actor as a tool: the agent sends code + rows and gets clean rows back, with per-row errors it can read and fix.
Run summary
RUN_SUMMARY record: inputRows, saved, errorRows, skippedUnchanged, wallSeconds, avgRowMs, lastError.
Notes
- Your code runs inside your own run's container; nothing is sent to other services unless your code does it.
- Price: $0.50 per 1,000 output rows. Error rows and dropped rows are free.