AIActionDefinition
Defines the parameters for an AI action executed via executeAction().
The definition supports a few different shapes, depending on the action type and its prompt source:
A system action runs one of the predefined actions. Provide its actionName.
{
actionName: 'improve-writing'
}Copy codeA custom action runs an inline prompt. Provide the model together with a userMessage that carries the prompt.
{
model: 'claude-4-6-sonnet',
userMessage: 'Rewrite the selected text in a more formal tone.'
}Copy codeA custom action can also rely on a context reference instead of an inline prompt. In that case neither actionName nor userMessage is set, and the referenced context is passed through contexts.
{
model: 'claude-4-6-sonnet',
contexts: [ { id: 'style-guide', promptId: 'improve-writing' } ]
}Copy codeProperties
module:ai/aiactions/aiactions~AIActionDefinition#actionNameargs?: Record<string, string>module:ai/aiactions/aiactions~AIActionDefinition#argscontexts?: Array<AIContextRef>module:ai/aiactions/aiactions~AIActionDefinition#contextsContext references attached to the action.
Experimental: This is a production-ready API but may change in minor releases without the standard deprecation policy. Check the changelog for migration guidance.
model?: stringmodule:ai/aiactions/aiactions~AIActionDefinition#modeluserMessage?: stringmodule:ai/aiactions/aiactions~AIActionDefinition#userMessage
Value
object