Customize the system prompt
Would you like to customize how your AI agent acts, writes and responds to users? Define a custom system prompt.
Usage with Tiptap Cloud
When using the AI Agent extension with Tiptap Cloud, use the systemPrompt
option to set a custom system prompt for the AI agent.
const provider = new AiAgentProvider({
systemPrompt: 'You are an AI agent that edits rich text...',
// ... Other options
})
This will replace the default system prompt that is used in Tiptap Cloud.
Usage with a custom AI agent
When using the AI Agent extension with a custom AI agent running in your backend, the way to customize the system prompt depends on the AI model provider you are using. Learn more in our Custom AI agent integration guide.
Support multiple AI agent types
Thanks to system prompts, your app can support multiple types of AI Agents, each with their rules and personality. You can change the system prompt at any time by calling the setSystemPrompt
method.
provider.setSystemPrompt('You are an AI agent that edits rich text...')
Crafting a good system prompt
Nailing the right system prompt can be hard. The @tiptap-pro/extension-ai-agent-server
package provides a default system prompt that works out of the box with the AI agent. Use it as a starting point to build your custom system prompt.
import { getDefaultSystemPrompt } from '@tiptap-pro/extension-ai-agent-server'
// Log the default system prompt to read it and adjust it to your needs.
console.log(getDefaultSystemPrompt())
Prompt engineering techniques can help you obtain the desired behavior from the AI agent. To learn more, see these resources: