# Limits and Errors

Limits on actions, executions, and calls, and the errors the actions API returns.

## Limits

| Limit                                                       | Value                              |
| ----------------------------------------------------------- | ---------------------------------- |
| Triggers per action                                         | 16                                 |
| Trigger expression size                                     | 16 KiB                             |
| Expressions in a trigger `view`                             | 64                                 |
| `session.schedule` entries                                  | 8                                  |
| `every` in a `session.schedule` entry                       | Whole minutes, at least 1m         |
| `turns.window`                                              | 24h                                |
| A view as the agent reads it                                | 4 KiB                              |
| Configuration size                                          | 352 KiB                            |
| Event and handler output size                               | 1 MiB                              |
| Samples per `validateAction` call                           | 100                                |
| Page size (`first`)                                         | 1 to 100                           |
| `maxInvocations`                                            | 24                                 |
| `timeout`                                                   | 24h                                |
| `retryDelay` and `maxRetryDelay`                            | 12h                                |
| `responseTimeout`                                           | 10m                                |
| `completionTimeout`                                         | 24h                                |
| Tools an MCP server references                              | 128                                |
| Tool levels below a first call                              | 8                                  |
| Calls beneath one call                                      | 1,024                              |
| Agents in one call chain                                    | 3                                  |
| Output uses per invocation                                  | 256                                |
| Transcript events per invocation                            | 4,096                              |
| Starlark source                                             | 64 KiB                             |
| Starlark steps per invocation                               | 1,000,000                          |
| `graphql`, `cel`, and `tools` calls per Starlark invocation | 64 each                            |
| A `cel` expression from Starlark                            | 16 KiB; aggregate CEL cost 100,000 |

## Errors

Errors follow the [API error format](https://www.twisp.com/docs/reference/api/errors.md). Reads of an identifier that was never created return null rather than an error. A request refused because it conflicts with what is recorded, such as rerunning a replay or an unfinished execution, replaying a replay, or answering an approval request twice, has code `BAD_REQUEST` and is not retriable: the same request is refused the same way.

| Situation                                                                                                                                                                                                         | Result                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `updateAction`, `deleteAction`, `cancelExecution`, `rerunExecution`, or `replayExecution` on an identifier that was never created                                                                                 | Error with code `NOT_FOUND`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Invalid trigger, configuration, policy, or execution setting on create, update, or validation                                                                                                                     | Error whose message names the rejected setting, for example `retry delay cannot exceed the maximum retry delay`.                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| More than 16 triggers, or no trigger, `tool` block, kind `skill`, or kind `mcp`, on create, update, or validation                                                                                                 | Error `an action accepts at most 16 triggers`, or `an action requires a trigger, a tool block, kind skill, or kind mcp`.                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| A name already used by another action, or a `tools` or `skills` entry that cannot be resolved                                                                                                                     | Error; the write is rejected.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| An invalid `schedule`, `cron`, `timezone`, `every`, or `session.ends`, or a schedule trigger without a name or resuming by `input`                                                                                | Error whose message names the rejected setting, for example `session.schedule[0].every: every 1m30s: must be whole minutes`.                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `session.ends`, `session.schedule`, or a schedule trigger in a deployment without a scheduler                                                                                                                     | Error `this deployment has no scheduler: session.ends, session.schedule, and schedule triggers are unavailable`.                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| A session turn that reports `COMPLETED` before the session's end, or `OPEN` in its final turn                                                                                                                     | The turn fails with `action_output_invalid`. An agent is offered only the allowed status.                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| A skill whose name is also a tool name the action's model sees                                                                                                                                                    | Error `tool and skill names must be distinct within one action`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| An agent's call to a tool or skill version it does not pin                                                                                                                                                        | Permission error carrying the code `tool_not_declared`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| A call to a tool whose session is closed                                                                                                                                                                          | Error with code `INVALID_STATE_TRANSITION` carrying `session_closed`; nothing runs or is recorded.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| A skill load whose input is not an empty object                                                                                                                                                                   | Error `a skill load takes an empty input object`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `invokeAction` on a disabled, deleted, or unpublished tool, a [native tool](https://www.twisp.com/docs/reference/actions/tools.md#native-tools) that acts for its caller, or without `INVOKE` permission                                       | Error that is not retriable, with code `NOT_SUPPORTED` or `ACCESS_DENIED`, whose `actionError` extension carries the reason's `code`, such as `action_not_callable` or `action_access_denied`, with a `message` and `hint`; nothing runs or is recorded.                                                                                                                                                                                                                                                                                                                |
| `startAction` on a disabled, deleted, or unpublished action, one without a `tool` block, a tool with a session, from inside an execution, without `INVOKE` permission, or with input that fails the schema        | Error that is not retriable, with code `NOT_SUPPORTED`, `ACCESS_DENIED`, or `BAD_REQUEST`, whose `actionError` extension carries the reason's `code`, such as `action_not_callable`, `start_not_supported`, `action_access_denied`, or `action_input_invalid`, with a `message` and `hint`; nothing is queued or recorded. In gRPC, the status carries them as an `ErrorInfo` detail: `reason` is the code, and `metadata.hint` the hint. From inside an MCP request, run the action with [`invoke`](https://www.twisp.com/docs/reference/actions/mcp.md#invoke) instead, on a server that lists it. |
| `startAction` of a native tool that acts for its caller, such as `program`, `invoke`, `read_turn_input`, or a harness tool, or `rerunExecution` of a call to one                                                  | Error that is not retriable, with code `NOT_SUPPORTED` and `actionError` code `start_not_supported`: such a tool runs only as its caller's call. Nothing is queued or recorded.                                                                                                                                                                                                                                                                                                                                                                                         |
| `startAction` with an `executionId` already used with a different principal, action, version, or input                                                                                                            | Error with code `ALREADY_EXISTS`, not retriable; an execution identifier names one start.                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| An invocation of a started execution after its starter was revoked, may no longer invoke the action, or its token expired                                                                                         | The execution fails with `action_access_denied`; nothing of the invocation runs.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `invokeAction` with input that fails the tool's schema, or a call that fails                                                                                                                                      | A `FAILED` execution whose `invocation.error` carries the code and a hint; the caller can still commit.                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| A write conflict, passed deadline, or interrupted transaction during a call                                                                                                                                       | Retryable error; roll back and retry in a new transaction.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Kind `workflow.starlark`, a `tool` block on a kind other than `tool`, `agent`, or a native tool's, or kind `tool` without one                                                                                     | Error; kind `tool` with config `{runtime, src}` replaces `workflow.starlark`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| An agent whose schemas do not combine into its turn outcome, whose limits could derive more than 256 uses, or whose references read `tool.input` while it has triggers                                            | Error whose message names the rule.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| An action named after a [native tool](https://www.twisp.com/docs/reference/actions/tools.md#native-tools), such as `graphql`, `cel`, or `read_turn_input`                                                                                      | Error; the names are reserved for native tools.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Update or delete of a deleted action                                                                                                                                                                              | Error; the action is immutable after `pending: DELETED`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `rerunExecution` of an intake record whose action is disabled or deleted, at a version without a `session`, or at a version whose triggers are no longer published                                                | Error whose message names the reason; nothing is created.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `rerunExecution` on a non-terminal source, or `executionId` reuse with different values                                                                                                                           | Error; the source must be terminal and an execution identifier names one rerun.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `replayExecution` on an unfinished execution, a call another execution made, a replay, an intake record, an action that is not kind `agent` or `mcp`, or with a version whose session does not match the source's | Error whose message names the reason; nothing is created.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `rerunExecution` of an MCP server's request                                                                                                                                                                       | Error; a request runs only when its endpoint serves it. Replay it instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `rerunExecution` or `replayExecution` of a draft's preview, an execution with a `draft`                                                                                                                           | Error; no version holds the draft it ran. Preview the draft again.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `rerunExecution` or `replayExecution` without `INVOKE` on the action, or `rerunExecution` from inside an execution                                                                                                | Error; nothing is queued or recorded. From inside an MCP request, run the action with [`invoke`](https://www.twisp.com/docs/reference/actions/mcp.md#invoke) instead, on a server that lists it.                                                                                                                                                                                                                                                                                                                                                                                                     |
| `rerunExecution` of a call to a tool with a session, or of a call or start whose action is no longer callable                                                                                                     | Error whose message names the reason; nothing is queued. Call the tool again instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `replayExecution` with `executionId` reuse with different values                                                                                                                                                  | Error; an execution identifier names one replay.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `cancelExecution` on an execution processing a session turn                                                                                                                                                       | Error; close the session instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Explicit `null` on an update field outside `execution`                                                                                                                                                            | Error; omit the field to preserve it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| An execution listing with `intake: true` and, in the gRPC `ListActionExecutions`, a `session_id` or `parent_execution_id`                                                                                         | Error; intake records run no turn and make no call.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Cursor from a different filter, or `first` outside 1 to 100                                                                                                                                                       | Error.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

Because operations inside one `actions` block share a transaction, an error in any of them aborts all of them.
