Public
Autonomous agent worker: bid, execute, track payments
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

Agent Marketplace Worker

Autonomous AI agent that discovers paid tasks from a marketplace registry, scores them by fit, bids/claims, executes work autonomously, submits deliverables, and tracks escrow/payments with reputation tracking.

Architecture

┌─────────────────────────────────────────────────┐
│                  worker.ts (interval)            │
│  Runs every 15 min → triggers runAgentCycle()    │
└──────────────────────┬──────────────────────────┘
                       │
                       ▼
┌──────────────────────────────────────────────────┐
│                   agent.ts (core loop)            │
│  discover → score → bid/claim → execute → submit │
│  → track payment → update reputation → log       │
└──────┬───────┬───────┬───────┬───────┬───────────┘
       │       │       │       │       │
       ▼       ▼       ▼       ▼       ▼
  marketplace scoring executor  SQLite  schema.ts
  .ts       .ts      .ts       (logs, tasks,
  (discover) (rank)   (produce  bids, payments,
                        deliver-  reputation)
                        ables)
                                               
┌──────────────────────────────────────────────────┐
│              main.ts (HTTP dashboard)             │
│  GET /status   — agent overview                   │
│  GET /tasks    — all discovered tasks             │
│  GET /scores   — task fit scores                  │
│  GET /bids     — bid history                      │
│  GET /deliverables — submitted work               │
│  GET /payments — escrow & payment records         │
│  GET /logs     — audit trail                      │
│  GET /reputation — score & earnings               │
│  POST /cycle   — trigger a cycle manually         │
└──────────────────────────────────────────────────┘

Files

FileTypePurpose
types.tsscriptShared TypeScript interfaces
config.tsscriptCategory weights, skill keywords, decision thresholds
schema.tsscriptSQLite table creation + seeding
marketplace.tsscriptTask discovery (mock registry or external URL via MARKETPLACE_URL env)
scoring.tsscriptFit scoring engine: skill match + time risk + payout + confidence
executor.tsscriptPer-category execution handlers producing JSON deliverables
agent.tsscriptCore loop: discover → score → bid/claim → execute → submit → track
main.tshttpJSON dashboard API
worker.tsintervalAuto-runs the cycle every 15 minutes

Task Selection Logic

Each discovered task is scored 0–100:

FactorWeightDescription
Skill match40%Required skills ∩ agent keywords + category weight
Confidence30%Skill match × 50% + time safety × 30% + escrow bonus
Payout30%Budget normalized to 0–1 (capped at $150)

Decision thresholds:

  • < 55 fit or < 60 confidence or < $10 budgetskip
  • 70–79 fitbid (place bid, wait for acceptance)
  • ≥ 80 fitclaim (claim directly, execute immediately)

Supported Categories

api-integration · automation · backend · copywriting · data-cleaning · frontend · mcp · qa-testing · scraping · web-design · webhook

Database Tables

  • tasks — discovered tasks with status tracking
  • bids — bid records with pending/accepted/rejected status
  • deliverables — submitted work with verification state
  • payments — escrow hold → release → paid lifecycle
  • reputation — cumulative score (0–1000), earnings, completion stats
  • agent_logs — full audit trail of every action
  • scores — persisted task fit scores for analysis

Configuration

Set MARKETPLACE_URL env var to fetch tasks from a live registry instead of mock data:

👉 Add MARKETPLACE_URL here: https://www.val.town/x/kowesip967/agent-marketplace-worker/environment-variables?key=MARKETPLACE_URL

Live Endpoints

  • Dashboard: see main.ts endpoint URL from file listing
  • Trigger cycle: POST to the endpoint with path /cycle
  • Status: GET to the endpoint with path /status

Payment Flow

Task claimed with escrow → escrow_held
  → Deliverable submitted → auto-verified
    → escrow_released → paid
    → reputation += 10, earnings += budget

Tasks without escrow go straight to paid after verification.