max_iterations is reached. Use POST /agent/chat + POST /agent/apply instead when you want to review each write before it lands.
On the first turn, the agent may emit a
plan object describing the full build — sections, target ranges, and notes. The chain loop uses this plan to drive subsequent turns, writing one section at a time and retrying any section that has column-alignment warnings before advancing.Request
The natural-language instruction describing the full task. Be as specific as possible — the agent uses this prompt on every iteration to understand the original goal.
Maximum number of auto-apply steps. Must be between
1 and 10 (values above 10 are clamped). Each iteration corresponds to one agent call and one write to the sheet. The loop may stop before this limit if the agent signals completion.Prior conversation turns, ordered oldest-first. Each element must have a
role field ("user" or "assistant") and a content field (string). The chain manages its own internal history across iterations, but you can seed it with earlier context here.Controls which cells the agent can see.
"sheet"— the entire active sheet (default)"selection"— only the cells listed inselected_cells
A list of cell addresses in A1 notation that are currently selected in the UI, for example
["B2"]. Used as an anchor hint when scope is "selection".Name of the sheet to target. Defaults to the active sheet when omitted.
The LLM model ID to use for every step in the chain. When omitted, GridOS selects the best available model.
Response
The name of the sheet that was written to across all iterations.
An array of step objects, one per iteration. Each step contains:
Zero-based index of this step within the chain run.
The agent that handled this step (for example
"finance" or "general").The agent’s explanation of what it wrote in this step.
The cell address where data was actually written for this step, in A1 notation.
The 2-D array of values written in this step.
Formula cell results read back after the write. Each observation has:
cell— A1 addressvalue— the computed value after formulas evaluatedformula— the formula string if the cell is formula-driven, otherwisenullwarning— a string describing a column-alignment issue if one was detected, otherwisenull
true if the agent signaled that the task is fully complete on this step (by returning an empty-string grid). The chain stops immediately when this is true.The chart object created during this step, or
null if no chart was requested.An error message if chart creation failed on this step, otherwise
null.A macro proposal from the agent on this step, or
null. Proposed macros are not saved automatically.The multi-section build plan, present only on the first step when the agent emits one.
null on all subsequent steps.The total number of steps that ran. Equal to
steps.length.true if the loop ended before reaching max_iterations — either because the agent signaled completion or because there was no remaining work detected. false if the loop ran to the iteration limit.Example
Request
Response (abbreviated — 2 of 3 steps shown)
terminated_early: true here means the loop finished before the 10-iteration cap — the agent signaled completion on step 3 (the COGS row), which is not shown in this abbreviated example. A completion_signal: true step is always the last entry in steps.