AIQuickActionCustomActionDefinition
A custom AI quick action definition.
The action needs a prompt source, provided in one of three ways:
- an inline
promptstring - sent as the prompt, - a
contextreference - the referenced context drives the action (for example through a prompt it contains), - both - the inline
promptis used and thecontextis attached as additional reference material (for example a file).
The model property is optional. If not specified, the default model (from the ai.models.defaultModelId configuration or the first available model) is used.
{
id: 'add-quote-from-famous-person',
label: 'Add a quote from a famous person',
prompt: 'Add a quote from a known person, which would make sense in the context of the selected text.',
type: 'action',
model: 'claude-4-6-sonnet'
}
The same action using a context reference instead of an inline prompt:
{
id: 'add-quote-from-famous-person',
label: 'Add a quote from a famous person',
context: { id: 'my-context', promptId: 'add-quote' },
type: 'action',
model: 'claude-4-6-sonnet'
}
An inline prompt combined with a context that attaches a single file as reference material:
{
id: 'add-quote-from-famous-person',
label: 'Add a quote from a famous person',
prompt: 'Add a quote from a known person, which would make sense in the context of the selected text.',
context: { id: 'my-context', fileId: 'famous-quotes' },
type: 'action',
model: 'claude-4-6-sonnet'
}
Properties
context : AIContextRef | undefinedreadonlymodule:ai/aiquickactions/aiquickactions~AIQuickActionCustomActionDefinition#contextA context reference attached to the action.
When no inline
promptis provided, the referenced context drives the action (a whole context or apromptIdreference). When combined with an inlineprompt, it is attached as additional reference material (for example a single file).Experimental: This is a production-ready API but may change in minor releases without the standard deprecation policy. Check the changelog for migration guidance.
prompt : string | undefinedreadonlymodule:ai/aiquickactions/aiquickactions~AIQuickActionCustomActionDefinition#promptThe prompt to be sent to the AI model when the action is executed.
At least one prompt source is required: an inline
prompt, acontextthat carries a prompt (a whole context or apromptIdreference), or both. Acontextthat references only a single file (fileId) cannot drive the action on its own and must be combined with an inlineprompt.type : 'action'module:ai/aiquickactions/aiquickactions~AIQuickActionCustomActionDefinition#type
Value
AIQuickActionCustomBaseDefinition & object