LlamaIndex.TS WorkPaper Spreadsheet Tool
Use a LlamaIndex.TS tool when an agent should change workbook assumptions but not freehand-edit a file. The useful shape is small: read a summary range, write one allowed input, and return the cells and formula values that changed.
The LlamaIndex.TS tool(fn, { parameters }) shape takes a function plus a
configuration object with name, description, and parameters. The
WorkPaper adapter keeps the same pattern: Zod validates the arguments, and
@bilig/workpaper does the spreadsheet work.
Run the checked adapter
git clone https://github.com/proompteng/bilig.git
cd bilig
pnpm --dir examples/headless-workpaper install --ignore-workspace
pnpm --dir examples/headless-workpaper run agent:framework-adapters
The LlamaIndex.TS lane proves the same WorkPaper functions are exposed as tool-style calls:
{
"toolNames": ["read_workpaper_summary", "set_workpaper_input_cell"],
"writeResult": {
"editedCell": "Inputs!B3",
"checks": {
"formulasPersisted": true,
"restoredMatchesAfter": true,
"expectedArrChanged": true
}
}
}
LlamaIndex.TS shape
const setInputTool = tool(setWorkPaperInputCell, {
name: 'set_workpaper_input_cell',
description: 'Set one validated WorkPaper input and return formula readback.',
parameters: setInputCellInputSchema,
})
The important boundary is the function behind the tool. It should validate the sheet and A1 address, apply one write, read dependent formulas before and after the write, serialize the WorkPaper document, restore it, and return the verification result.
What to copy
- Use Zod schemas for agent-generated arguments.
- Keep workbook state in your app or workflow context.
- Return exact cells and computed values so the agent can decide the next step.
- Prefer a small
set_workpaper_input_celltool over a broad “edit workbook” tool.
Official LlamaIndex.TS tools docs: https://developers.llamaindex.ai/typescript/framework/modules/agents/tool/.
Runnable source:
examples/headless-workpaper/agent-framework-adapters.ts.