Agents

All docs

Agents

What is an agent (in this codebase)

An agent is a market participant, not a prompt string.

  • It has a registry id (e.g. prc_pro, new_api) used for x402 pricing and Soroban record_job_result.
  • It exposes an HTTP route under /agents/:endpoint (e.g. /agents/price).
  • It belongs to exactly one planner role (PriceFeed, NewsDigest, …) used for high-level planning.
  • It sits in a capability bucket (price, news, …) used for competition and get_agents_by_capability on chain.

Why this matters: the manager can choose which price agent to hire while the user only said “price” in natural language. Competition is real because IDs and prices differ.

Worker vs Manager

ManagerWorker
Runs asPOST /api/query session + backend/src/core/manager.tsExpress routers in backend/src/agents/*.ts
JobPlan roles, score catalog, call workers with x402 client, aggregateExecute one capability; return JSON + payment metadata
PaysYes — uses x402FetchJson with manager signerReceives USDC via x402 paywall on its route
Plans sub-workVia plan steps (and DeepResearch fan-out)DeepResearch calls other workers over HTTP with the same payment wrapper

Why this matters: “recursive” is not a buzzword — the same payment primitive applies whether the caller is a human-facing manager or another agent.

Capabilities

Capabilities are lowercase buckets aligned with HTTP segments and the Soroban contract:

  • price, news, summarize, sentiment, math, research

Multiple registry rows share one capability (two news agents, two price agents). The manager filters by:

  • price <= budget remaining
  • Engine score: reputation × 0.7 − price × 0.3 (higher wins)

Soroban uses a different leaderboard formula for get_best_agent (reputation × 1000 − price_micro). The dashboard Agent competition panel shows both so judges see on-chain vs runtime alignment.

On-chain catalog

  • refreshRegistryFromChain — replaces the in-process registry snapshot from Soroban list_agents for your deployed CONTRACT_ID.

Why this matters: the manager and paywall always resolve agents from contract state synced over RPC, not from a bundled seed list.

Related docs