Function: createAgentStorageTools()
createAgentStorageTools(
storage):object
Defined in: adapters/vercel-ai.ts:25
Creates a set of Vercel AI SDK tools that expose AgentStorage capabilities
to AI agents.
Agents call these tools to persist state, restore previous runs, log actions, and verify storage health — all without touching the SDK internals.
Parameters
storage
AgentStorage
A configured AgentStorage instance.
Returns
An object containing four tools: checkpoint, resumeState,
logAction, and checkHealth.
checkHealth
checkHealth:
any
Check the storage health and return the latest checkpoint pointer. Use this to verify the SDK is connected and operating correctly.
checkpoint
checkpoint:
any
Save the current agent state as a checkpoint on Filecoin. Call this after completing significant work so it can be recovered on restart.
logAction
logAction:
any
Append a tool call or event to the append-only audit log on Filecoin. Use this after every significant action to maintain a tamper-proof audit trail.
resumeState
resumeState:
any
Retrieve the most recent checkpoint state from Filecoin. Call this on startup to restore the previous world state.
Example
const storage = await AgentStorage.create(config);
const tools = createAgentStorageTools(storage);
// Pass to generateText / streamText
const result = await generateText({ model, tools, prompt });