# AIActionDefinition

typedef

Defines the parameters for an AI action executed via [`executeAction()`](module_ai_aiactions_aiactions-AIActions.md#function-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`.

```typescript
{
	actionName: 'improve-writing'
}
```

A custom action runs an inline prompt. Provide the `model` together with a `userMessage` that carries the prompt.

```typescript
{
	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`.

```typescript
{
	model: 'claude-4-6-sonnet',
	contexts: [ { id: 'style-guide', promptId: 'improve-writing' } ]
}
```

<a id="properties">

## Properties

<a id="member-actionName">

### `actionName?: AIActionsNames`

<a id="member-args">

### `args?: Record<string, string>`

<a id="member-contexts">

### `contexts?: Array<AIContextRef>`

Context 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.

<a id="member-model">

### `model?: string`

<a id="member-userMessage">

### `userMessage?: string`

#### Value

`object`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
