@elevasis/sdk 0.5.11 → 0.5.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/cli.cjs +276 -298
  2. package/dist/index.d.ts +13 -256
  3. package/dist/index.js +10 -38
  4. package/dist/templates.js +193 -187
  5. package/dist/types/worker/adapters/index.d.ts +0 -1
  6. package/dist/worker/index.js +126 -75
  7. package/package.json +1 -1
  8. package/reference/_navigation.md +13 -57
  9. package/reference/concepts.mdx +203 -0
  10. package/reference/deployment/{command-center-ui.mdx → command-center.mdx} +229 -151
  11. package/reference/deployment/index.mdx +158 -153
  12. package/reference/framework/agent.mdx +168 -151
  13. package/reference/framework/index.mdx +182 -103
  14. package/reference/framework/memory.mdx +347 -347
  15. package/reference/framework/project-structure.mdx +3 -13
  16. package/reference/framework/tutorial-system.mdx +253 -0
  17. package/reference/{getting-started/index.mdx → getting-started.mdx} +6 -7
  18. package/reference/index.mdx +117 -114
  19. package/reference/platform-tools/adapters.mdx +175 -32
  20. package/reference/platform-tools/index.mdx +354 -195
  21. package/reference/resources/index.mdx +5 -0
  22. package/reference/{roadmap/index.mdx → roadmap.mdx} +1 -1
  23. package/reference/{runtime/index.mdx → runtime.mdx} +196 -141
  24. package/dist/types/worker/adapters/trello.d.ts +0 -14
  25. package/reference/concepts/index.mdx +0 -203
  26. package/reference/deployment/command-view.mdx +0 -154
  27. package/reference/framework/documentation.mdx +0 -92
  28. package/reference/platform-tools/examples.mdx +0 -170
  29. package/reference/runtime/limits.mdx +0 -75
  30. package/reference/security/credentials.mdx +0 -141
  31. /package/reference/{cli/index.mdx → cli.mdx} +0 -0
  32. /package/reference/{developer → framework}/interaction-guidance.mdx +0 -0
  33. /package/reference/{troubleshooting/common-errors.mdx → troubleshooting.mdx} +0 -0
@@ -1,141 +1,196 @@
1
- ---
2
- title: Execution Runtime
3
- description: How your code runs on the Elevasis platform -- execution lifecycle, concurrency, timeouts, cancellation, error handling, and observability
4
- loadWhen: "Debugging execution behavior or understanding the runtime model"
5
- ---
6
-
7
- This page covers everything that happens after you deploy -- how resources execute as managed processes, how failures surface to you, and what observability data you can access. For resource limits and quotas, see [Resource Limits & Quotas](limits.mdx).
8
-
9
- ---
10
-
11
- ## Execution Lifecycle
12
-
13
- ### The Four Stages
14
-
15
- Every execution traverses four stages: trigger, route, execute, and return.
16
-
17
- 1. **Trigger** -- A user, CLI command, or API call initiates execution. The platform creates an execution record with `status: 'running'` and generates a unique `executionId`.
18
- 2. **Route** -- The platform resolves the target resource from the registry. All resources (static and external) coexist in a single in-memory registry with no database queries at lookup time.
19
- 3. **Execute** -- An ephemeral worker thread is created from your deployed bundle and sent the execution request. The worker matches the `resourceId` to your definition, validates the input against your Zod schema, and runs the handler. For workflows, steps execute sequentially following the `next` chain. The worker is terminated immediately after execution completes.
20
- 4. **Return** -- The worker posts the result back to the platform. The platform stores the final result, updates the execution record, and fans events out to AI Studio and CLI subscribers.
21
-
22
- ### Concurrency Model
23
-
24
- Workers are ephemeral -- each execution creates a new worker thread. There is no persistent pool:
25
-
26
- - **Per-execution isolation:** Each execution gets its own worker thread. Concurrent executions for the same organization run in separate workers with no shared state.
27
- - **Memory:** Each worker is capped at 256MB. Concurrent workers multiply memory usage proportionally.
28
- - **No cold start:** Workers are created fresh per execution. Your first execution and hundredth are identical in terms of startup behavior.
29
-
30
- ### Timeout Enforcement
31
-
32
- Timeouts are enforced by the platform. You do not handle them explicitly in your code:
33
-
34
- - **Default timeout:** A platform default applies to all resource types unless overridden.
35
- - **Per-resource override:** Agents can configure `constraints.timeout` in the agent definition. Workflows use the platform default.
36
- - **Enforcement:** When a timeout fires, the worker is terminated immediately -- even if it is stuck in a synchronous loop. No special handler signature is required on your part.
37
-
38
- ### Cancellation Protocol
39
-
40
- Cancellation is initiated by the platform and requires no special code in your handler:
41
-
42
- 1. A cancellation request is received -- via CLI, API, or platform timeout.
43
- 2. The platform aborts the execution controller registered for that `executionId`.
44
- 3. The worker is terminated immediately (kills the worker even if stuck in a synchronous loop).
45
- 4. The platform records the cancellation in the execution record.
46
-
47
- **What triggers cancellation:**
48
-
49
- - You call `POST /api/external/executions/:resourceId/:executionId/cancel` via CLI or API
50
- - The platform timeout expires
51
- - The resource is deleted while an execution is in-flight
52
-
53
- ---
54
-
55
- ## Error Handling
56
-
57
- ### How Errors Reach You
58
-
59
- Errors are displayed depending on the surface you use to inspect them:
60
-
61
- - **AI Studio:** Shows the error message and execution status. Example: `Remote resource 'onboard-client' failed: Email delivery failed: invalid address`
62
- - **CLI (`elevasis-sdk execution <resourceId> <id>`):** Shows full execution detail including the error message. The `--json` flag includes an `error` field in structured output.
63
- - **Error message source:** The error string comes directly from your handler's catch block (`String(err)`). The platform stores this verbatim and displays it as-is. Write descriptive error messages in your handlers -- they surface directly to users.
64
-
65
- ### What Causes a Failed Execution
66
-
67
- - **Unhandled exception in your handler:** The worker reports `status: 'failed'` with the error message.
68
- - **Memory limit exceeded (256MB):** The worker crashes with an out-of-memory error. The platform catches this; other tenants are unaffected.
69
- - **Timeout exceeded:** The platform terminates the worker and marks the execution failed with a timeout reason.
70
- - **Cancellation:** Execution is marked cancelled.
71
-
72
- ---
73
-
74
- ## Observability
75
-
76
- ### Logging
77
-
78
- You produce logs using standard `console` methods -- no special logger object is needed:
79
-
80
- - **Console interception:** The SDK worker runtime intercepts `console.log`, `console.warn`, and `console.error` during handler execution and captures them as structured `{ level, message }` entries.
81
- - **Level mapping:** `console.log` maps to `info`, `console.warn` maps to `warn`, `console.error` maps to `error`.
82
- - **No changes required:** Any code that already uses `console.log` automatically has its output captured. Existing code works without modification.
83
-
84
- ### Log Transport
85
-
86
- Logs are delivered to the platform atomically with the execution result:
87
-
88
- - **Bundled delivery:** All logs for an execution are included in the result message when the handler completes. There is no real-time streaming -- logs arrive with the final result.
89
- - **Crash behavior:** If the worker crashes before completing, logs captured up to the crash point are lost. The platform records only the crash error.
90
-
91
- ### Log Retention and Display
92
-
93
- - **Retention:** 30 days by default (configurable per plan).
94
- - **Real-time fanout:** After execution completes, logs are stored and fanned out to AI Studio and CLI subscribers. AI Studio shows them in the execution detail view.
95
- - **CLI access:** Use `elevasis-sdk execution <resourceId> <id>` to view execution details including logs.
96
-
97
- ---
98
-
99
- ## Resource Lifecycle
100
-
101
- ### Status
102
-
103
- Every resource on the platform has a status that you control in your definition:
104
-
105
- - **`dev`** -- Default for new resources. Visible in AI Studio and executable, but marked with a "Development" badge. Use this during testing and iteration.
106
- - **`prod`** -- Set `status: 'prod'` in your resource definition before deploying. No badge. This is the live, production-ready state.
107
-
108
- ### Versioning
109
-
110
- v1 versioning is intentionally simple:
111
-
112
- - **One active version per resource per org.** Deploying replaces the running version. There is no version history at the resource level; previous deploys are marked stopped.
113
- - **Immutable per deploy.** A resource definition is frozen at deploy time. Changing code requires a new deploy.
114
-
115
- ### Deletion
116
-
117
- - **Via CLI:** Remove the resource from your `OrganizationResources` export and run `elevasis-sdk deploy`. Resources absent from the new bundle are automatically deregistered from the platform.
118
- - **Via AI Studio:** The delete button unregisters the resource immediately and marks the deployment stopped.
119
- - **In-flight executions:** Workers already running complete normally. Deletion affects only new execution attempts.
120
- - **Data retention:** Execution logs and history for a deleted resource are retained for 30 days, then purged.
121
-
122
- ---
123
-
124
- ## Platform Storage
125
-
126
- Your deployed bundle is stored in Supabase Storage. On API restart, the platform re-registers all active deployments from the database and re-downloads bundles if needed. This means:
127
-
128
- - **No data loss on restart:** Your resources are automatically re-registered after platform restarts.
129
- - **No action required from you:** The platform handles recovery transparently.
130
-
131
- ---
132
-
133
- ## Platform Maintenance
134
-
135
- - **Rolling updates:** Platform upgrades trigger a re-registration of all active deployments on startup. No in-flight executions are lost (workers are ephemeral and complete independently).
136
- - **In-flight executions during restart:** Already-running workers complete normally. New executions use the newly reloaded registry after restart.
137
- - **Advance notice:** You will receive 24-hour advance notice for breaking maintenance windows. These are rare and reserved for major infrastructure changes.
138
-
139
- ---
140
-
141
- **Last Updated:** 2026-02-25
1
+ ---
2
+ title: Execution Runtime
3
+ description: How your code runs on the Elevasis platform -- execution lifecycle, concurrency, timeouts, cancellation, error handling, observability, resource limits, and v1 limitations
4
+ loadWhen: "Debugging execution behavior or understanding the runtime model"
5
+ ---
6
+
7
+ This page covers everything that happens after you deploy -- how resources execute as managed processes, how failures surface to you, what observability data you can access, and the hard limits enforced on all executions.
8
+
9
+ ---
10
+
11
+ ## Execution Lifecycle
12
+
13
+ ### The Four Stages
14
+
15
+ Every execution traverses four stages: trigger, route, execute, and return.
16
+
17
+ 1. **Trigger** -- A user, CLI command, or API call initiates execution. The platform creates an execution record with `status: 'running'` and generates a unique `executionId`.
18
+ 2. **Route** -- The platform resolves the target resource from the registry. All resources (static and external) coexist in a single in-memory registry with no database queries at lookup time.
19
+ 3. **Execute** -- An ephemeral worker thread is created from your deployed bundle and sent the execution request. The worker matches the `resourceId` to your definition, validates the input against your Zod schema, and runs the handler. For workflows, steps execute sequentially following the `next` chain. The worker is terminated immediately after execution completes.
20
+ 4. **Return** -- The worker posts the result back to the platform. The platform stores the final result, updates the execution record, and fans events out to AI Studio and CLI subscribers.
21
+
22
+ ### Concurrency Model
23
+
24
+ Workers are ephemeral -- each execution creates a new worker thread. There is no persistent pool:
25
+
26
+ - **Per-execution isolation:** Each execution gets its own worker thread. Concurrent executions for the same organization run in separate workers with no shared state.
27
+ - **Memory:** Each worker is capped at 256MB. Concurrent workers multiply memory usage proportionally.
28
+ - **No cold start:** Workers are created fresh per execution. Your first execution and hundredth are identical in terms of startup behavior.
29
+
30
+ ### Timeout Enforcement
31
+
32
+ Timeouts are enforced by the platform. You do not handle them explicitly in your code:
33
+
34
+ - **Default timeout:** A platform default applies to all resource types unless overridden.
35
+ - **Per-resource override:** Agents can configure `constraints.timeout` in the agent definition. Workflows use the platform default.
36
+ - **Enforcement:** When a timeout fires, the worker is terminated immediately -- even if it is stuck in a synchronous loop. No special handler signature is required on your part.
37
+
38
+ ### Cancellation Protocol
39
+
40
+ Cancellation is initiated by the platform and requires no special code in your handler:
41
+
42
+ 1. A cancellation request is received -- via CLI, API, or platform timeout.
43
+ 2. The platform aborts the execution controller registered for that `executionId`.
44
+ 3. The worker is terminated immediately (kills the worker even if stuck in a synchronous loop).
45
+ 4. The platform records the cancellation in the execution record.
46
+
47
+ **What triggers cancellation:**
48
+
49
+ - You call `POST /api/external/executions/:resourceId/:executionId/cancel` via CLI or API
50
+ - The platform timeout expires
51
+ - The resource is deleted while an execution is in-flight
52
+
53
+ ---
54
+
55
+ ## Error Handling
56
+
57
+ ### How Errors Reach You
58
+
59
+ Errors are displayed depending on the surface you use to inspect them:
60
+
61
+ - **AI Studio:** Shows the error message and execution status. Example: `Remote resource 'onboard-client' failed: Email delivery failed: invalid address`
62
+ - **CLI (`elevasis-sdk execution <resourceId> <id>`):** Shows full execution detail including the error message. The `--json` flag includes an `error` field in structured output.
63
+ - **Error message source:** The error string comes directly from your handler's catch block (`String(err)`). The platform stores this verbatim and displays it as-is. Write descriptive error messages in your handlers -- they surface directly to users.
64
+
65
+ ### What Causes a Failed Execution
66
+
67
+ - **Unhandled exception in your handler:** The worker reports `status: 'failed'` with the error message.
68
+ - **Memory limit exceeded (256MB):** The worker crashes with an out-of-memory error. The platform catches this; other tenants are unaffected.
69
+ - **Timeout exceeded:** The platform terminates the worker and marks the execution failed with a timeout reason.
70
+ - **Cancellation:** Execution is marked cancelled.
71
+
72
+ ---
73
+
74
+ ## Observability
75
+
76
+ ### Logging
77
+
78
+ You produce logs using standard `console` methods -- no special logger object is needed:
79
+
80
+ - **Console interception:** The SDK worker runtime intercepts `console.log`, `console.warn`, and `console.error` during handler execution and captures them as structured `{ level, message }` entries.
81
+ - **Level mapping:** `console.log` maps to `info`, `console.warn` maps to `warn`, `console.error` maps to `error`.
82
+ - **No changes required:** Any code that already uses `console.log` automatically has its output captured. Existing code works without modification.
83
+
84
+ ### Log Transport
85
+
86
+ Logs are delivered to the platform atomically with the execution result:
87
+
88
+ - **Bundled delivery:** All logs for an execution are included in the result message when the handler completes. There is no real-time streaming -- logs arrive with the final result.
89
+ - **Crash behavior:** If the worker crashes before completing, logs captured up to the crash point are lost. The platform records only the crash error.
90
+
91
+ ### Log Retention and Display
92
+
93
+ - **Retention:** 30 days by default (configurable per plan).
94
+ - **Real-time fanout:** After execution completes, logs are stored and fanned out to AI Studio and CLI subscribers. AI Studio shows them in the execution detail view.
95
+ - **CLI access:** Use `elevasis-sdk execution <resourceId> <id>` to view execution details including logs.
96
+
97
+ ---
98
+
99
+ ## Resource Lifecycle
100
+
101
+ ### Status
102
+
103
+ Every resource on the platform has a status that you control in your definition:
104
+
105
+ - **`dev`** -- Default for new resources. Visible in AI Studio and executable, but marked with a "Development" badge. Use this during testing and iteration.
106
+ - **`prod`** -- Set `status: 'prod'` in your resource definition before deploying. No badge. This is the live, production-ready state.
107
+
108
+ ### Versioning
109
+
110
+ v1 versioning is intentionally simple:
111
+
112
+ - **One active version per resource per org.** Deploying replaces the running version. There is no version history at the resource level; previous deploys are marked stopped.
113
+ - **Immutable per deploy.** A resource definition is frozen at deploy time. Changing code requires a new deploy.
114
+
115
+ ### Deletion
116
+
117
+ - **Via CLI:** Remove the resource from your `OrganizationResources` export and run `elevasis-sdk deploy`. Resources absent from the new bundle are automatically deregistered from the platform.
118
+ - **Via AI Studio:** The delete button unregisters the resource immediately and marks the deployment stopped.
119
+ - **In-flight executions:** Workers already running complete normally. Deletion affects only new execution attempts.
120
+ - **Data retention:** Execution logs and history for a deleted resource are retained for 30 days, then purged.
121
+
122
+ ---
123
+
124
+ ## Platform Storage
125
+
126
+ Your deployed bundle is stored in Supabase Storage. On API restart, the platform re-registers all active deployments from the database and re-downloads bundles if needed. This means:
127
+
128
+ - **No data loss on restart:** Your resources are automatically re-registered after platform restarts.
129
+ - **No action required from you:** The platform handles recovery transparently.
130
+
131
+ ---
132
+
133
+ ## Resource Limits & Quotas
134
+
135
+ ### Per-Worker Limits
136
+
137
+ Limits enforced per worker thread at runtime:
138
+
139
+ | Resource | Value |
140
+ | ---------------- | ----------------------------------------------------------- |
141
+ | Memory (V8 heap) | 256MB per worker |
142
+ | Disk | Bundle file only (ephemeral, not persistent across deploys) |
143
+
144
+ - **Memory:** Enforced by the platform. Exceeding 256MB crashes the worker. The platform catches the error; other tenants are unaffected. If your workflow processes large datasets, consider streaming or batching to stay within the limit.
145
+ - **Disk:** Your bundle is written to disk during deploy and available to the worker at execution time. It is not a persistent write surface -- do not write files to disk from within your handler expecting them to persist.
146
+
147
+ ### Scale Limits
148
+
149
+ Hard limits to prevent abuse and ensure platform stability:
150
+
151
+ | Limit | Value |
152
+ | ---------------------------------- | ------------- |
153
+ | Max execution duration (workflows) | 300s (5 min) |
154
+ | Max execution duration (agents) | 600s (10 min) |
155
+ | Max log volume | 100MB/day |
156
+ | Max deploy frequency | 60/day |
157
+
158
+ - **Execution duration:** Executions exceeding the timeout are terminated by the platform. The execution is marked failed with a timeout reason.
159
+ - **Log volume:** Total log output across all executions is capped at 100MB per day. Logs beyond this threshold may be truncated.
160
+ - **Deploy frequency:** 60 deploys per day is generous for normal development. This limit prevents accidental deploy loops (for example, a CI pipeline misconfigured to deploy on every commit).
161
+
162
+ ### Networking
163
+
164
+ - **Outbound:** Unrestricted. Your handlers can call any external API (OpenAI, Twilio, Stripe, etc.) from within the worker.
165
+ - **Inbound:** Workers receive input from the platform coordinator via internal message passing -- they are not exposed to the network directly.
166
+ - **No ports:** Workers communicate with the platform via zero-network-overhead message passing. No port allocation occurs.
167
+ - **Isolation:** Workers have no access to other organizations' data or platform credentials by default. Supabase credentials are not present in the worker environment.
168
+
169
+ ---
170
+
171
+ ## Platform Maintenance
172
+
173
+ - **Rolling updates:** Platform upgrades re-register all active deployments on startup. No executions are lost.
174
+ - **Node.js updates:** When the server's Node.js version is updated, worker threads pick up the new version on the next execution with no action required from you.
175
+ - **In-flight executions during restart:** Already-running workers complete normally. New executions use the newly reloaded registry after restart.
176
+ - **Advance notice:** 24-hour advance notice is provided for breaking maintenance windows. These are rare and reserved for major infrastructure changes.
177
+
178
+ ---
179
+
180
+ ## v1 Limitations
181
+
182
+ | Limitation | Reason | Future path |
183
+ | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
184
+ | **No nested execution from external resources** | External resources cannot call back to the platform's execution coordinator to trigger other resources as sub-executions. | A callback API endpoint that external processes can call to trigger nested executions (requires auth token forwarding). |
185
+ | **No streaming logs** | Execution logs are returned in the response body after completion. There is no real-time SSE streaming from within the worker. | SSE/WebSocket push from external processes to the platform log system. |
186
+ | **Static resource priority conflicts** | If your organization has a static (monorepo) resource with the same ID as a resource in your SDK bundle, the deploy will fail. Static definitions always take priority and cannot be overridden. | Conflict detection is surfaced in the CLI with a clear error message. |
187
+
188
+ ---
189
+
190
+ ## Organization Provisioning
191
+
192
+ Organization creation is currently admin-only. If you need a new organization provisioned for SDK access, contact the Elevasis team. Self-serve organization creation and API key generation is on the roadmap.
193
+
194
+ ---
195
+
196
+ **Last Updated:** 2026-03-06
@@ -1,14 +0,0 @@
1
- /**
2
- * Trello Integration Adapter
3
- *
4
- * Typed wrapper over platform.call() for Trello board operations.
5
- * Uses factory pattern -- credential is bound once at construction time.
6
- */
7
- import type { TrelloToolMap } from '../../types/index.js';
8
- /**
9
- * Create a typed Trello adapter bound to a specific credential.
10
- *
11
- * @param credential - Credential name as configured in the command center
12
- * @returns Object with 10 typed methods for Trello board operations
13
- */
14
- export declare function createTrelloAdapter(credential: string): import("./create-adapter.js").TypedAdapter<TrelloToolMap>;
@@ -1,203 +0,0 @@
1
- ---
2
- title: Concepts Reference
3
- description: Plain-English explanations of Elevasis SDK concepts -- glossary, workflow analogies, Zod schemas, execution model, platform tools, common errors, and design decisions
4
- loadWhen: "User asks what is or needs conceptual grounding"
5
- ---
6
-
7
- This page covers core Elevasis concepts in plain English. It is the teaching vocabulary for the agent when helping you build workflows, and a reference you can return to whenever a term or behavior is unclear.
8
-
9
- ## Glossary
10
-
11
- | Term | Definition |
12
- | --- | --- |
13
- | Workflow | A series of named steps that run one after another. Each step does one job. The workflow receives input data and produces output data. |
14
- | Agent | An autonomous AI resource with access to platform tools. Agents can make decisions and call tools on their own. Run agents with `--async` to avoid HTTP timeout limits on long-running executions. |
15
- | Resource | Anything you deploy to the platform -- a workflow or an agent. Each resource has a unique ID. |
16
- | Step | One job inside a workflow. A step receives data, processes it, and passes data to the next step. |
17
- | Schema | A description of what your data looks like. Schemas validate that input and output data has the right shape -- the right fields with the right types. |
18
- | Credential | A saved API key or login for an external service (Gmail, Attio, Stripe). Stored securely on the platform, never in your code. |
19
- | Execution | One run of a resource. Each time someone triggers your workflow, that is one execution. |
20
- | Deployment | The act of uploading your code to the platform. After deploying, your resources are live and can be executed. |
21
- | Platform Tool | A pre-built integration the platform provides. You call platform tools from your workflow steps using `platform.call()`. |
22
- | Organization | Your team or company on the Elevasis platform. Resources, credentials, and executions belong to an organization. |
23
- | Handler | The function inside a step that does the actual work. It receives input data and returns output data. |
24
- | Entry Point | The first step that runs when a workflow is executed. Every workflow must have one. |
25
- | Resource ID | A unique lowercase name for your resource (e.g., `lead-scorer`, `send-welcome-email`). Must be unique within your organization. |
26
- | Workspace | Your Elevasis project directory. Contains resources (workflows and agents), documentation, and optionally a database connection and custom apps. Created by `elevasis-sdk init`. |
27
- | Data Table | A table in your database (e.g., Supabase) that stores structured data your workflows can read and write. Defined in `data/schema.ts` as documentation for the agent. |
28
-
29
- ---
30
-
31
- ## What is a Workflow?
32
-
33
- A workflow is a piece of automation that runs on the Elevasis platform. You define the steps in TypeScript; the platform handles running them, logging results, and retrying on failure.
34
-
35
- ### Two Analogies
36
-
37
- **Recipe analogy:** A recipe has ingredients (input), instructions (steps), and a finished dish (output). Each instruction is one step. You follow them in order. If a step fails (you burn the sauce), the recipe stops.
38
-
39
- **Assembly line analogy:** Raw material goes in one end (input). Each station does one job (step). The finished product comes out the other end (output).
40
-
41
- ### When to Use a Workflow
42
-
43
- - Automating a repeatable task with defined input and output
44
- - Chaining multiple actions together (fetch data, process it, send an email)
45
- - When you need the platform to handle execution, retries, and logging
46
-
47
- ### When NOT to Use a Workflow
48
-
49
- - One-off tasks you will only do once
50
- - Tasks that need constant human judgment at every step
51
-
52
- ---
53
-
54
- ## Understanding Schemas (Zod)
55
-
56
- ### What Schemas Do
57
-
58
- Schemas describe and validate the shape of data your workflow expects and produces. If someone sends the wrong data, the platform rejects it before your code runs. This prevents confusing errors deep inside your handler.
59
-
60
- The Elevasis SDK uses [Zod](https://zod.dev) for schema definition. Zod is a TypeScript-first validation library. Every workflow has an `inputSchema` and an `outputSchema`.
61
-
62
- ### Common Zod Types
63
-
64
- | Zod Type | What It Means | Example |
65
- | --- | --- | --- |
66
- | `z.string()` | Text | `"hello"`, `"user@email.com"` |
67
- | `z.number()` | A number | `42`, `3.14` |
68
- | `z.boolean()` | True or false | `true`, `false` |
69
- | `z.array(z.string())` | A list of text values | `["a", "b", "c"]` |
70
- | `z.object({ name: z.string() })` | A group of named fields | `{ "name": "Jane" }` |
71
- | `z.string().optional()` | Text that might be missing | `"hello"` or not provided |
72
- | `z.enum(['a', 'b', 'c'])` | One of a specific set of values | `"a"` |
73
- | `z.string().email()` | Text that must be a valid email | `"user@example.com"` |
74
-
75
- ### Why `z.infer` Exists
76
-
77
- `z.infer` creates a TypeScript type from a schema so the type system can check your code. You define the schema once and get both runtime validation and compile-time checking. Without it, you would have to define the same shape twice -- once as a Zod schema and once as a TypeScript type.
78
-
79
- ```ts
80
- const myInput = z.object({ name: z.string(), age: z.number() });
81
- type MyInput = z.infer<typeof myInput>;
82
- // MyInput is now: { name: string; age: number }
83
- ```
84
-
85
- ### Common Schema Mistakes
86
-
87
- - Forgetting `.optional()` on fields that might be missing -- the platform will reject valid input that omits those fields
88
- - Returning data from a handler that does not match the output schema -- causes `outputSchema validation failed`
89
- - Misspelling field names -- the schema says `companyName`, but the handler returns `company_name`
90
-
91
- ---
92
-
93
- ## The Execution Model
94
-
95
- ### What Happens When You Run a Workflow
96
-
97
- 1. A request arrives at the Elevasis platform (someone runs `elevasis-sdk exec` or a schedule triggers)
98
- 2. The platform creates a temporary server just for this execution
99
- 3. Your code runs on that server
100
- 4. The result is sent back
101
- 5. The temporary server is deleted
102
-
103
- ### Practical Implications
104
-
105
- | What You Might Expect | What Actually Happens | Why |
106
- | --- | --- | --- |
107
- | Files I create persist | Files disappear after execution | The server is temporary |
108
- | I can see logs in real-time | Logs appear after execution completes | No streaming from workers |
109
- | My code runs on my computer | Your code runs on Elevasis servers | That is what "deploy" means |
110
- | I can use unlimited memory | 256MB memory limit per execution | Prevents runaway processes |
111
- | Executions share state | Each execution is independent | No shared memory between runs |
112
- | I can call external APIs | Yes, outbound network is unrestricted | Workers have internet access |
113
-
114
- ### What "completed" vs "failed" Means
115
-
116
- - **completed** -- Your code ran successfully and returned output
117
- - **failed** -- Something went wrong: your code threw an error, timed out (300s default), or ran out of memory
118
-
119
- ---
120
-
121
- ## Platform Tools Overview
122
-
123
- Platform tools are pre-built integrations the platform provides. You call them from inside workflow steps using `platform.call()` without managing API keys in your code.
124
-
125
- ### Tool Categories
126
-
127
- | Category | Tools | Example Use |
128
- | --- | --- | --- |
129
- | Communication | Gmail, Resend, email | Send transactional emails, notifications |
130
- | CRM | Attio (11 methods) | Create leads, update records, search contacts |
131
- | Documents | PDF, Google Sheets, Notion | Generate invoices, read spreadsheets, update pages |
132
- | AI | LLM (GPT, Gemini, Claude) | Classify text, extract data, generate content |
133
- | Storage | Dropbox, platform storage | Upload files, create signed URLs |
134
- | Scheduling | Scheduler | Run workflows on a schedule or after a delay |
135
- | Approvals | Approval gates | Pause workflow until a human approves |
136
- | Verification | Mailso | Verify email addresses |
137
- | E-Signatures | SignatureAPI | Create and manage document envelopes |
138
- | Marketing | Instantly | Send email campaigns |
139
- | Payments | Stripe | Create payment links, checkout sessions |
140
- | Automation | Apify | Run web scraping actors |
141
-
142
- ### How Credentials Work
143
-
144
- 1. Create a credential in the Elevasis platform (API key, OAuth token, etc.) via the command center UI
145
- 2. Give it a name (e.g., `my-gmail`, `production-attio`)
146
- 3. In your code, pass that name: `platform.call({ credential: 'my-gmail', ... })`
147
- 4. The platform injects the actual API key at runtime -- it never appears in your code
148
-
149
- ### What Happens When a Credential Name is Wrong
150
-
151
- You will see a `PlatformToolError` with the message "credential not found". Check for typos -- credential names are case-sensitive.
152
-
153
- ---
154
-
155
- ## Common Errors and Fixes
156
-
157
- | Error | What It Means | How to Fix |
158
- | --- | --- | --- |
159
- | `ELEVASIS_API_KEY not set` | Your `.env` file is missing the API key | Add `ELEVASIS_API_KEY=sk_...` to `.env` |
160
- | `Schema validation failed` | The input data does not match your Zod schema | Compare the error's field names to your schema definition. Check types (string vs number) and required vs optional fields. |
161
- | `Cannot find module '@elevasis/sdk'` | Dependencies are not installed | Run `pnpm install` |
162
- | `PlatformToolError: credential not found` | The credential name in your code does not match any stored credential | Check spelling and case. Verify the credential name in the command center UI. |
163
- | `Execution timeout (300s)` | Your workflow took too long | Optimize your handler or break it into smaller steps. Check for infinite loops. |
164
- | `Cannot find name 'z'` | Missing Zod import | Add `import { z } from 'zod'` at the top of your file |
165
- | `Type 'X' is not assignable to type 'Y'` | Your handler returns data that does not match the output schema | Compare what your handler returns to what `outputSchema` expects. Field names and types must match exactly. |
166
- | `outputSchema validation failed` | Handler returned data but it does not match the output schema | Check field names, types, and required fields against your output schema. |
167
- | `Duplicate resource ID` | Two resources have the same `resourceId` | Each resource needs a unique ID within your organization. Rename one. |
168
- | `NODE_ENV=development` in .env | SDK is trying to connect to a local API server | Remove `NODE_ENV` from your `.env` file. The SDK connects to the hosted platform by default. |
169
-
170
- ---
171
-
172
- ## Design Decisions Guide
173
-
174
- ### Single-Step vs Multi-Step
175
-
176
- Use a single step when the workflow does one thing -- validate an email, format a message, call one API.
177
-
178
- Use multiple steps when you have distinct phases (fetch data, process it, send a notification) or when you want separate error handling per phase. Each step failure is logged independently, making it easier to identify where something went wrong.
179
-
180
- ### dev vs production Status
181
-
182
- - **dev** -- Resource is visible in the dashboard and can be triggered manually, but will not auto-trigger from schedules or webhooks. Use while building and testing.
183
- - **production** -- Resource is fully live. All trigger sources work. Use when you are confident it works correctly.
184
-
185
- You can switch between them by changing `status` in the workflow config and redeploying.
186
-
187
- ### When to Use Conditional Routing
188
-
189
- Use `StepType.CONDITIONAL` when different inputs should follow different processing paths.
190
-
191
- Example: score >= 80 goes to the approve path, score >= 50 goes to the review path, everything else goes to the reject path. Each path can have its own steps and logic.
192
-
193
- Always include a `defaultTarget` fallback for inputs that do not match any condition. Without a fallback, an unmatched execution will fail.
194
-
195
- ### When to Use Platform Tools vs Custom Code
196
-
197
- Use platform tools when the integration exists in the tool catalog -- they handle auth, retries, and error normalization for you.
198
-
199
- Write custom code (e.g., using `fetch` directly) only when you need a service or API method that is not in the catalog, or when you need fine-grained control over the HTTP request.
200
-
201
- ---
202
-
203
- **Last Updated:** 2026-02-26