Skip to content

Commit 71e3d6a

Browse files
authored
feat: extract core fns from cli to use-agently-sdk (#65)
* feat: initial use-agently-sdk * update use-agently cli to use sdk * fix a2a + balance in sdk * fix client and config * fix mcp * fix test timeout * resolve comments * use tsdown for sdk bundler * resolve comments + duplicate testing * fix typing * fix types + tests * inject clientFetch to all commands * fix for npm publish
1 parent c4c2c89 commit 71e3d6a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1946
-495
lines changed

bun.lock

Lines changed: 172 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
},
2525
"devDependencies": {
2626
"@types/bun": "^1.3.9",
27+
"@types/node": "^25.4.0",
2728
"husky": "^9.1.7",
2829
"lint-staged": "^16.2.7",
2930
"prettier": "^3.8.1",

packages/localhost-aixyz/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"version": "0.0.0",
44
"private": true,
55
"type": "module",
6+
"exports": {
7+
"./test": "./test.ts"
8+
},
69
"scripts": {
710
"dev": "aixyz dev",
811
"test": "bun test"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

packages/use-agently-sdk/README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# @use-agently/sdk
2+
3+
Core SDK for the [Agently](https://use-agently.com) platform — wallet management, A2A (Agent-to-Agent) protocol, MCP (Model Context Protocol), and x402 payments.
4+
5+
## Install
6+
7+
```bash
8+
npm install @use-agently/sdk
9+
```
10+
11+
or
12+
13+
```bash
14+
bun install @use-agently/sdk
15+
```
16+
17+
## A2A (Agent-to-Agent)
18+
19+
```ts
20+
import { getA2ACard } from "@use-agently/sdk";
21+
22+
// Fetch an agent's A2A card
23+
const card = await getA2ACard("https://use-agently.com/echo-agent/");
24+
```
25+
26+
```ts
27+
import { sendA2AMessage } from "@use-agently/sdk";
28+
29+
// Send a message (dry-run by default — no payment)
30+
const result = await sendA2AMessage("https://use-agently.com/echo-agent/", "Hello!");
31+
console.log(result.text);
32+
```
33+
34+
## MCP (Model Context Protocol)
35+
36+
```ts
37+
import { listMcpTools } from "@use-agently/sdk";
38+
39+
// List tools on an MCP server
40+
const tools = await listMcpTools("https://use-agently.com/echo-agent/");
41+
```
42+
43+
```ts
44+
import { callMcpTool } from "@use-agently/sdk";
45+
46+
// Call an MCP tool
47+
const output = await callMcpTool("https://use-agently.com/echo-agent/", "echo", { message: "hi" });
48+
```
49+
50+
## Wallet & Payments
51+
52+
```ts
53+
import { generateEvmPrivateKeyConfig, loadWallet } from "@use-agently/sdk";
54+
55+
const config = generateEvmPrivateKeyConfig();
56+
const wallet = loadWallet(config);
57+
console.log(wallet.address);
58+
59+
// Send a message with real payment
60+
const result = await sendA2AMessage("https://use-agently.com/echo-agent/", "Hello!", {
61+
transaction: PayTransaction(wallet),
62+
});
63+
```
64+
65+
## Marketplace Discovery
66+
67+
```ts
68+
import { fetchAgents, searchAgents } from "@use-agently/sdk";
69+
70+
const agents = await fetchAgents();
71+
const a2aAgents = await searchAgents({ query: "echo", protocols: ["a2a"] });
72+
```
73+
74+
```ts
75+
import { resolveErc8004Agent } from "@use-agently/sdk";
76+
77+
const agent = await resolveErc8004Agent("eip155:8453/erc-8004:0x1234/1");
78+
```
79+
80+
## License
81+
82+
MIT
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "@use-agently/sdk",
3+
"version": "0.0.0",
4+
"description": "Core SDK for the Agently platform — wallet management, A2A, MCP, x402 payments",
5+
"homepage": "https://github.com/AgentlyHQ/use-agently/tree/main/packages/use-agently-sdk",
6+
"bugs": {
7+
"url": "https://github.com/AgentlyHQ/use-agently/issues"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/AgentlyHQ/use-agently.git",
12+
"directory": "packages/use-agently-sdk"
13+
},
14+
"license": "MIT",
15+
"author": "AgentlyHQ",
16+
"type": "module",
17+
"exports": {
18+
".": {
19+
"types": "./build/index.d.ts",
20+
"bun": "./src/index.ts",
21+
"default": "./build/index.js"
22+
}
23+
},
24+
"files": [
25+
"build",
26+
"README.md"
27+
],
28+
"scripts": {
29+
"build": "tsdown",
30+
"clean": "rm -rf build",
31+
"test": "bun test"
32+
},
33+
"dependencies": {
34+
"@a2a-js/sdk": "^0.3.10",
35+
"@modelcontextprotocol/sdk": "^1.27.1",
36+
"@x402/evm": "^2.5.0",
37+
"@x402/fetch": "^2.5.0",
38+
"@x402/mcp": "^2.5.0",
39+
"viem": "^2.46.3",
40+
"zod": "^4"
41+
},
42+
"devDependencies": {
43+
"@types/bun": "^1.3.9",
44+
"localhost-aixyz": "^0",
45+
"testcontainers": "^11",
46+
"tsdown": "^0.21.1",
47+
"x402-fl": "^0"
48+
},
49+
"engines": {
50+
"node": ">=20"
51+
}
52+
}

0 commit comments

Comments
 (0)