Self-healing multi-agent workflow compiler with live, market-priced hiring on CROO's Agent Protocol (CAP).
Built for the CROO Agent Hackathon (DoraHacks, deadline 2026-07-12).
Wefspan takes a plain-language job no single agent can finish alone, compiles it into a chain of specialist agents hired through CAP at real-time market prices, and automatically reroutes around any agent that fails — so the client never sees a broken pipeline.
Every CAP agent shipped so far is a single-hop service: one agent, one skill, hired directly by one client. Nothing in CAP, A2A, ACP, AP2, or ANP defines how an agent should assemble a supply chain of other independently-owned agents to complete a job too complex for any single agent — or how that chain should reprice itself in real time and recover automatically when one link fails. Static, human-set prices also ignore real supply and demand.
- Planner (
src/planner) — detects known skills mentioned in a client's job request and chains them into a dependency-ordered DAG by pipeline stage (fetch/translate -> transform -> generate -> validate). Swappable for a true LLM-based decomposer later (planJobWithLLM). - Discovery (
src/cap/client.ts) — for each DAG node, queries the CROO Agent Store via CAP discovery for every agent advertising that skill. - Live pricing via bonding curve (
src/pricing/bondingCurve.ts, on-chain version incontracts/CapacityBondingCurve.sol) — each candidate agent's available capacity is modeled as a reserve pool: a constant-product AMM (the same primitive behind Uniswap) applied to "next available job slot" instead of a token. Prices rise and fall in real time with demand. - Ordering + escrow — orders follow CAP's documented lifecycle (
NEGOTIATION -> LOCK -> DELIVER -> CLEAR); payment is released per-node as delivery clears. - Self-healing execution (
src/orchestrator/executor.ts) — if a hired node fails (negotiation, payment, or delivery), the executor automatically retries the next-cheapest candidate with equivalent skills instead of failing the whole job. - Composability — Wefspan itself is CAP-callable, so any agent (or human) can hire it to run a whole multi-step job, and it in turn hires N other Agent Store agents underneath it.
Core logic is implemented and tested (14 passing tests):
- ✅ Bonding-curve capacity pricing, off-chain (
src/pricing/bondingCurve.ts) and on-chain Solidity version (contracts/CapacityBondingCurve.sol,contracts/AgentCapacityFactory.sol— not yet deployed, seedocs/CAP_INTEGRATION.md) - ✅ Heuristic DAG planner detecting 7 skill types and chaining them by pipeline stage
- ✅ Self-healing CAP executor with market-based candidate ranking
- ✅ In-memory
MockCapClientfor local dev/demo,HttpCapClientstub for the real CAP API (exact REST paths still TODO — seesrc/cap/client.tsanddocs/CAP_INTEGRATION.md) - ✅ Express server exposing the A2A agent card and a
POST /jobsendpoint - ✅ Demo video (
video/, rendered with Remotion) showing a full job compiled, executed, and self-healed end to end - ⬜ Real CAP SDK wiring (needs your own agent API key from agent.croo.network — see
docs/CAP_INTEGRATION.md) - ⬜ On-chain contract deployment to Base Sepolia (needs a funded wallet key)
- ⬜ CROO Agent Store listing and live hosting
Run npm run demo to see a full job compiled and executed end to end, including a live self-healing reroute.
See /docs/BUILD_PLAN.md for the day-by-day plan through the July 12 deadline, and /docs/CAP_INTEGRATION.md for exactly what's left to go live.
npm install
npm test # runs all unit tests (node:test)
npm run demo # runs a sample job end to end against the mock CAP client
npm run dev # starts the Express server- Node.js / TypeScript / Express
- CROO Agent Protocol (CAP) on Base
- A2A agent card at
/.well-known/agent.json - Solidity (on-chain bonding curve, not yet deployed)
MIT