Writing a Code Action
Create an Action in the dashboard and choose the Code backend. Default-export a function;defineAction from the SDK adds typing and an authenticated client:
inputs— the Action’s declared inputs, already validated against its input schemaconfig— your organization’s configuration variables (for API keys and settings)client— the Simple AI SDK, authenticated for your organization automatically; you never handle an API key
result — for example {{ result.plan }}.
Rules and Limits
- TypeScript or JavaScript, Node.js 22. The only importable package is
@simple-ai-lab/sdk(preinstalled in the sandbox). - Timeout: configurable per action, 1–60 seconds (default 30). Voice conversations feel best well under 10 seconds — configure filler speech on the agent for longer actions.
- Result size: the returned value must serialize to JSON of at most 1 MB.
- Logs:
console.log/console.erroroutput is captured and shown in test runs and call transcripts — it never pollutes the result. - Each execution runs in a fresh, isolated sandbox; nothing persists between runs. Persist state in custom data instead.