Skip to main content

SDK

Workflow SDK

Build multi-step workflows with step graphs, dependency ordering, and per-device routing.

workflow-example.ts
1// Build a structured workflow with dependencies
2const workflow = {
3 steps: [
4 {
5 id: 'capture',
6 actionType: 'TakeScreenshot',
7 targetDeviceId: DEVICE_ID,
8 parameters: {},
9 },
10 {
11 id: 'describe',
12 actionType: 'DescribeScreen',
13 targetDeviceId: DEVICE_ID,
14 parameters: {},
15 dependsOn: ['capture'], // runs after capture
16 },
17 {
18 id: 'summarize',
19 actionType: 'EditDocument',
20 targetDeviceId: DEVICE_ID,
21 parameters: { filePath: '/tmp/summary.md', content: '...' },
22 dependsOn: ['describe'], // runs after describe
23 },
24 ],
25};
26
27const task = await fetch('/api/tee/tasks', {
28 method: 'POST',
29 headers: { 'x-user-id': 'user_123', 'Content-Type': 'application/json' },
30 body: JSON.stringify(workflow),
31}).then(r => r.json());