lobster-worker-client
Client library and dispatch CLI for the lobster sub-agent worker system. Dispatches tasks to EC2 spot workers via Lambda/EventBridge and polls DynamoDB for results.
Install
npm install
Library Usage
import { dispatchAndWait, listTasks } from './src/worker-client.mjs';
// Dispatch a task and wait for completion
const result = await dispatchAndWait({
prompt: 'Analyze the current APY rates and recommend rebalancing',
sapBranch: 'sap/task-123',
workerId: 'sub_agent_0',
timeoutMinutes: 45,
});
console.log(result.output);
// List recent tasks
const tasks = await listTasks('sub_agent_0', 10);
CLI Usage
# Dispatch and return immediately
node scripts/dispatch-sap.js --prompt "your task here" --sap-branch sap/my-task
# Dispatch and wait for result
node scripts/dispatch-sap.js --prompt "your task here" --sap-branch sap/my-task --wait
# List recent tasks
node scripts/dispatch-sap.js --list
# Poll a specific task
node scripts/dispatch-sap.js --task-id <uuid> --worker-id sub_agent_0
Setup
See SETUP.md for full AWS permissions, cross-account EventBridge configuration, and CDK deployment guide.
Configuration
Set in .env or environment:
| Variable | Description |
|----------|-------------|
| AWS_ACCESS_KEY_ID | Source account credentials |
| AWS_SECRET_ACCESS_KEY | Source account credentials |
| AWS_REGION | Default: us-west-2 |