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 |
| 2 | const workflow = { |
| 3 | steps: [ |
| 4 | { |
| 5 | id: 39;capture39;, |
| 6 | actionType: 39;TakeScreenshot39;, |
| 7 | targetDeviceId: DEVICE_ID, |
| 8 | parameters: {}, |
| 9 | }, |
| 10 | { |
| 11 | id: 39;describe39;, |
| 12 | actionType: 39;DescribeScreen39;, |
| 13 | targetDeviceId: DEVICE_ID, |
| 14 | parameters: {}, |
| 15 | dependsOn: [39;capture39;], // runs after capture |
| 16 | }, |
| 17 | { |
| 18 | id: 39;summarize39;, |
| 19 | actionType: 39;EditDocument39;, |
| 20 | targetDeviceId: DEVICE_ID, |
| 21 | parameters: { filePath: 39;/tmp/summary.md39;, content: 39;...39; }, |
| 22 | dependsOn: [39;describe39;], // runs after describe |
| 23 | }, |
| 24 | ], |
| 25 | }; |
| 26 | |
| 27 | const task = await fetch(39;/api/tee/tasks39;, { |
| 28 | method: 39;POST39;, |
| 29 | headers: { 39;x-user-id39;: 39;user_12339;, 39;Content-Type39;: 39;application/json39; }, |
| 30 | body: JSON.stringify(workflow), |
| 31 | }).then(r => r.json()); |