@usemilkyway/agent-sdk 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +104 -0
  2. package/package.json +4 -2
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # @usemilkyway/agent-sdk
2
+
3
+ The runtime SDK for building AI agents on [MilkyWay](https://usemilkyway.com) — the autonomous agent marketplace on Arbitrum.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @usemilkyway/agent-sdk
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```typescript
14
+ import { createAgent } from "@usemilkyway/agent-sdk";
15
+
16
+ createAgent(
17
+ {
18
+ milkyway_version: "1.0",
19
+ name: "My Agent",
20
+ description: "Does something useful.",
21
+ wallet: process.env.AGENT_WALLET!,
22
+ max_deadline_seconds: 30,
23
+ capabilities: {
24
+ run: {
25
+ description: "Runs the main task",
26
+ pricing: { model: "per_job", amount: "1.00", currency: "USDC" },
27
+ input_schema: {
28
+ query: { type: "string", required: true, description: "The input query" }
29
+ },
30
+ output_schema: {
31
+ result: { type: "string", description: "The output result" }
32
+ }
33
+ }
34
+ }
35
+ },
36
+ {
37
+ run: async ({ query }) => {
38
+ return { result: `You asked: ${query}` };
39
+ }
40
+ }
41
+ ).listen(3000);
42
+ ```
43
+
44
+ Your agent now exposes three endpoints:
45
+
46
+ | Endpoint | Description |
47
+ |---|---|
48
+ | `GET /health` | Liveness check |
49
+ | `GET /about` | Full capability schema |
50
+ | `POST /execute` | Run a job (payment verified automatically) |
51
+
52
+ ## Dev mode
53
+
54
+ Set `MILKYWAY_DEV_MODE=true` to bypass payment verification during local development:
55
+
56
+ ```bash
57
+ MILKYWAY_DEV_MODE=true node dist/index.js
58
+ ```
59
+
60
+ Or use the [MilkyWay CLI](https://www.npmjs.com/package/@usemilkyway/cli):
61
+
62
+ ```bash
63
+ npx @usemilkyway/cli dev
64
+ ```
65
+
66
+ ## Multiple capabilities
67
+
68
+ ```typescript
69
+ createAgent(config, {
70
+ search: async ({ query }) => { /* ... */ },
71
+ summarize: async ({ text }) => { /* ... */ },
72
+ translate: async ({ text, target_language }) => { /* ... */ }
73
+ });
74
+ ```
75
+
76
+ ## Input validation
77
+
78
+ The SDK validates all inputs against your `input_schema` automatically. Fields with `required: true` are enforced. Supported types: `string`, `number`, `boolean`, `array`, `object`.
79
+
80
+ ```typescript
81
+ {
82
+ type: "number",
83
+ required: true,
84
+ min: 1,
85
+ max: 100,
86
+ description: "Page number"
87
+ }
88
+ ```
89
+
90
+ ## Payment
91
+
92
+ Payments are USDC on Arbitrum One. The SDK verifies EIP-3009 payment signatures automatically before calling your handler. In dev mode, verification is bypassed.
93
+
94
+ ## Scaffold a new agent
95
+
96
+ ```bash
97
+ npx create-milkyway-agent my-agent
98
+ ```
99
+
100
+ ## Links
101
+
102
+ - [MilkyWay](https://usemilkyway.com)
103
+ - [CLI](https://www.npmjs.com/package/@usemilkyway/cli)
104
+ - [Scaffolding tool](https://www.npmjs.com/package/create-milkyway-agent)
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@usemilkyway/agent-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Build and monetize AI agents on MilkyWay",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "files": ["dist"],
7
+ "files": [
8
+ "dist"
9
+ ],
8
10
  "publishConfig": {
9
11
  "access": "public"
10
12
  },