@letta-ai/letta-client 1.6.3 → 1.6.5

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 (75) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/client.d.mts +3 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/agents/messages.d.mts +19 -3
  12. package/resources/agents/messages.d.mts.map +1 -1
  13. package/resources/agents/messages.d.ts +19 -3
  14. package/resources/agents/messages.d.ts.map +1 -1
  15. package/resources/agents/messages.js +10 -3
  16. package/resources/agents/messages.js.map +1 -1
  17. package/resources/agents/messages.mjs +10 -3
  18. package/resources/agents/messages.mjs.map +1 -1
  19. package/resources/conversations/conversations.d.mts +96 -0
  20. package/resources/conversations/conversations.d.mts.map +1 -0
  21. package/resources/conversations/conversations.d.ts +96 -0
  22. package/resources/conversations/conversations.d.ts.map +1 -0
  23. package/resources/conversations/conversations.js +37 -0
  24. package/resources/conversations/conversations.js.map +1 -0
  25. package/resources/conversations/conversations.mjs +32 -0
  26. package/resources/conversations/conversations.mjs.map +1 -0
  27. package/resources/conversations/index.d.mts +3 -0
  28. package/resources/conversations/index.d.mts.map +1 -0
  29. package/resources/conversations/index.d.ts +3 -0
  30. package/resources/conversations/index.d.ts.map +1 -0
  31. package/resources/conversations/index.js +9 -0
  32. package/resources/conversations/index.js.map +1 -0
  33. package/resources/conversations/index.mjs +4 -0
  34. package/resources/conversations/index.mjs.map +1 -0
  35. package/resources/conversations/messages.d.mts +198 -0
  36. package/resources/conversations/messages.d.mts.map +1 -0
  37. package/resources/conversations/messages.d.ts +198 -0
  38. package/resources/conversations/messages.d.ts.map +1 -0
  39. package/resources/conversations/messages.js +46 -0
  40. package/resources/conversations/messages.js.map +1 -0
  41. package/resources/conversations/messages.mjs +42 -0
  42. package/resources/conversations/messages.mjs.map +1 -0
  43. package/resources/conversations.d.mts +2 -0
  44. package/resources/conversations.d.mts.map +1 -0
  45. package/resources/conversations.d.ts +2 -0
  46. package/resources/conversations.d.ts.map +1 -0
  47. package/resources/conversations.js +6 -0
  48. package/resources/conversations.js.map +1 -0
  49. package/resources/conversations.mjs +3 -0
  50. package/resources/conversations.mjs.map +1 -0
  51. package/resources/index.d.mts +1 -0
  52. package/resources/index.d.mts.map +1 -1
  53. package/resources/index.d.ts +1 -0
  54. package/resources/index.d.ts.map +1 -1
  55. package/resources/index.js +3 -1
  56. package/resources/index.js.map +1 -1
  57. package/resources/index.mjs +1 -0
  58. package/resources/index.mjs.map +1 -1
  59. package/resources/messages.d.mts +8 -0
  60. package/resources/messages.d.mts.map +1 -1
  61. package/resources/messages.d.ts +8 -0
  62. package/resources/messages.d.ts.map +1 -1
  63. package/src/client.ts +19 -0
  64. package/src/resources/agents/messages.ts +21 -3
  65. package/src/resources/conversations/conversations.ts +148 -0
  66. package/src/resources/conversations/index.ts +18 -0
  67. package/src/resources/conversations/messages.ts +277 -0
  68. package/src/resources/conversations.ts +3 -0
  69. package/src/resources/index.ts +8 -0
  70. package/src/resources/messages.ts +10 -0
  71. package/src/version.ts +1 -1
  72. package/version.d.mts +1 -1
  73. package/version.d.ts +1 -1
  74. package/version.js +1 -1
  75. package/version.mjs +1 -1
@@ -0,0 +1,277 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as AgentsAPI from '../agents/agents';
5
+ import * as MessagesAPI from '../agents/messages';
6
+ import { APIPromise } from '../../core/api-promise';
7
+ import { Stream } from '../../core/streaming';
8
+ import { RequestOptions } from '../../internal/request-options';
9
+ import { path } from '../../internal/utils/path';
10
+
11
+ export class Messages extends APIResource {
12
+ /**
13
+ * Send a message to a conversation and get a streaming response.
14
+ *
15
+ * This endpoint sends a message to an existing conversation and streams the
16
+ * agent's response back.
17
+ */
18
+ create(
19
+ conversationID: string,
20
+ body: MessageCreateParams,
21
+ options?: RequestOptions,
22
+ ): APIPromise<Stream<MessagesAPI.LettaStreamingResponse>> {
23
+ return this._client.post(path`/v1/conversations/${conversationID}/messages`, {
24
+ body,
25
+ ...options,
26
+ stream: true,
27
+ }) as APIPromise<Stream<MessagesAPI.LettaStreamingResponse>>;
28
+ }
29
+
30
+ /**
31
+ * List all messages in a conversation.
32
+ *
33
+ * Returns LettaMessage objects (UserMessage, AssistantMessage, etc.) for all
34
+ * messages in the conversation, ordered by position (oldest first), with support
35
+ * for cursor-based pagination.
36
+ */
37
+ list(
38
+ conversationID: string,
39
+ query: MessageListParams | null | undefined = {},
40
+ options?: RequestOptions,
41
+ ): APIPromise<MessageListResponse> {
42
+ return this._client.get(path`/v1/conversations/${conversationID}/messages`, { query, ...options });
43
+ }
44
+
45
+ /**
46
+ * Resume the stream for the most recent active run in a conversation.
47
+ *
48
+ * This endpoint allows you to reconnect to an active background stream for a
49
+ * conversation, enabling recovery from network interruptions.
50
+ */
51
+ stream(
52
+ conversationID: string,
53
+ body: MessageStreamParams | undefined = {},
54
+ options?: RequestOptions,
55
+ ): APIPromise<Stream<MessagesAPI.LettaStreamingResponse>> {
56
+ return this._client.post(path`/v1/conversations/${conversationID}/stream`, {
57
+ body,
58
+ ...options,
59
+ stream: true,
60
+ }) as APIPromise<Stream<MessagesAPI.LettaStreamingResponse>>;
61
+ }
62
+ }
63
+
64
+ export type MessageListResponse = Array<MessagesAPI.Message>;
65
+
66
+ export type MessageStreamResponse = unknown;
67
+
68
+ export interface MessageCreateParams {
69
+ /**
70
+ * @deprecated The name of the message argument in the designated message tool.
71
+ * Still supported for legacy agent types, but deprecated for letta_v1_agent
72
+ * onward.
73
+ */
74
+ assistant_message_tool_kwarg?: string;
75
+
76
+ /**
77
+ * @deprecated The name of the designated message tool. Still supported for legacy
78
+ * agent types, but deprecated for letta_v1_agent onward.
79
+ */
80
+ assistant_message_tool_name?: string;
81
+
82
+ /**
83
+ * Whether to process the request in the background (only used when
84
+ * streaming=true).
85
+ */
86
+ background?: boolean;
87
+
88
+ /**
89
+ * Client-side tools that the agent can call. When the agent calls a client-side
90
+ * tool, execution pauses and returns control to the client to execute the tool and
91
+ * provide the result via a ToolReturn.
92
+ */
93
+ client_tools?: Array<MessageCreateParams.ClientTool> | null;
94
+
95
+ /**
96
+ * @deprecated If set to True, enables reasoning before responses or tool calls
97
+ * from the agent.
98
+ */
99
+ enable_thinking?: string;
100
+
101
+ /**
102
+ * Whether to include periodic keepalive ping messages in the stream to prevent
103
+ * connection timeouts (only used when streaming=true).
104
+ */
105
+ include_pings?: boolean;
106
+
107
+ /**
108
+ * Only return specified message types in the response. If `None` (default) returns
109
+ * all messages.
110
+ */
111
+ include_return_message_types?: Array<MessagesAPI.MessageType> | null;
112
+
113
+ /**
114
+ * Syntactic sugar for a single user message. Equivalent to messages=[{'role':
115
+ * 'user', 'content': input}].
116
+ */
117
+ input?:
118
+ | string
119
+ | Array<
120
+ | MessagesAPI.TextContent
121
+ | MessagesAPI.ImageContent
122
+ | MessagesAPI.ToolCallContent
123
+ | MessagesAPI.ToolReturnContent
124
+ | MessagesAPI.ReasoningContent
125
+ | MessagesAPI.RedactedReasoningContent
126
+ | MessagesAPI.OmittedReasoningContent
127
+ | MessageCreateParams.SummarizedReasoningContent
128
+ >
129
+ | null;
130
+
131
+ /**
132
+ * Maximum number of steps the agent should take to process the request.
133
+ */
134
+ max_steps?: number;
135
+
136
+ /**
137
+ * The messages to be sent to the agent.
138
+ */
139
+ messages?: Array<AgentsAPI.MessageCreate | MessagesAPI.ApprovalCreate> | null;
140
+
141
+ /**
142
+ * Flag to determine if individual tokens should be streamed, rather than streaming
143
+ * per step (only used when streaming=true).
144
+ */
145
+ stream_tokens?: boolean;
146
+
147
+ /**
148
+ * If True, returns a streaming response (Server-Sent Events). If False (default),
149
+ * returns a complete response.
150
+ */
151
+ streaming?: boolean;
152
+
153
+ /**
154
+ * @deprecated Whether the server should parse specific tool call arguments
155
+ * (default `send_message`) as `AssistantMessage` objects. Still supported for
156
+ * legacy agent types, but deprecated for letta_v1_agent onward.
157
+ */
158
+ use_assistant_message?: boolean;
159
+ }
160
+
161
+ export namespace MessageCreateParams {
162
+ /**
163
+ * Schema for a client-side tool passed in the request.
164
+ *
165
+ * Client-side tools are executed by the client, not the server. When the agent
166
+ * calls a client-side tool, execution pauses and returns control to the client to
167
+ * execute the tool and provide the result.
168
+ */
169
+ export interface ClientTool {
170
+ /**
171
+ * The name of the tool function
172
+ */
173
+ name: string;
174
+
175
+ /**
176
+ * Description of what the tool does
177
+ */
178
+ description?: string | null;
179
+
180
+ /**
181
+ * JSON Schema for the function parameters
182
+ */
183
+ parameters?: { [key: string]: unknown } | null;
184
+ }
185
+
186
+ /**
187
+ * The style of reasoning content returned by the OpenAI Responses API
188
+ */
189
+ export interface SummarizedReasoningContent {
190
+ /**
191
+ * The unique identifier for this reasoning step.
192
+ */
193
+ id: string;
194
+
195
+ /**
196
+ * Summaries of the reasoning content.
197
+ */
198
+ summary: Array<SummarizedReasoningContent.Summary>;
199
+
200
+ /**
201
+ * The encrypted reasoning content.
202
+ */
203
+ encrypted_content?: string;
204
+
205
+ /**
206
+ * Indicates this is a summarized reasoning step.
207
+ */
208
+ type?: 'summarized_reasoning';
209
+ }
210
+
211
+ export namespace SummarizedReasoningContent {
212
+ export interface Summary {
213
+ /**
214
+ * The index of the summary part.
215
+ */
216
+ index: number;
217
+
218
+ /**
219
+ * The text of the summary part.
220
+ */
221
+ text: string;
222
+ }
223
+ }
224
+ }
225
+
226
+ export interface MessageListParams {
227
+ /**
228
+ * Message ID cursor for pagination. Returns messages that come after this message
229
+ * ID in the conversation
230
+ */
231
+ after?: string | null;
232
+
233
+ /**
234
+ * Message ID cursor for pagination. Returns messages that come before this message
235
+ * ID in the conversation
236
+ */
237
+ before?: string | null;
238
+
239
+ /**
240
+ * Maximum number of messages to return
241
+ */
242
+ limit?: number | null;
243
+ }
244
+
245
+ export interface MessageStreamParams {
246
+ /**
247
+ * Number of entries to read per batch.
248
+ */
249
+ batch_size?: number | null;
250
+
251
+ /**
252
+ * Whether to include periodic keepalive ping messages in the stream to prevent
253
+ * connection timeouts.
254
+ */
255
+ include_pings?: boolean | null;
256
+
257
+ /**
258
+ * Seconds to wait between polls when no new data.
259
+ */
260
+ poll_interval?: number | null;
261
+
262
+ /**
263
+ * Sequence id to use as a cursor for pagination. Response will start streaming
264
+ * after this chunk sequence id
265
+ */
266
+ starting_after?: number;
267
+ }
268
+
269
+ export declare namespace Messages {
270
+ export {
271
+ type MessageListResponse as MessageListResponse,
272
+ type MessageStreamResponse as MessageStreamResponse,
273
+ type MessageCreateParams as MessageCreateParams,
274
+ type MessageListParams as MessageListParams,
275
+ type MessageStreamParams as MessageStreamParams,
276
+ };
277
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './conversations/index';
@@ -76,6 +76,14 @@ export {
76
76
  type BlockListParams,
77
77
  type BlockResponsesArrayPage,
78
78
  } from './blocks/blocks';
79
+ export {
80
+ Conversations,
81
+ type Conversation,
82
+ type CreateConversation,
83
+ type ConversationListResponse,
84
+ type ConversationCreateParams,
85
+ type ConversationListParams,
86
+ } from './conversations/conversations';
79
87
  export {
80
88
  Folders,
81
89
  type Folder,
@@ -33,6 +33,11 @@ export interface MessageSearchRequest {
33
33
  */
34
34
  query: string;
35
35
 
36
+ /**
37
+ * Filter messages by agent ID
38
+ */
39
+ agent_id?: string | null;
40
+
36
41
  /**
37
42
  * Filter messages created on or before this date
38
43
  */
@@ -246,6 +251,11 @@ export interface MessageSearchParams {
246
251
  */
247
252
  query: string;
248
253
 
254
+ /**
255
+ * Filter messages by agent ID
256
+ */
257
+ agent_id?: string | null;
258
+
249
259
  /**
250
260
  * Filter messages created on or before this date
251
261
  */
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.6.3'; // x-release-please-version
1
+ export const VERSION = '1.6.5'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.6.3";
1
+ export declare const VERSION = "1.6.5";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.6.3";
1
+ export declare const VERSION = "1.6.5";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.6.3'; // x-release-please-version
4
+ exports.VERSION = '1.6.5'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.6.3'; // x-release-please-version
1
+ export const VERSION = '1.6.5'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map