Actions
Define workflow and agent actions with createAction.
An action is a single operation users (or agents) can invoke as a workflow step or tool call. Define actions with createAction from @lunnoa/toolkit.
These examples assume you already understand the toolkit overview.
createAction fields
| Field | Purpose |
|---|---|
id | Unique id: <app-id>_action_<action-name> |
name / description | Labels shown in the workflow and agent UIs |
inputConfig | UI fields for configuring the action (see Input config) |
aiSchema | Zod object that mirrors inputConfig field ids; used by agents and validation |
run | Executes the action; receives configValue, connection, and platform services |
mockRun | Returns representative output for workflow mapping and testing |
needsConnection | Set false when this action does not need the app's connection |
needsApproval | When true, agent tool execution requires user approval before running |
availableForAgent | Set false to hide the action from the agent tool list |
iconUrl | Optional; falls back to the app logoUrl |
ui | Optional declarative chat UI for execution and output |
systemPromptFragment | Optional per-action policy text injected when the tool is enabled |
Example
send-request.ts
aiSchema must match inputConfig
If inputConfig has a field with id: 'name', then aiSchema must include a name property. Agents and validation rely on that 1:1 mapping. Keep descriptions on Zod fields short and concrete so tool calling stays reliable.
run vs mockRun
runis the real execution path in workflows and agent tools. PreferconfigValueandconnectionfrom the handler args.mockRunshould return data shaped likerunso users can map outputs to downstream steps. If the output is always different, hide save-and-test withviewOptions.hideSaveAndTestButton: true.
Handlers run inside the Lunnoa server. Do not assume your package's private node_modules beyond the toolkit peer dependency and what the host injects.
Next
- Input config: build the configuration form
- Connections: require auth with
needsConnection - Packaging: export actions from
createApp