@letta-ai/letta-agent-sdk 0.2.6 → 0.3.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 (86) hide show
  1. package/README.md +71 -333
  2. package/dist/app-server-management.d.ts +26 -0
  3. package/dist/app-server-management.d.ts.map +1 -0
  4. package/dist/app-server-session.d.ts +13 -15
  5. package/dist/app-server-session.d.ts.map +1 -1
  6. package/dist/client-base.d.ts +60 -0
  7. package/dist/client-base.d.ts.map +1 -0
  8. package/dist/client-entry.d.ts +19 -0
  9. package/dist/client-entry.d.ts.map +1 -0
  10. package/dist/client-entry.js +8806 -0
  11. package/dist/client-entry.js.map +25 -0
  12. package/dist/client.d.ts +8 -49
  13. package/dist/client.d.ts.map +1 -1
  14. package/dist/cloud-management.d.ts +23 -0
  15. package/dist/cloud-management.d.ts.map +1 -0
  16. package/dist/cloud-session.d.ts.map +1 -1
  17. package/dist/index.d.ts +3 -3
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +8828 -7020
  20. package/dist/index.js.map +21 -38
  21. package/dist/local-app-server-session.d.ts +4 -0
  22. package/dist/local-app-server-session.d.ts.map +1 -0
  23. package/dist/management-types.d.ts +100 -0
  24. package/dist/management-types.d.ts.map +1 -0
  25. package/dist/management.d.ts +17 -0
  26. package/dist/management.d.ts.map +1 -0
  27. package/dist/remote-client-session-core.d.ts +3 -7
  28. package/dist/remote-client-session-core.d.ts.map +1 -1
  29. package/dist/session.d.ts +3 -1
  30. package/dist/session.d.ts.map +1 -1
  31. package/dist/tests/advanced-session.d.ts +1 -9
  32. package/dist/tests/advanced-session.d.ts.map +1 -1
  33. package/dist/transport.d.ts.map +1 -1
  34. package/dist/types.d.ts +64 -12
  35. package/dist/types.d.ts.map +1 -1
  36. package/dist/websocket.d.ts +9 -0
  37. package/dist/websocket.d.ts.map +1 -0
  38. package/package.json +14 -3
  39. package/dist/dream/agent.d.ts +0 -55
  40. package/dist/dream/agent.d.ts.map +0 -1
  41. package/dist/dream/aggregate.d.ts +0 -38
  42. package/dist/dream/aggregate.d.ts.map +0 -1
  43. package/dist/dream/batching.d.ts +0 -12
  44. package/dist/dream/batching.d.ts.map +0 -1
  45. package/dist/dream/clone.d.ts +0 -14
  46. package/dist/dream/clone.d.ts.map +0 -1
  47. package/dist/dream/cursors.d.ts +0 -7
  48. package/dist/dream/cursors.d.ts.map +0 -1
  49. package/dist/dream/index.d.ts +0 -67
  50. package/dist/dream/index.d.ts.map +0 -1
  51. package/dist/dream/memfs.d.ts +0 -75
  52. package/dist/dream/memfs.d.ts.map +0 -1
  53. package/dist/dream/normalize-core.d.ts +0 -67
  54. package/dist/dream/normalize-core.d.ts.map +0 -1
  55. package/dist/dream/prompts.d.ts +0 -26
  56. package/dist/dream/prompts.d.ts.map +0 -1
  57. package/dist/dream/redact.d.ts +0 -3
  58. package/dist/dream/redact.d.ts.map +0 -1
  59. package/dist/dream/reflect.d.ts +0 -49
  60. package/dist/dream/reflect.d.ts.map +0 -1
  61. package/dist/dream/registry.d.ts +0 -4
  62. package/dist/dream/registry.d.ts.map +0 -1
  63. package/dist/dream/runner.d.ts +0 -30
  64. package/dist/dream/runner.d.ts.map +0 -1
  65. package/dist/dream/sdk-messages.d.ts +0 -4
  66. package/dist/dream/sdk-messages.d.ts.map +0 -1
  67. package/dist/dream/select.d.ts +0 -6
  68. package/dist/dream/select.d.ts.map +0 -1
  69. package/dist/dream/sources/claude-code.d.ts +0 -18
  70. package/dist/dream/sources/claude-code.d.ts.map +0 -1
  71. package/dist/dream/sources/codex.d.ts +0 -20
  72. package/dist/dream/sources/codex.d.ts.map +0 -1
  73. package/dist/dream/sources/letta.d.ts +0 -3
  74. package/dist/dream/sources/letta.d.ts.map +0 -1
  75. package/dist/dream/sources/openhands.d.ts +0 -43
  76. package/dist/dream/sources/openhands.d.ts.map +0 -1
  77. package/dist/dream/sources/transcript-file.d.ts +0 -8
  78. package/dist/dream/sources/transcript-file.d.ts.map +0 -1
  79. package/dist/dream/store-utils.d.ts +0 -21
  80. package/dist/dream/store-utils.d.ts.map +0 -1
  81. package/dist/dream/transcripts.d.ts +0 -27
  82. package/dist/dream/transcripts.d.ts.map +0 -1
  83. package/dist/dream/types.d.ts +0 -48
  84. package/dist/dream/types.d.ts.map +0 -1
  85. package/dist/dream/workers.d.ts +0 -12
  86. package/dist/dream/workers.d.ts.map +0 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@letta-ai/letta-agent-sdk.svg?style=flat-square)](https://www.npmjs.com/package/@letta-ai/letta-agent-sdk) [![Discord](https://img.shields.io/badge/discord-join-blue?style=flat-square&logo=discord)](https://discord.gg/letta)
4
4
 
5
- The SDK interface to [**Letta Code**](https://github.com/letta-ai/letta-code). Build agents with persistent memory that learn over time.
5
+ Build applications with stateful agents powered by the [Letta agent harness](https://www.letta.com/agent). The Agent SDK provides one TypeScript interface for managed, local, and self-hosted deployments.
6
6
 
7
7
  ## Installation
8
8
 
@@ -10,399 +10,137 @@ The SDK interface to [**Letta Code**](https://github.com/letta-ai/letta-code). B
10
10
  npm install @letta-ai/letta-agent-sdk
11
11
  ```
12
12
 
13
- ## Quick start
13
+ Local execution requires Node.js 22.19 or newer.
14
14
 
15
- ### Client creation
15
+ ## Quick start
16
16
 
17
17
  ```ts
18
18
  import { LettaAgentClient } from "@letta-ai/letta-agent-sdk";
19
19
 
20
- // Local: SDK-owned Letta Code app-server over loopback websockets. The SDK
21
- // spawns/manages the app-server process for you.
22
- const localClient = new LettaAgentClient({ backend: "local" });
23
-
24
- // Remote: connect to a user-managed Letta Code app-server over websockets.
25
- const remoteClient = new LettaAgentClient({
26
- backend: "remote",
27
- url: "http://127.0.0.1:4500",
28
- // Required when the app-server is bound to a non-loopback interface with
29
- // --ws-auth capability-token.
30
- authToken: process.env.LETTA_APP_SERVER_TOKEN,
31
- });
32
-
33
- // Constellation: create or resume agents whose state lives in Letta's
34
- // agent cloud, with an SDK-managed sandbox by default.
35
20
  const client = new LettaAgentClient({
36
21
  backend: "cloud",
37
22
  apiKey: process.env.LETTA_API_KEY,
38
23
  });
39
- ```
40
-
41
- ### Persistent agent with multi-turn conversations
42
-
43
- ```ts
44
- import { LettaAgentClient } from "@letta-ai/letta-agent-sdk";
45
-
46
- const client = new LettaAgentClient({ backend: "local" });
47
-
48
- const agentId = await client.createAgent({
49
- persona: "You are a helpful coding assistant for TypeScript projects.",
50
- });
51
-
52
- await using session = client.resumeSession(agentId);
53
-
54
- await session.send("Find and fix the bug in auth.ts");
55
- for await (const msg of session.stream()) {
56
- if (msg.type === "assistant") console.log(msg.content);
57
- }
58
-
59
- await session.send("Add a unit test for the fix");
60
- for await (const msg of session.stream()) {
61
- if (msg.type === "assistant") console.log(msg.content);
62
- }
63
- ```
64
-
65
- Cloud, remote, and local agent sessions can accept another `send()` while a
66
- turn is streaming. The SDK sends the same `input` frame used by Letta Desktop
67
- and the listener owns queueing; `stream()` may surface `queue_update` events
68
- before the current turn's `result`.
69
-
70
- By default, `resumeSession(agentId)` continues the agent’s default conversation.
71
- Use `createSession(agentId)` when you want to start a fresh thread.
72
-
73
- For Constellation agents, omitting `environment` lets the SDK create and manage
74
- a sandbox for the session. `environment` is still session-scoped and can
75
- override the client default when you want to use a specific remote runtime:
76
-
77
- ```ts
78
- await using session = client.resumeSession(agentId, {
79
- environment: { name: "LettaDevelopers" },
80
- });
81
- ```
82
-
83
- The top-level helpers (`createAgent`, `createSession`, `resumeSession`, and
84
- `prompt`) remain available. Local helper calls use Letta Code's default agent
85
- selection when you do not pass an agent ID.
86
-
87
- ### User-managed app-server backend
88
-
89
- Use `backend: "remote"` when you already have a Letta Code app-server running.
90
- The app-server URL selects the execution environment; the SDK uses the same
91
- Letta Code websocket protocol for `runtime_start`, `input`, streaming deltas,
92
- and SDK-defined external tools.
93
-
94
- ```ts
95
- const client = new LettaAgentClient({
96
- backend: "remote",
97
- url: "http://127.0.0.1:4500",
98
- authToken: process.env.LETTA_APP_SERVER_TOKEN,
99
- requestTimeoutMs: 120_000,
100
- });
101
24
 
102
25
  const agentId = await client.createAgent({
103
- model: "anthropic/claude-sonnet-4",
104
- persona: "You are a helpful coding assistant.",
26
+ model: "anthropic/claude-opus-4-8",
27
+ persona: "You are a proactive research assistant.",
28
+ human: "The user prefers concise summaries with sources and next steps.",
105
29
  });
106
30
 
107
31
  await using session = client.createSession(agentId);
108
32
 
109
- await session.send("Summarize this repository.");
110
- for await (const msg of session.stream()) {
111
- if (msg.type === "assistant") console.log(msg.content);
33
+ await session.send("Research the latest project changes and prepare a brief.");
34
+ for await (const message of session.stream()) {
35
+ if (message.type === "assistant") {
36
+ console.log(message.content);
37
+ }
112
38
  }
113
39
  ```
114
40
 
41
+ An agent is the persistent entity with memory. A conversation is a thread on that agent. A session is the active connection used to send messages, stream events, execute tools, and handle approvals.
115
42
 
116
- ### Constellation
43
+ - `createSession(agentId)` starts a new conversation.
44
+ - `resumeSession(conversationId)` resumes a saved conversation.
45
+ - `resumeSession(agentId)` resumes the agent's default conversation.
46
+ - `prompt(message, agentId)` runs a one-shot prompt in a new conversation.
117
47
 
118
- Use `backend: "cloud"` to create or resume agents hosted on Constellation. If
119
- no `environment` is provided, the SDK creates a managed sandbox, waits for it to
120
- come online, and refreshes it while the session is active. Non-default
121
- conversations request a conversation-scoped sandbox from supporting servers;
122
- the default conversation and legacy servers retain the agent-scoped lifecycle.
123
- Managed sandboxes are left for TTL cleanup by default so another session for the
124
- same conversation can reconnect to them.
48
+ Portable sessions also expose the stateful controls needed by interactive
49
+ clients:
125
50
 
126
51
  ```ts
127
- const client = new LettaAgentClient({
128
- backend: "cloud",
129
- apiKey: process.env.LETTA_API_KEY,
130
- sandbox: {
131
- // Optional: defaults to a 5-minute refresh TTL.
132
- ttlMinutes: 5,
133
- // Optional: defaults false. Set true only with exclusive ownership.
134
- terminateOnClose: false,
135
- },
136
- });
137
-
138
- const agentId = await client.createAgent({
139
- model: "anthropic/claude-sonnet-4",
140
- persona: "You are a helpful coding assistant.",
141
- });
142
-
143
- await using session = client.resumeSession(agentId, {
144
- permissionMode: "unrestricted",
52
+ const state = await session.bootstrapState();
53
+ await session.changeDeviceState({
54
+ cwd: "/workspace/project",
55
+ permissionMode: "acceptEdits",
145
56
  });
146
57
 
147
- await session.send("Summarize this repository.");
148
- for await (const msg of session.stream()) {
149
- if (msg.type === "assistant") console.log(msg.content);
58
+ const removed = await session.removeQueuedMessage(queueItemId);
59
+ if (!removed.removed) {
60
+ // Reconcile the authoritative queue before offering the action again.
150
61
  }
151
- ```
152
-
153
- If you pass `cwd` for a Constellation session, use a path that exists inside the
154
- selected remote environment or managed sandbox. Local paths such as
155
- `process.cwd()` are not mapped into managed sandboxes automatically.
156
-
157
- You can still set a default `environment` on the client or override it per
158
- session to use an existing remote runtime instead of an SDK-managed sandbox. Use
159
- the environment name from `letta remote --env-name <name>`:
160
-
161
- ```ts
162
- const client = new LettaAgentClient({
163
- backend: "cloud",
164
- apiKey: process.env.LETTA_API_KEY,
165
- environment: { name: "devbox" },
166
- });
167
62
 
168
- await using session = client.resumeSession(agentId, {
169
- environment: { name: "devbox" },
170
- });
63
+ await session.recoverPendingApprovals();
171
64
  ```
172
65
 
173
- For advanced cases where you want to target a specific remote connection, pass
174
- its `connectionId` instead. Connection IDs are assigned when the remote listener
175
- registers and may change after reconnects:
176
-
177
- ```ts
178
- await using session = client.resumeSession(agentId, {
179
- environment: { connectionId: "conn-123" },
180
- });
181
- ```
66
+ `removeQueuedMessage()` waits for an app-server acknowledgement.
67
+ `changeDeviceState()` currently confirms command transport only because the
68
+ underlying protocol does not acknowledge that mutation.
182
69
 
183
- `environment` also accepts `{ id: "env-..." }` for an environment record or
184
- `{ deviceId: "device-..." }` for a stable device selector.
70
+ ## Deployment options
185
71
 
186
- `environment` and `sandbox` are mutually exclusive. Conversation-scoped
187
- sandboxes refresh and terminate by sandbox ID. Legacy agent-scoped sandboxes
188
- retain the latest-active ownership check. Pass `sandbox.terminateOnClose: true`
189
- to request best-effort eager cleanup, but only when no other session or
190
- reconnecting client needs the sandbox.
72
+ | Backend | Agent state | Tool execution |
73
+ | --- | --- | --- |
74
+ | `cloud` | Letta Cloud | Managed cloud sandbox or a selected computer |
75
+ | `local` | Current computer | Current computer through an SDK-managed App Server |
76
+ | `remote` | Configured by the App Server | A user-managed App Server computer |
191
77
 
192
- If Cloud reaps a conversation-scoped sandbox before the next refresh,
193
- `send()` throws `CloudManagedSandboxExpiredError` before transmitting the turn.
194
- Close the old SDK session and resume the same conversation to create a fresh
195
- connection, then retry safely:
78
+ ### Local
196
79
 
197
80
  ```ts
198
- import {
199
- CloudManagedSandboxExpiredError,
200
- LettaAgentClient,
201
- } from "@letta-ai/letta-agent-sdk";
81
+ const client = new LettaAgentClient({ backend: "local" });
202
82
 
203
- const client = new LettaAgentClient({
204
- backend: "cloud",
205
- apiKey: process.env.LETTA_API_KEY,
83
+ await using session = client.createSession(agentId, {
84
+ cwd: process.cwd(),
206
85
  });
207
- const conversationId = "conv-123";
208
- let session = client.resumeSession(conversationId);
209
-
210
- async function sendWithSandboxRecovery(message: string): Promise<void> {
211
- for (let attempt = 0; attempt < 2; attempt += 1) {
212
- try {
213
- await session.send(message);
214
- for await (const event of session.stream()) {
215
- if (event.type === "assistant") console.log(event.content);
216
- }
217
- return;
218
- } catch (error) {
219
- if (!(error instanceof CloudManagedSandboxExpiredError) || attempt > 0) {
220
- throw error;
221
- }
222
- session.close();
223
- session = client.resumeSession(conversationId);
224
- }
225
- }
226
- }
227
86
  ```
228
87
 
229
- Only retry automatically for this pre-send expiration error. If a connection
230
- fails after `send()` succeeds, inspect conversation history before retrying
231
- because the original message may already have reached the runtime.
232
-
233
- By default, websocket authentication uses `Authorization` headers. Set
234
- `webSocketAuth: "query"` for browser-style websocket clients that cannot send
235
- custom upgrade headers.
236
-
237
- ## Cloud repositories
238
-
239
- Cloud clients can create hosted repositories, manage text files inside them,
240
- and attach repositories to a session as resources. Repository resources are
241
- attached before the session starts and detached when the SDK session closes.
88
+ ### Remote App Server
242
89
 
243
90
  ```ts
244
91
  const client = new LettaAgentClient({
245
- backend: "cloud",
246
- apiKey: process.env.LETTA_API_KEY,
247
- });
248
-
249
- const repo = await client.repositories.create({ name: "inputs" });
250
-
251
- await client.repositories.files.create(repo.id, {
252
- path: "data.csv",
253
- content: csvContent,
254
- });
255
-
256
- await using session = client.createSession(agentId, {
257
- resources: [
258
- { type: "repository", repositoryId: repo.id },
259
- ],
92
+ backend: "remote",
93
+ url: "http://127.0.0.1:4500",
94
+ authToken: process.env.LETTA_APP_SERVER_TOKEN,
260
95
  });
261
-
262
- await session.send("Analyze the files in the attached repository.");
263
96
  ```
264
97
 
265
- Repository file helpers are available under `client.repositories.files`, and
266
- version history helpers are available under `client.repositories.versions`.
98
+ See the [deployment guide](https://docs.letta.com/letta-agent-sdk/deployment) for managed sandboxes, remote computers, App Server setup, and authentication.
267
99
 
268
- ## Session configuration
100
+ ## Browser and React Native
269
101
 
270
- Session options let you set runtime defaults before a session starts, including
271
- `model`, `reasoningEffort`, `cwd`, `permissionMode`, and dreaming triggers. For
272
- remote and Constellation sessions, `cwd` must be a path inside the selected
273
- runtime environment.
102
+ Use the portable `/client` entry point in browser, Expo, and React Native applications. It supports the `cloud` and `remote` backends without importing Node process-management modules.
274
103
 
275
104
  ```ts
276
- import { LettaAgentClient } from "@letta-ai/letta-agent-sdk";
277
-
278
- const client = new LettaAgentClient({ backend: "local" });
105
+ import { LettaAgentClient } from "@letta-ai/letta-agent-sdk/client";
279
106
 
280
- const session = client.resumeSession("agent-123", {
281
- model: "anthropic/claude-sonnet-4",
282
- reasoningEffort: "high",
283
- // For local sessions this may be a local path; for remote/Constellation
284
- // sessions, use a path inside the selected runtime environment.
285
- cwd: "/workspace/project",
286
- permissionMode: "unrestricted",
287
- dreaming: {
288
- trigger: "step-count", // off | step-count | compaction-event
289
- stepCount: 8,
290
- },
107
+ const client = new LettaAgentClient({
108
+ backend: "cloud",
109
+ apiKey: userProvidedApiKey,
110
+ webSocketAuth: "query",
291
111
  });
292
112
  ```
293
113
 
294
- You can also inspect and change models after startup:
114
+ For authenticated Remote App Servers in React Native, pass the platform WebSocket through `createReactNativeWebSocketConstructor()` so capability-token headers use React Native's third constructor argument.
295
115
 
296
- ```ts
297
- const catalog = await session.listModels();
298
- await session.updateModel({ model: "sonnet", reasoningEffort: "medium" });
299
- ```
300
-
301
- Call `await session.abort()` to interrupt the current turn without closing the
302
- session.
116
+ ## Management APIs
303
117
 
304
- For advanced protocol access, use `sendCommand()` with raw Letta Code websocket
305
- protocol commands:
118
+ The client exposes agent, conversation, and Cloud repository management alongside active sessions:
306
119
 
307
120
  ```ts
308
- await session.sendCommand({
309
- type: "change_device_state",
310
- runtime: { agent_id: session.agentId!, conversation_id: session.conversationId! },
311
- payload: { cwd: "/workspace/project" },
312
- });
313
-
314
- const sync = await session.sendCommand(
315
- {
316
- type: "sync",
317
- runtime: { agent_id: session.agentId!, conversation_id: session.conversationId! },
318
- },
319
- { responseType: "sync_response" },
320
- );
321
- ```
322
-
323
- ## Dreaming
324
-
325
- The dreaming API has three explicit components: collect normalized transcript
326
- snapshots, initialize a guarded memory filesystem, then run a dream over the
327
- exact transcript list. Reflection batches edit isolated clones and a final
328
- aggregation pass synthesizes their diffs into the dream agent's MemFS.
329
-
330
- ```typescript
331
- import {
332
- LettaAgentClient,
333
- collectTranscripts,
334
- dream,
335
- initDreamAgent,
336
- } from "@letta-ai/letta-agent-sdk";
337
-
338
- const client = new LettaAgentClient({
339
- backend: "local",
340
- appServer: { harnessBackend: "api" },
121
+ const agents = await client.agents.list({ tags: ["support"] });
122
+ const conversations = await client.conversations.list({
123
+ agentId: agents[0].id,
124
+ orderBy: "lastMessageAt",
125
+ order: "desc",
341
126
  });
342
127
 
343
- // 1. Collect immutable snapshots after an exclusive cutoff. Limits apply per
344
- // source, so this selects the five newest eligible sessions from each store.
345
- const transcripts = await collectTranscripts({
346
- after: "2026-07-01T00:00:00Z",
347
- sources: [
348
- { type: "claude", limit: 5 },
349
- { type: "codex", limit: 5 },
350
- ],
128
+ const repository = await client.repositories.create({ name: "inputs" });
129
+ await client.repositories.files.create(repository.id, {
130
+ path: "brief.md",
131
+ content: "# Project brief\n",
351
132
  });
133
+ ```
352
134
 
353
- // 2. Initialize the complete starting MemFS. Seeded files may be modified but
354
- // not deleted. New files and directories are allowed only below skills/.
355
- const agent = await initDreamAgent(client, {
356
- model: "anthropic/claude-opus-4-8",
357
- memfs: {
358
- directories: ["skills"],
359
- files: {
360
- "system/project/AGENTS.md":
361
- "---\ndescription: Project guidance\n---\n\n# Project guidance\n",
362
- },
363
- },
364
- guard: {
365
- allowedNewFilePrefixes: ["skills"],
366
- },
367
- });
135
+ `client.repositories` is available on the `cloud` backend. See [Cloud repositories](https://docs.letta.com/letta-agent-sdk/repositories) for file operations, version history, and session resources.
368
136
 
369
- // 3. Run against the exact snapshots. The optional prompt is appended to each
370
- // reflection batch, not to the aggregation pass.
371
- const result = await dream({
372
- client,
373
- agentId: agent.agentId,
374
- transcripts,
375
- reflectionPrompt: "Only retain learnings relevant to this project.",
376
- });
377
-
378
- if (result.kind === "completed") {
379
- console.log(result.success, result.runRoot, result.aggregation.report);
380
- }
381
- ```
137
+ ## Documentation
382
138
 
383
- Available transcript sources include `claude`, `codex`, `openhands`, `letta`,
384
- and already-normalized `transcript` files. `after` compares against each
385
- session's end time and is exclusive; `limit` keeps the latest eligible sessions
386
- for that source spec. Use `planOnly: true` to inspect transcript selection and
387
- batch packing without running agents.
388
-
389
- The pre-commit guard is installed on the canonical MemFS and every reflection
390
- clone. The SDK also validates every commit and the final working tree after
391
- each run, so `--no-verify` cannot bypass the policy. For finer control, pass
392
- `guard.allowedOperations` rules for exact or recursive paths. Every run records
393
- batch inputs, output clones, diffs, normalized worker trajectories, reports,
394
- and an immutable final aggregate snapshot under `runRoot`. See
395
- [`examples/dream.ts`](./examples/dream.ts).
396
-
397
- OpenHands conversations retain incremental cursors in the dream agent's SDK
398
- state; later dreams skip records at or before the last successfully reflected
399
- timestamp. Claude and Codex sessions are finite snapshots and remain
400
- cursor-free.
401
-
402
- ## Links
403
-
404
- - Docs: https://docs.letta.com/letta-agent-sdk
405
- - Examples: [`./examples`](./examples)
139
+ - [Overview](https://docs.letta.com/letta-agent-sdk/overview)
140
+ - [Quickstart](https://docs.letta.com/letta-agent-sdk/quickstart)
141
+ - [Deployment](https://docs.letta.com/letta-agent-sdk/deployment)
142
+ - [SDK reference](https://docs.letta.com/letta-agent-sdk/reference)
143
+ - [Examples](./examples)
406
144
 
407
145
  ---
408
146
 
@@ -0,0 +1,26 @@
1
+ import type { ManagementQuery, ManagementTransport } from "./management.js";
2
+ import type { ConversationMessagesResult, LettaAgent, LettaConversation } from "./management-types.js";
3
+ import type { LettaCodeRemoteClientOptions } from "./types.js";
4
+ type OwnedConnection = {
5
+ url: string;
6
+ close(): void;
7
+ };
8
+ export type AppServerManagementOptions = Partial<LettaCodeRemoteClientOptions> & {
9
+ url?: string;
10
+ connect?: () => Promise<OwnedConnection>;
11
+ };
12
+ export declare class AppServerManagementTransport implements ManagementTransport {
13
+ private readonly options;
14
+ constructor(options: AppServerManagementOptions);
15
+ listAgents(query: ManagementQuery): Promise<LettaAgent[]>;
16
+ retrieveAgent(agentId: string): Promise<LettaAgent>;
17
+ updateAgent(agentId: string, body: Record<string, unknown>): Promise<LettaAgent>;
18
+ listConversations(query: ManagementQuery): Promise<LettaConversation[]>;
19
+ retrieveConversation(conversationId: string): Promise<LettaConversation>;
20
+ createConversation(body: Record<string, unknown>): Promise<LettaConversation>;
21
+ updateConversation(conversationId: string, body: Record<string, unknown>): Promise<LettaConversation>;
22
+ listConversationMessages(conversationId: string, query: ManagementQuery): Promise<ConversationMessagesResult>;
23
+ private request;
24
+ }
25
+ export {};
26
+ //# sourceMappingURL=app-server-management.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-server-management.d.ts","sourceRoot":"","sources":["../src/app-server-management.ts"],"names":[],"mappings":"AAMA,OAAO,KAA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,EAAE,MAAM,EACtB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,0BAA0B,CAAC;YAgBxB,OAAO;CA8CtB"}
@@ -7,19 +7,16 @@ type UpdateModelPayload = {
7
7
  };
8
8
  export declare function agentToolNames(agent: Record<string, unknown> | null | undefined): string[] | undefined;
9
9
  export type AppServerSessionOptions = Partial<LettaCodeRemoteClientOptions> & {
10
- /** Base websocket URL. Remote sessions require this; local sessions may omit
11
- * it to spawn an SDK-owned app-server lazily at initialize(). */
10
+ /** Base websocket URL. */
12
11
  url?: string;
13
- /** Spawn a local app-server when url is omitted. */
14
- local?: boolean;
15
- /** Optional backend for SDK-owned local app-server processes. */
16
- localBackend?: string;
17
- /** Optional local app-server listen URL. Defaults to ws://127.0.0.1:0. */
18
- localListen?: string;
19
- /** Timeout for local app-server startup. */
20
- localStartupTimeoutMs?: number;
21
- /** Extra environment variables for SDK-owned local app-server processes. */
22
- localEnv?: Record<string, string | undefined>;
12
+ /**
13
+ * Internal lazy connection hook. The Node entry point uses this to start a
14
+ * local app-server without pulling process-management code into `/client`.
15
+ */
16
+ connect?: (sessionEnv?: Record<string, string>) => Promise<{
17
+ url: string;
18
+ close(): void;
19
+ }>;
23
20
  /** Whether create-agent runtime_start should pin the created agent globally. */
24
21
  pinGlobalAgent?: boolean;
25
22
  /** Whether SDK create-agent payloads should add the origin tag automatically. */
@@ -29,7 +26,7 @@ export type AppServerSessionMode = RuntimeSessionMode;
29
26
  export declare function assertRemoteSessionOptionsSupported(action: string, options: LettaCodeClientSessionOptions): void;
30
27
  export declare function createAgentBody(options: CreateAgentOptions, settings?: {
31
28
  includeSdkOriginTag?: boolean;
32
- }): Record<string, unknown>;
29
+ }): Promise<Record<string, unknown>>;
33
30
  export declare function externalToolGroups(tools: AnyAgentTool[] | undefined): Array<Record<string, unknown>> | undefined;
34
31
  export declare function createExternalToolCallHandler(externalTools: Map<string, AnyAgentTool>): AppServerExternalToolCallHandler;
35
32
  type AppServerApprovalOptions = LettaCodeClientSessionOptions | CreateAgentOptions;
@@ -52,7 +49,8 @@ export declare function registerAppServerControlRequestHandler(config: {
52
49
  export declare class AppServerRuntimeController implements RemoteClientRuntimeController {
53
50
  private readonly client;
54
51
  private readonly options;
55
- constructor(client: AppServerClient, options: AppServerSessionOptions);
52
+ private readonly clientToolAllowlist?;
53
+ constructor(client: AppServerClient, options: AppServerSessionOptions, clientToolAllowlist?: readonly string[] | undefined);
56
54
  onMessage(handler: (message: ProtocolMessage, channel?: string) => void): () => void;
57
55
  send(command: Record<string, unknown>): void;
58
56
  sendTurnMessage(runtime: RuntimeScope, message: SendMessage, options: RuntimeSendTurnOptions): void;
@@ -69,7 +67,7 @@ export declare class AppServerRuntimeController implements RemoteClientRuntimeCo
69
67
  }
70
68
  export declare class AppServerSession extends RemoteClientSessionCore {
71
69
  private readonly remoteOptions;
72
- private ownedAppServer;
70
+ private ownedConnection;
73
71
  private externalTools;
74
72
  private removeExternalToolHandler;
75
73
  private removeControlRequestHandler;
@@ -1 +1 @@
1
- {"version":3,"file":"app-server-session.d.ts","sourceRoot":"","sources":["../src/app-server-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,gCAAgC,EAEtC,MAAM,wCAAwC,CAAC;AAMhD,OAAO,EACL,uBAAuB,EAKvB,KAAK,eAAe,EACpB,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,6BAA6B,EAC7B,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAElB,8BAA8B,EAC9B,6BAA6B,EAC7B,WAAW,EACX,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAoDpB,KAAK,kBAAkB,GAAG;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;I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EAAE,MAAM,EACtB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC;IAwC9B,KAAK,IAAI,IAAI;CAGd;AAED,qBAAa,gBAAiB,SAAQ,uBAAuB;IAOzD,OAAO,CAAC,QAAQ,CAAC,aAAa;IANhC,OAAO,CAAC,eAAe,CAAkC;IACzD,OAAO,CAAC,aAAa,CAAmC;IACxD,OAAO,CAAC,yBAAyB,CAA6B;IAC9D,OAAO,CAAC,2BAA2B,CAA6B;gBAG7C,aAAa,EAAE,uBAAuB,EACvD,IAAI,EAAE,oBAAoB;cAYT,iBAAiB,CAAC,OAAO,EAAE,6BAA6B,GAAG,kBAAkB,GAAG,OAAO;cAKjF,2BAA2B,IAAI,OAAO,CAAC,kBAAkB,CAAC;cA0DhE,WAAW,IAAI,IAAI;YASxB,mBAAmB;YAenB,YAAY;YAMZ,wBAAwB;YAiExB,0BAA0B;CAoBzC"}
@@ -0,0 +1,60 @@
1
+ import { RepositoriesClient } from "./repositories.js";
2
+ import { type ManagementTransport } from "./management.js";
3
+ import type { AgentsClient, ConversationsClient } from "./management-types.js";
4
+ import type { CreateAgentOptions, CreateSessionOptions, LettaCodeBackend, LettaCodeClientOptions, LettaCodeClientSessionOptions, LettaCodeEnvironment, LettaCodeSession, SDKResultMessage, SendMessage } from "./types.js";
5
+ /**
6
+ * Top-level Letta Agent SDK client.
7
+ *
8
+ * `backend` selects how the SDK reaches or runs the Letta Code harness.
9
+ * `local` spawns an SDK-owned Letta Code app-server and speaks the websocket
10
+ * protocol by default, with an explicit stdio fallback for legacy flows.
11
+ * `remote` connects to a user-managed Letta Code app-server websocket endpoint.
12
+ * `cloud` uses agents hosted on Letta Cloud, with an explicit remote
13
+ * environment or SDK-managed sandbox.
14
+ */
15
+ export declare class LettaAgentClientBase {
16
+ readonly backend: LettaCodeBackend;
17
+ readonly environment: LettaCodeEnvironment | undefined;
18
+ readonly agents: AgentsClient;
19
+ readonly conversations: ConversationsClient;
20
+ protected readonly options: LettaCodeClientOptions;
21
+ private repositoriesClient;
22
+ private managementTransport;
23
+ constructor(options?: LettaCodeClientOptions);
24
+ /**
25
+ * Create a new Letta Code agent with a default conversation.
26
+ *
27
+ * Environment/device selection is intentionally not part of the agent payload;
28
+ * it belongs to the client/session execution context.
29
+ */
30
+ get repositories(): RepositoriesClient;
31
+ createAgent(options?: CreateAgentOptions): Promise<string>;
32
+ /**
33
+ * Create a new conversation/session.
34
+ *
35
+ * Without an agent id, this uses the default/LRU agent, matching the legacy
36
+ * top-level createSession() helper.
37
+ */
38
+ createSession(agentIdOrOptions?: string | LettaCodeClientSessionOptions, options?: LettaCodeClientSessionOptions): LettaCodeSession;
39
+ /**
40
+ * Resume an existing agent default conversation or a specific conversation.
41
+ *
42
+ * `options.environment` overrides the client's default execution target for
43
+ * Letta Cloud sessions. Remote app-server URLs already select the runtime.
44
+ */
45
+ resumeSession(id: string, options?: LettaCodeClientSessionOptions): LettaCodeSession;
46
+ /** One-shot prompt convenience helper using a new conversation. */
47
+ prompt(message: SendMessage, agentId?: string, options?: LettaCodeClientSessionOptions): Promise<SDKResultMessage>;
48
+ private assertSessionBackend;
49
+ protected useLegacyLocalStdio(): boolean;
50
+ protected createLocalAgent(_options: CreateAgentOptions): Promise<string>;
51
+ protected createLocalSession(_agentId: string | undefined, _options: LettaCodeClientSessionOptions, _sessionOptions: CreateSessionOptions): LettaCodeSession;
52
+ protected resumeLocalSession(_id: string, _options: LettaCodeClientSessionOptions, _sessionOptions: CreateSessionOptions): LettaCodeSession;
53
+ protected localBackendUnavailableError(): Error;
54
+ protected createLocalManagementTransport(): ManagementTransport;
55
+ private remoteOptions;
56
+ private getRepositoriesClient;
57
+ private getManagementTransport;
58
+ private cloudOptions;
59
+ }
60
+ //# sourceMappingURL=client-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-base.d.ts","sourceRoot":"","sources":["../src/client-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM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