@agentdomain/sdk 0.5.0 → 0.5.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.
Files changed (2) hide show
  1. package/README.md +120 -120
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,120 +1,120 @@
1
- # @agentdomain/sdk
2
-
3
- TypeScript SDK for AgentDomain, the autonomous identity stack for AI agents.
4
-
5
- AgentDomain provides domain, DNS, SSL, email, Basename, ENS, x402 USDC checkout, AgentID NFT, renewal controls, and per-agent Premium Plans.
6
-
7
- Checkout uses x402 v2 on Base mainnet (`eip155:8453`). The SDK parses
8
- `PAYMENT-REQUIRED`, signs the official EVM exact-payment payload, and retries
9
- with `PAYMENT-SIGNATURE`; successful responses include `PAYMENT-RESPONSE`.
10
-
11
- ```bash
12
- npm install @agentdomain/sdk viem
13
- ```
14
-
15
- ```ts
16
- import { AgentDomain } from '@agentdomain/sdk';
17
-
18
- const ad = new AgentDomain({
19
- apiUrl: 'https://agentdomain.app/api/v1',
20
- walletClient,
21
- });
22
-
23
- const quote = await ad.quote({
24
- preferredName: 'research-agent',
25
- tld: 'xyz',
26
- registerBasename: true,
27
- registerEns: false,
28
- emailUsername: 'agent',
29
- premiumPlan: 'pro',
30
- });
31
- ```
32
-
33
- The SDK handles x402 payment challenges for registration, RenewalVault funding, and Premium Plan purchases when a `walletClient` is provided. Email setup, SSL certification, DNS orchestration, and AgentID NFT mint/orchestration are included in the annual platform fee; Basename and ENS remain optional paid add-ons.
34
-
35
- ## Autonomous Premium Plan actions
36
-
37
- An agent can buy or upgrade its Premium Plan autonomously only when its runtime has an owner or delegated wallet signer on Base with enough USDC. An agent-scoped API key is enough for scoped operations like email/DNS, but it cannot sign x402 paid purchases.
38
-
39
- ```ts
40
- const identity = await ad.register({
41
- preferredName: 'research-agent',
42
- tld: 'xyz',
43
- years: 1,
44
- premiumPlan: 'pro',
45
- });
46
-
47
- await ad.purchaseServicePlan({
48
- agentId: identity.agentId,
49
- plan: 'enterprise',
50
- });
51
- ```
52
-
53
- ## Agent-scoped API keys
54
-
55
- API keys are scoped to one agent identity and count against that agent's Premium Plan limit. Create the key from the owner dashboard or with an owner wallet signature, then pass the full key to the agent runtime.
56
-
57
- ```ts
58
- const owner = new AgentDomain({ walletClient });
59
- const key = await owner.createApiKey(agentId, 'Production key');
60
-
61
- const agent = new AgentDomain({
62
- apiKey: key.fullKey,
63
- });
64
-
65
- await agent.sendEmail(agentId, {
66
- to: 'admin@example.com',
67
- fromAddress: 'agent@research-agent.xyz',
68
- subject: 'Status',
69
- text: 'Agent online.',
70
- });
71
-
72
- const inbox = await agent.listEmail(agentId);
73
- await agent.deleteEmailMessage(agentId, inbox.messages[0].id);
74
- ```
75
-
76
- The full key is returned only once. A scoped key can manage only its own agent ID.
77
-
78
- ## Monthly usage, batch send, and inbound webhooks
79
-
80
- All plans combine sent recipients and accepted inbound messages into one monthly
81
- quota. Send up to 100 message objects in one batch request, inspect current
82
- usage, and configure a signed inbound webhook:
83
-
84
- ```ts
85
- await agent.sendEmailBatch(agentId, {
86
- messages: [
87
- { to: 'ops@example.com', subject: 'Status', text: 'Agent online.' },
88
- ],
89
- });
90
-
91
- const usage = await agent.getEmailUsage(agentId);
92
- const webhook = await agent.setEmailWebhook(agentId, {
93
- url: 'https://example.com/webhooks/agentdomain',
94
- payloadMode: 'metadata',
95
- enabled: true,
96
- });
97
- ```
98
-
99
- ## Email addresses
100
-
101
- Every agent gets one editable primary email address. Starter agents can create 5
102
- aliases, Pro agents 10, and Enterprise agents 20.
103
-
104
- ```ts
105
- await ad.updatePrimaryEmail(agentId, 'support');
106
- await ad.createEmailAlias(agentId, 'billing');
107
- await ad.deleteEmailAlias(agentId, 'billing@research-agent.xyz');
108
- ```
109
-
110
- ## Renewal plan selection
111
-
112
- Humans and autonomous agents can select the exact plan charged with the next
113
- identity renewal, including an Enterprise volume tier:
114
-
115
- ```ts
116
- await ad.scheduleServicePlanRenewal(agentId, {
117
- plan: 'enterprise',
118
- planSku: 'enterprise-500000',
119
- });
120
- ```
1
+ # @agentdomain/sdk
2
+
3
+ TypeScript SDK for AgentDomain, the autonomous identity stack for AI agents.
4
+
5
+ AgentDomain provides domain, DNS, SSL, email, Basename, ENS, x402 USDC checkout, AgentID NFT, renewal controls, and per-agent Premium Plans.
6
+
7
+ Checkout uses x402 v2 on Base mainnet (`eip155:8453`). The SDK parses
8
+ `PAYMENT-REQUIRED`, signs the official EVM exact-payment payload, and retries
9
+ with `PAYMENT-SIGNATURE`; successful responses include `PAYMENT-RESPONSE`.
10
+
11
+ ```bash
12
+ npm install @agentdomain/sdk viem
13
+ ```
14
+
15
+ ```ts
16
+ import { AgentDomain } from '@agentdomain/sdk';
17
+
18
+ const ad = new AgentDomain({
19
+ apiUrl: 'https://agentdomain.app/api/v1',
20
+ walletClient,
21
+ });
22
+
23
+ const quote = await ad.quote({
24
+ preferredName: 'research-agent',
25
+ tld: 'xyz',
26
+ registerBasename: true,
27
+ registerEns: false,
28
+ emailUsername: 'agent',
29
+ premiumPlan: 'pro',
30
+ });
31
+ ```
32
+
33
+ The SDK handles x402 payment challenges for registration, RenewalVault funding, and Premium Plan purchases when a `walletClient` is provided. Email setup, SSL certification, DNS orchestration, and AgentID NFT mint/orchestration are included in the annual platform fee; Basename and ENS remain optional paid add-ons.
34
+
35
+ ## Autonomous Premium Plan actions
36
+
37
+ An agent can buy or upgrade its Premium Plan autonomously only when its runtime has an owner or delegated wallet signer on Base with enough USDC. An agent-scoped API key is enough for scoped operations like email/DNS, but it cannot sign x402 paid purchases.
38
+
39
+ ```ts
40
+ const identity = await ad.register({
41
+ preferredName: 'research-agent',
42
+ tld: 'xyz',
43
+ years: 1,
44
+ premiumPlan: 'pro',
45
+ });
46
+
47
+ await ad.purchaseServicePlan({
48
+ agentId: identity.agentId,
49
+ plan: 'enterprise',
50
+ });
51
+ ```
52
+
53
+ ## Agent-scoped API keys
54
+
55
+ API keys are scoped to one agent identity and count against that agent's Premium Plan limit. Create the key from the owner dashboard or with an owner wallet signature, then pass the full key to the agent runtime.
56
+
57
+ ```ts
58
+ const owner = new AgentDomain({ walletClient });
59
+ const key = await owner.createApiKey(agentId, 'Production key');
60
+
61
+ const agent = new AgentDomain({
62
+ apiKey: key.fullKey,
63
+ });
64
+
65
+ await agent.sendEmail(agentId, {
66
+ to: 'admin@example.com',
67
+ fromAddress: 'agent@research-agent.xyz',
68
+ subject: 'Status',
69
+ text: 'Agent online.',
70
+ });
71
+
72
+ const inbox = await agent.listEmail(agentId);
73
+ await agent.deleteEmailMessage(agentId, inbox.messages[0].id);
74
+ ```
75
+
76
+ The full key is returned only once. A scoped key can manage only its own agent ID.
77
+
78
+ ## Monthly usage, batch send, and inbound webhooks
79
+
80
+ All plans combine sent recipients and accepted inbound messages into one monthly
81
+ quota. Send up to 100 message objects in one batch request, inspect current
82
+ usage, and configure a signed inbound webhook:
83
+
84
+ ```ts
85
+ await agent.sendEmailBatch(agentId, {
86
+ messages: [
87
+ { to: 'ops@example.com', subject: 'Status', text: 'Agent online.' },
88
+ ],
89
+ });
90
+
91
+ const usage = await agent.getEmailUsage(agentId);
92
+ const webhook = await agent.setEmailWebhook(agentId, {
93
+ url: 'https://example.com/webhooks/agentdomain',
94
+ payloadMode: 'metadata',
95
+ enabled: true,
96
+ });
97
+ ```
98
+
99
+ ## Email addresses
100
+
101
+ Every agent gets one editable primary email address. Starter agents can create 5
102
+ aliases, Pro agents 10, and Enterprise agents 20.
103
+
104
+ ```ts
105
+ await ad.updatePrimaryEmail(agentId, 'support');
106
+ await ad.createEmailAlias(agentId, 'billing');
107
+ await ad.deleteEmailAlias(agentId, 'billing@research-agent.xyz');
108
+ ```
109
+
110
+ ## Renewal plan selection
111
+
112
+ Humans and autonomous agents can select the exact plan charged with the next
113
+ identity renewal, including an Enterprise volume tier:
114
+
115
+ ```ts
116
+ await ad.scheduleServicePlanRenewal(agentId, {
117
+ plan: 'enterprise',
118
+ planSku: 'enterprise-500000',
119
+ });
120
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentdomain/sdk",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "AgentDomain SDK for AI agents - domain registration, management, and x402 payments",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/0xmdrakib/AgentDomain.git",
@@ -28,7 +28,7 @@
28
28
  "@x402/evm": "2.21.0",
29
29
  "viem": "^2.55.2",
30
30
  "zod": "^3.24.1",
31
- "@agentdomain/shared": "^0.5.0"
31
+ "@agentdomain/shared": "^0.5.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "typescript": "^5.7.2"