core preset ships 40 built-in actions. Add a custom action when your agent needs another named document operation. Custom actions run through superdoc_perform_action alongside the built-ins.
You define custom actions in your application with the installed SDK. The toolkit adds them to the tool schema, system prompt, and dispatcher together.
Quick start
Define an action, pass it tocreateAgentToolkit, then call the returned dispatcher. These examples assume your application already has an open document handle named doc.
- Node.js
- Python
action. Do not nest them under an args property.
createAgentToolkit builds an ephemeral preset over core. The returned tools, system prompt, and dispatcher use the same action surface. Provider shaping for Anthropic, OpenAI, Vercel, and generic tools is automatic.
Choose an execution tier
defineAction returns an ActionSpec. Every action spec uses exactly one execution tier:
| Tier | What it does | Use it when |
|---|---|---|
steps | Runs a sequence of built-in core actions | The built-ins already cover the operation. This keeps their targeting and verification behavior. |
run | Runs your function against the document handle | You need Document API operations or application logic that the built-ins do not provide. |
steps when possible. In a step argument, a value that is exactly {{label}} passes the original argument value. Text around the placeholder interpolates it into a string.
Use run for operations such as footnotes, headers, bookmarks, or table borders. The function runs in your application process.
- Node.js
- Python
Limit the built-in actions
PassincludeCoreActions to keep only selected built-ins. Custom actions passed through actions remain available alongside that subset.
"includeCoreActions": ["insert_paragraphs", "add_comments"].
Generate an action with a coding agent
Thesuperdoc-custom-actions skill guides Claude Code and Codex through choosing a tier, defining the action, wiring it into the toolkit, and testing it against a document.
Install it from your application’s root directory:
Add a custom action that inserts a footnote after a piece of text.The skill instructs the agent to verify the action against a real document when possible. If the environment cannot provide a suitable document, the agent should label the action as unverified and include a test for the first real run.
--copy vendors the skill into your project. Add -a <agent> if you want to install it for one supported coding agent only.Python async clients
If your application usesAsyncSuperDocClient or dispatch_async, a run action must use async def and await every doc.* call. A synchronous function receives coroutine values from the async document handle. steps actions do not require changes.
Reuse a named preset
Advanced: register a named preset
Advanced: register a named preset
Register a preset when several toolkit instances or standalone SDK functions need to resolve the same action set by ID.Registration is process-local. Run it during application startup before resolving the preset. Pass the preset ID to every preset-scoped standalone function. Common examples include:
- Node.js
- Python
- Node.js:
chooseTools,getToolCatalog,listTools,getSystemPrompt, anddispatchSuperDocTool - Python:
choose_tools,get_tool_catalog,list_tools,get_system_prompt,dispatch_superdoc_tool, anddispatch_superdoc_tool_async
createAgentToolkit and create_agent_toolkit are already bound to the preset.Use composePreset or compose_preset instead when a named preset should keep only selected built-in actions.Related
Core preset
The 40 built-in actions your custom actions extend.
LLM Tools
The toolkit, dispatch, and agent loop.

