@elevasis/sdk 0.5.12 → 0.5.14

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 (37) hide show
  1. package/dist/cli.cjs +144 -118
  2. package/dist/index.d.ts +19 -253
  3. package/dist/index.js +20 -9
  4. package/dist/templates.js +62 -59
  5. package/dist/types/worker/adapters/index.d.ts +0 -1
  6. package/dist/worker/index.js +47 -53
  7. package/package.json +1 -1
  8. package/reference/_navigation.md +13 -57
  9. package/reference/{cli/index.mdx → cli.mdx} +568 -505
  10. package/reference/concepts.mdx +164 -0
  11. package/reference/deployment/api.mdx +297 -297
  12. package/reference/deployment/command-center.mdx +226 -0
  13. package/reference/deployment/index.mdx +158 -153
  14. package/reference/framework/agent.mdx +156 -151
  15. package/reference/framework/index.mdx +182 -103
  16. package/reference/{developer → framework}/interaction-guidance.mdx +182 -182
  17. package/reference/framework/memory.mdx +326 -347
  18. package/reference/framework/project-structure.mdx +277 -298
  19. package/reference/framework/tutorial-system.mdx +222 -0
  20. package/reference/{getting-started/index.mdx → getting-started.mdx} +152 -148
  21. package/reference/index.mdx +131 -114
  22. package/reference/platform-tools/adapters.mdx +868 -929
  23. package/reference/platform-tools/index.mdx +354 -195
  24. package/reference/resources/index.mdx +339 -336
  25. package/reference/resources/patterns.mdx +355 -354
  26. package/reference/resources/types.mdx +207 -207
  27. package/reference/{roadmap/index.mdx → roadmap.mdx} +163 -147
  28. package/reference/{runtime/index.mdx → runtime.mdx} +173 -141
  29. package/reference/{troubleshooting/common-errors.mdx → troubleshooting.mdx} +223 -210
  30. package/dist/types/worker/adapters/trello.d.ts +0 -14
  31. package/reference/concepts/index.mdx +0 -203
  32. package/reference/deployment/command-center-ui.mdx +0 -151
  33. package/reference/deployment/command-view.mdx +0 -154
  34. package/reference/framework/documentation.mdx +0 -92
  35. package/reference/platform-tools/examples.mdx +0 -170
  36. package/reference/runtime/limits.mdx +0 -75
  37. package/reference/security/credentials.mdx +0 -141
@@ -1,210 +1,223 @@
1
- ---
2
- title: "Common Errors"
3
- description: "Static SDK-level error catalog -- CLI errors, deployment errors, schema validation, platform tool failures, and runtime errors with diagnostic steps"
4
- loadWhen: "Debugging an unknown error not found in workspace memory"
5
- ---
6
-
7
- This is the static SDK-level error catalog. Check `.claude/memory/errors/` first for workspace-specific fixes. Use this file when the error is new to the workspace or when the memory has no match.
8
-
9
- ---
10
-
11
- ## CLI Errors
12
-
13
- ### ELEVASIS_API_KEY not set
14
-
15
- **Cause:** The `.env` file is missing the API key, or the file was not loaded.
16
-
17
- **Fix:**
18
- 1. Check that `.env` exists in the workspace root
19
- 2. Confirm it contains `ELEVASIS_API_KEY=sk_...`
20
- 3. Make sure you are running the CLI from the workspace directory (where `.env` is located)
21
- 4. If the file exists with the right content, run `elevasis-sdk check` again
22
-
23
- ### Cannot connect to API
24
-
25
- **Cause:** Network issue or the API URL is incorrect.
26
-
27
- **Fix:**
28
- 1. Check your internet connection
29
- 2. If using a custom API URL via `--api-url` or `ELEVASIS_API_URL`, verify it is correct
30
- 3. Remove `NODE_ENV=development` from `.env` if you are not running a local API server
31
-
32
- ### NODE_ENV=development in .env
33
-
34
- **Cause:** The SDK is pointing at a local API server (port 5170 by default) instead of the hosted platform.
35
-
36
- **Fix:** Remove `NODE_ENV=development` from `.env`. The CLI connects to the hosted platform by default.
37
-
38
- ---
39
-
40
- ## Validation Errors (elevasis-sdk check)
41
-
42
- ### Duplicate resource ID
43
-
44
- **Message:** `Duplicate resource ID 'name' in organization 'org'`
45
-
46
- **Cause:** Two resources in `src/` share the same `resourceId`.
47
-
48
- **Fix:** Each resource must have a unique `resourceId` within your organization. Check all domain directories in `src/` and rename the duplicate.
49
-
50
- ### Workflow step references non-existent next step
51
-
52
- **Message:** `Workflow step 'stepA' references non-existent next step 'stepB'`
53
-
54
- **Cause:** A step's `next.target` or `next.routes[*].target` points to a step name that does not exist in the `steps` record.
55
-
56
- **Fix:** Check the spelling of the target step name. All target values must exactly match keys in the `steps` object.
57
-
58
- ### Missing entryPoint
59
-
60
- **Cause:** The workflow's `entryPoint` field names a step that does not exist in `steps`.
61
-
62
- **Fix:** Confirm `entryPoint` matches an exact key in your `steps` record.
63
-
64
- ---
65
-
66
- ## Schema Validation Errors
67
-
68
- ### Schema validation failed (input)
69
-
70
- **Message:** `Schema validation failed` with field-level details
71
-
72
- **Cause:** The input passed to the workflow does not match the `inputSchema`.
73
-
74
- **Fix:**
75
- 1. Read the error's field details -- it names the failing field and expected type
76
- 2. Compare against your `inputSchema` definition
77
- 3. Common causes: wrong type (string vs number), missing required field, extra field not in schema, misspelled field name
78
- 4. Check that `z.infer` types match what your handler actually receives
79
-
80
- ### outputSchema validation failed
81
-
82
- **Cause:** Your handler's return value does not match the workflow's `outputSchema`.
83
-
84
- **Fix:**
85
- 1. Compare what your handler returns to what `outputSchema` expects
86
- 2. Check field names for typos (the schema says `companyName`, handler returns `company_name`)
87
- 3. Check types -- the schema says `z.number()` but the handler returns a string
88
- 4. Check required vs optional -- do not return undefined for a required field
89
-
90
- ### Cannot find name 'z'
91
-
92
- **Cause:** Missing Zod import.
93
-
94
- **Fix:** Add `import { z } from 'zod'` at the top of the file.
95
-
96
- ---
97
-
98
- ## TypeScript Errors
99
-
100
- ### Type 'X' is not assignable to type 'Y'
101
-
102
- **Cause:** The data flowing into a step or returned from a handler does not match the declared type.
103
-
104
- **Fix:**
105
- 1. Check the input type annotation on the handler: `async (input: MyInput) => ...`
106
- 2. Confirm the `z.infer<typeof mySchema>` type matches what the previous step returns
107
- 3. Check that all optional fields are handled (do not assume they are always present)
108
-
109
- ### Cannot find module '@elevasis/sdk'
110
-
111
- **Cause:** Dependencies are not installed.
112
-
113
- **Fix:** Run `pnpm install` in the workspace root.
114
-
115
- ### Cannot find module '@elevasis/sdk/worker'
116
-
117
- **Cause:** Dependencies not installed, or using an old SDK version that does not export the `worker` subpath.
118
-
119
- **Fix:**
120
- 1. Run `pnpm install`
121
- 2. Check that `@elevasis/sdk` version is recent enough to include `worker` export
122
- 3. Confirm your `tsconfig.json` has `"moduleResolution": "Bundler"` or `"NodeNext"`
123
-
124
- ---
125
-
126
- ## Platform Tool Errors
127
-
128
- ### PlatformToolError: credential not found
129
-
130
- **Cause:** The credential name passed to `platform.call()` does not match any credential stored in the platform.
131
-
132
- **Fix:**
133
- 1. Check spelling and case -- credential names are case-sensitive
134
- 2. Open the command center and confirm the credential exists and is named exactly as referenced
135
- 3. Check that the credential belongs to the correct organization
136
-
137
- ### PlatformToolError: credentials_invalid
138
-
139
- **Cause:** The credential exists but has the wrong shape for the tool being called.
140
-
141
- **Fix:**
142
- 1. For the `http` tool: verify the credential type matches the API's auth method (bearer, api-key-header, basic, etc.)
143
- 2. For the Supabase tool: verify the credential contains `url` and `serviceRoleKey` fields
144
- 3. Re-create the credential in the command center if the format is wrong
145
-
146
- ### PlatformToolError: timeout_error
147
-
148
- **Cause:** The platform tool call took longer than 60 seconds.
149
-
150
- **Fix:**
151
- 1. Check if the external API is slow or down
152
- 2. Reduce the amount of data being processed in a single call
153
- 3. For `http` tool: the external endpoint may be unresponsive -- check directly
154
-
155
- ### PlatformToolError: service_unavailable
156
-
157
- **Cause:** The platform service or integration adapter is not available.
158
-
159
- **Fix:**
160
- 1. Check the Elevasis status page
161
- 2. Retry -- transient availability issues resolve quickly
162
-
163
- ---
164
-
165
- ## Runtime Errors
166
-
167
- ### Execution timeout (300s)
168
-
169
- **Cause:** The entire workflow execution exceeded the 300-second limit.
170
-
171
- **Fix:**
172
- 1. Identify which step is slow -- check execution logs for step timing
173
- 2. Reduce work per step or parallelize if possible
174
- 3. For long-running operations, consider breaking into multiple workflows with the `execution` platform tool to chain them
175
-
176
- ### Worker ran out of memory (256MB limit)
177
-
178
- **Cause:** The workflow processed too much data in memory at once.
179
-
180
- **Fix:**
181
- 1. Reduce the size of data loaded per execution
182
- 2. Use pagination for large data sets (fetch in chunks, process one at a time)
183
- 3. Avoid loading large files or arrays entirely into memory
184
-
185
- ### Module resolution error at runtime
186
-
187
- **Cause:** An import in your workflow bundle cannot be resolved.
188
-
189
- **Fix:**
190
- 1. Run `elevasis-sdk check` -- it catches most resolution errors before deploy
191
- 2. If the import is a built-in Node.js module, ensure it is compatible with the worker environment
192
- 3. Avoid imports that require file system access or native modules
193
-
194
- ---
195
-
196
- ## Memory Error Structure
197
-
198
- When recording a new error in `.claude/memory/errors/`, use this table format:
199
-
200
- ```
201
- | Error | Context | Fix | Count | Last Seen | Status |
202
- | --- | --- | --- | --- | --- | --- |
203
- | `Schema validation failed` on lead-scorer | Added score field | Changed score from z.string() to z.number() | 1 | 2026-02-26 | Resolved |
204
- ```
205
-
206
- Status values: `Resolved` (fixed this session), `Recurring` (seen 2+ times), `Promoted` (3+ times, now in Rules).
207
-
208
- ---
209
-
210
- **Last Updated:** 2026-02-26
1
+ ---
2
+ title: "Common Errors"
3
+ description: "Static SDK-level error catalog -- CLI errors, deployment errors, schema validation, platform tool failures, and runtime errors with diagnostic steps"
4
+ loadWhen: "Debugging an unknown error not found in workspace memory"
5
+ ---
6
+
7
+ This is the static SDK-level error catalog. Check `.claude/memory/errors/` first for workspace-specific fixes. Use this file when the error is new to the workspace or when the memory has no match.
8
+
9
+ ---
10
+
11
+ ## CLI Errors
12
+
13
+ ### ELEVASIS_PLATFORM_KEY not set
14
+
15
+ **Cause:** The `.env` file is missing the API key, or the file was not loaded.
16
+
17
+ **Fix:**
18
+
19
+ 1. Check that `.env` exists in the workspace root
20
+ 2. Confirm it contains `ELEVASIS_PLATFORM_KEY=sk_...`
21
+ 3. Make sure you are running the CLI from the workspace directory (where `.env` is located)
22
+ 4. If the file exists with the right content, run `elevasis-sdk check` again
23
+
24
+ ### Cannot connect to API
25
+
26
+ **Cause:** Network issue or the API URL is incorrect.
27
+
28
+ **Fix:**
29
+
30
+ 1. Check your internet connection
31
+ 2. If using a custom API URL via `--api-url` or `ELEVASIS_API_URL`, verify it is correct
32
+ 3. Remove `NODE_ENV=development` from `.env` if you are not running a local API server
33
+
34
+ ### NODE_ENV=development in .env
35
+
36
+ **Cause:** The SDK is pointing at a local API server (port 5170 by default) instead of the hosted platform.
37
+
38
+ **Fix:** Remove `NODE_ENV=development` from `.env`. The CLI connects to the hosted platform by default.
39
+
40
+ ---
41
+
42
+ ## Validation Errors (elevasis-sdk check)
43
+
44
+ ### Duplicate resource ID
45
+
46
+ **Message:** `Duplicate resource ID 'name' in organization 'org'`
47
+
48
+ **Cause:** Two resources in `src/` share the same `resourceId`.
49
+
50
+ **Fix:** Each resource must have a unique `resourceId` within your organization. Check all domain directories in `src/` and rename the duplicate.
51
+
52
+ ### Workflow step references non-existent next step
53
+
54
+ **Message:** `Workflow step 'stepA' references non-existent next step 'stepB'`
55
+
56
+ **Cause:** A step's `next.target` or `next.routes[*].target` points to a step name that does not exist in the `steps` record.
57
+
58
+ **Fix:** Check the spelling of the target step name. All target values must exactly match keys in the `steps` object.
59
+
60
+ ### Missing entryPoint
61
+
62
+ **Cause:** The workflow's `entryPoint` field names a step that does not exist in `steps`.
63
+
64
+ **Fix:** Confirm `entryPoint` matches an exact key in your `steps` record.
65
+
66
+ ---
67
+
68
+ ## Schema Validation Errors
69
+
70
+ ### Schema validation failed (input)
71
+
72
+ **Message:** `Schema validation failed` with field-level details
73
+
74
+ **Cause:** The input passed to the workflow does not match the `inputSchema`.
75
+
76
+ **Fix:**
77
+
78
+ 1. Read the error's field details -- it names the failing field and expected type
79
+ 2. Compare against your `inputSchema` definition
80
+ 3. Common causes: wrong type (string vs number), missing required field, extra field not in schema, misspelled field name
81
+ 4. Check that `z.infer` types match what your handler actually receives
82
+
83
+ ### outputSchema validation failed
84
+
85
+ **Cause:** Your handler's return value does not match the workflow's `outputSchema`.
86
+
87
+ **Fix:**
88
+
89
+ 1. Compare what your handler returns to what `outputSchema` expects
90
+ 2. Check field names for typos (the schema says `companyName`, handler returns `company_name`)
91
+ 3. Check types -- the schema says `z.number()` but the handler returns a string
92
+ 4. Check required vs optional -- do not return undefined for a required field
93
+
94
+ ### Cannot find name 'z'
95
+
96
+ **Cause:** Missing Zod import.
97
+
98
+ **Fix:** Add `import { z } from 'zod'` at the top of the file.
99
+
100
+ ---
101
+
102
+ ## TypeScript Errors
103
+
104
+ ### Type 'X' is not assignable to type 'Y'
105
+
106
+ **Cause:** The data flowing into a step or returned from a handler does not match the declared type.
107
+
108
+ **Fix:**
109
+
110
+ 1. Check the input type annotation on the handler: `async (input: MyInput) => ...`
111
+ 2. Confirm the `z.infer<typeof mySchema>` type matches what the previous step returns
112
+ 3. Check that all optional fields are handled (do not assume they are always present)
113
+
114
+ ### Cannot find module '@elevasis/sdk'
115
+
116
+ **Cause:** Dependencies are not installed.
117
+
118
+ **Fix:** Run `pnpm install` in the workspace root.
119
+
120
+ ### Cannot find module '@elevasis/sdk/worker'
121
+
122
+ **Cause:** Dependencies not installed, or using an old SDK version that does not export the `worker` subpath.
123
+
124
+ **Fix:**
125
+
126
+ 1. Run `pnpm install`
127
+ 2. Check that `@elevasis/sdk` version is recent enough to include `worker` export
128
+ 3. Confirm your `tsconfig.json` has `"moduleResolution": "Bundler"` or `"NodeNext"`
129
+
130
+ ---
131
+
132
+ ## Platform Tool Errors
133
+
134
+ ### PlatformToolError: credential not found
135
+
136
+ **Cause:** The credential name passed to `platform.call()` does not match any credential stored in the platform.
137
+
138
+ **Fix:**
139
+
140
+ 1. Check spelling and case -- credential names are case-sensitive
141
+ 2. Open the command center and confirm the credential exists and is named exactly as referenced
142
+ 3. Check that the credential belongs to the correct organization
143
+
144
+ ### PlatformToolError: credentials_invalid
145
+
146
+ **Cause:** The credential exists but has the wrong shape for the tool being called.
147
+
148
+ **Fix:**
149
+
150
+ 1. For the `http` tool: verify the credential type matches the API's auth method (bearer, api-key-header, basic, etc.)
151
+ 2. For the Supabase tool: verify the credential contains `url` and `serviceRoleKey` fields
152
+ 3. Re-create the credential in the command center if the format is wrong
153
+
154
+ ### PlatformToolError: timeout_error
155
+
156
+ **Cause:** The platform tool call took longer than 60 seconds.
157
+
158
+ **Fix:**
159
+
160
+ 1. Check if the external API is slow or down
161
+ 2. Reduce the amount of data being processed in a single call
162
+ 3. For `http` tool: the external endpoint may be unresponsive -- check directly
163
+
164
+ ### PlatformToolError: service_unavailable
165
+
166
+ **Cause:** The platform service or integration adapter is not available.
167
+
168
+ **Fix:**
169
+
170
+ 1. Check the Elevasis status page
171
+ 2. Retry -- transient availability issues resolve quickly
172
+
173
+ ---
174
+
175
+ ## Runtime Errors
176
+
177
+ ### Execution timeout (300s)
178
+
179
+ **Cause:** The entire workflow execution exceeded the 300-second limit.
180
+
181
+ **Fix:**
182
+
183
+ 1. Identify which step is slow -- check execution logs for step timing
184
+ 2. Reduce work per step or parallelize if possible
185
+ 3. For long-running operations, consider breaking into multiple workflows with the `execution` platform tool to chain them
186
+
187
+ ### Worker ran out of memory (256MB limit)
188
+
189
+ **Cause:** The workflow processed too much data in memory at once.
190
+
191
+ **Fix:**
192
+
193
+ 1. Reduce the size of data loaded per execution
194
+ 2. Use pagination for large data sets (fetch in chunks, process one at a time)
195
+ 3. Avoid loading large files or arrays entirely into memory
196
+
197
+ ### Module resolution error at runtime
198
+
199
+ **Cause:** An import in your workflow bundle cannot be resolved.
200
+
201
+ **Fix:**
202
+
203
+ 1. Run `elevasis-sdk check` -- it catches most resolution errors before deploy
204
+ 2. If the import is a built-in Node.js module, ensure it is compatible with the worker environment
205
+ 3. Avoid imports that require file system access or native modules
206
+
207
+ ---
208
+
209
+ ## Memory Error Structure
210
+
211
+ When recording a new error in `.claude/memory/errors/`, use this table format:
212
+
213
+ ```
214
+ | Error | Context | Fix | Count | Last Seen | Status |
215
+ | --- | --- | --- | --- | --- | --- |
216
+ | `Schema validation failed` on lead-scorer | Added score field | Changed score from z.string() to z.number() | 1 | 2026-02-26 | Resolved |
217
+ ```
218
+
219
+ Status values: `Resolved` (fixed this session), `Recurring` (seen 2+ times), `Promoted` (3+ times, now in Rules).
220
+
221
+ ---
222
+
223
+ **Last Updated:** 2026-02-26
@@ -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