@agenttool/sdk 0.1.0 → 0.2.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 +206 -18
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,32 +1,220 @@
1
- # agenttool
1
+ # @agenttool/sdk · TypeScript
2
2
 
3
- TypeScript SDK for [agenttool.dev](https://agenttool.dev) memory and tools for AI agents.
3
+ > Persistent memory, verified actions, and tool access for AI agents — one API key.
4
4
 
5
+ [![npm](https://img.shields.io/npm/v/@agenttool/sdk)](https://www.npmjs.com/package/@agenttool/sdk)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue)](https://www.typescriptlang.org/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
8
+
9
+ ```bash
10
+ npm install @agenttool/sdk
11
+ # or
12
+ bun add @agenttool/sdk
13
+ ```
14
+
15
+ ## What is this?
16
+
17
+ AgentTool gives AI agents the infrastructure they need to operate reliably:
18
+
19
+ | Service | What it does |
20
+ |---------|-------------|
21
+ | **agent-memory** | Persistent semantic memory — store facts, retrieve by similarity |
22
+ | **agent-tools** | Web search, page scraping, code execution |
23
+ | **agent-verify** | SHA-256 proof-of-work attestations with timestamps |
24
+ | **agent-economy** | Wallets, credits, agent-to-agent billing |
25
+
26
+ All four services, one API key, one SDK.
27
+
28
+ ## Quick start (60 seconds)
29
+
30
+ **1. Get your API key** — create a free project at [app.agenttool.dev](https://app.agenttool.dev)
31
+
32
+ **2. Set your key:**
5
33
  ```bash
6
- npm install agenttool
34
+ export AT_API_KEY=at_your_key_here
7
35
  ```
8
36
 
37
+ **3. Store and retrieve a memory:**
9
38
  ```typescript
10
- import { AgentTool } from "agenttool";
39
+ import { AgentTool } from "@agenttool/sdk";
11
40
 
12
41
  const at = new AgentTool(); // reads AT_API_KEY from env
13
42
 
14
- // Memory
15
- await at.memory.store("learned something new");
16
- const results = await at.memory.search("what did I learn?");
17
- const mem = await at.memory.get("mem-id");
18
- const usage = await at.memory.usage();
43
+ // Store a memory
44
+ const memory = await at.memory.store({
45
+ content: "The user prefers dark mode and concise responses",
46
+ agentId: "my-assistant",
47
+ tags: ["preference", "ui"],
48
+ });
49
+
50
+ // Retrieve it later (semantic search)
51
+ const results = await at.memory.search({
52
+ query: "what does the user prefer?",
53
+ limit: 5,
54
+ });
55
+
56
+ for (const result of results) {
57
+ console.log(`${result.score.toFixed(2)} ${result.content}`);
58
+ }
59
+ ```
60
+
61
+ ## Usage
62
+
63
+ ### Memory
64
+
65
+ ```typescript
66
+ import { AgentTool } from "@agenttool/sdk";
67
+
68
+ const at = new AgentTool({ apiKey: "at_..." }); // or use AT_API_KEY env var
69
+
70
+ // Store
71
+ const mem = await at.memory.store({
72
+ content: "User is based in London, timezone Europe/London",
73
+ });
74
+
75
+ // Search (semantic)
76
+ const results = await at.memory.search({ query: "where is the user?" });
77
+
78
+ // Retrieve by ID
79
+ const mem2 = await at.memory.get("mem_...");
80
+
81
+ // Delete
82
+ await at.memory.delete("mem_...");
83
+ ```
84
+
85
+ ### Tools
86
+
87
+ ```typescript
88
+ // Web search
89
+ const results = await at.tools.search({ query: "latest papers on RAG", numResults: 5 });
90
+ for (const r of results) {
91
+ console.log(r.title, r.url);
92
+ }
93
+
94
+ // Scrape a page
95
+ const page = await at.tools.scrape({ url: "https://example.com" });
96
+ console.log(page.text);
97
+
98
+ // Execute code
99
+ const output = await at.tools.execute({ code: "console.log(Math.PI)" });
100
+ console.log(output.stdout);
101
+ ```
102
+
103
+ ### Verify
104
+
105
+ ```typescript
106
+ // Create an attestation
107
+ const proof = await at.verify.create({
108
+ action: "task_completed",
109
+ agentId: "my-agent",
110
+ payload: { task: "data_analysis", rowsProcessed: 1500 },
111
+ });
112
+ console.log(proof.attestationId, proof.hash);
113
+
114
+ // Verify an attestation
115
+ const result = await at.verify.check("att_...");
116
+ console.log(result.valid); // true
117
+ ```
118
+
119
+ ### Economy
120
+
121
+ ```typescript
122
+ // Create a wallet
123
+ const wallet = await at.economy.createWallet({ name: "agent-wallet" });
124
+
125
+ // Check balance
126
+ const { balance } = await at.economy.getBalance(wallet.id);
127
+
128
+ // Transfer credits
129
+ await at.economy.transfer({
130
+ fromWallet: wallet.id,
131
+ toWallet: "wlt_...",
132
+ amount: 10,
133
+ memo: "payment for search service",
134
+ });
135
+ ```
136
+
137
+ ## Integration example — Vercel AI SDK
19
138
 
20
- // Tools
21
- const hits = await at.tools.search("latest AI news");
22
- const page = await at.tools.scrape("https://example.com");
23
- const out = await at.tools.execute("print(1 + 1)");
139
+ ```typescript
140
+ import { AgentTool } from "@agenttool/sdk";
141
+ import { tool } from "ai";
142
+ import { z } from "zod";
24
143
 
25
- // Verify
26
- const v = await at.verify.check("The Earth is round");
144
+ const at = new AgentTool();
27
145
 
28
- // Economy
29
- const wallet = await at.economy.createWallet({ name: "my-wallet" });
146
+ export const memoryTools = {
147
+ remember: tool({
148
+ description: "Store a memory for later retrieval",
149
+ parameters: z.object({ content: z.string() }),
150
+ execute: async ({ content }) => {
151
+ const mem = await at.memory.store({ content, agentId: "vercel-ai-agent" });
152
+ return { id: mem.id, stored: true };
153
+ },
154
+ }),
155
+ recall: tool({
156
+ description: "Search past memories by semantic similarity",
157
+ parameters: z.object({ query: z.string() }),
158
+ execute: async ({ query }) => {
159
+ const results = await at.memory.search({ query, limit: 5 });
160
+ return results.map((r) => ({ content: r.content, score: r.score }));
161
+ },
162
+ }),
163
+ };
30
164
  ```
31
165
 
32
- Set your key: `export AT_API_KEY=your-key-here`
166
+ ## Integration example any agent loop
167
+
168
+ ```typescript
169
+ import { AgentTool } from "@agenttool/sdk";
170
+
171
+ const at = new AgentTool();
172
+
173
+ async function agentLoop(userMessage: string): Promise<string> {
174
+ // Recall relevant memories
175
+ const memories = await at.memory.search({ query: userMessage, limit: 5 });
176
+ const context = memories.map((m) => m.content).join("\n");
177
+
178
+ // Call your LLM with context
179
+ const response = await yourLLM(`Context:\n${context}\n\nUser: ${userMessage}`);
180
+
181
+ // Store the exchange
182
+ await at.memory.store({ content: `User: ${userMessage}\nAgent: ${response}` });
183
+
184
+ return response;
185
+ }
186
+ ```
187
+
188
+ ## Free tier
189
+
190
+ | Resource | Free | Seed ($29/mo) | Grow ($99/mo) |
191
+ |----------|------|----------------|----------------|
192
+ | Memory ops/day | 100 | 10,000 | 100,000 |
193
+ | Tool calls/day | 10 | 500 | 5,000 |
194
+ | Verifications/day | 5 | 100 | 1,000 |
195
+
196
+ [Upgrade at app.agenttool.dev/billing](https://app.agenttool.dev/billing)
197
+
198
+ ## Configuration
199
+
200
+ ```typescript
201
+ import { AgentTool } from "@agenttool/sdk";
202
+
203
+ const at = new AgentTool({
204
+ apiKey: "at_...", // default: AT_API_KEY env var
205
+ baseUrl: "https://api.agenttool.dev", // default
206
+ timeout: 30_000, // ms, default 30s
207
+ });
208
+ ```
209
+
210
+ ## Links
211
+
212
+ - 🏠 [agenttool.dev](https://agenttool.dev)
213
+ - 📖 [docs.agenttool.dev](https://docs.agenttool.dev)
214
+ - 🎛️ [app.agenttool.dev](https://app.agenttool.dev) — dashboard + API key
215
+ - 📦 [npm](https://www.npmjs.com/package/@agenttool/sdk)
216
+ - 🐍 [Python SDK](https://github.com/cambridgetcg/agenttool-sdk-py)
217
+
218
+ ## License
219
+
220
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenttool/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "TypeScript SDK for agenttool.dev — memory and tools for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",