Skip to main content

useNotebookToolActions

Agent Runtimes


Agent Runtimes / tools/adapters/copilotkit/notebookHooks / useNotebookToolActions

Function: useNotebookToolActions()

useNotebookToolActions(documentId, contextOverrides?): CopilotKitAction[]

Defined in: tools/adapters/copilotkit/notebookHooks.tsx:49

Hook that creates CopilotKit actions for notebook tools. Returns stable actions array that won't cause re-renders.

Parameters

documentId

string

Document ID (notebook identifier)

contextOverrides?

Partial<Omit<ToolExecutionContext, "documentId" | "executor">>

Optional context overrides (format, extras, etc.)

Returns

CopilotKitAction[]

CopilotKit actions

Example

// Default context (toon format for AI)
const actions = useNotebookToolActions("my-notebook-id");

// Custom format
const actions = useNotebookToolActions("my-notebook-id", { format: 'json' });

// With extras
const actions = useNotebookToolActions("my-notebook-id", {
format: 'toon',
extras: { userId: '123', theme: 'dark' }
});