Code mode does the heavy lifting. A million rows never touch the model.

For big jobs the agent writes JavaScript instead of calling tools one by one. The code joins, aggregates, and exports across your datasources in a sandbox, and the result lands as a file in your workspace.

acme / LTV export
export lifetime value per customer, orders joined with billing
Run code Cancel
const orders = await query("shop", ordersSql);
const subs = await query("billing", subsSql);
const ltv = joinOnCustomer(orders, subs);
await writeFile("ltv.csv", toCsv(ltv));

Done. 48,102 customers joined across both databases, sorted by lifetime value:

ltv.csv

Ask a follow-up…

Claude Code
ltv.csv
48,102 rows · 1 run
customer orders mrr ltv
Acme 184 $4,200 $31,400
Initech 97 $8,900 $27,800
Wayne 212 $11,200 $24,100
Northwind 64 $3,100 $18,700
Umbrella 51 $2,400 $12,300

Rows stay out of the chat. Only the result reaches the model.

The code fetches and crunches the data inside the sandbox. The model sees the summary and the file name, not a million rows of context.

1,204,882 rows scanned in the sandbox
48,102 rows written ltv.csv
4 lines reached the model the summary

Same rules as every tool. Code is not a back door.

Every query the code runs goes through the same access policies as the ordinary tools. A column you hid from the AI stays hidden inside code mode too.

Inside the sandbox

await query("shop",
  "SELECT email FROM customers");
Denied · customers.email is hidden from the AI

Guardrails on every run. Bounded, watchable, cancelable.

Runs live in an isolated worker with data functions as the only globals. You can watch the code before it finishes and stop it at any point.

Sandboxed worker, no filesystem data tools only
5 minute timeout guaranteed kill
100 KB chat output cap big results go to files
Cancel button on every run stops mid-execution

Let the agent do the heavy lifting.