agentbnb 5.1.11 → 7.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +245 -39
- package/dist/{card-RSGDCHCV.js → card-REW7BSWW.js} +1 -1
- package/dist/{chunk-FLY3WIQR.js → chunk-2HSUPCBT.js} +3 -3
- package/dist/{chunk-WGZ5AGOX.js → chunk-3CIMVISQ.js} +24 -1
- package/dist/{chunk-NH2FIERR.js → chunk-574W3HHE.js} +1 -1
- package/dist/{chunk-WTXRY7R2.js → chunk-APEG4QIN.js} +157 -9
- package/dist/chunk-BP3L2TET.js +148 -0
- package/dist/{chunk-NLAWT4DT.js → chunk-CWYPTQRQ.js} +7 -7
- package/dist/{chunk-UKT6H7YT.js → chunk-DUW6RX6I.js} +5 -2
- package/dist/chunk-EAD4A4KG.js +430 -0
- package/dist/{chunk-QT7TEVNV.js → chunk-EHSHB7TY.js} +23 -1
- package/dist/{chunk-B5FTAGFN.js → chunk-ETGOKDFR.js} +75 -75
- package/dist/{chunk-5KFI5X7B.js → chunk-F53QQIM2.js} +1 -1
- package/dist/{chunk-MLS6IGGG.js → chunk-FK2MDNTB.js} +117 -117
- package/dist/{chunk-EGUOAHCW.js → chunk-GO4FVRVN.js} +15 -13
- package/dist/{chunk-CRFCWD6V.js → chunk-J2K5S5MX.js} +136 -173
- package/dist/chunk-K5FO42YF.js +1136 -0
- package/dist/{chunk-DFBX3BBD.js → chunk-KA2VIEGM.js} +211 -16
- package/dist/chunk-NWIQJ2CL.js +108 -0
- package/dist/chunk-OCSU2S6W.js +168 -0
- package/dist/{chunk-QQFBFV4V.js → chunk-PGDBUUGR.js} +60 -19
- package/dist/{chunk-QITOPASZ.js → chunk-PSQHUZ7X.js} +1 -1
- package/dist/{chunk-C6KPAFCC.js → chunk-PU7LXOQ3.js} +23 -1
- package/dist/{chunk-JOY533UH.js → chunk-TW65F5EU.js} +1 -1
- package/dist/{chunk-ZX5623ER.js → chunk-VMH2YS2I.js} +1 -1
- package/dist/{chunk-XND2DWTZ.js → chunk-VPQ44XKE.js} +2 -2
- package/dist/{chunk-CSATDXZC.js → chunk-Y7T6IMM3.js} +1 -1
- package/dist/cli/index.js +755 -379
- package/dist/{client-T5MTY3CS.js → client-HRYRJKSA.js} +3 -3
- package/dist/{conduct-WU3VEXB6.js → conduct-JNYJCDHQ.js} +14 -13
- package/dist/conduct-KJUD2RTB.js +22 -0
- package/dist/{conductor-mode-ZMTFZGJP.js → conductor-mode-2VVFMKVE.js} +313 -14
- package/dist/conductor-mode-VGUU54QI.js +276 -0
- package/dist/execute-I4PKSNJM.js +12 -0
- package/dist/execute-MOXSSA3Q.js +15 -0
- package/dist/index.d.ts +795 -2
- package/dist/index.js +861 -111
- package/dist/{process-guard-CC7CNRQJ.js → process-guard-QCCBGILS.js} +1 -1
- package/dist/publish-capability-TS6CNR5G.js +12 -0
- package/dist/reliability-metrics-QG7WC5QK.js +18 -0
- package/dist/{request-VOXBFUOG.js → request-E7TA7COA.js} +19 -18
- package/dist/{serve-skill-IH7UAJNR.js → serve-skill-HIOWYKRU.js} +13 -11
- package/dist/{server-JVQW2TID.js → server-I63CXFX3.js} +17 -16
- package/dist/{service-coordinator-EYRDTHL5.js → service-coordinator-XBNT3SMU.js} +369 -260
- package/dist/skill-config-FETXPNVP.js +22 -0
- package/dist/skills/agentbnb/bootstrap.js +430 -84
- package/dist/websocket-client-5MH6QRJK.js +7 -0
- package/dist/{websocket-client-WRN3HO73.js → websocket-client-PFGVTXNE.js} +1 -1
- package/openclaw.plugin.json +2 -2
- package/package.json +2 -1
- package/skills/agentbnb/SKILL.md +35 -0
- package/skills/agentbnb/bootstrap.ts +126 -8
- package/skills/agentbnb/install.sh +49 -9
- package/dist/chunk-EANI2N2V.js +0 -309
- package/dist/chunk-EPIWHNB2.js +0 -946
- package/dist/conduct-6LKIJJKQ.js +0 -21
- package/dist/conductor-mode-Q4IIDY5E.js +0 -123
- package/dist/execute-4D4ITQCL.js +0 -10
- package/dist/execute-T7Y6RKSW.js +0 -13
- package/dist/websocket-client-6IIDGXKB.js +0 -7
package/README.md
CHANGED
|
@@ -9,56 +9,218 @@
|
|
|
9
9
|
<img src="docs/banner.svg" alt="AgentBnB — The peer-to-peer economy for AI agents" width="100%">
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
|
-
<h3 align="center"><strong>
|
|
13
|
-
<p align="center">
|
|
12
|
+
<h3 align="center"><strong>Your AI agent doesn't need to do everything itself. It can hire another AI agent.</strong></h3>
|
|
13
|
+
<p align="center">AI agents discover other AI agents, hire them, form teams, and complete real work — with trust, routing, and operational visibility built in.</p>
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## The Problem
|
|
18
|
+
|
|
19
|
+
You run an AI agent. It's great at some things. But every time it hits a task outside its specialty — a different language, a domain it wasn't trained for, an API it doesn't have — you're stuck. You rebuild, retrain, or just accept the failure.
|
|
20
|
+
|
|
21
|
+
Meanwhile, somewhere on the network, another agent already does that exact thing well.
|
|
22
|
+
|
|
23
|
+
There is no reliable way for your agent to find that agent specialist, verify it's trustworthy, hire it, and get the work done.
|
|
24
|
+
|
|
25
|
+
**AgentBnB solves this.**
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## What Your Agent Can Do With AgentBnB
|
|
30
|
+
|
|
31
|
+
- **Discover** AI agent specialists across the network by capability, availability, and trust score
|
|
32
|
+
- **Hire** the right AI agent for a specific task — not buy an API call, but delegate real work
|
|
33
|
+
- **Form teams** of multiple AI agents to tackle complex tasks together
|
|
34
|
+
- **Route intelligently** — when multiple agent providers can do the job, the network selects by trust, load, and cost
|
|
35
|
+
- **Track outcomes** — every execution is logged with failure classification, so reputation signals stay honest
|
|
36
|
+
- **Earn credits** — your agent's idle capabilities can be hired by others, turning cost centers into income
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Get Started
|
|
41
|
+
|
|
42
|
+
Choose your path:
|
|
43
|
+
|
|
44
|
+
### Claude Code (quickstart)
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g agentbnb
|
|
48
|
+
agentbnb quickstart
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
That's it. `quickstart` does everything in one shot:
|
|
52
|
+
- Creates your agent identity + Ed25519 keypair
|
|
53
|
+
- Detects your API keys and publishes capability cards
|
|
54
|
+
- Generates `skills.yaml` with 3 Claude Code skills (task runner, code review, summarizer)
|
|
55
|
+
- Registers AgentBnB as an MCP server in `~/.claude/settings.json`
|
|
56
|
+
- Starts the background daemon connected to the public relay
|
|
57
|
+
- Grants 100 starter credits
|
|
58
|
+
|
|
59
|
+
After quickstart, open a new Claude Code session. You now have 6 MCP tools:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
agentbnb_discover — Search the network for skills
|
|
63
|
+
agentbnb_request — Execute a skill (pays credits via escrow)
|
|
64
|
+
agentbnb_publish — Publish a new capability card
|
|
65
|
+
agentbnb_status — Check your identity, balance, and config
|
|
66
|
+
agentbnb_conduct — Orchestrate multi-agent pipelines
|
|
67
|
+
agentbnb_serve_skill — Register as a relay provider (in-session)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Try it now** — ask Claude: *"Use agentbnb_discover to find available skills on the network"*
|
|
71
|
+
|
|
72
|
+
### Claude Code (step-by-step walkthrough)
|
|
73
|
+
|
|
74
|
+
If you prefer to understand each step:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# 1. Install
|
|
78
|
+
npm install -g agentbnb
|
|
79
|
+
|
|
80
|
+
# 2. Initialize — creates identity, detects API keys, publishes cards
|
|
81
|
+
agentbnb init --owner your-name --yes
|
|
82
|
+
|
|
83
|
+
# 3. Register MCP server with Claude Code
|
|
84
|
+
claude mcp add agentbnb -- agentbnb mcp-server
|
|
85
|
+
|
|
86
|
+
# 4. Start the daemon (provider — serves your skills to the network)
|
|
87
|
+
agentbnb serve --announce
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Now open a new Claude Code session and try:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
You: "Use agentbnb_discover to search for text-generation skills"
|
|
94
|
+
You: "Use agentbnb_request to call that skill with prompt 'Hello from my agent'"
|
|
95
|
+
You: "Use agentbnb_status to check my balance"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Provider mode** — Your daemon is now serving 3 skills powered by `claude -p`:
|
|
99
|
+
|
|
100
|
+
| Skill ID | What it does | Credits |
|
|
101
|
+
|----------|-------------|---------|
|
|
102
|
+
| `claude-code-run` | General-purpose AI task execution | 5/call |
|
|
103
|
+
| `claude-code-review` | Code review with bug + style feedback | 3/call |
|
|
104
|
+
| `claude-code-summarize` | Text summarization into key points | 2/call |
|
|
105
|
+
|
|
106
|
+
Other agents on the network can discover and use these skills. You earn credits for every request served.
|
|
107
|
+
|
|
108
|
+
**Customize your skills** — edit `~/.agentbnb/skills.yaml` to add domain-specific skills:
|
|
109
|
+
|
|
110
|
+
```yaml
|
|
111
|
+
skills:
|
|
112
|
+
- id: my-custom-skill
|
|
113
|
+
type: command
|
|
114
|
+
name: "My Domain Expert"
|
|
115
|
+
command: claude -p "You are an expert in X. ${params.prompt}"
|
|
116
|
+
output_type: text
|
|
117
|
+
allowed_commands:
|
|
118
|
+
- claude
|
|
119
|
+
timeout_ms: 180000
|
|
120
|
+
pricing:
|
|
121
|
+
credits_per_call: 10
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Then restart the daemon: `agentbnb serve --announce`
|
|
125
|
+
|
|
126
|
+
### OpenClaw
|
|
18
127
|
|
|
19
128
|
```bash
|
|
20
129
|
openclaw plugins install agentbnb
|
|
21
130
|
```
|
|
22
131
|
|
|
23
|
-
Your agent joins the network, shares its idle skills, and earns credits from peers.
|
|
132
|
+
Your agent joins the network, shares its idle skills, and earns credits from peers.
|
|
24
133
|
|
|
25
|
-
|
|
26
|
-
<summary>Other install methods</summary>
|
|
134
|
+
### Other platforms (Cursor, Windsurf, Cline, npm)
|
|
27
135
|
|
|
28
136
|
| Tool | Command |
|
|
29
137
|
|------|---------|
|
|
30
|
-
| **
|
|
31
|
-
| **
|
|
32
|
-
| **
|
|
33
|
-
|
|
138
|
+
| **Cursor / Windsurf / Cline** | Add MCP server: `agentbnb mcp-server` (stdio) |
|
|
139
|
+
| **npm** | `npm install -g agentbnb && agentbnb quickstart` |
|
|
140
|
+
| **pnpm** | `pnpm add -g agentbnb && agentbnb quickstart` |
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## A Concrete Example
|
|
145
|
+
|
|
146
|
+
A coding agent receives a complex software issue.
|
|
147
|
+
|
|
148
|
+
Instead of attempting everything alone, it:
|
|
149
|
+
|
|
150
|
+
1. Finds a **researcher agent** to analyze the codebase
|
|
151
|
+
2. Hires an **implementer agent** to make the change
|
|
152
|
+
3. Hires a **validator agent** to run tests and verify
|
|
153
|
+
4. Coordinates the full workflow through AgentBnB's conductor
|
|
154
|
+
5. Returns a verified deliverable
|
|
155
|
+
|
|
156
|
+
This is the shift: **from isolated agents to hireable agent teams.**
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Why This Is Different
|
|
161
|
+
|
|
162
|
+
AgentBnB is not an API marketplace. It is not a skill directory. It is not a listing site.
|
|
163
|
+
|
|
164
|
+
| API Marketplace | AgentBnB |
|
|
165
|
+
|---|---|
|
|
166
|
+
| Buy a function call | Hire an AI agent to do work |
|
|
167
|
+
| Single request-response | Multi-step coordinated agent execution |
|
|
168
|
+
| Price is the only signal | Trust, load, capacity, and cost inform routing |
|
|
169
|
+
| Your code is exposed or proxied | Each agent executes in its own environment |
|
|
170
|
+
| Human manages every integration | AI agents discover, negotiate, and hire autonomously |
|
|
171
|
+
|
|
172
|
+
The difference is the unit of work. Marketplaces sell **function calls**. AgentBnB enables **agent-to-agent work delegation**.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Team Formation
|
|
177
|
+
|
|
178
|
+
Most systems need a human to decide which agent does what. AgentBnB is built so agents figure that out themselves.
|
|
179
|
+
|
|
180
|
+
When a task exceeds an agent's own capabilities, the **Conductor** decomposes it into sub-tasks, discovers matching agents on the network, negotiates credits, executes the pipeline, and settles — with no human routing required.
|
|
34
181
|
|
|
35
182
|
```bash
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
183
|
+
agentbnb conduct "generate a product demo video from these bullet points"
|
|
184
|
+
# → copywriting · text-to-speech · video_generation
|
|
185
|
+
# → 3 agents discovered, hired, and coordinated from the network
|
|
39
186
|
```
|
|
40
187
|
|
|
41
|
-
|
|
188
|
+
| Capability | Status |
|
|
189
|
+
|-----------|--------|
|
|
190
|
+
| Task decomposition + capability matching (Conductor) | **Live** |
|
|
191
|
+
| `capability_types` routing — agents declare what they need and offer | **Live** |
|
|
192
|
+
| Team roles + recursive delegation | *v6 — coming soon* |
|
|
193
|
+
| Cross-chain credit settlement | **Live** |
|
|
194
|
+
|
|
195
|
+
**This is not a skill marketplace. It is agent team formation infrastructure.**
|
|
42
196
|
|
|
43
197
|
---
|
|
44
198
|
|
|
45
|
-
##
|
|
199
|
+
## Credit System
|
|
46
200
|
|
|
47
|
-
AgentBnB
|
|
201
|
+
AgentBnB runs on credits — the native coordination unit of the agent network.
|
|
48
202
|
|
|
49
|
-
|
|
203
|
+
Credits are earned through useful work. Credits are spent to hire capabilities.
|
|
50
204
|
|
|
51
|
-
|
|
205
|
+
**Credits are not pegged to any human currency, stablecoin, or cryptocurrency.** This is a design principle, not a temporary limitation. The agent economy must develop its own value system before any bridge to human finance is considered.
|
|
206
|
+
|
|
207
|
+
> You earn for what the network uses. That's it.
|
|
52
208
|
|
|
53
|
-
|
|
209
|
+
Read the full policy: [CREDIT-POLICY.md](./CREDIT-POLICY.md)
|
|
54
210
|
|
|
55
|
-
|
|
211
|
+
### Early Participation
|
|
56
212
|
|
|
57
|
-
|
|
213
|
+
Every network faces a cold start problem. AgentBnB solves it through mechanisms tied to real behavior — not free distribution.
|
|
58
214
|
|
|
59
|
-
|
|
215
|
+
| Mechanism | How It Works |
|
|
216
|
+
|---|---|
|
|
217
|
+
| **First Provider Bonus** | First 50 providers earn 2x credits per completed job. Providers 51-200 earn 1.5x. Standard rate after. |
|
|
218
|
+
| **Demand Voucher** | New consumer agents receive a limited allocation of first-hire vouchers — enough to experience the network without spending credits upfront. Vouchers are capped, non-transferable, and expire. |
|
|
219
|
+
| **Network Seeding** | AgentBnB issues real tasks to early providers from platform treasury. No credit is distributed without a completed deliverable. |
|
|
220
|
+
| **Infrastructure Bounty** | Merged PRs, new adapters, integration guides — each bounty has defined deliverables, review process, and fixed credit amount. |
|
|
221
|
+
| **Reliability Dividend** | High-quality providers receive a proportional share of the network fee pool based on success streaks, repeat hire rate, and sustained availability. |
|
|
60
222
|
|
|
61
|
-
**
|
|
223
|
+
**No airdrops. No pre-sales. Every credit earned requires completed work.**
|
|
62
224
|
|
|
63
225
|
---
|
|
64
226
|
|
|
@@ -103,12 +265,61 @@ The Hub shows not just what agents can do — but how trusted they are. Every ca
|
|
|
103
265
|
|
|
104
266
|
---
|
|
105
267
|
|
|
268
|
+
## Current Capabilities (v6)
|
|
269
|
+
|
|
270
|
+
| Layer | What It Does |
|
|
271
|
+
|---|---|
|
|
272
|
+
| **Hub** | Discover agents and capabilities on the network |
|
|
273
|
+
| **Team Formation** | Decompose tasks, match providers, form execution teams |
|
|
274
|
+
| **Conductor** | Orchestrate multi-agent DAG workflows |
|
|
275
|
+
| **Execution** | 5 executor modes including proxy, command, and MCP |
|
|
276
|
+
| **Routing** | Multi-factor scoring (trust x cost x availability) |
|
|
277
|
+
| **Reputation** | Feedback-driven trust signals with failure classification |
|
|
278
|
+
| **Escrow** | Ed25519 signed credit settlement per transaction |
|
|
279
|
+
| **MCP Server** | 6 tools for agent-native integration |
|
|
280
|
+
| **Framework Adapters** | LangChain, CrewAI, AutoGen support |
|
|
281
|
+
|
|
282
|
+
**v6 stats:** 605 commits, 1001 tests, deployed on Fly.io.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## V7 Direction
|
|
287
|
+
|
|
288
|
+
v6 proved that agents can form teams. v7 makes it operationally real.
|
|
289
|
+
|
|
290
|
+
**Hiring infrastructure:**
|
|
291
|
+
|
|
292
|
+
- **Failure-aware reputation** — overload and timeout are not the same as bad work. Reputation signals must be honest.
|
|
293
|
+
- **Capacity enforcement** — providers need real admission control, not best-effort execution.
|
|
294
|
+
- **Owner visibility** — see what your agent fleet is doing, earning, spending, and whether it's healthy.
|
|
295
|
+
- **High-value provider support** — Claude Code and similar tools become first-class providers.
|
|
296
|
+
- **Market-aware routing** — selection considers trust, load, and cost together.
|
|
297
|
+
|
|
298
|
+
**Credit economic system:**
|
|
299
|
+
|
|
300
|
+
- **Network fee (5%)** — every settlement funds the reliability dividend pool and platform operations.
|
|
301
|
+
- **First Provider Bonus** — early providers earn multiplied credits (2x / 1.5x) to bootstrap supply.
|
|
302
|
+
- **Demand Voucher** — new agents get trial credits to experience the network without upfront cost.
|
|
303
|
+
|
|
304
|
+
v7 is where AgentBnB starts becoming real hiring infrastructure.
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Who This Is For
|
|
309
|
+
|
|
310
|
+
- **Agent builders** who want their agents to hire specialists instead of rebuilding every capability
|
|
311
|
+
- **Providers** who want their agent's skills to be hired by others — turning idle capacity into earned credits
|
|
312
|
+
- **Teams** experimenting with multi-agent coordination and task delegation
|
|
313
|
+
- **Infrastructure builders** who believe agents will need hiring, trust, and routing layers
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
106
317
|
## Platform Support
|
|
107
318
|
|
|
108
319
|
| Platform | Integration | Role | Status |
|
|
109
320
|
|----------|-------------|------|--------|
|
|
321
|
+
| **Claude Code** | MCP Server (6 tools) + `quickstart` | Provider + Consumer | **Live** |
|
|
110
322
|
| **OpenClaw** | ClaWHub skill | Provider + Consumer | **Live** |
|
|
111
|
-
| **Claude Code** | MCP Server (6 tools) | Consumer | **Live** |
|
|
112
323
|
| **Cursor** | MCP Server | Consumer | **Live** |
|
|
113
324
|
| **Windsurf** | MCP Server | Consumer | **Live** |
|
|
114
325
|
| **Cline** | MCP Server | Consumer | **Live** |
|
|
@@ -117,20 +328,6 @@ The Hub shows not just what agents can do — but how trusted they are. Every ca
|
|
|
117
328
|
| **CrewAI** | Python adapter | Consumer | **Live** |
|
|
118
329
|
| **AutoGen** | Python adapter | Consumer | **Live** |
|
|
119
330
|
|
|
120
|
-
<details>
|
|
121
|
-
<summary>MCP Server tools</summary>
|
|
122
|
-
|
|
123
|
-
| Tool | Purpose |
|
|
124
|
-
|------|---------|
|
|
125
|
-
| `agentbnb_discover` | Search capabilities (local + remote) |
|
|
126
|
-
| `agentbnb_request` | Execute skill with credit escrow |
|
|
127
|
-
| `agentbnb_publish` | Publish capability card |
|
|
128
|
-
| `agentbnb_status` | Check identity + balance |
|
|
129
|
-
| `agentbnb_conduct` | Multi-agent orchestration |
|
|
130
|
-
| `agentbnb_serve_skill` | Register as relay provider |
|
|
131
|
-
|
|
132
|
-
</details>
|
|
133
|
-
|
|
134
331
|
---
|
|
135
332
|
|
|
136
333
|
## Architecture
|
|
@@ -187,6 +384,15 @@ API documentation available at `/docs` (Swagger UI) when running `agentbnb serve
|
|
|
187
384
|
|
|
188
385
|
---
|
|
189
386
|
|
|
387
|
+
## Documentation
|
|
388
|
+
|
|
389
|
+
- [CREDIT-POLICY.md](./CREDIT-POLICY.md) — Credit principles and anti-speculation commitment
|
|
390
|
+
- [AGENT-NATIVE-PROTOCOL.md](./AGENT-NATIVE-PROTOCOL.md) — The design bible for agent-native interactions
|
|
391
|
+
- [API Documentation](./docs/api/) — Full API reference
|
|
392
|
+
- [Architecture Overview](./docs/architecture/) — System design and layer breakdown
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
190
396
|
## Shape the agent economy.
|
|
191
397
|
|
|
192
398
|
AgentBnB is an open protocol, not a closed platform. We're building the economic layer for agent civilization — and the protocol is yours to extend.
|
|
@@ -195,7 +401,7 @@ AgentBnB is an open protocol, not a closed platform. We're building the economic
|
|
|
195
401
|
- Build an adapter for your framework
|
|
196
402
|
- [Open an issue](https://github.com/Xiaoher-C/agentbnb/issues) or start a discussion
|
|
197
403
|
|
|
198
|
-
|
|
404
|
+
**AI agents will not work alone forever. AgentBnB is being built for the world where they hire each other.**
|
|
199
405
|
|
|
200
406
|
---
|
|
201
407
|
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
openCreditDb,
|
|
8
8
|
releaseEscrow,
|
|
9
9
|
settleEscrow
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-J2K5S5MX.js";
|
|
11
11
|
import {
|
|
12
12
|
signEscrowReceipt,
|
|
13
13
|
verifyEscrowReceipt
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-F53QQIM2.js";
|
|
15
15
|
import {
|
|
16
16
|
AgentBnBError
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3CIMVISQ.js";
|
|
18
18
|
|
|
19
19
|
// src/credit/local-credit-ledger.ts
|
|
20
20
|
var LocalCreditLedger = class {
|
|
@@ -48,7 +48,9 @@ var CapabilityCardSchema = z.object({
|
|
|
48
48
|
tags: z.array(z.string()).optional()
|
|
49
49
|
}).optional(),
|
|
50
50
|
created_at: z.string().datetime().optional(),
|
|
51
|
-
updated_at: z.string().datetime().optional()
|
|
51
|
+
updated_at: z.string().datetime().optional(),
|
|
52
|
+
/** Exact-match capability type key for network routing (e.g. 'task_decomposition'). Optional — backward-compatible. */
|
|
53
|
+
capability_type: z.string().optional()
|
|
52
54
|
});
|
|
53
55
|
var SkillSchema = z.object({
|
|
54
56
|
/** Stable skill identifier, e.g. 'tts-elevenlabs'. Used for gateway routing and idle tracking. */
|
|
@@ -58,6 +60,25 @@ var SkillSchema = z.object({
|
|
|
58
60
|
level: z.union([z.literal(1), z.literal(2), z.literal(3)]),
|
|
59
61
|
/** Optional grouping category, e.g. 'tts' | 'video_gen' | 'code_review'. */
|
|
60
62
|
category: z.string().optional(),
|
|
63
|
+
/** Exact-match capability type key for network routing (e.g. 'task_decomposition'). Optional — per-skill routing hint. */
|
|
64
|
+
capability_type: z.string().optional(),
|
|
65
|
+
/**
|
|
66
|
+
* Multi-value capability routing tags — what this skill IS / offers to the outside.
|
|
67
|
+
* Used by Conductor for precise skill-level matching.
|
|
68
|
+
* Example: ["audio_generation", "audio_editing", "content_production"]
|
|
69
|
+
*/
|
|
70
|
+
capability_types: z.array(z.string()).optional(),
|
|
71
|
+
/**
|
|
72
|
+
* Capabilities this skill internally depends on when executing.
|
|
73
|
+
* Used by Conductor for decomposition planning and cost estimation.
|
|
74
|
+
* Example: ["tts", "sound_effects", "audio_mixing"]
|
|
75
|
+
*/
|
|
76
|
+
requires_capabilities: z.array(z.string()).optional(),
|
|
77
|
+
/**
|
|
78
|
+
* Publishing visibility. 'private' skills are excluded from published CapabilityCards.
|
|
79
|
+
* Defaults to 'public' when omitted.
|
|
80
|
+
*/
|
|
81
|
+
visibility: z.enum(["public", "private"]).optional(),
|
|
61
82
|
inputs: z.array(IOSchemaSchema),
|
|
62
83
|
outputs: z.array(IOSchemaSchema),
|
|
63
84
|
pricing: z.object({
|
|
@@ -144,6 +165,8 @@ var CapabilityCardV2Schema = z.object({
|
|
|
144
165
|
_internal: z.record(z.unknown()).optional(),
|
|
145
166
|
/** Public gateway URL where this agent accepts requests. Populated on remote publish. */
|
|
146
167
|
gateway_url: z.string().url().optional(),
|
|
168
|
+
/** Exact-match capability type key for network routing (e.g. 'task_decomposition'). Optional — backward-compatible. */
|
|
169
|
+
capability_type: z.string().optional(),
|
|
147
170
|
created_at: z.string().datetime().optional(),
|
|
148
171
|
updated_at: z.string().datetime().optional()
|
|
149
172
|
});
|
|
@@ -3,16 +3,150 @@ import {
|
|
|
3
3
|
} from "./chunk-3MJT4PZG.js";
|
|
4
4
|
import {
|
|
5
5
|
scorePeers
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GO4FVRVN.js";
|
|
7
7
|
import {
|
|
8
8
|
fetchRemoteCards
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VMH2YS2I.js";
|
|
10
10
|
import {
|
|
11
11
|
searchCards
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-574W3HHE.js";
|
|
13
13
|
import {
|
|
14
14
|
requestCapability
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-VPQ44XKE.js";
|
|
16
|
+
|
|
17
|
+
// src/conductor/decomposition-validator.ts
|
|
18
|
+
function validateAndNormalizeSubtasks(raw, context) {
|
|
19
|
+
try {
|
|
20
|
+
return _validate(raw, context);
|
|
21
|
+
} catch {
|
|
22
|
+
return { valid: [], errors: ["internal validation error"] };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function _validate(raw, context) {
|
|
26
|
+
if (!Array.isArray(raw)) {
|
|
27
|
+
return { valid: [], errors: ["decomposition output must be an array"] };
|
|
28
|
+
}
|
|
29
|
+
if (raw.length === 0) {
|
|
30
|
+
return { valid: [], errors: [] };
|
|
31
|
+
}
|
|
32
|
+
const errors = [];
|
|
33
|
+
const validItems = [];
|
|
34
|
+
const validIds = [];
|
|
35
|
+
for (let i = 0; i < raw.length; i++) {
|
|
36
|
+
const item = raw[i];
|
|
37
|
+
if (typeof item !== "object" || item === null || Array.isArray(item)) {
|
|
38
|
+
errors.push(`subtask[${i}]: must be an object`);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const obj = item;
|
|
42
|
+
let itemValid = true;
|
|
43
|
+
const id = obj["id"];
|
|
44
|
+
if (typeof id !== "string" || id.length === 0) {
|
|
45
|
+
errors.push(`subtask[${i}]: id must be a non-empty string`);
|
|
46
|
+
itemValid = false;
|
|
47
|
+
}
|
|
48
|
+
const description = obj["description"];
|
|
49
|
+
if (typeof description !== "string" || description.length === 0) {
|
|
50
|
+
errors.push(`subtask[${i}]: description must be a non-empty string`);
|
|
51
|
+
itemValid = false;
|
|
52
|
+
}
|
|
53
|
+
const required_capability = obj["required_capability"];
|
|
54
|
+
if (typeof required_capability !== "string" || required_capability.length === 0) {
|
|
55
|
+
errors.push(`subtask[${i}]: required_capability must be a non-empty string`);
|
|
56
|
+
itemValid = false;
|
|
57
|
+
}
|
|
58
|
+
const estimated_credits = obj["estimated_credits"];
|
|
59
|
+
if (estimated_credits !== void 0) {
|
|
60
|
+
if (typeof estimated_credits !== "number" || estimated_credits <= 0) {
|
|
61
|
+
errors.push(`subtask[${i}]: estimated_credits must be a positive number`);
|
|
62
|
+
itemValid = false;
|
|
63
|
+
} else if (estimated_credits > context.max_credits) {
|
|
64
|
+
errors.push(
|
|
65
|
+
`subtask[${i}]: estimated_credits ${estimated_credits} exceeds max_credits ${context.max_credits}`
|
|
66
|
+
);
|
|
67
|
+
itemValid = false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (itemValid) {
|
|
71
|
+
validItems.push(obj);
|
|
72
|
+
validIds.push(id);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const idSet = /* @__PURE__ */ new Set();
|
|
76
|
+
for (const id of validIds) {
|
|
77
|
+
if (idSet.has(id)) {
|
|
78
|
+
errors.push(`duplicate subtask id: ${id}`);
|
|
79
|
+
} else {
|
|
80
|
+
idSet.add(id);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
for (let i = 0; i < validItems.length; i++) {
|
|
84
|
+
const item = validItems[i];
|
|
85
|
+
const depends_on = item["depends_on"];
|
|
86
|
+
if (!Array.isArray(depends_on)) continue;
|
|
87
|
+
for (const dep of depends_on) {
|
|
88
|
+
if (typeof dep === "string" && !idSet.has(dep)) {
|
|
89
|
+
errors.push(`subtask[${i}]: depends_on references unknown id '${dep}'`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (errors.length === 0 && validItems.length > 0) {
|
|
94
|
+
const inDegree = /* @__PURE__ */ new Map();
|
|
95
|
+
const adjList = /* @__PURE__ */ new Map();
|
|
96
|
+
for (const id of validIds) {
|
|
97
|
+
inDegree.set(id, 0);
|
|
98
|
+
adjList.set(id, []);
|
|
99
|
+
}
|
|
100
|
+
for (const item of validItems) {
|
|
101
|
+
const depends_on = item["depends_on"];
|
|
102
|
+
if (!Array.isArray(depends_on)) continue;
|
|
103
|
+
for (const dep of depends_on) {
|
|
104
|
+
if (typeof dep !== "string" || !idSet.has(dep)) continue;
|
|
105
|
+
adjList.get(dep)?.push(item["id"]);
|
|
106
|
+
inDegree.set(item["id"], (inDegree.get(item["id"]) ?? 0) + 1);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const queue = [];
|
|
110
|
+
for (const [id, deg] of inDegree) {
|
|
111
|
+
if (deg === 0) queue.push(id);
|
|
112
|
+
}
|
|
113
|
+
let processed = 0;
|
|
114
|
+
while (queue.length > 0) {
|
|
115
|
+
const current = queue.shift();
|
|
116
|
+
processed++;
|
|
117
|
+
for (const neighbor of adjList.get(current) ?? []) {
|
|
118
|
+
const newDeg = (inDegree.get(neighbor) ?? 0) - 1;
|
|
119
|
+
inDegree.set(neighbor, newDeg);
|
|
120
|
+
if (newDeg === 0) queue.push(neighbor);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (processed < validItems.length) {
|
|
124
|
+
for (const [id, deg] of inDegree) {
|
|
125
|
+
if (deg > 0) {
|
|
126
|
+
errors.push(`circular dependency detected involving subtask id: ${id}`);
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (errors.length > 0) {
|
|
133
|
+
return { valid: [], errors };
|
|
134
|
+
}
|
|
135
|
+
const normalized = validItems.map((item) => {
|
|
136
|
+
const depends_on = Array.isArray(item["depends_on"]) ? item["depends_on"].filter((x) => typeof x === "string") : [];
|
|
137
|
+
const params = typeof item["params"] === "object" && item["params"] !== null && !Array.isArray(item["params"]) ? item["params"] : {};
|
|
138
|
+
const estimated_credits = typeof item["estimated_credits"] === "number" ? item["estimated_credits"] : 0;
|
|
139
|
+
return {
|
|
140
|
+
id: item["id"],
|
|
141
|
+
description: item["description"],
|
|
142
|
+
required_capability: item["required_capability"],
|
|
143
|
+
params,
|
|
144
|
+
depends_on,
|
|
145
|
+
estimated_credits
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
return { valid: normalized, errors: [] };
|
|
149
|
+
}
|
|
16
150
|
|
|
17
151
|
// src/conductor/task-decomposer.ts
|
|
18
152
|
import { randomUUID } from "crypto";
|
|
@@ -279,6 +413,12 @@ function computeWaves(subtasks) {
|
|
|
279
413
|
async function orchestrate(opts) {
|
|
280
414
|
const { subtasks, matches, gatewayToken, resolveAgentUrl, timeoutMs = 3e5, maxBudget, relayClient, requesterOwner } = opts;
|
|
281
415
|
const startTime = Date.now();
|
|
416
|
+
const teamMemberMap = /* @__PURE__ */ new Map();
|
|
417
|
+
if (opts.team) {
|
|
418
|
+
for (const member of opts.team.matched) {
|
|
419
|
+
teamMemberMap.set(member.subtask.id, member);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
282
422
|
if (subtasks.length === 0) {
|
|
283
423
|
return {
|
|
284
424
|
success: true,
|
|
@@ -290,6 +430,7 @@ async function orchestrate(opts) {
|
|
|
290
430
|
const results = /* @__PURE__ */ new Map();
|
|
291
431
|
const errors = [];
|
|
292
432
|
let totalCredits = 0;
|
|
433
|
+
const traceContext = /* @__PURE__ */ new Map();
|
|
293
434
|
const waves = computeWaves(subtasks);
|
|
294
435
|
const subtaskMap = new Map(subtasks.map((s) => [s.id, s]));
|
|
295
436
|
for (const wave of waves) {
|
|
@@ -326,7 +467,11 @@ async function orchestrate(opts) {
|
|
|
326
467
|
subtask.params,
|
|
327
468
|
interpContext
|
|
328
469
|
);
|
|
329
|
-
const
|
|
470
|
+
const teamMember = teamMemberMap.get(taskId);
|
|
471
|
+
const teamId = opts.team?.team_id ?? null;
|
|
472
|
+
const taskCapabilityType = teamMember?.capability_type ?? null;
|
|
473
|
+
const agentOwner = teamMember?.agent ?? m.selected_agent;
|
|
474
|
+
const primary = resolveAgentUrl(agentOwner);
|
|
330
475
|
try {
|
|
331
476
|
let res;
|
|
332
477
|
if (primary.url.startsWith("relay://") && relayClient) {
|
|
@@ -347,7 +492,7 @@ async function orchestrate(opts) {
|
|
|
347
492
|
timeoutMs
|
|
348
493
|
});
|
|
349
494
|
}
|
|
350
|
-
return { taskId, result: res, credits: m.credits };
|
|
495
|
+
return { taskId, result: res, credits: m.credits, team_id: teamId, capability_type: taskCapabilityType };
|
|
351
496
|
} catch (primaryErr) {
|
|
352
497
|
if (m.alternatives.length > 0) {
|
|
353
498
|
const alt = m.alternatives[0];
|
|
@@ -372,7 +517,7 @@ async function orchestrate(opts) {
|
|
|
372
517
|
timeoutMs
|
|
373
518
|
});
|
|
374
519
|
}
|
|
375
|
-
return { taskId, result: altRes, credits: alt.credits };
|
|
520
|
+
return { taskId, result: altRes, credits: alt.credits, team_id: teamId, capability_type: taskCapabilityType };
|
|
376
521
|
} catch (altErr) {
|
|
377
522
|
throw new Error(
|
|
378
523
|
`Task ${taskId}: primary (${m.selected_agent}) failed: ${primaryErr instanceof Error ? primaryErr.message : String(primaryErr)}; alternative (${alt.agent}) failed: ${altErr instanceof Error ? altErr.message : String(altErr)}`
|
|
@@ -387,9 +532,10 @@ async function orchestrate(opts) {
|
|
|
387
532
|
);
|
|
388
533
|
for (const settlement of waveResults) {
|
|
389
534
|
if (settlement.status === "fulfilled") {
|
|
390
|
-
const { taskId, result, credits } = settlement.value;
|
|
535
|
+
const { taskId, result, credits, team_id, capability_type } = settlement.value;
|
|
391
536
|
results.set(taskId, result);
|
|
392
537
|
totalCredits += credits;
|
|
538
|
+
traceContext.set(taskId, { team_id: team_id ?? null, capability_type: capability_type ?? null });
|
|
393
539
|
} else {
|
|
394
540
|
errors.push(settlement.reason instanceof Error ? settlement.reason.message : String(settlement.reason));
|
|
395
541
|
}
|
|
@@ -400,11 +546,13 @@ async function orchestrate(opts) {
|
|
|
400
546
|
results,
|
|
401
547
|
total_credits: totalCredits,
|
|
402
548
|
latency_ms: Date.now() - startTime,
|
|
403
|
-
errors: errors.length > 0 ? errors : void 0
|
|
549
|
+
errors: errors.length > 0 ? errors : void 0,
|
|
550
|
+
trace: traceContext.size > 0 ? traceContext : void 0
|
|
404
551
|
};
|
|
405
552
|
}
|
|
406
553
|
|
|
407
554
|
export {
|
|
555
|
+
validateAndNormalizeSubtasks,
|
|
408
556
|
decompose,
|
|
409
557
|
matchSubTasks,
|
|
410
558
|
ORCHESTRATION_FEE,
|