agentmail-toolkit 0.4.2 → 0.5.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.
- package/README.md +56 -2
- package/dist/ai-sdk.cjs +407 -93
- package/dist/ai-sdk.cjs.map +1 -1
- package/dist/ai-sdk.d.cts +1 -1
- package/dist/ai-sdk.d.ts +1 -1
- package/dist/ai-sdk.js +11 -3
- package/dist/ai-sdk.js.map +1 -1
- package/dist/chunk-YW6YZ3LD.js +940 -0
- package/dist/chunk-YW6YZ3LD.js.map +1 -0
- package/dist/clawdbot.cjs +404 -83
- package/dist/clawdbot.cjs.map +1 -1
- package/dist/clawdbot.d.cts +1 -1
- package/dist/clawdbot.d.ts +1 -1
- package/dist/clawdbot.js +12 -7
- package/dist/clawdbot.js.map +1 -1
- package/dist/index.cjs +401 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/langchain.cjs +403 -99
- package/dist/langchain.cjs.map +1 -1
- package/dist/langchain.d.cts +1 -1
- package/dist/langchain.d.ts +1 -1
- package/dist/langchain.js +16 -7
- package/dist/langchain.js.map +1 -1
- package/dist/mcp.cjs +438 -94
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +2 -1
- package/dist/mcp.d.ts +2 -1
- package/dist/mcp.js +28 -8
- package/dist/mcp.js.map +1 -1
- package/dist/toolkit-CAJg3QL3.d.cts +29 -0
- package/dist/toolkit-CAJg3QL3.d.ts +29 -0
- package/package.json +10 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AgentMail Toolkit
|
|
2
2
|
|
|
3
|
-
The AgentMail Toolkit integrates popular agent frameworks and protocols
|
|
3
|
+
The AgentMail Toolkit integrates the AgentMail API with popular agent frameworks and protocols: the Model Context Protocol (MCP), the Vercel AI SDK, LangChain, and clawdbot. A framework-agnostic generic export is also available.
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
@@ -18,7 +18,11 @@ npm install agentmail-toolkit
|
|
|
18
18
|
export AGENTMAIL_API_KEY=your-api-key
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Each framework has its own subpath export. All tools share the same input/output schemas and descriptions - only the wrapping and error-signaling convention differs per framework, matching that framework's own idioms.
|
|
24
|
+
|
|
25
|
+
### Vercel AI SDK (`agentmail-toolkit/ai-sdk`)
|
|
22
26
|
|
|
23
27
|
```typescript
|
|
24
28
|
import { openai } from '@ai-sdk/openai'
|
|
@@ -32,3 +36,53 @@ const result = streamText({
|
|
|
32
36
|
tools: new AgentMailToolkit().getTools(),
|
|
33
37
|
})
|
|
34
38
|
```
|
|
39
|
+
|
|
40
|
+
A failed tool call throws, which the AI SDK surfaces as a distinct `tool-error` part rather than a successful result.
|
|
41
|
+
|
|
42
|
+
### MCP (`agentmail-toolkit/mcp`)
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
46
|
+
import { AgentMailToolkit } from 'agentmail-toolkit/mcp'
|
|
47
|
+
|
|
48
|
+
const server = new McpServer({ name: 'agentmail', version: '1.0.0' })
|
|
49
|
+
for (const tool of new AgentMailToolkit().getTools()) {
|
|
50
|
+
server.registerTool(tool.name, tool, tool.callback)
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Every tool declares an `outputSchema` and returns matching `structuredContent` alongside a JSON-stringified text block on success. On error, the result carries `isError: true` and an actionable text message instead of structured content.
|
|
55
|
+
|
|
56
|
+
### LangChain (`agentmail-toolkit/langchain`)
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { AgentMailToolkit } from 'agentmail-toolkit/langchain'
|
|
60
|
+
import { createAgent } from 'langchain'
|
|
61
|
+
|
|
62
|
+
const agent = createAgent({
|
|
63
|
+
model: 'openai:gpt-4o',
|
|
64
|
+
tools: new AgentMailToolkit().getTools(),
|
|
65
|
+
})
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
A failed tool call throws, which LangChain propagates as a rejected tool run instead of a JSON-stringified success value.
|
|
69
|
+
|
|
70
|
+
### clawdbot (`agentmail-toolkit/clawdbot`)
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { AgentMailToolkit } from 'agentmail-toolkit/clawdbot'
|
|
74
|
+
|
|
75
|
+
const tools = new AgentMailToolkit().getTools()
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
A failed tool call throws; clawdbot's agent loop catches it and marks the tool result as errored.
|
|
79
|
+
|
|
80
|
+
### Generic (`agentmail-toolkit`)
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { AgentMailToolkit } from 'agentmail-toolkit'
|
|
84
|
+
|
|
85
|
+
const tools = new AgentMailToolkit().getTools()
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Exposes each tool's `name`, `description`, `paramsSchema`, `outputSchema`, and a `func` for frameworks not covered above. A failed call throws a concise `Error` rather than the AgentMail SDK's raw, unbounded error dump.
|