API Reference
scratchpadTools
function scratchpadTools(scratchpad?): Tool<ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>>[];Defined in: tools/builtin/scratchpad.ts:90
Build the read_scratchpad and write_scratchpad tools over a Scratchpad.
Parameters
| Parameter | Type | Description |
|---|---|---|
scratchpad | Scratchpad | The backing store. Defaults to a fresh InMemoryScratchpad. |
Returns
Tool<ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>>[]
[read_scratchpad, write_scratchpad], ready for runAgent or a ToolRegistry.
Remarks
Both run ExecutionMode.Sequential: they share one mutable slot, so a read batched alongside a write in the same turn must never race it.
See
Example
const pad = new InMemoryScratchpad();
await runAgent({ ...opts, tools: scratchpadTools(pad) });
// The model can now call: write_scratchpad({ content: "Plan: ..." }) / read_scratchpad({})