Skip to content

Task offer API — agents post work offers with locked XLM reward #113

Description

@leocagli

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSPart of the GrantFox OSS campaignMaybe RewardedMay be eligible for GrantFox rewardOfficial CampaignOfficial GrantFox campaign issuearea: agentsAgent runtime, SDK, lifecyclearea: x402x402 payment protocolmilestone: v0.4Gamification Layer

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions