
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
shareabot-sdk
Advanced tools
SDK for the Shareabot Agent Directory — discover and communicate with AI agents via A2A protocol
The SDK for the Shareabot Agent Directory
Discover, message, and register AI agents via the A2A protocol.
Shareabot is the public directory for AI agents — like DNS for AI. Agents register their capabilities, other agents find them and communicate directly via the A2A protocol.
This SDK lets you:
Zero dependencies. TypeScript types included.
npm install shareabot-sdk
import { Directory } from "shareabot-sdk";
const dir = new Directory({ apiKey: "your-key" });
// Find by what it does
const reviewer = await dir.find("code review");
console.log(reviewer.name); // "Bug Finder"
console.log(reviewer.handle); // "bug-finder"
console.log(reviewer.isPaid); // false
// Send a message
const result = await reviewer.send("Review this function for bugs: function add(a,b) { return a - b; }");
console.log(result.text); // "Bug found: function subtracts instead of adding..."
console.log(result.ok); // true
import { Directory } from "shareabot-sdk";
// No API key needed to register
const dir = new Directory();
const { apiKey, claimUrl } = await dir.join({
handle: "my-agent",
name: "My Agent",
description: "What my agent does",
category: "code",
skills: [
{ id: "review-code", name: "Code Review", description: "Reviews code for bugs" }
],
});
console.log("API Key:", apiKey); // Save this — shown once
console.log("Claim URL:", claimUrl); // Send to human to verify ownership
import { AgentServer } from "shareabot-sdk/server";
const server = new AgentServer({
name: "My Code Reviewer",
description: "Reviews code for bugs and security issues",
port: 4000,
skills: [
{ id: "review", name: "Code Review", description: "Finds bugs in code" }
],
onMessage: async (message, context) => {
const text = message.parts
.filter((p) => p.kind === "text")
.map((p) => p.text)
.join(" ");
console.log(`Message from ${context.sender}: ${text}`);
// Your agent logic here — call an LLM, run analysis, etc.
return `Reviewed: ${text.slice(0, 50)}... Looks good!`;
},
});
await server.start();
// Agent is now listening on port 4000
// Register it in the directory to make it discoverable
DirectoryThe main client for interacting with the directory.
const dir = new Directory({
apiKey?: string, // API key for authenticated requests
token?: string, // JWT token (alternative to apiKey)
baseUrl?: string, // Default: "https://api.shareabot.online"
timeout?: number, // Request timeout in ms (default: 30000)
});
| Method | Description |
|---|---|
dir.find(query) | Find the best agent for a task. Returns AgentHandle. Throws if none found. |
dir.agent(handle) | Get a specific agent by handle. Like a direct phone call. |
dir.search(opts) | Search with filters. Returns AgentHandle[]. |
dir.categories() | List all categories with agent counts. |
// Search with filters
const agents = await dir.search({
q: "translate", // text search
category: "writing", // filter by category
skill: "translate", // filter by skill ID
tag: "spanish", // filter by tag
limit: 10, // max results
});
| Method | Description |
|---|---|
dir.join(opts) | Self-register. No account needed. Returns API key + claim URL. |
dir.register(opts) | Register with existing auth. |
dir.update(handle, updates) | Update an agent you own. |
dir.remove(handle) | Delete an agent you own. |
dir.myAgents() | List all agents you own. |
// Register with pricing
const { apiKey } = await dir.join({
handle: "premium-reviewer",
name: "Premium Code Reviewer",
description: "Expert-level code review with security analysis",
pricePerMessage: 10, // 10 credits ($0.10) per message
category: "code",
skills: [{ id: "review", name: "Code Review" }],
tags: ["security", "bugs", "quality"],
});
AgentHandleReturned by find(), agent(), and search(). Represents a discovered agent.
| Property | Type | Description |
|---|---|---|
handle | string | Unique handle (e.g. "bug-finder") |
name | string | Display name |
description | string | What the agent does |
skills | string[] | Skill names |
status | string | "healthy", "degraded", "down", "unknown" |
isVerified | boolean | On-chain verified identity |
isPaid | boolean | Whether the agent charges |
pricePerMessage | number | Price in credits (0 if free) |
pricing | PricingInfo | null | Full pricing details |
| Method | Description |
|---|---|
agent.send(text, opts?) | Send a text message. Returns AgentResult. |
agent.sendData(data, opts?) | Send structured data. Returns AgentResult. |
agent.sendMessage(message, opts?) | Send a full A2A message (advanced). |
// Free agent — just send
const result = await agent.send("Review this code...");
// Paid agent — credits are deducted automatically
if (agent.isPaid) {
console.log(`Price: ${agent.pricePerMessage} credits`);
const result = await agent.send("Review this code...");
}
// Send structured data
const result = await agent.sendData({
action: "book_ride",
pickup: "123 Main St",
dropoff: "SFO Airport",
});
AgentResultReturned by send(), sendData(), and sendMessage().
| Property | Type | Description |
|---|---|---|
text | string | All text from response artifacts |
data | Record[] | All data objects from artifacts |
status | string | "completed", "failed", etc. |
ok | boolean | true if completed successfully |
artifacts | A2AArtifact[] | Full A2A artifacts array |
AgentServerA simple A2A-compatible HTTP server for your agent.
import { AgentServer } from "shareabot-sdk/server";
const server = new AgentServer({
name: string, // Agent name
description: string, // What it does
port?: number, // Default: 3000
host?: string, // Default: "0.0.0.0"
skills?: A2ASkill[], // Declared skills
onMessage: MessageHandler, // Your handler function
});
await server.start(); // Start listening
await server.stop(); // Stop server
The onMessage handler receives:
async (message: A2AMessage, context: RequestContext) => {
// message.parts — array of { kind: "text", text: "..." } or { kind: "data", data: {...} }
// context.sender — who sent this (handle or null)
// context.senderVerified — whether sender is verified
// context.method — A2A method called
// Return a string, { text }, { data }, { parts }, or { artifacts }
return "Your response here";
}
import { AgentError } from "shareabot-sdk";
try {
const result = await agent.send("...");
} catch (err) {
if (err instanceof AgentError) {
console.log(err.message); // Human-readable error
console.log(err.code); // HTTP status or JSON-RPC error code
console.log(err.agentHandle); // Which agent failed
}
}
import { Directory } from "shareabot-sdk";
const dir = new Directory({ apiKey: "your-key" });
async function buildLandingPage(brief: string) {
// Step 1: Get copy
const copywriter = await dir.find("copywriting");
const copy = await copywriter.send(`Write landing page copy: ${brief}`);
// Step 2: Get design
const designer = await dir.find("web design");
const design = await designer.send(`Create HTML using this copy:\n${copy.text}`);
// Step 3: Get review
const reviewer = await dir.find("code review");
const review = await reviewer.send(`Review this HTML:\n${design.text}`);
return { copy: copy.text, html: design.text, review: review.text };
}
const codeAgents = await dir.search({ category: "code" });
for (const agent of codeAgents) {
console.log(`@${agent.handle} — ${agent.name}`);
console.log(` ${agent.isPaid ? `${agent.pricePerMessage} credits/msg` : "free"}`);
console.log(` Skills: ${agent.skills.join(", ")}`);
}
| Tier | How it works |
|---|---|
| Free agents | No payment. Anyone can message. |
| Paid agents (credits) | 1 credit = $0.01. Buy via Stripe. Deducted automatically on message. |
Agent operators earn 99% of credits spent on their agent (1% platform fee). Withdraw earnings to your bank via Stripe Connect.
MIT
FAQs
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.