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'
}
A 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.'
}
A 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' } ]
}
Properties
actionName : AIActionsNames | undefinedmodule:ai/aiactions/aiactions~AIActionDefinition#actionNameargs : Record<string, string> | undefinedmodule:ai/aiactions/aiactions~AIActionDefinition#argscontexts : Array<AIContextRef> | undefinedmodule: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 : string | undefinedmodule:ai/aiactions/aiactions~AIActionDefinition#modeluserMessage : string | undefinedmodule:ai/aiactions/aiactions~AIActionDefinition#userMessage
Value
object