You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!--
Welcome to contributing to AI SDK! We're excited to see your changes.
We suggest you read the following contributing guide we've created
before submitting:
https://github.com/vercel/ai/blob/main/CONTRIBUTING.md
-->
## Background
<!-- Why was this change necessary? -->
* We updated our provider to be AI SDK v5 compatible
## Summary
<!-- What did you change? -->
* Updated Letta provider doc
`content/providers/03-community-providers/71-letta.mdx`
## Checklist
<!--
Do not edit this list. Leave items unchecked that don't apply. If you
need to track subtasks, create a new "## Tasks" section
Please check if the PR fulfills the following requirements:
-->
- [ ] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [ ] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [X] Formatting issues have been fixed (run `pnpm prettier-fix` in the
project root)
- [X] I have reviewed this pull request (self-review)
---------
Co-authored-by: Nico Albanese <49612682+nicoalbanese@users.noreply.github.com>
Co-authored-by: nicoalbanese <gcalbanese96@gmail.com>
description: 'Learn how to use the Letta AI SDK provider for the AI SDK.'
2
+
title: Letta
3
+
description: Learn how to use the Letta provider with the AI SDK.
4
4
---
5
5
6
6
# Letta Provider
7
7
8
-
<Notetype="warning">
9
-
This community provider is not yet compatible with AI SDK 5. Please wait for
10
-
the provider to be updated or consider using an [AI SDK 5 compatible
11
-
provider](/providers/ai-sdk-providers).
12
-
</Note>
8
+
The [Letta AI SDK provider](https://github.com/letta-ai/vercel-ai-sdk-provider) allows you to use Letta agents with the AI SDK.
13
9
14
-
The [Letta AI-SDK provider](https://github.com/letta-ai/vercel-ai-sdk-provider) is the official provider for the [Letta](https://docs.letta.com) platform. It allows you to integrate Letta's AI capabilities into your applications using the Vercel AI SDK.
10
+
Features include:
11
+
12
+
- Persistent and long-term memory
13
+
- Access to both agent-level and model-level reasoning messages with source attribution
14
+
- Support for custom agent-configured tools and MCP (Model Context Protocol)
15
+
- Agent-managed filesystem operations with tool-based file access
16
+
- Built-in utilities to convert between Letta and AI SDK message formats
17
+
-[Every Letta Send Message API feature](https://docs.letta.com/api-reference/agents/messages/create-stream), like [Long-Running Agent Executions](https://docs.letta.com/guides/agents/long-running)
18
+
19
+
## Supported Models
20
+
21
+
See the [Letta documentation](https://docs.letta.com/connecting-model-providers/supported-models) for the complete list of supported models. For models not on the list, you can try configuring Letta to use [OpenAI proxy](https://docs.letta.com/guides/server/providers/openai-proxy).
15
22
16
23
## Setup
17
24
18
-
The Letta provider is available in the `@letta-ai/vercel-ai-sdk-provider` module. You can install it with:
25
+
You can install the Letta provider with:
19
26
20
27
<Tabsitems={['pnpm', 'npm', 'yarn', 'bun']}>
21
28
<Tab>
@@ -34,62 +41,147 @@ The Letta provider is available in the `@letta-ai/vercel-ai-sdk-provider` module
34
41
35
42
## Provider Instance
36
43
37
-
You can import the default provider instance `letta` from `@letta-ai/vercel-ai-sdk-provider`:
44
+
You can import the provider instance `lettaCloud` or `lettaLocal` from `@letta-ai/vercel-ai-sdk-provider`:
-`background` (`boolean`): Enable background execution for long-running operations
126
+
- Additional parameters available in the [Letta API documentation](https://docs.letta.com/api-reference/agents/messages/create-stream)
127
+
128
+
#### Timeout Configuration
129
+
130
+
**Type:**`number`
131
+
132
+
**Default:**`1000`
133
+
134
+
Set the maximum wait time (in seconds) for agent responses. This is important for long-running agent operations or when working with complex reasoning chains.
135
+
136
+
```typescript
137
+
const result =streamText({
138
+
model: lettaCloud(),
139
+
providerOptions: {
140
+
letta: {
141
+
agent: { id: 'your-agent-id' },
142
+
timeoutInSeconds: 300, // Wait up to 5 minutes
143
+
},
144
+
},
145
+
prompt: 'Process this complex task...',
84
146
});
147
+
```
85
148
86
-
const { text } =awaitgenerateText({
87
-
model: letta('your_agent_id'),
88
-
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
149
+
## Custom Tools and MCP
150
+
151
+
Letta agents support custom tools and MCP (Model Context Protocol) servers through provider-executed tools. Once [ configured on your Letta agent ](https://docs.letta.com/guides/agents/custom-tools), you can include them in your requests using `letta.tool()` and Letta handles tool execution.
// Optionally provide description and schema (placeholders only - execution handled by Letta)
168
+
typed_query: lettaCloud.tool('typed_query', {
169
+
description: 'Query with typed parameters',
170
+
inputSchema: z.object({
171
+
query: z.string(),
172
+
}),
173
+
}),
174
+
},
175
+
providerOptions: {
176
+
letta: {
177
+
agent: { id: agentId },
178
+
},
179
+
},
180
+
prompt: 'Tell me a story about a robot learning to paint',
89
181
});
90
182
```
91
183
92
-
###Using other Letta Client Functions
184
+
## Using other Letta Client Functions
93
185
94
186
The `vercel-ai-sdk-provider` extends the [@letta-ai/letta-client](https://www.npmjs.com/package/@letta-ai/letta-client), you can access the operations directly by using `lettaCloud.client` or `lettaLocal.client` or your custom generated `letta.client`
0 commit comments