Type a sentence. Get a model that already runs.
The Grid agent doesn't hallucinate spreadsheets. It runs every model it writes through the actual TypeScript runtime before returning, so by the time you see the source, the source has already computed.
MODEL "SaaS pricing" RUNTIME "lua_generated" # plans, prices, billing cadence plans = ["Starter", "Team", "Scale"] monthly as currency = [29, 99, 299] annual as currency = monthly * 12 * 0.83 # variable cost per seat cac as currency = [40, 120, 480] payback = MAP(cac, monthly, (c, m) => c / m) END MODEL
Drafted in 1.4s · 2 tool calls · 3 cells with type tags · validatedClean: true · evaluatedClean: true
Six tools for grounding. One that runs the code.
Every invocation has access to the same tool set. The first six help the agent ground itself in the real runtime — function signatures, doc sections, error codes, canonical examples. The seventh, evaluate_grid, is the difference between "the agent claims this works" and this works.
When the agent doesn't know a function, it looks it up. It cannot make one up: the function signature, error model, and canonical examples come from the same binary your production runtime uses.
- 01lookup_functionFull signature plus description for one function.
- 02search_functionsMatch by name or description, optionally filtered by category.
- 03get_doc_sectionFetch a section of the language docs by topic name.
- 04get_canonical_exampleFetch one of the worked, canonical example models.
- 05explain_errorCause, recovery, and an errors.md excerpt for any error code.
- 06validate_gridParse, build, Lua-generate. Returns ok or structured diagnostics.
- 07evaluate_gridDeploy into the in-process Grid runtime, run, and return every cell's resolved value, status, and error code. The agent reads what its model actually does — not what a token predictor thinks it should do.
Syntax + structure.
{
"ok": true,
"cells": 9,
"lua_bytes": 1894,
"errors": []
}Behavior, observed.
It runs before it returns.
After drafting, the agent calls validate_grid for syntax and structural checks, then evaluate_grid against the in-memory Grid runtime. It reads every resolved value, fixes diagnostics in-loop, and only returns when both checks pass.
Successful generations carry validatedClean: true and evaluatedClean: true in the response. If the model wouldn't evaluate, the agent says so — it doesn't hand back something that won't run.
Same agent. Four ways to talk to it.
Embed it in TypeScript. Run it from the CLI. Call it over HTTP. Stream tokens to a chat UI. Same system prompt, same tools, same structured output — selectable per-call across the gateway, Anthropic, or OpenAI providers.
Library
$createGridAgent({ provider: 'gateway' })Embed the agent directly. Same tools, same loop, same structured output as the CLI and HTTP surfaces.
CLI
$npm run agent -- 'pricing model'One-shot generation in a terminal. Useful for inspection, scripts, and CI fixtures.
HTTP
Coming soonPlain JSON request, structured response. Same diagnostics surface as the library.
Stream
Coming soonToken-by-token streaming for chat UIs. Tool calls and partial drafts emit as events.