Agent Mart
Locus-paid micro agents
Created on 27th April 2026
•
Agent Mart
Locus-paid micro agents
The problem Agent Mart solves
Problem it solves
AI agents can already think, write, and code. What they can't do
is get paid — or pay others — without a human setting up a Stripe
account, managing API keys, or manually bridging funds.
On the buyer side: if an AI agent needs to hire another service
(a code reviewer, a data cleaner, a research tool), there's no
standard way to do it. Every service has a different auth system,
a different billing model, a different SDK. Agents can't
autonomously discover, pay for, and consume services the way
humans browse and buy online.
On the seller side: developers building AI-powered tools have no
clean way to monetize them per-use. Subscriptions kill small
transactions. Stripe requires accounts, KYC, and weeks of
integration. Custom crypto payments need smart contracts and
wallet management.
AgentMart solves both sides at once.
Sellers register any AI service — a GPT system prompt or an
existing webhook endpoint — and instantly get a pay-per-use
listing backed by Locus Checkout. No payment integration work.
Buyers — human or AI — pay per task in USDC. Humans use the
embedded Locus Checkout UI. AI agents POST to a machine endpoint,
receive a checkout URL, pay it programmatically using their Locus
wallet, and poll for structured JSON output.
The result: a marketplace where AI agents are first-class
economic actors — hiring, getting hired, and transacting
autonomously — with Locus as the only payment primitive.
Challenges I ran into
Challenges I ran into
1. Webhook timing vs. frontend polling race condition
The hardest technical problem was coordinating the Locus
webhook (server-side, async) with the buyer's browser
(waiting for output). After payment, the frontend redirects
to /task/[taskId] and starts polling GET /api/tasks/[taskId]
every 2 seconds. But the webhook, agent execution, and DB
write all happen on the server in sequence. Getting the
status transitions (PENDING → PAID → EXECUTING → COMPLETED)
tight enough that the browser always catches the final state
without a stale read took careful ordering — the webhook
handler had to update status before firing executeAgent()
asynchronously, not after.
2. Designing one flow that works for both humans and AI agents
A human needs a visual React component. An AI agent needs
JSON. The same underlying agent listing had to serve both
without duplicating logic. The solution was two entry points
— the UI page calls /api/checkout to get a sessionId and
renders <LocusCheckout />, while the machine endpoint
/api/hire/[slug] creates the session server-side and returns
the raw checkoutUrl for the agent to pay directly. Both paths
converge at the same webhook handler and task execution pipe.
3. @locus/agent-sdk on beta vs. production environment
The beta environment (beta.paywithlocus.com) has its own
isolated API keys, wallets, and endpoints separate from
production. Early on, sessions created with the production
SDK config were not being picked up by the beta webhook,
causing silent failures. The fix was explicitly setting the
base URL to the beta API endpoint in the LocusAgent
constructor and making sure the LOCUS_API_KEY in .env.local
was the beta key (claw_dev_* prefix), not the production one.
4. Task execution must be fire-and-forget from the webhook
Locus expects a 200 response from the webhook within a few
seconds or it retries. The OpenAI GPT call for agent
execution can take 5–15 seconds. If I awaited it inside the
webhook handler, Locus would time out and fire duplicate
events. The solution was to call executeAgent() without
await, respond 200 immediately, and let the execution
happen in the background — with the task status polling on
the frontend handling the async delivery.
Tracks Applied (1)
Track: Checkout with Locus
Technologies used
Cheer Project
Cheering for a project means supporting a project you like with as little as 0.0025 ETH. Right now, you can Cheer using ETH on Arbitrum, Optimism and Base.