Skip to content

Notebook

A scratchpad the agent can read and write across invocations. The most effective use is giving the agent a notebook at the start of a task and instructing it to plan its work there. It can break the task into steps, check things off as it goes, and always have a clear picture of what’s left. Notebook state is part of the agent’s state, so it persists automatically with Session Management.

Supported in: Node.js, modern browsers (TypeScript); all platforms (Python).

Example - Task Management:

import { Agent } from '@strands-agents/sdk'
import { notebook } from '@strands-agents/sdk/vended-tools/notebook'
const agent = new Agent({
tools: [notebook],
systemPrompt:
'Before starting any multi-step task, create a notebook with a checklist of steps. ' +
'Check off each step as you complete it.',
})
// The agent uses the notebook to plan and track its work
await agent.invoke('Write a project plan for building a personal budget tracker app')

Example - State Persistence:

import { Agent, SessionManager, FileStorage } from '@strands-agents/sdk'
import { notebook } from '@strands-agents/sdk/vended-tools/notebook'
const session = new SessionManager({
sessionId: 'my-session',
storage: { snapshot: new FileStorage('./sessions') },
})
const agent = new Agent({ tools: [notebook], sessionManager: session })
// Notebooks are automatically persisted as part of the session
await agent.invoke('Create a notebook called "ideas" with "# Project Ideas"')
await agent.invoke('Add "- Build a web scraper" to the ideas notebook')
// ...
// Later, a new agent with the same session restores notebooks automatically
const restoredAgent = new Agent({ tools: [notebook], sessionManager: session })
await restoredAgent.invoke('Read the ideas notebook')

Example - Custom configuration:

import { Agent } from '@strands-agents/sdk'
import { makeNotebook } from '@strands-agents/sdk/vended-tools/notebook'
const notes = makeNotebook({
name: 'notes',
maxNotebookSizeBytes: 64 * 1024, // 64 KiB
})
const agent = new Agent({ tools: [notes] })

📖 Full API Reference