@sardis/sdk 0.2.0

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 (146) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/LICENSE +21 -0
  3. package/README.md +439 -0
  4. package/dist/browser/index.js +7049 -0
  5. package/dist/browser/index.js.map +1 -0
  6. package/dist/browser/sardis.umd.js +7071 -0
  7. package/dist/browser/sardis.umd.js.map +1 -0
  8. package/dist/cjs/client.js +644 -0
  9. package/dist/cjs/client.js.map +1 -0
  10. package/dist/cjs/demo.js +699 -0
  11. package/dist/cjs/demo.js.map +1 -0
  12. package/dist/cjs/errors.js +630 -0
  13. package/dist/cjs/errors.js.map +1 -0
  14. package/dist/cjs/index.js +131 -0
  15. package/dist/cjs/index.js.map +1 -0
  16. package/dist/cjs/integrations/index.js +21 -0
  17. package/dist/cjs/integrations/index.js.map +1 -0
  18. package/dist/cjs/integrations/langchain.js +339 -0
  19. package/dist/cjs/integrations/langchain.js.map +1 -0
  20. package/dist/cjs/integrations/openai.js +505 -0
  21. package/dist/cjs/integrations/openai.js.map +1 -0
  22. package/dist/cjs/integrations/vercel-ai.js +198 -0
  23. package/dist/cjs/integrations/vercel-ai.js.map +1 -0
  24. package/dist/cjs/resources/a2a.js +158 -0
  25. package/dist/cjs/resources/a2a.js.map +1 -0
  26. package/dist/cjs/resources/agents.js +142 -0
  27. package/dist/cjs/resources/agents.js.map +1 -0
  28. package/dist/cjs/resources/base.js +124 -0
  29. package/dist/cjs/resources/base.js.map +1 -0
  30. package/dist/cjs/resources/cards.js +43 -0
  31. package/dist/cjs/resources/cards.js.map +1 -0
  32. package/dist/cjs/resources/holds.js +64 -0
  33. package/dist/cjs/resources/holds.js.map +1 -0
  34. package/dist/cjs/resources/index.js +31 -0
  35. package/dist/cjs/resources/index.js.map +1 -0
  36. package/dist/cjs/resources/ledger.js +43 -0
  37. package/dist/cjs/resources/ledger.js.map +1 -0
  38. package/dist/cjs/resources/marketplace.js +88 -0
  39. package/dist/cjs/resources/marketplace.js.map +1 -0
  40. package/dist/cjs/resources/payments.js +33 -0
  41. package/dist/cjs/resources/payments.js.map +1 -0
  42. package/dist/cjs/resources/policies.js +31 -0
  43. package/dist/cjs/resources/policies.js.map +1 -0
  44. package/dist/cjs/resources/transactions.js +37 -0
  45. package/dist/cjs/resources/transactions.js.map +1 -0
  46. package/dist/cjs/resources/ucp.js +133 -0
  47. package/dist/cjs/resources/ucp.js.map +1 -0
  48. package/dist/cjs/resources/wallets.js +109 -0
  49. package/dist/cjs/resources/wallets.js.map +1 -0
  50. package/dist/cjs/resources/webhooks.js +81 -0
  51. package/dist/cjs/resources/webhooks.js.map +1 -0
  52. package/dist/cjs/types.js +11 -0
  53. package/dist/cjs/types.js.map +1 -0
  54. package/dist/client.d.ts +419 -0
  55. package/dist/client.d.ts.map +1 -0
  56. package/dist/client.js +637 -0
  57. package/dist/client.js.map +1 -0
  58. package/dist/demo.d.ts +335 -0
  59. package/dist/demo.d.ts.map +1 -0
  60. package/dist/demo.js +694 -0
  61. package/dist/demo.js.map +1 -0
  62. package/dist/errors.d.ts +522 -0
  63. package/dist/errors.d.ts.map +1 -0
  64. package/dist/errors.js +612 -0
  65. package/dist/errors.js.map +1 -0
  66. package/dist/index.d.ts +83 -0
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/index.js +85 -0
  69. package/dist/index.js.map +1 -0
  70. package/dist/integrations/index.d.ts +4 -0
  71. package/dist/integrations/index.d.ts.map +1 -0
  72. package/dist/integrations/index.js +5 -0
  73. package/dist/integrations/index.js.map +1 -0
  74. package/dist/integrations/langchain.d.ts +68 -0
  75. package/dist/integrations/langchain.d.ts.map +1 -0
  76. package/dist/integrations/langchain.js +335 -0
  77. package/dist/integrations/langchain.js.map +1 -0
  78. package/dist/integrations/openai.d.ts +97 -0
  79. package/dist/integrations/openai.d.ts.map +1 -0
  80. package/dist/integrations/openai.js +467 -0
  81. package/dist/integrations/openai.js.map +1 -0
  82. package/dist/integrations/vercel-ai.d.ts +180 -0
  83. package/dist/integrations/vercel-ai.d.ts.map +1 -0
  84. package/dist/integrations/vercel-ai.js +194 -0
  85. package/dist/integrations/vercel-ai.js.map +1 -0
  86. package/dist/resources/a2a.d.ts +254 -0
  87. package/dist/resources/a2a.d.ts.map +1 -0
  88. package/dist/resources/a2a.js +154 -0
  89. package/dist/resources/a2a.js.map +1 -0
  90. package/dist/resources/agents.d.ts +111 -0
  91. package/dist/resources/agents.d.ts.map +1 -0
  92. package/dist/resources/agents.js +138 -0
  93. package/dist/resources/agents.js.map +1 -0
  94. package/dist/resources/base.d.ts +115 -0
  95. package/dist/resources/base.d.ts.map +1 -0
  96. package/dist/resources/base.js +120 -0
  97. package/dist/resources/base.js.map +1 -0
  98. package/dist/resources/cards.d.ts +19 -0
  99. package/dist/resources/cards.d.ts.map +1 -0
  100. package/dist/resources/cards.js +39 -0
  101. package/dist/resources/cards.js.map +1 -0
  102. package/dist/resources/holds.d.ts +44 -0
  103. package/dist/resources/holds.d.ts.map +1 -0
  104. package/dist/resources/holds.js +60 -0
  105. package/dist/resources/holds.js.map +1 -0
  106. package/dist/resources/index.d.ts +16 -0
  107. package/dist/resources/index.d.ts.map +1 -0
  108. package/dist/resources/index.js +16 -0
  109. package/dist/resources/index.js.map +1 -0
  110. package/dist/resources/ledger.d.ts +38 -0
  111. package/dist/resources/ledger.d.ts.map +1 -0
  112. package/dist/resources/ledger.js +39 -0
  113. package/dist/resources/ledger.js.map +1 -0
  114. package/dist/resources/marketplace.d.ts +60 -0
  115. package/dist/resources/marketplace.d.ts.map +1 -0
  116. package/dist/resources/marketplace.js +84 -0
  117. package/dist/resources/marketplace.js.map +1 -0
  118. package/dist/resources/payments.d.ts +24 -0
  119. package/dist/resources/payments.d.ts.map +1 -0
  120. package/dist/resources/payments.js +29 -0
  121. package/dist/resources/payments.js.map +1 -0
  122. package/dist/resources/policies.d.ts +23 -0
  123. package/dist/resources/policies.d.ts.map +1 -0
  124. package/dist/resources/policies.js +27 -0
  125. package/dist/resources/policies.js.map +1 -0
  126. package/dist/resources/transactions.d.ts +32 -0
  127. package/dist/resources/transactions.d.ts.map +1 -0
  128. package/dist/resources/transactions.js +33 -0
  129. package/dist/resources/transactions.js.map +1 -0
  130. package/dist/resources/ucp.d.ts +218 -0
  131. package/dist/resources/ucp.d.ts.map +1 -0
  132. package/dist/resources/ucp.js +129 -0
  133. package/dist/resources/ucp.js.map +1 -0
  134. package/dist/resources/wallets.d.ts +71 -0
  135. package/dist/resources/wallets.d.ts.map +1 -0
  136. package/dist/resources/wallets.js +105 -0
  137. package/dist/resources/wallets.js.map +1 -0
  138. package/dist/resources/webhooks.d.ts +57 -0
  139. package/dist/resources/webhooks.d.ts.map +1 -0
  140. package/dist/resources/webhooks.js +77 -0
  141. package/dist/resources/webhooks.js.map +1 -0
  142. package/dist/types.d.ts +1045 -0
  143. package/dist/types.d.ts.map +1 -0
  144. package/dist/types.js +10 -0
  145. package/dist/types.js.map +1 -0
  146. package/package.json +114 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.0] - 2025-01-27
9
+
10
+ ### Added
11
+
12
+ - Full TypeScript SDK for Sardis stablecoin execution layer
13
+ - `SardisClient` class with comprehensive API coverage
14
+ - Payment execution with mandate support (AP2 bundles)
15
+ - Pre-authorization holds (create, capture, void, extend)
16
+ - Webhook management for real-time events
17
+ - Agent-to-Agent (A2A) marketplace integration
18
+ - Transaction gas estimation and status tracking
19
+ - Ledger queries and entry verification
20
+ - Agent management with spending policies
21
+ - Wallet management with MPC provider support
22
+ - Framework integrations:
23
+ - LangChain.js toolkit
24
+ - Vercel AI SDK tools
25
+ - OpenAI function calling
26
+
27
+ ### Features
28
+
29
+ - ESM, CommonJS, and browser bundle support
30
+ - Full TypeScript type definitions
31
+ - Typed error classes for precise error handling
32
+ - Retry logic with exponential backoff
33
+ - Request/response logging support
34
+ - Multi-chain support (Base, Polygon, Ethereum, Arbitrum, Optimism)
35
+ - Multi-token support (USDC, USDT, PYUSD, EURC)
36
+
37
+ ## [0.1.0] - 2025-01-15
38
+
39
+ ### Added
40
+
41
+ - Initial release
42
+ - Basic client implementation
43
+ - Payment execution support
44
+ - Wallet management
45
+
46
+ [0.2.0]: https://github.com/sardis-network/sardis-sdk-js/compare/v0.1.0...v0.2.0
47
+ [0.1.0]: https://github.com/sardis-network/sardis-sdk-js/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sardis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,439 @@
1
+ # Sardis TypeScript SDK
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@sardis/sdk.svg)](https://www.npmjs.com/package/@sardis/sdk)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@sardis/sdk.svg)](https://www.npmjs.com/package/@sardis/sdk)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
7
+
8
+ The official TypeScript SDK for the Sardis stablecoin execution layer. Enables AI agents to execute programmable payments using stablecoins across multiple chains.
9
+
10
+ ## Table of Contents
11
+
12
+ - [Installation](#installation)
13
+ - [Quick Start](#quick-start)
14
+ - [Features](#features)
15
+ - [Error Handling](#error-handling)
16
+ - [Configuration](#configuration)
17
+ - [Agents](#agents)
18
+ - [Wallets](#wallets)
19
+ - [Supported Chains](#supported-chains)
20
+ - [Supported Tokens](#supported-tokens)
21
+ - [TypeScript Support](#typescript-support)
22
+ - [Framework Integrations](#framework-integrations)
23
+ - [Browser Usage](#browser-usage)
24
+ - [Contributing](#contributing)
25
+ - [License](#license)
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ npm install @sardis/sdk
31
+ # or
32
+ yarn add @sardis/sdk
33
+ # or
34
+ pnpm add @sardis/sdk
35
+ ```
36
+
37
+ ## Quick Start
38
+
39
+ ```typescript
40
+ import { SardisClient } from '@sardis/sdk';
41
+
42
+ const client = new SardisClient({
43
+ apiKey: 'your-api-key',
44
+ });
45
+
46
+ // Check API health
47
+ const health = await client.health();
48
+ console.log(`API Status: ${health.status}`);
49
+
50
+ // Execute a payment mandate
51
+ const result = await client.payments.executeMandate({
52
+ mandate_id: 'mandate_123',
53
+ subject: 'wallet_abc',
54
+ destination: '0x...',
55
+ amount_minor: 10000000, // $10.00 USDC (6 decimals)
56
+ token: 'USDC',
57
+ chain: 'base',
58
+ });
59
+ console.log(`Payment executed: ${result.tx_hash}`);
60
+ ```
61
+
62
+ ## Features
63
+
64
+ ### Payments
65
+
66
+ Execute single mandates or full AP2 payment bundles:
67
+
68
+ ```typescript
69
+ // Execute AP2 bundle (Intent → Cart → Payment)
70
+ const result = await client.payments.executeAP2(
71
+ intentMandate,
72
+ cartMandate,
73
+ paymentMandate
74
+ );
75
+ ```
76
+
77
+ ### Holds (Pre-Authorization)
78
+
79
+ Create, capture, and void pre-authorization holds:
80
+
81
+ ```typescript
82
+ // Create a hold
83
+ const hold = await client.holds.create({
84
+ wallet_id: 'wallet_123',
85
+ amount: '100.00',
86
+ token: 'USDC',
87
+ merchant_id: 'merchant_456',
88
+ duration_hours: 24,
89
+ });
90
+
91
+ // Capture the hold (complete payment)
92
+ const captured = await client.holds.capture(hold.hold_id, '95.00');
93
+
94
+ // Or void the hold (cancel)
95
+ await client.holds.void(hold.hold_id);
96
+ ```
97
+
98
+ ### Webhooks
99
+
100
+ Manage webhook subscriptions for real-time events:
101
+
102
+ ```typescript
103
+ // Create a webhook subscription
104
+ const webhook = await client.webhooks.create({
105
+ url: 'https://your-server.com/webhooks',
106
+ events: ['payment.completed', 'hold.captured'],
107
+ });
108
+
109
+ // List deliveries
110
+ const deliveries = await client.webhooks.listDeliveries(webhook.id);
111
+ ```
112
+
113
+ ### Marketplace (A2A)
114
+
115
+ Discover and interact with agent-to-agent services:
116
+
117
+ ```typescript
118
+ // List available services
119
+ const services = await client.marketplace.listServices({
120
+ category: 'ai',
121
+ });
122
+
123
+ // Create an offer
124
+ const offer = await client.marketplace.createOffer({
125
+ service_id: 'service_123',
126
+ consumer_agent_id: 'agent_456',
127
+ total_amount: '50.00',
128
+ });
129
+
130
+ // Accept an offer (as provider)
131
+ await client.marketplace.acceptOffer(offer.id);
132
+ ```
133
+
134
+ ### Transactions
135
+
136
+ Get gas estimates and transaction status:
137
+
138
+ ```typescript
139
+ // Estimate gas
140
+ const estimate = await client.transactions.estimateGas({
141
+ chain: 'base',
142
+ to_address: '0x...',
143
+ amount: '100.00',
144
+ token: 'USDC',
145
+ });
146
+ console.log(`Estimated cost: ${estimate.estimated_cost_wei} wei`);
147
+
148
+ // Check transaction status
149
+ const status = await client.transactions.getStatus('0x...', 'base');
150
+ ```
151
+
152
+ ### Ledger
153
+
154
+ Query the append-only ledger:
155
+
156
+ ```typescript
157
+ // List ledger entries
158
+ const entries = await client.ledger.listEntries({ wallet_id: 'wallet_123' });
159
+
160
+ // Verify an entry
161
+ const verification = await client.ledger.verifyEntry('tx_123');
162
+ ```
163
+
164
+ ## Error Handling
165
+
166
+ The SDK provides typed exceptions for common error cases:
167
+
168
+ ```typescript
169
+ import {
170
+ SardisError,
171
+ APIError,
172
+ AuthenticationError,
173
+ RateLimitError,
174
+ InsufficientBalanceError,
175
+ } from '@sardis/sdk';
176
+
177
+ try {
178
+ const result = await client.payments.executeMandate(mandate);
179
+ } catch (error) {
180
+ if (error instanceof AuthenticationError) {
181
+ console.error('Invalid API key');
182
+ } else if (error instanceof RateLimitError) {
183
+ console.error(`Rate limited, retry after ${error.retryAfter} seconds`);
184
+ } else if (error instanceof InsufficientBalanceError) {
185
+ console.error(`Need ${error.required} ${error.currency}, have ${error.available}`);
186
+ } else if (error instanceof APIError) {
187
+ console.error(`API error [${error.code}]: ${error.message}`);
188
+ }
189
+ }
190
+ ```
191
+
192
+ ## Configuration
193
+
194
+ ```typescript
195
+ const client = new SardisClient({
196
+ baseUrl: 'https://api.sardis.network', // API base URL (optional)
197
+ apiKey: 'sk_live_...', // Your API key (required)
198
+ timeout: 30000, // Request timeout in ms (optional)
199
+ maxRetries: 3, // Max retry attempts (optional)
200
+ });
201
+ ```
202
+
203
+ ## Agents
204
+
205
+ Create and manage AI agents with spending policies:
206
+
207
+ ```typescript
208
+ // Create an agent
209
+ const agent = await client.agents.create({
210
+ name: 'Invoice Processing Agent',
211
+ description: 'Processes invoices and pays vendors',
212
+ spending_limits: {
213
+ per_transaction: '500.00',
214
+ daily: '5000.00',
215
+ monthly: '50000.00',
216
+ },
217
+ policy: {
218
+ blocked_categories: ['gambling', 'adult'],
219
+ approval_threshold: '1000.00',
220
+ },
221
+ });
222
+
223
+ // Update spending limits
224
+ await client.agents.update(agent.id, {
225
+ spending_limits: { daily: '10000.00' },
226
+ });
227
+
228
+ // List agents
229
+ const agents = await client.agents.list({ is_active: true, limit: 50 });
230
+ ```
231
+
232
+ ## Wallets
233
+
234
+ Manage non-custodial MPC wallets:
235
+
236
+ ```typescript
237
+ // Create a wallet for an agent
238
+ const wallet = await client.wallets.create({
239
+ agent_id: agent.id,
240
+ mpc_provider: 'turnkey', // or 'fireblocks'
241
+ limit_per_tx: '500.00',
242
+ limit_total: '10000.00',
243
+ });
244
+
245
+ // Get wallet balance (read from chain)
246
+ const balance = await client.wallets.getBalance(wallet.id, 'base', 'USDC');
247
+ console.log(`Balance: ${balance.balance} USDC`);
248
+
249
+ // Set chain address
250
+ await client.wallets.setAddress(wallet.id, 'base', '0x...');
251
+ ```
252
+
253
+ ## Policies (Natural Language → Deterministic Enforcement)
254
+
255
+ LLMs help **write** policies, but Sardis uses deterministic code to **enforce** them.
256
+
257
+ ```typescript
258
+ // Preview what the system understood (human-in-the-loop)
259
+ const preview = await client.policies.preview(
260
+ "Max $100 per transaction, block gambling",
261
+ "agent_demo_001"
262
+ );
263
+ console.log(preview.parsed);
264
+
265
+ // Apply policy to agent
266
+ const applied = await client.policies.apply(
267
+ "Max $100 per transaction, block gambling",
268
+ "agent_demo_001"
269
+ );
270
+ console.log(applied.policy_id);
271
+ ```
272
+
273
+ ## Cards (Virtual Cards + Simulated Purchase Demo)
274
+
275
+ ```typescript
276
+ // Issue a virtual card (Lithic-backed)
277
+ const card = await client.cards.issue({
278
+ wallet_id: wallet.id,
279
+ limit_per_tx: "100.00",
280
+ });
281
+
282
+ // Simulate a purchase (e.g. gambling MCC -> policy deny + optional auto-freeze)
283
+ const result = await client.cards.simulatePurchase(card.card_id, {
284
+ amount: "25.00",
285
+ currency: "USD",
286
+ merchant_name: "Demo Casino",
287
+ mcc_code: "7995",
288
+ });
289
+ console.log(result.policy, result.transaction);
290
+
291
+ // Show card transactions
292
+ const txs = await client.cards.transactions(card.card_id, 20);
293
+ console.log(txs.length);
294
+ ```
295
+
296
+ ## Stablecoin Transfers (Agent is Sender)
297
+
298
+ This is intended to be called by an agent process using an API key:
299
+
300
+ ```typescript
301
+ const tx = await client.wallets.transfer(wallet.id, {
302
+ destination: "0x000000000000000000000000000000000000dEaD",
303
+ amount: "1.00",
304
+ token: "USDC",
305
+ chain: "base_sepolia",
306
+ domain: "localhost",
307
+ memo: "demo stablecoin transfer",
308
+ });
309
+ console.log(tx.tx_hash);
310
+ ```
311
+
312
+ ## Supported Chains
313
+
314
+ | Chain | Mainnet | Testnet |
315
+ |-------|---------|---------|
316
+ | Base | `base` | `base_sepolia` |
317
+ | Polygon | `polygon` | `polygon_amoy` |
318
+ | Ethereum | `ethereum` | `ethereum_sepolia` |
319
+ | Arbitrum | `arbitrum` | `arbitrum_sepolia` |
320
+ | Optimism | `optimism` | `optimism_sepolia` |
321
+
322
+ > **Note:** Solana support is planned but not yet implemented.
323
+
324
+ ## Supported Tokens
325
+
326
+ - **USDC** - USD Coin (Circle)
327
+ - **USDT** - Tether USD
328
+ - **PYUSD** - PayPal USD
329
+ - **EURC** - Euro Coin (Circle)
330
+
331
+ ## TypeScript Support
332
+
333
+ This SDK is written in TypeScript and provides full type definitions for all API responses.
334
+
335
+ ```typescript
336
+ import type {
337
+ Chain,
338
+ Token,
339
+ MPCProvider,
340
+ Payment,
341
+ Hold,
342
+ Webhook,
343
+ Service,
344
+ GasEstimate,
345
+ Agent,
346
+ Wallet,
347
+ WalletBalance,
348
+ } from '@sardis/sdk';
349
+
350
+ // Type-safe chain selection
351
+ const chain: Chain = 'base';
352
+ const token: Token = 'USDC';
353
+ ```
354
+
355
+ ## Framework Integrations
356
+
357
+ ### LangChain.js
358
+
359
+ ```typescript
360
+ import { SardisToolkit } from '@sardis/sdk/integrations/langchain';
361
+
362
+ const toolkit = new SardisToolkit({ client });
363
+ const tools = toolkit.getTools();
364
+
365
+ // Use with LangChain agent
366
+ const agent = createOpenAIFunctionsAgent({ llm, tools, prompt });
367
+ ```
368
+
369
+ ### Vercel AI SDK
370
+
371
+ ```typescript
372
+ import { sardisTools } from '@sardis/sdk/integrations/vercel-ai';
373
+
374
+ const tools = sardisTools(client);
375
+
376
+ // Use with Vercel AI
377
+ const { text } = await generateText({
378
+ model: openai('gpt-4'),
379
+ tools,
380
+ messages,
381
+ });
382
+ ```
383
+
384
+ ### OpenAI Function Calling
385
+
386
+ ```typescript
387
+ import { sardisFunctions, handleSardisCall } from '@sardis/sdk/integrations/openai';
388
+
389
+ // Get function definitions
390
+ const functions = sardisFunctions(client);
391
+
392
+ // Handle function calls
393
+ const result = await handleSardisCall(client, functionName, args);
394
+ ```
395
+
396
+ ## Browser Usage
397
+
398
+ The SDK includes a browser-optimized bundle:
399
+
400
+ ```html
401
+ <!-- Via CDN -->
402
+ <script src="https://unpkg.com/@sardis/sdk@latest/dist/browser/sardis.umd.min.js"></script>
403
+ <script>
404
+ const client = new Sardis.SardisClient({
405
+ apiKey: 'your-api-key',
406
+ });
407
+ </script>
408
+ ```
409
+
410
+ Or import the browser bundle directly:
411
+
412
+ ```typescript
413
+ import { SardisClient } from '@sardis/sdk/browser';
414
+ ```
415
+
416
+ ## Requirements
417
+
418
+ - Node.js 18.0.0 or higher
419
+ - TypeScript 4.7+ (optional, for type definitions)
420
+
421
+ ## Contributing
422
+
423
+ We welcome contributions! Please see our [Contributing Guide](https://github.com/sardis-network/sardis-sdk-js/blob/main/CONTRIBUTING.md) for details.
424
+
425
+ 1. Fork the repository
426
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
427
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
428
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
429
+ 5. Open a Pull Request
430
+
431
+ ## Support
432
+
433
+ - [Documentation](https://docs.sardis.network)
434
+ - [GitHub Issues](https://github.com/sardis-network/sardis-sdk-js/issues)
435
+ - [Discord Community](https://discord.gg/sardis)
436
+
437
+ ## License
438
+
439
+ MIT - see [LICENSE](./LICENSE) for details.