Quick start
Install the SDK, create a client, open a document, and wire up an agentic loop.- Node.js
- Python
Tool selection
chooseTools() returns provider-formatted tool definitions ready to pass to your LLM.
- Node.js
- Python
Tool catalog
The generated catalog currently contains 9 grouped intent tools. Most tools use anaction argument to select the underlying operation. Single-action tools like superdoc_search do not require action.
Built-in tools cover the core operations. For tables, images, hyperlinks, and anything else, create custom tools that call any
doc.* operation today.Dispatching tool calls
dispatchSuperDocTool() resolves a tool name to the correct SDK method, validates arguments, and executes the call against a bound document handle.
- Node.js
- Python (sync)
- Python (async)
System prompt
getSystemPrompt() returns a default prompt that teaches the model the tool workflow: targeting, search-before-edit, and common patterns. It’s optional. You can use it as-is, extend it with your own instructions, or write a completely custom prompt.
Provider formats
Each provider gets tool definitions in its native format.- OpenAI
- Anthropic
- Vercel AI
- Generic
Creating custom tools
The built-in tools cover core editing operations. For advanced features like tables, images, hyperlinks, footnotes, and citations, create custom tools that calldoc.* methods directly.
Step 1: Pick your operations
Everydoc.* namespace maps to a group of Document API operations:
Step 2: Define the tool schema
Group related operations under a single tool using anaction enum. This matches the pattern the built-in tools use.
- Keep descriptions short. The model reads every tool definition on each turn.
- Use
additionalProperties: falseto prevent hallucinated parameters. - Reference
superdoc_searchin descriptions so the model knows how to get targets.
Step 3: Write a dispatcher
Map each action to the correspondingdoc.* call:
Step 4: Merge and use
Combine your custom tool with the SDK tools and use your dispatcher in the agentic loop:Extending the system prompt
For custom tools, append usage instructions to the SDK system prompt so the model knows how to use them:SDK functions
Related
- How to use: step-by-step integration guide with copy-pasteable code
- Best practices: prompting, workflow tips, and tested prompt examples
- Debugging: troubleshoot tool call failures
- SDKs: typed Node.js and Python wrappers
- Document API: the operation set behind the tools

