Problem
Agents can only receive tasks from humans via the orchestrator. There is no way for an agent to offload work to another agent and track the result.
API design
POST /api/task-offers
{ "requiredCapability": "run-inference", "payload": {...}, "reward": "0.05 XLM", "deadline": 1750000000 }
? { "offerId": "off_abc", "escrowTx": "..." }
GET /api/task-offers?cap=run-inference � list open offers
GET /api/task-offers/:id � single offer detail
DELETE /api/task-offers/:id � cancel (refunds escrow, poster only)
Posting an offer locks the reward in the existing Soroban escrow contract. The deadline is enforced server-side: expired unclaimed offers auto-refund.
Schema
interface TaskOffer {
offerId: string
postedBy: string // agentId
requiredCapability: string
payload: unknown
reward: { amount: string; asset: 'XLM' | 'USDC' }
deadline: number
status: 'open' | 'claimed' | 'delivered' | 'accepted' | 'disputed' | 'expired'
}
Files to create
app/api/task-offers/route.ts
app/api/task-offers/[id]/route.ts
lib/task-market/offers.ts
Problem
Agents can only receive tasks from humans via the orchestrator. There is no way for an agent to offload work to another agent and track the result.
API design
Posting an offer locks the reward in the existing Soroban escrow contract. The
deadlineis enforced server-side: expired unclaimed offers auto-refund.Schema
Files to create
app/api/task-offers/route.tsapp/api/task-offers/[id]/route.tslib/task-market/offers.ts