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 workawait agent.invoke('Write a project plan for building a personal budget tracker app')from strands import Agentfrom strands.vended_tools import notebook
agent = Agent(tools=[notebook])agent('Create a notebook called "tasks" with "# Daily Tasks" and add "- [ ] Review code" to it')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 sessionawait 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 automaticallyconst restoredAgent = new Agent({ tools: [notebook], sessionManager: session })await restoredAgent.invoke('Read the ideas notebook')from strands import Agentfrom strands.vended_tools import notebook
agent = Agent(tools=[notebook])agent('Create a notebook called "tasks" with "# Daily Tasks" and add "- [ ] Review code" to it')
# Read the notebook contents directly off agent state.notebooks = agent.state.get("notebooks") or {}print(notebooks.get("tasks"))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] })from strands import Agentfrom strands.vended_tools import make_notebook
notes = make_notebook( name="notes", max_notebook_size_bytes=64 * 1024, # 64 KiB)agent = Agent(tools=[notes])