@elevasis/sdk 0.4.5 → 0.4.7
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.
- package/dist/cli.cjs +829 -413
- package/dist/index.d.ts +79 -14
- package/dist/index.js +17 -12
- package/dist/templates.js +747 -0
- package/dist/types/templates.d.ts +1 -0
- package/dist/types/worker/index.d.ts +6 -0
- package/dist/types/worker/platform.d.ts +32 -0
- package/dist/worker/index.js +4701 -9
- package/package.json +10 -3
- package/reference/_index.md +95 -0
- package/reference/_navigation.md +104 -0
- package/reference/cli/index.mdx +497 -0
- package/reference/concepts/index.mdx +203 -0
- package/reference/deployment/api.mdx +297 -0
- package/reference/deployment/index.mdx +153 -0
- package/reference/developer/interaction-guidance.mdx +213 -0
- package/reference/framework/agent.mdx +175 -0
- package/reference/framework/documentation.mdx +92 -0
- package/reference/framework/index.mdx +95 -0
- package/reference/framework/memory.mdx +337 -0
- package/reference/framework/project-structure.mdx +294 -0
- package/reference/getting-started/index.mdx +148 -0
- package/reference/index.mdx +113 -0
- package/reference/platform-tools/examples.mdx +187 -0
- package/reference/platform-tools/index.mdx +182 -0
- package/reference/resources/index.mdx +289 -0
- package/reference/resources/patterns.mdx +341 -0
- package/reference/resources/types.mdx +207 -0
- package/reference/roadmap/index.mdx +147 -0
- package/reference/runtime/index.mdx +141 -0
- package/reference/runtime/limits.mdx +77 -0
- package/reference/security/credentials.mdx +141 -0
- package/reference/templates/data-enrichment.mdx +162 -0
- package/reference/templates/email-sender.mdx +135 -0
- package/reference/templates/lead-scorer.mdx +175 -0
- package/reference/templates/pdf-generator.mdx +151 -0
- package/reference/templates/recurring-job.mdx +189 -0
- package/reference/templates/text-classifier.mdx +147 -0
- package/reference/templates/web-scraper.mdx +135 -0
- package/reference/troubleshooting/common-errors.mdx +210 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: SDK Types
|
|
3
|
+
description: Complete type reference for @elevasis/sdk -- package exports, re-exported platform types, ElevasConfig interface, StepHandler context, and runtime values
|
|
4
|
+
loadWhen: "Looking up type signatures or SDK exports"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
`@elevasis/sdk` is published to the public npm registry. It bundles all platform types from `@repo/core` into a single self-contained type declaration file with zero internal monorepo references. External developers install the package and get full TypeScript support without any monorepo tooling.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm install @elevasis/sdk zod
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Zod is a peer dependency and must be installed separately.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Package Exports
|
|
18
|
+
|
|
19
|
+
The package exposes two subpaths:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"exports": {
|
|
24
|
+
".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
|
|
25
|
+
"./worker": { "import": "./dist/worker/index.js" }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- `@elevasis/sdk` -- all types plus runtime values (`StepType`, `ExecutionError`, `ToolingError`)
|
|
31
|
+
- `@elevasis/sdk/worker` -- worker runtime module (`startWorker`, `platform`, `PlatformToolError`)
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Type Re-exports
|
|
36
|
+
|
|
37
|
+
All types come from the platform core. The SDK re-exports them grouped by source domain:
|
|
38
|
+
|
|
39
|
+
### Platform Types
|
|
40
|
+
|
|
41
|
+
| Type | Description |
|
|
42
|
+
| ---- | ----------- |
|
|
43
|
+
| `ResourceDefinition` | Base interface for all resource types |
|
|
44
|
+
| `ResourceType` | Enum: `'workflow' | 'agent'` |
|
|
45
|
+
| `ResourceStatus` | Enum: `'dev' | 'production'` |
|
|
46
|
+
| `ResourceDomain` | Domain classification for a resource |
|
|
47
|
+
| `DomainDefinition` | Structure for grouping resources by domain |
|
|
48
|
+
| `OrganizationResources` | Top-level export shape: `{ workflows, agents }` |
|
|
49
|
+
| `TriggerDefinition` | Base for trigger configuration |
|
|
50
|
+
| `IntegrationDefinition` | Integration configuration structure |
|
|
51
|
+
| `WebhookProviderType` | Supported webhook providers |
|
|
52
|
+
| `WebhookTriggerConfig` | Webhook trigger configuration |
|
|
53
|
+
| `ScheduleTriggerConfig` | Cron/schedule trigger configuration |
|
|
54
|
+
| `EventTriggerConfig` | Internal event trigger configuration |
|
|
55
|
+
| `TriggerConfig` | Union of all trigger config types |
|
|
56
|
+
|
|
57
|
+
### Execution Types
|
|
58
|
+
|
|
59
|
+
| Type | Description |
|
|
60
|
+
| ---- | ----------- |
|
|
61
|
+
| `WorkflowDefinition` | Complete workflow definition including config, contract, steps, entryPoint |
|
|
62
|
+
| `WorkflowStep` | Individual step definition with type, handler, and next routing |
|
|
63
|
+
| `WorkflowConfig` | Metadata block: name, description, status |
|
|
64
|
+
| `StepHandler` | Function type: `(input: unknown, context: StepContext) => Promise<unknown>` |
|
|
65
|
+
| `NextConfig` | Union of `LinearNext` and `ConditionalNext` |
|
|
66
|
+
| `LinearNext` | `{ target: string }` -- fixed next step |
|
|
67
|
+
| `ConditionalNext` | `{ routes: Route[], defaultTarget: string }` -- branching routing |
|
|
68
|
+
| `StepType` | Runtime enum: `LINEAR | CONDITIONAL` (also a runtime value -- see below) |
|
|
69
|
+
| `AgentDefinition` | Complete agent definition including config, agentConfig, tools |
|
|
70
|
+
| `AgentConfig` | Agent metadata: name, description, status |
|
|
71
|
+
| `AgentConstraints` | Execution limits for agents |
|
|
72
|
+
| `Tool` | Tool definition for agent use |
|
|
73
|
+
| `ToolExecutionOptions` | Options passed when a tool executes |
|
|
74
|
+
| `ToolingErrorType` | Enum of tool error categories |
|
|
75
|
+
| `ToolingError` | Error class for tool execution failures (also a runtime value -- see below) |
|
|
76
|
+
| `ExecutionError` | Error class for execution-level failures (also a runtime value -- see below) |
|
|
77
|
+
| `Contract` | Input/output Zod schema pair |
|
|
78
|
+
| `ExecutionContext` | Runtime context passed to step handlers |
|
|
79
|
+
| `ExecutionMetadata` | Metadata about a running execution |
|
|
80
|
+
| `LLMModel` | Model identifier: provider + model name |
|
|
81
|
+
| `ModelConfig` | Full model configuration including temperature and token limits |
|
|
82
|
+
| `ExecutionInterface` | Interface for triggering and inspecting executions |
|
|
83
|
+
|
|
84
|
+
### Form and Metrics Types
|
|
85
|
+
|
|
86
|
+
| Type | Description |
|
|
87
|
+
| ---- | ----------- |
|
|
88
|
+
| `FormField` | Individual form field definition |
|
|
89
|
+
| `FormSchema` | Collection of form fields |
|
|
90
|
+
| `FormFieldType` | Enum of supported field types |
|
|
91
|
+
| `ResourceMetricsConfig` | Observability configuration for a resource |
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## ElevasConfig
|
|
96
|
+
|
|
97
|
+
`ElevasConfig` is the only type defined by the SDK itself (not re-exported from the platform). It configures SDK behavior via `elevasis.config.ts` in your project root.
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
export interface ElevasConfig {
|
|
101
|
+
defaultStatus?: ResourceStatus
|
|
102
|
+
dev?: { port?: number }
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
| Field | Type | Default | Description |
|
|
107
|
+
| ----- | ---- | ------- | ----------- |
|
|
108
|
+
| `defaultStatus` | `'dev' | 'production'` | `'production'` | Default status applied to all resources that do not set their own `config.status`. Set to `'dev'` to keep resources inactive while building. |
|
|
109
|
+
| `dev.port` | `number` | `3001` | Local port for the development worker process. Change this if port 3001 conflicts with another service. |
|
|
110
|
+
|
|
111
|
+
Usage:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import type { ElevasConfig } from '@elevasis/sdk';
|
|
115
|
+
|
|
116
|
+
const config: ElevasConfig = {
|
|
117
|
+
defaultStatus: 'dev',
|
|
118
|
+
dev: { port: 3002 },
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default config;
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## StepHandler Context
|
|
127
|
+
|
|
128
|
+
`StepHandler` accepts two parameters: `input` (validated by your contract schema) and `context` (runtime metadata). The `context` parameter is not optional in the type definition, but TypeScript allows you to omit it in your handler function -- writing `async (input) => { ... }` works without error.
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import type { StepHandler, ExecutionContext } from '@elevasis/sdk';
|
|
132
|
+
|
|
133
|
+
const handler: StepHandler = async (input, context: ExecutionContext) => {
|
|
134
|
+
const { executionId, organizationId, resourceId, logger, store } = context;
|
|
135
|
+
|
|
136
|
+
logger.info('Processing', { executionId, resourceId });
|
|
137
|
+
|
|
138
|
+
await store.set('checkpoint', JSON.stringify({ step: 'started' }));
|
|
139
|
+
|
|
140
|
+
return { done: true };
|
|
141
|
+
};
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### ExecutionContext Fields
|
|
145
|
+
|
|
146
|
+
| Field | Type | Description |
|
|
147
|
+
| ----- | ---- | ----------- |
|
|
148
|
+
| `executionId` | `string` | Unique identifier for this execution run |
|
|
149
|
+
| `organizationId` | `string` | Your organization identifier |
|
|
150
|
+
| `resourceId` | `string` | Identifier of the executing workflow or agent |
|
|
151
|
+
| `logger` | `Logger` | Structured logger -- messages appear in the Elevasis dashboard under the execution |
|
|
152
|
+
| `store` | `Store` | Key-value store scoped to the current execution. Useful for passing data between steps or checkpointing progress. |
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Runtime Values
|
|
157
|
+
|
|
158
|
+
Three runtime values are exported from `@elevasis/sdk` as JavaScript values (not just types). They are defined directly in the SDK package to avoid pulling in the full platform execution engine.
|
|
159
|
+
|
|
160
|
+
### StepType
|
|
161
|
+
|
|
162
|
+
An enum used to configure step routing in multi-step workflows.
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
import { StepType } from '@elevasis/sdk';
|
|
166
|
+
|
|
167
|
+
// StepType.LINEAR -- fixed next step via { target: 'stepName' }
|
|
168
|
+
// StepType.CONDITIONAL -- branching via { routes: [...], defaultTarget: 'stepName' }
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### ToolingError
|
|
172
|
+
|
|
173
|
+
Thrown by platform tool calls when a tool fails. Use this class to distinguish tool failures from general errors in `try/catch` blocks.
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
import { ToolingError } from '@elevasis/sdk';
|
|
177
|
+
|
|
178
|
+
try {
|
|
179
|
+
const result = await platform.call({ ... });
|
|
180
|
+
} catch (err) {
|
|
181
|
+
if (err instanceof ToolingError) {
|
|
182
|
+
// tool-specific failure -- check err.type for category
|
|
183
|
+
console.error('Tool failed:', err.type, err.message);
|
|
184
|
+
} else {
|
|
185
|
+
throw err; // re-throw unexpected errors
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### ExecutionError
|
|
191
|
+
|
|
192
|
+
Represents a failure at the execution level (distinct from a tool-level failure). Throw this from a step handler to signal that the execution should be marked as failed with a structured error message.
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
import { ExecutionError } from '@elevasis/sdk';
|
|
196
|
+
|
|
197
|
+
const handler = async (input) => {
|
|
198
|
+
if (!input.userId) {
|
|
199
|
+
throw new ExecutionError('userId is required', { code: 'MISSING_INPUT' });
|
|
200
|
+
}
|
|
201
|
+
return { result: 'ok' };
|
|
202
|
+
};
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
**Last Updated:** 2026-02-25
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Roadmap
|
|
3
|
+
description: Planned SDK features -- error taxonomy, retry semantics, circuit breaker, metrics, alerting, and resource lifecycle extensions
|
|
4
|
+
loadWhen: "Asking about future features or planned capabilities"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Status:** Planned -- none of these features are implemented yet.
|
|
8
|
+
|
|
9
|
+
For currently implemented behavior, see [Runtime](../runtime/index.mdx).
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Structured Error Taxonomy
|
|
14
|
+
|
|
15
|
+
The current runtime reports errors as plain strings. A future SDK version will introduce a structured error taxonomy. All SDK errors will extend `ResourceError`, the base class for errors surfaced through the execution protocol.
|
|
16
|
+
|
|
17
|
+
Every error carries: `message` (string), `code` (string enum), `details` (optional structured data), and `retryable` (boolean).
|
|
18
|
+
|
|
19
|
+
**Error types:**
|
|
20
|
+
|
|
21
|
+
- **`ResourceError`** -- Base class for all SDK errors
|
|
22
|
+
- **`ValidationError`** -- Input or output schema validation failed. Thrown automatically when Zod `.parse()` fails. Code: `VALIDATION_ERROR`. Not retryable.
|
|
23
|
+
- **`StepError`** -- A workflow step handler threw. Includes `stepId` and `stepName`. Code: `STEP_ERROR`. Retryable (transient failures may succeed on retry).
|
|
24
|
+
- **`ToolError`** -- A tool execution failed. Includes `toolName`. Code: `TOOL_ERROR`. Retryability depends on the underlying error.
|
|
25
|
+
- **`TimeoutError`** -- Execution exceeded the deadline. Code: `TIMEOUT`. Retryable.
|
|
26
|
+
- **`CancellationError`** -- Execution was cancelled by the platform or user. Code: `CANCELLED`. Not retryable.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Retry Semantics
|
|
31
|
+
|
|
32
|
+
Retries are platform-side only -- workers are ephemeral and never retry internally.
|
|
33
|
+
|
|
34
|
+
- **Configuration:** Per-resource via `maxRetries` (default: 0) and `backoffStrategy` (exponential with jitter)
|
|
35
|
+
- **Retryable conditions:** Worker crash or timeout (worker terminated by `AbortSignal`)
|
|
36
|
+
- **Non-retryable conditions:** Worker reports `status: 'failed'` (handler ran and returned an error -- application logic, not infrastructure failure), user cancellation
|
|
37
|
+
- **Idempotency:** On retry, the same `executionId` is reused. Design handlers to be idempotent where possible.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Workflow Step Failure
|
|
42
|
+
|
|
43
|
+
Default behavior is fail-fast: when a step throws, the workflow fails immediately.
|
|
44
|
+
|
|
45
|
+
- **Error handler:** Optional `onError` callback per step. The callback receives the error and can return a recovery value or rethrow to propagate the failure.
|
|
46
|
+
- **Partial output:** Steps completed before the failure are included in the error response. The platform receives: `failedStepId`, `completedSteps[]` (IDs of successfully completed steps), and `partialOutput` (the last successful step's output).
|
|
47
|
+
|
|
48
|
+
**Step error response format:**
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"status": "failed",
|
|
53
|
+
"error": {
|
|
54
|
+
"code": "STEP_ERROR",
|
|
55
|
+
"message": "Email delivery failed: invalid address",
|
|
56
|
+
"stepId": "send-welcome",
|
|
57
|
+
"stepName": "Send Welcome Email"
|
|
58
|
+
},
|
|
59
|
+
"completedSteps": ["validate"],
|
|
60
|
+
"partialOutput": { "clientName": "Jane", "isValid": true }
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Agent Failure Modes
|
|
67
|
+
|
|
68
|
+
Agents have multiple failure paths due to the LLM loop:
|
|
69
|
+
|
|
70
|
+
- **Max iterations reached:** The agent returns the best output produced so far, plus a warning flag (`maxIterationsReached: true`). This is a graceful termination, not an error.
|
|
71
|
+
- **Tool crash:** Tool errors are caught by the SDK runtime, formatted as a tool result, and sent back to the LLM. The LLM decides whether to retry, try a different approach, or give up.
|
|
72
|
+
- **Model refusal:** If the model refuses the prompt, the SDK retries once with an adjusted system prompt. If the retry also refuses, the agent fails with `code: 'MODEL_REFUSAL'`.
|
|
73
|
+
- **Model API error:** Network errors, rate limits, or server errors from the model provider. The SDK retries with exponential backoff (3 attempts, 1s/2s/4s), then fails with `code: 'MODEL_ERROR'`.
|
|
74
|
+
- **Agent error response includes:** `iterationCount` (LLM iterations completed), `toolCallHistory` (array of tool calls made), `lastModelResponse` (final response from the LLM before failure).
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Circuit Breaker
|
|
79
|
+
|
|
80
|
+
The platform will implement a circuit breaker to prevent runaway failures:
|
|
81
|
+
|
|
82
|
+
- **Trip condition:** 5 consecutive failures on the same resource within a 10-minute window
|
|
83
|
+
- **Action:** Pause executions for 60 seconds. New execution requests for that resource return `503` with: "Resource temporarily unavailable (circuit breaker tripped)"
|
|
84
|
+
- **Auto-recovery:** After the 60-second pause, the next execution attempt is allowed through. If it succeeds, the circuit breaker resets. If it fails, the pause extends (120s, then 240s, capped at 5 minutes).
|
|
85
|
+
- **Alerting:** You are notified via webhook callback or email when the circuit breaker trips. Configurable per organization.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Metrics
|
|
90
|
+
|
|
91
|
+
### Auto-Collected
|
|
92
|
+
|
|
93
|
+
The SDK runtime and platform will automatically collect these metrics for every execution:
|
|
94
|
+
|
|
95
|
+
- `execution_duration_ms` -- Total wall-clock time from request received to result sent
|
|
96
|
+
- `step_duration_ms` -- Per-step timing for workflows (array of `{ stepId, durationMs }`)
|
|
97
|
+
- `iteration_count` -- Number of LLM loop iterations for agents
|
|
98
|
+
- `ai_token_usage` -- Token counts per model call: `{ prompt_tokens, completion_tokens, total_tokens }`
|
|
99
|
+
- `ai_cost_usd` -- Calculated from model pricing multiplied by token usage
|
|
100
|
+
- `tool_call_count` -- Total number of tool invocations during the execution
|
|
101
|
+
- `tool_call_duration_ms` -- Per-tool timing (array of `{ toolName, durationMs }`)
|
|
102
|
+
- `error_count` -- Number of errors encountered (including recovered errors)
|
|
103
|
+
|
|
104
|
+
### Cost Attribution
|
|
105
|
+
|
|
106
|
+
Metrics are aggregated at multiple levels:
|
|
107
|
+
|
|
108
|
+
- **Per-execution:** Total AI spend and total duration
|
|
109
|
+
- **Per-resource:** Aggregated over configurable time periods (daily, weekly, monthly)
|
|
110
|
+
- **Per-organization:** Total platform cost (execution time + AI spend + managed hosting compute)
|
|
111
|
+
- **Visibility:** Platform dashboard and the CLI via `elevasis executions <resourceId>`
|
|
112
|
+
|
|
113
|
+
### Developer-Defined Metrics
|
|
114
|
+
|
|
115
|
+
A future SDK version will support custom metrics emitted from your handlers:
|
|
116
|
+
|
|
117
|
+
- `sdk.metrics.counter('custom_name', value)` -- Increment a counter
|
|
118
|
+
- `sdk.metrics.gauge('queue_depth', value)` -- Set a point-in-time gauge value
|
|
119
|
+
- Custom metrics are stored alongside auto-collected metrics and queryable through the same APIs
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Alerting
|
|
124
|
+
|
|
125
|
+
Developer-configurable alerts for production monitoring:
|
|
126
|
+
|
|
127
|
+
- **Error rate threshold:** Notify when more than X% of executions fail within Y minutes
|
|
128
|
+
- **Latency percentile:** Notify when p95 execution duration exceeds a threshold
|
|
129
|
+
- **Cost budget:** Notify when daily or weekly AI spend exceeds a configured limit
|
|
130
|
+
- **Channel:** Webhook callback to a developer-provided URL (integrates with Slack, PagerDuty, and similar services via webhook)
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Resource Lifecycle Extensions
|
|
135
|
+
|
|
136
|
+
### Deprecation Status
|
|
137
|
+
|
|
138
|
+
Beyond the current `dev` and `production` statuses, two additional statuses are planned:
|
|
139
|
+
|
|
140
|
+
- **`deprecated`** -- Marked via the platform UI. Existing executions continue working. New executions show a warning: "This resource is deprecated." The resource still appears in the platform and can still be triggered.
|
|
141
|
+
- **`offline`** -- Set automatically when a deployment is unregistered (for example, after a failed deploy or explicit deletion). Clears automatically on the next successful deploy. No executions are accepted while a resource is offline.
|
|
142
|
+
|
|
143
|
+
Deprecation requires no automatic removal -- the developer must explicitly delete the resource to remove it.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
**Last Updated:** 2026-02-25
|
|
@@ -0,0 +1,141 @@
|
|
|
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 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 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 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
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Resource Limits & Quotas
|
|
3
|
+
description: Memory limits, execution timeouts, scale quotas, networking constraints, and v1 platform limitations for SDK resources
|
|
4
|
+
loadWhen: "Hitting resource limits or planning for scale"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This page documents the hard limits enforced on all SDK resources running on the Elevasis platform. These limits exist to ensure platform stability and fair resource usage across all organizations.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Resource Limits
|
|
12
|
+
|
|
13
|
+
Limits enforced per worker thread at runtime:
|
|
14
|
+
|
|
15
|
+
| Resource | Value |
|
|
16
|
+
| -------- | ----- |
|
|
17
|
+
| Memory (V8 heap) | 256MB per worker |
|
|
18
|
+
| Disk | Bundle file only (ephemeral, not persistent across deploys) |
|
|
19
|
+
|
|
20
|
+
- **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.
|
|
21
|
+
- **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.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Scale Limits & Quotas
|
|
26
|
+
|
|
27
|
+
Hard limits to prevent abuse and ensure platform stability:
|
|
28
|
+
|
|
29
|
+
| Limit | Value |
|
|
30
|
+
| ----- | ----- |
|
|
31
|
+
| Max resources per org | 50 |
|
|
32
|
+
| Max execution duration (workflows) | 300s (5 min) |
|
|
33
|
+
| Max execution duration (agents) | 600s (10 min) |
|
|
34
|
+
| Max log volume | 100MB/day |
|
|
35
|
+
| Max deploy frequency | 60/day |
|
|
36
|
+
|
|
37
|
+
- **Resources per org:** The combined count of all workflows and agents across your organization cannot exceed 50.
|
|
38
|
+
- **Execution duration:** Executions exceeding the timeout are terminated by the platform. The execution is marked failed with a timeout reason.
|
|
39
|
+
- **Log volume:** Total log output across all executions is capped at 100MB per day. Logs beyond this threshold may be truncated.
|
|
40
|
+
- **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).
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Networking
|
|
45
|
+
|
|
46
|
+
- **Outbound:** Unrestricted. Your handlers can call any external API (OpenAI, Twilio, Stripe, etc.) from within the worker.
|
|
47
|
+
- **Inbound:** Workers receive input from the platform coordinator via internal message passing -- they are not exposed to the network directly.
|
|
48
|
+
- **No ports:** Workers communicate with the platform via zero-network-overhead message passing. No port allocation occurs.
|
|
49
|
+
- **Isolation:** Workers have no access to other organizations' data or platform credentials by default. Supabase credentials are not present in the worker environment.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Platform Maintenance
|
|
54
|
+
|
|
55
|
+
- **Rolling updates:** Platform upgrades re-register all active deployments on startup. No executions are lost.
|
|
56
|
+
- **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.
|
|
57
|
+
- **Advance notice:** 24-hour advance notice is provided for breaking maintenance windows. These are rare and reserved for major infrastructure changes.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## v1 Limitations
|
|
62
|
+
|
|
63
|
+
| Limitation | Reason | Future path |
|
|
64
|
+
| ---------- | ------ | ----------- |
|
|
65
|
+
| **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). |
|
|
66
|
+
| **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. |
|
|
67
|
+
| **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. |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Organization Provisioning
|
|
72
|
+
|
|
73
|
+
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.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
**Last Updated:** 2026-02-25
|