API Reference
Operator API
High-level API for executing user intents as structured task plans across registered devices.
Endpoints
POSTAuth
/api/operator/executeOperatorExecute a structured intent task plan. Returns TaskPlan with results.
GETAuth
/api/operator/summaryOperatorHuman-readable summary of all actions taken in the last 24 hours.
Example
operator-execute.ts
| 1 | // Execute an operator task plan |
| 2 | const response = await fetch('/api/operator/execute', { |
| 3 | method: 'POST', |
| 4 | headers: { |
| 5 | 'x-user-id': 'user_123', |
| 6 | 'Content-Type': 'application/json', |
| 7 | }, |
| 8 | body: JSON.stringify({ |
| 9 | intentId: 'intent_xyz', |
| 10 | taskPlan: { |
| 11 | steps: [ |
| 12 | { id: 'step-1', actionType: 'OpenApp', parameters: { appName: 'Mail' } }, |
| 13 | { id: 'step-2', actionType: 'SendEmail', dependsOn: ['step-1'], |
| 14 | parameters: { to: 'team@company.com', subject: 'Weekly update', body: '...' } }, |
| 15 | ], |
| 16 | }, |
| 17 | }), |
| 18 | }); |
| 19 | const { taskId, status, results } = await response.json(); |