@letta-ai/letta-client 1.0.0-alpha.17 → 1.0.0-alpha.19

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 (140) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +5 -15
  3. package/client.d.mts +20 -20
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +20 -20
  6. package/client.d.ts.map +1 -1
  7. package/client.js +29 -23
  8. package/client.js.map +1 -1
  9. package/client.mjs +29 -23
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/agents/agents.d.mts +319 -935
  13. package/resources/agents/agents.d.mts.map +1 -1
  14. package/resources/agents/agents.d.ts +319 -935
  15. package/resources/agents/agents.d.ts.map +1 -1
  16. package/resources/agents/agents.js +12 -4
  17. package/resources/agents/agents.js.map +1 -1
  18. package/resources/agents/agents.mjs +12 -4
  19. package/resources/agents/agents.mjs.map +1 -1
  20. package/resources/agents/archives.d.mts +31 -0
  21. package/resources/agents/archives.d.mts.map +1 -0
  22. package/resources/agents/archives.d.ts +31 -0
  23. package/resources/agents/archives.d.ts.map +1 -0
  24. package/resources/agents/archives.js +24 -0
  25. package/resources/agents/archives.js.map +1 -0
  26. package/resources/agents/archives.mjs +20 -0
  27. package/resources/agents/archives.mjs.map +1 -0
  28. package/resources/agents/folders.d.mts +1 -1
  29. package/resources/agents/folders.d.mts.map +1 -1
  30. package/resources/agents/folders.d.ts +1 -1
  31. package/resources/agents/folders.d.ts.map +1 -1
  32. package/resources/agents/identities.d.mts +31 -0
  33. package/resources/agents/identities.d.mts.map +1 -0
  34. package/resources/agents/identities.d.ts +31 -0
  35. package/resources/agents/identities.d.ts.map +1 -0
  36. package/resources/agents/identities.js +24 -0
  37. package/resources/agents/identities.js.map +1 -0
  38. package/resources/agents/identities.mjs +20 -0
  39. package/resources/agents/identities.mjs.map +1 -0
  40. package/resources/agents/index.d.mts +4 -2
  41. package/resources/agents/index.d.mts.map +1 -1
  42. package/resources/agents/index.d.ts +4 -2
  43. package/resources/agents/index.d.ts.map +1 -1
  44. package/resources/agents/index.js +5 -1
  45. package/resources/agents/index.js.map +1 -1
  46. package/resources/agents/index.mjs +2 -0
  47. package/resources/agents/index.mjs.map +1 -1
  48. package/resources/agents/messages.d.mts +244 -284
  49. package/resources/agents/messages.d.mts.map +1 -1
  50. package/resources/agents/messages.d.ts +244 -284
  51. package/resources/agents/messages.d.ts.map +1 -1
  52. package/resources/agents/messages.js.map +1 -1
  53. package/resources/agents/messages.mjs.map +1 -1
  54. package/resources/archives/archives.d.mts +111 -0
  55. package/resources/archives/archives.d.mts.map +1 -0
  56. package/resources/archives/archives.d.ts +111 -0
  57. package/resources/archives/archives.d.ts.map +1 -0
  58. package/resources/archives/archives.js +50 -0
  59. package/resources/archives/archives.js.map +1 -0
  60. package/resources/archives/archives.mjs +45 -0
  61. package/resources/archives/archives.mjs.map +1 -0
  62. package/resources/archives/index.d.mts +3 -0
  63. package/resources/archives/index.d.mts.map +1 -0
  64. package/resources/archives/index.d.ts +3 -0
  65. package/resources/archives/index.d.ts.map +1 -0
  66. package/resources/archives/index.js +9 -0
  67. package/resources/archives/index.js.map +1 -0
  68. package/resources/archives/index.mjs +4 -0
  69. package/resources/archives/index.mjs.map +1 -0
  70. package/resources/archives/passages.d.mts +112 -0
  71. package/resources/archives/passages.d.mts.map +1 -0
  72. package/resources/archives/passages.d.ts +112 -0
  73. package/resources/archives/passages.d.ts.map +1 -0
  74. package/resources/archives/passages.js +32 -0
  75. package/resources/archives/passages.js.map +1 -0
  76. package/resources/archives/passages.mjs +28 -0
  77. package/resources/archives/passages.mjs.map +1 -0
  78. package/resources/archives.d.mts +1 -106
  79. package/resources/archives.d.mts.map +1 -1
  80. package/resources/archives.d.ts +1 -106
  81. package/resources/archives.d.ts.map +1 -1
  82. package/resources/archives.js +2 -38
  83. package/resources/archives.js.map +1 -1
  84. package/resources/archives.mjs +1 -36
  85. package/resources/archives.mjs.map +1 -1
  86. package/resources/batches/messages.d.mts +3 -3
  87. package/resources/batches/messages.d.mts.map +1 -1
  88. package/resources/batches/messages.d.ts +3 -3
  89. package/resources/batches/messages.d.ts.map +1 -1
  90. package/resources/batches/messages.js.map +1 -1
  91. package/resources/batches/messages.mjs.map +1 -1
  92. package/resources/groups/messages.d.mts +3 -3
  93. package/resources/groups/messages.d.mts.map +1 -1
  94. package/resources/groups/messages.d.ts +3 -3
  95. package/resources/groups/messages.d.ts.map +1 -1
  96. package/resources/groups/messages.js +4 -1
  97. package/resources/groups/messages.js.map +1 -1
  98. package/resources/groups/messages.mjs +4 -1
  99. package/resources/groups/messages.mjs.map +1 -1
  100. package/resources/index.d.mts +2 -2
  101. package/resources/index.d.mts.map +1 -1
  102. package/resources/index.d.ts +2 -2
  103. package/resources/index.d.ts.map +1 -1
  104. package/resources/index.js +1 -1
  105. package/resources/index.js.map +1 -1
  106. package/resources/index.mjs +1 -1
  107. package/resources/index.mjs.map +1 -1
  108. package/resources/runs/messages.d.mts +3 -3
  109. package/resources/runs/messages.d.mts.map +1 -1
  110. package/resources/runs/messages.d.ts +3 -3
  111. package/resources/runs/messages.d.ts.map +1 -1
  112. package/resources/runs/messages.js +4 -1
  113. package/resources/runs/messages.js.map +1 -1
  114. package/resources/runs/messages.mjs +4 -1
  115. package/resources/runs/messages.mjs.map +1 -1
  116. package/resources/steps/steps.d.mts +1 -1
  117. package/resources/steps/steps.d.mts.map +1 -1
  118. package/resources/steps/steps.d.ts +1 -1
  119. package/resources/steps/steps.d.ts.map +1 -1
  120. package/src/client.ts +156 -130
  121. package/src/resources/agents/agents.ts +721 -1527
  122. package/src/resources/agents/archives.ts +51 -0
  123. package/src/resources/agents/folders.ts +1 -1
  124. package/src/resources/agents/identities.ts +51 -0
  125. package/src/resources/agents/index.ts +28 -3
  126. package/src/resources/agents/messages.ts +377 -424
  127. package/src/resources/archives/archives.ts +165 -0
  128. package/src/resources/archives/index.ts +17 -0
  129. package/src/resources/archives/passages.ts +149 -0
  130. package/src/resources/archives.ts +1 -150
  131. package/src/resources/batches/messages.ts +4 -4
  132. package/src/resources/groups/messages.ts +7 -8
  133. package/src/resources/index.ts +11 -1
  134. package/src/resources/runs/messages.ts +7 -8
  135. package/src/resources/steps/steps.ts +1 -1
  136. package/src/version.ts +1 -1
  137. package/version.d.mts +1 -1
  138. package/version.d.ts +1 -1
  139. package/version.js +1 -1
  140. package/version.mjs +1 -1
@@ -20,8 +20,8 @@ export class Messages extends APIResource {
20
20
  agentID: string,
21
21
  query: MessageListParams | null | undefined = {},
22
22
  options?: RequestOptions,
23
- ): PagePromise<LettaMessageUnionsArrayPage, LettaMessageUnion> {
24
- return this._client.getAPIList(path`/v1/agents/${agentID}/messages`, ArrayPage<LettaMessageUnion>, {
23
+ ): PagePromise<MessagesArrayPage, Message> {
24
+ return this._client.getAPIList(path`/v1/agents/${agentID}/messages`, ArrayPage<Message>, {
25
25
  query,
26
26
  ...options,
27
27
  });
@@ -147,11 +147,11 @@ export class Messages extends APIResource {
147
147
  }
148
148
  }
149
149
 
150
- export type LettaMessageUnionsArrayPage = ArrayPage<LettaMessageUnion>;
150
+ export type MessagesArrayPage = ArrayPage<Message>;
151
151
 
152
152
  export type RunsArrayPage = ArrayPage<Run>;
153
153
 
154
- export type MessagesObjectPage = ObjectPage<Message>;
154
+ export type InternalMessagesObjectPage = ObjectPage<InternalMessage>;
155
155
 
156
156
  /**
157
157
  * Input to approve or deny a tool call request
@@ -165,7 +165,7 @@ export interface ApprovalCreate {
165
165
  /**
166
166
  * The list of approval responses
167
167
  */
168
- approvals?: Array<ApprovalCreate.ApprovalReturn | ToolReturn> | null;
168
+ approvals?: Array<ApprovalReturn | ToolReturn> | null;
169
169
 
170
170
  /**
171
171
  * @deprecated Whether the tool has been approved
@@ -188,30 +188,6 @@ export interface ApprovalCreate {
188
188
  type?: 'approval';
189
189
  }
190
190
 
191
- export namespace ApprovalCreate {
192
- export interface ApprovalReturn {
193
- /**
194
- * Whether the tool has been approved
195
- */
196
- approve: boolean;
197
-
198
- /**
199
- * The ID of the tool call that corresponds to this approval
200
- */
201
- tool_call_id: string;
202
-
203
- /**
204
- * An optional explanation for the provided approval status
205
- */
206
- reason?: string | null;
207
-
208
- /**
209
- * The message type to be created.
210
- */
211
- type?: 'approval';
212
- }
213
- }
214
-
215
191
  /**
216
192
  * A message representing a request for approval to call a tool (generated by the
217
193
  * LLM to trigger tool execution).
@@ -279,7 +255,7 @@ export interface ApprovalResponseMessage {
279
255
  /**
280
256
  * The list of approval responses
281
257
  */
282
- approvals?: Array<ApprovalResponseMessage.ApprovalReturn | ToolReturn> | null;
258
+ approvals?: Array<ApprovalReturn | ToolReturn> | null;
283
259
 
284
260
  /**
285
261
  * @deprecated Whether the tool has been approved
@@ -311,28 +287,26 @@ export interface ApprovalResponseMessage {
311
287
  step_id?: string | null;
312
288
  }
313
289
 
314
- export namespace ApprovalResponseMessage {
315
- export interface ApprovalReturn {
316
- /**
317
- * Whether the tool has been approved
318
- */
319
- approve: boolean;
290
+ export interface ApprovalReturn {
291
+ /**
292
+ * Whether the tool has been approved
293
+ */
294
+ approve: boolean;
320
295
 
321
- /**
322
- * The ID of the tool call that corresponds to this approval
323
- */
324
- tool_call_id: string;
296
+ /**
297
+ * The ID of the tool call that corresponds to this approval
298
+ */
299
+ tool_call_id: string;
325
300
 
326
- /**
327
- * An optional explanation for the provided approval status
328
- */
329
- reason?: string | null;
301
+ /**
302
+ * An optional explanation for the provided approval status
303
+ */
304
+ reason?: string | null;
330
305
 
331
- /**
332
- * The message type to be created.
333
- */
334
- type?: 'approval';
335
- }
306
+ /**
307
+ * The message type to be created.
308
+ */
309
+ type?: 'approval';
336
310
  }
337
311
 
338
312
  /**
@@ -521,113 +495,188 @@ export namespace ImageContent {
521
495
  }
522
496
 
523
497
  /**
524
- * Status of the job.
498
+ * Letta's internal representation of a message. Includes methods to convert to/from LLM provider formats.
499
+ *
500
+ * Attributes:
501
+ * id (str): The unique identifier of the message.
502
+ * role (MessageRole): The role of the participant.
503
+ * text (str): The text of the message.
504
+ * user_id (str): The unique identifier of the user.
505
+ * agent_id (str): The unique identifier of the agent.
506
+ * model (str): The model used to make the function call.
507
+ * name (str): The name of the participant.
508
+ * created_at (datetime): The time the message was created.
509
+ * tool_calls (List[OpenAIToolCall,]): The list of tool calls requested.
510
+ * tool_call_id (str): The id of the tool call.
511
+ * step_id (str): The id of the step that this message was created in.
512
+ * otid (str): The offline threading id associated with this message.
513
+ * tool_returns (List[ToolReturn]): The list of tool returns requested.
514
+ * group_id (str): The multi-agent group that the message was sent in.
515
+ * sender_id (str): The id of the sender of the message, can be an identity id or agent id.
516
+ *
517
+ * t
525
518
  */
526
- export type JobStatus = 'created' | 'running' | 'completed' | 'failed' | 'pending' | 'cancelled' | 'expired';
519
+ export interface InternalMessage {
520
+ /**
521
+ * The human-friendly ID of the Message
522
+ */
523
+ id: string;
527
524
 
528
- export type JobType = 'job' | 'run' | 'batch';
525
+ /**
526
+ * The role of the participant.
527
+ */
528
+ role: MessageRole;
529
529
 
530
- export interface LettaAssistantMessageContentUnion {
531
530
  /**
532
- * The text content of the message.
531
+ * The unique identifier of the agent.
533
532
  */
534
- text: string;
533
+ agent_id?: string | null;
535
534
 
536
535
  /**
537
- * Stores a unique identifier for any reasoning associated with this text content.
536
+ * The id of the approval request if this message is associated with a tool call
537
+ * request.
538
538
  */
539
- signature?: string | null;
539
+ approval_request_id?: string | null;
540
540
 
541
541
  /**
542
- * The type of the message.
542
+ * The list of approvals for this message.
543
543
  */
544
- type?: 'text';
545
- }
544
+ approvals?: Array<ApprovalReturn | InternalMessage.LettaSchemasMessageToolReturn> | null;
546
545
 
547
- /**
548
- * A message generated by the system. Never streamed back on a response, only used
549
- * for cursor pagination.
550
- *
551
- * Args: id (str): The ID of the message date (datetime): The date the message was
552
- * created in ISO format name (Optional[str]): The name of the sender of the
553
- * message content (str): The message content sent by the system
554
- */
555
- export type LettaMessageUnion =
556
- | SystemMessage
557
- | UserMessage
558
- | ReasoningMessage
559
- | HiddenReasoningMessage
560
- | ToolCallMessage
561
- | ToolsAPI.ToolReturnMessage
562
- | AssistantMessage
563
- | ApprovalRequestMessage
564
- | ApprovalResponseMessage
565
- | SummaryMessage
566
- | EventMessage;
546
+ /**
547
+ * Whether tool call is approved.
548
+ */
549
+ approve?: boolean | null;
567
550
 
568
- export interface LettaRequest {
569
551
  /**
570
- * @deprecated The name of the message argument in the designated message tool.
571
- * Still supported for legacy agent types, but deprecated for letta_v1_agent
572
- * onward.
552
+ * The id of the LLMBatchItem that this message is associated with
573
553
  */
574
- assistant_message_tool_kwarg?: string;
554
+ batch_item_id?: string | null;
575
555
 
576
556
  /**
577
- * @deprecated The name of the designated message tool. Still supported for legacy
578
- * agent types, but deprecated for letta_v1_agent onward.
557
+ * The content of the message.
579
558
  */
580
- assistant_message_tool_name?: string;
559
+ content?: Array<
560
+ | TextContent
561
+ | ImageContent
562
+ | ToolCallContent
563
+ | ToolReturnContent
564
+ | ReasoningContent
565
+ | RedactedReasoningContent
566
+ | OmittedReasoningContent
567
+ | InternalMessage.SummarizedReasoningContent
568
+ > | null;
581
569
 
582
570
  /**
583
- * @deprecated If set to True, enables reasoning before responses or tool calls
584
- * from the agent.
571
+ * The timestamp when the object was created.
585
572
  */
586
- enable_thinking?: string;
573
+ created_at?: string;
587
574
 
588
575
  /**
589
- * Only return specified message types in the response. If `None` (default) returns
590
- * all messages.
576
+ * The id of the user that made this object.
591
577
  */
592
- include_return_message_types?: Array<MessageType> | null;
578
+ created_by_id?: string | null;
593
579
 
594
580
  /**
595
- * Syntactic sugar for a single user message. Equivalent to messages=[{'role':
596
- * 'user', 'content': input}].
581
+ * The reason the tool call request was denied.
597
582
  */
598
- input?:
599
- | string
600
- | Array<
601
- | TextContent
602
- | ImageContent
603
- | ToolCallContent
604
- | ToolReturnContent
605
- | ReasoningContent
606
- | RedactedReasoningContent
607
- | OmittedReasoningContent
608
- | LettaRequest.SummarizedReasoningContent
609
- >
610
- | null;
583
+ denial_reason?: string | null;
611
584
 
612
585
  /**
613
- * Maximum number of steps the agent should take to process the request.
586
+ * The multi-agent group that the message was sent in
614
587
  */
615
- max_steps?: number;
588
+ group_id?: string | null;
616
589
 
617
590
  /**
618
- * The messages to be sent to the agent.
591
+ * Whether this message is part of an error step. Used only for debugging purposes.
619
592
  */
620
- messages?: Array<AgentsAPI.MessageCreate | ApprovalCreate> | null;
593
+ is_err?: boolean | null;
621
594
 
622
595
  /**
623
- * @deprecated Whether the server should parse specific tool call arguments
624
- * (default `send_message`) as `AssistantMessage` objects. Still supported for
625
- * legacy agent types, but deprecated for letta_v1_agent onward.
596
+ * The id of the user that made this object.
626
597
  */
627
- use_assistant_message?: boolean;
598
+ last_updated_by_id?: string | null;
599
+
600
+ /**
601
+ * The model used to make the function call.
602
+ */
603
+ model?: string | null;
604
+
605
+ /**
606
+ * For role user/assistant: the (optional) name of the participant. For role
607
+ * tool/function: the name of the function called.
608
+ */
609
+ name?: string | null;
610
+
611
+ /**
612
+ * The offline threading id associated with this message
613
+ */
614
+ otid?: string | null;
615
+
616
+ /**
617
+ * The id of the run that this message was created in.
618
+ */
619
+ run_id?: string | null;
620
+
621
+ /**
622
+ * The id of the sender of the message, can be an identity id or agent id
623
+ */
624
+ sender_id?: string | null;
625
+
626
+ /**
627
+ * The id of the step that this message was created in.
628
+ */
629
+ step_id?: string | null;
630
+
631
+ /**
632
+ * The ID of the tool call. Only applicable for role tool.
633
+ */
634
+ tool_call_id?: string | null;
635
+
636
+ /**
637
+ * The list of tool calls requested. Only applicable for role assistant.
638
+ */
639
+ tool_calls?: Array<InternalMessage.ToolCall> | null;
640
+
641
+ /**
642
+ * Tool execution return information for prior tool calls
643
+ */
644
+ tool_returns?: Array<InternalMessage.ToolReturn> | null;
645
+
646
+ /**
647
+ * The timestamp when the object was last updated.
648
+ */
649
+ updated_at?: string | null;
628
650
  }
629
651
 
630
- export namespace LettaRequest {
652
+ export namespace InternalMessage {
653
+ export interface LettaSchemasMessageToolReturn {
654
+ /**
655
+ * The status of the tool call
656
+ */
657
+ status: 'success' | 'error';
658
+
659
+ /**
660
+ * The function response string
661
+ */
662
+ func_response?: string | null;
663
+
664
+ /**
665
+ * Captured stderr from the tool invocation
666
+ */
667
+ stderr?: Array<string> | null;
668
+
669
+ /**
670
+ * Captured stdout (e.g. prints, logs) from the tool invocation
671
+ */
672
+ stdout?: Array<string> | null;
673
+
674
+ /**
675
+ * The ID for the tool call
676
+ */
677
+ tool_call_id?: unknown;
678
+ }
679
+
631
680
  /**
632
681
  * The style of reasoning content returned by the OpenAI Responses API
633
682
  */
@@ -666,22 +715,196 @@ export namespace LettaRequest {
666
715
  text: string;
667
716
  }
668
717
  }
669
- }
670
-
671
- /**
672
- * Response object from an agent interaction, consisting of the new messages
673
- * generated by the agent and usage statistics. The type of the returned messages
674
- * can be either `Message` or `LettaMessage`, depending on what was specified in
675
- * the request.
676
- *
677
- * Attributes: messages (List[Union[Message, LettaMessage]]): The messages returned
678
- * by the agent. usage (LettaUsageStatistics): The usage statistics
679
- */
680
- export interface LettaResponse {
681
- /**
682
- * The messages returned by the agent.
683
- */
684
- messages: Array<LettaMessageUnion>;
718
+
719
+ export interface ToolCall {
720
+ id: string;
721
+
722
+ function: ToolCall.Function;
723
+
724
+ type: 'function';
725
+
726
+ [k: string]: unknown;
727
+ }
728
+
729
+ export namespace ToolCall {
730
+ export interface Function {
731
+ arguments: string;
732
+
733
+ name: string;
734
+
735
+ [k: string]: unknown;
736
+ }
737
+ }
738
+
739
+ export interface ToolReturn {
740
+ /**
741
+ * The status of the tool call
742
+ */
743
+ status: 'success' | 'error';
744
+
745
+ /**
746
+ * The function response string
747
+ */
748
+ func_response?: string | null;
749
+
750
+ /**
751
+ * Captured stderr from the tool invocation
752
+ */
753
+ stderr?: Array<string> | null;
754
+
755
+ /**
756
+ * Captured stdout (e.g. prints, logs) from the tool invocation
757
+ */
758
+ stdout?: Array<string> | null;
759
+
760
+ /**
761
+ * The ID for the tool call
762
+ */
763
+ tool_call_id?: unknown;
764
+ }
765
+ }
766
+
767
+ /**
768
+ * Status of the job.
769
+ */
770
+ export type JobStatus = 'created' | 'running' | 'completed' | 'failed' | 'pending' | 'cancelled' | 'expired';
771
+
772
+ export type JobType = 'job' | 'run' | 'batch';
773
+
774
+ export interface LettaAssistantMessageContentUnion {
775
+ /**
776
+ * The text content of the message.
777
+ */
778
+ text: string;
779
+
780
+ /**
781
+ * Stores a unique identifier for any reasoning associated with this text content.
782
+ */
783
+ signature?: string | null;
784
+
785
+ /**
786
+ * The type of the message.
787
+ */
788
+ type?: 'text';
789
+ }
790
+
791
+ export interface LettaRequest {
792
+ /**
793
+ * @deprecated The name of the message argument in the designated message tool.
794
+ * Still supported for legacy agent types, but deprecated for letta_v1_agent
795
+ * onward.
796
+ */
797
+ assistant_message_tool_kwarg?: string;
798
+
799
+ /**
800
+ * @deprecated The name of the designated message tool. Still supported for legacy
801
+ * agent types, but deprecated for letta_v1_agent onward.
802
+ */
803
+ assistant_message_tool_name?: string;
804
+
805
+ /**
806
+ * @deprecated If set to True, enables reasoning before responses or tool calls
807
+ * from the agent.
808
+ */
809
+ enable_thinking?: string;
810
+
811
+ /**
812
+ * Only return specified message types in the response. If `None` (default) returns
813
+ * all messages.
814
+ */
815
+ include_return_message_types?: Array<MessageType> | null;
816
+
817
+ /**
818
+ * Syntactic sugar for a single user message. Equivalent to messages=[{'role':
819
+ * 'user', 'content': input}].
820
+ */
821
+ input?:
822
+ | string
823
+ | Array<
824
+ | TextContent
825
+ | ImageContent
826
+ | ToolCallContent
827
+ | ToolReturnContent
828
+ | ReasoningContent
829
+ | RedactedReasoningContent
830
+ | OmittedReasoningContent
831
+ | LettaRequest.SummarizedReasoningContent
832
+ >
833
+ | null;
834
+
835
+ /**
836
+ * Maximum number of steps the agent should take to process the request.
837
+ */
838
+ max_steps?: number;
839
+
840
+ /**
841
+ * The messages to be sent to the agent.
842
+ */
843
+ messages?: Array<AgentsAPI.MessageCreate | ApprovalCreate> | null;
844
+
845
+ /**
846
+ * @deprecated Whether the server should parse specific tool call arguments
847
+ * (default `send_message`) as `AssistantMessage` objects. Still supported for
848
+ * legacy agent types, but deprecated for letta_v1_agent onward.
849
+ */
850
+ use_assistant_message?: boolean;
851
+ }
852
+
853
+ export namespace LettaRequest {
854
+ /**
855
+ * The style of reasoning content returned by the OpenAI Responses API
856
+ */
857
+ export interface SummarizedReasoningContent {
858
+ /**
859
+ * The unique identifier for this reasoning step.
860
+ */
861
+ id: string;
862
+
863
+ /**
864
+ * Summaries of the reasoning content.
865
+ */
866
+ summary: Array<SummarizedReasoningContent.Summary>;
867
+
868
+ /**
869
+ * The encrypted reasoning content.
870
+ */
871
+ encrypted_content?: string;
872
+
873
+ /**
874
+ * Indicates this is a summarized reasoning step.
875
+ */
876
+ type?: 'summarized_reasoning';
877
+ }
878
+
879
+ export namespace SummarizedReasoningContent {
880
+ export interface Summary {
881
+ /**
882
+ * The index of the summary part.
883
+ */
884
+ index: number;
885
+
886
+ /**
887
+ * The text of the summary part.
888
+ */
889
+ text: string;
890
+ }
891
+ }
892
+ }
893
+
894
+ /**
895
+ * Response object from an agent interaction, consisting of the new messages
896
+ * generated by the agent and usage statistics. The type of the returned messages
897
+ * can be either `Message` or `LettaMessage`, depending on what was specified in
898
+ * the request.
899
+ *
900
+ * Attributes: messages (List[Union[Message, LettaMessage]]): The messages returned
901
+ * by the agent. usage (LettaUsageStatistics): The usage statistics
902
+ */
903
+ export interface LettaResponse {
904
+ /**
905
+ * The messages returned by the agent.
906
+ */
907
+ messages: Array<Message>;
685
908
 
686
909
  /**
687
910
  * The stop reason from Letta indicating why agent loop stopped execution.
@@ -956,296 +1179,25 @@ export namespace LettaStreamingResponse {
956
1179
  export type LettaUserMessageContentUnion = TextContent | ImageContent;
957
1180
 
958
1181
  /**
959
- * Letta's internal representation of a message. Includes methods to convert to/from LLM provider formats.
960
- *
961
- * Attributes:
962
- * id (str): The unique identifier of the message.
963
- * role (MessageRole): The role of the participant.
964
- * text (str): The text of the message.
965
- * user_id (str): The unique identifier of the user.
966
- * agent_id (str): The unique identifier of the agent.
967
- * model (str): The model used to make the function call.
968
- * name (str): The name of the participant.
969
- * created_at (datetime): The time the message was created.
970
- * tool_calls (List[OpenAIToolCall,]): The list of tool calls requested.
971
- * tool_call_id (str): The id of the tool call.
972
- * step_id (str): The id of the step that this message was created in.
973
- * otid (str): The offline threading id associated with this message.
974
- * tool_returns (List[ToolReturn]): The list of tool returns requested.
975
- * group_id (str): The multi-agent group that the message was sent in.
976
- * sender_id (str): The id of the sender of the message, can be an identity id or agent id.
1182
+ * A message generated by the system. Never streamed back on a response, only used
1183
+ * for cursor pagination.
977
1184
  *
978
- * t
1185
+ * Args: id (str): The ID of the message date (datetime): The date the message was
1186
+ * created in ISO format name (Optional[str]): The name of the sender of the
1187
+ * message content (str): The message content sent by the system
979
1188
  */
980
- export interface Message {
981
- /**
982
- * The human-friendly ID of the Message
983
- */
984
- id: string;
985
-
986
- /**
987
- * The role of the participant.
988
- */
989
- role: MessageRole;
990
-
991
- /**
992
- * The unique identifier of the agent.
993
- */
994
- agent_id?: string | null;
995
-
996
- /**
997
- * The id of the approval request if this message is associated with a tool call
998
- * request.
999
- */
1000
- approval_request_id?: string | null;
1001
-
1002
- /**
1003
- * The list of approvals for this message.
1004
- */
1005
- approvals?: Array<Message.ApprovalReturn | Message.LettaSchemasMessageToolReturn> | null;
1006
-
1007
- /**
1008
- * Whether tool call is approved.
1009
- */
1010
- approve?: boolean | null;
1011
-
1012
- /**
1013
- * The id of the LLMBatchItem that this message is associated with
1014
- */
1015
- batch_item_id?: string | null;
1016
-
1017
- /**
1018
- * The content of the message.
1019
- */
1020
- content?: Array<
1021
- | TextContent
1022
- | ImageContent
1023
- | ToolCallContent
1024
- | ToolReturnContent
1025
- | ReasoningContent
1026
- | RedactedReasoningContent
1027
- | OmittedReasoningContent
1028
- | Message.SummarizedReasoningContent
1029
- > | null;
1030
-
1031
- /**
1032
- * The timestamp when the object was created.
1033
- */
1034
- created_at?: string;
1035
-
1036
- /**
1037
- * The id of the user that made this object.
1038
- */
1039
- created_by_id?: string | null;
1040
-
1041
- /**
1042
- * The reason the tool call request was denied.
1043
- */
1044
- denial_reason?: string | null;
1045
-
1046
- /**
1047
- * The multi-agent group that the message was sent in
1048
- */
1049
- group_id?: string | null;
1050
-
1051
- /**
1052
- * Whether this message is part of an error step. Used only for debugging purposes.
1053
- */
1054
- is_err?: boolean | null;
1055
-
1056
- /**
1057
- * The id of the user that made this object.
1058
- */
1059
- last_updated_by_id?: string | null;
1060
-
1061
- /**
1062
- * The model used to make the function call.
1063
- */
1064
- model?: string | null;
1065
-
1066
- /**
1067
- * For role user/assistant: the (optional) name of the participant. For role
1068
- * tool/function: the name of the function called.
1069
- */
1070
- name?: string | null;
1071
-
1072
- /**
1073
- * The offline threading id associated with this message
1074
- */
1075
- otid?: string | null;
1076
-
1077
- /**
1078
- * The id of the run that this message was created in.
1079
- */
1080
- run_id?: string | null;
1081
-
1082
- /**
1083
- * The id of the sender of the message, can be an identity id or agent id
1084
- */
1085
- sender_id?: string | null;
1086
-
1087
- /**
1088
- * The id of the step that this message was created in.
1089
- */
1090
- step_id?: string | null;
1091
-
1092
- /**
1093
- * The ID of the tool call. Only applicable for role tool.
1094
- */
1095
- tool_call_id?: string | null;
1096
-
1097
- /**
1098
- * The list of tool calls requested. Only applicable for role assistant.
1099
- */
1100
- tool_calls?: Array<Message.ToolCall> | null;
1101
-
1102
- /**
1103
- * Tool execution return information for prior tool calls
1104
- */
1105
- tool_returns?: Array<Message.ToolReturn> | null;
1106
-
1107
- /**
1108
- * The timestamp when the object was last updated.
1109
- */
1110
- updated_at?: string | null;
1111
- }
1112
-
1113
- export namespace Message {
1114
- export interface ApprovalReturn {
1115
- /**
1116
- * Whether the tool has been approved
1117
- */
1118
- approve: boolean;
1119
-
1120
- /**
1121
- * The ID of the tool call that corresponds to this approval
1122
- */
1123
- tool_call_id: string;
1124
-
1125
- /**
1126
- * An optional explanation for the provided approval status
1127
- */
1128
- reason?: string | null;
1129
-
1130
- /**
1131
- * The message type to be created.
1132
- */
1133
- type?: 'approval';
1134
- }
1135
-
1136
- export interface LettaSchemasMessageToolReturn {
1137
- /**
1138
- * The status of the tool call
1139
- */
1140
- status: 'success' | 'error';
1141
-
1142
- /**
1143
- * The function response string
1144
- */
1145
- func_response?: string | null;
1146
-
1147
- /**
1148
- * Captured stderr from the tool invocation
1149
- */
1150
- stderr?: Array<string> | null;
1151
-
1152
- /**
1153
- * Captured stdout (e.g. prints, logs) from the tool invocation
1154
- */
1155
- stdout?: Array<string> | null;
1156
-
1157
- /**
1158
- * The ID for the tool call
1159
- */
1160
- tool_call_id?: unknown;
1161
- }
1162
-
1163
- /**
1164
- * The style of reasoning content returned by the OpenAI Responses API
1165
- */
1166
- export interface SummarizedReasoningContent {
1167
- /**
1168
- * The unique identifier for this reasoning step.
1169
- */
1170
- id: string;
1171
-
1172
- /**
1173
- * Summaries of the reasoning content.
1174
- */
1175
- summary: Array<SummarizedReasoningContent.Summary>;
1176
-
1177
- /**
1178
- * The encrypted reasoning content.
1179
- */
1180
- encrypted_content?: string;
1181
-
1182
- /**
1183
- * Indicates this is a summarized reasoning step.
1184
- */
1185
- type?: 'summarized_reasoning';
1186
- }
1187
-
1188
- export namespace SummarizedReasoningContent {
1189
- export interface Summary {
1190
- /**
1191
- * The index of the summary part.
1192
- */
1193
- index: number;
1194
-
1195
- /**
1196
- * The text of the summary part.
1197
- */
1198
- text: string;
1199
- }
1200
- }
1201
-
1202
- export interface ToolCall {
1203
- id: string;
1204
-
1205
- function: ToolCall.Function;
1206
-
1207
- type: 'function';
1208
-
1209
- [k: string]: unknown;
1210
- }
1211
-
1212
- export namespace ToolCall {
1213
- export interface Function {
1214
- arguments: string;
1215
-
1216
- name: string;
1217
-
1218
- [k: string]: unknown;
1219
- }
1220
- }
1221
-
1222
- export interface ToolReturn {
1223
- /**
1224
- * The status of the tool call
1225
- */
1226
- status: 'success' | 'error';
1227
-
1228
- /**
1229
- * The function response string
1230
- */
1231
- func_response?: string | null;
1232
-
1233
- /**
1234
- * Captured stderr from the tool invocation
1235
- */
1236
- stderr?: Array<string> | null;
1237
-
1238
- /**
1239
- * Captured stdout (e.g. prints, logs) from the tool invocation
1240
- */
1241
- stdout?: Array<string> | null;
1242
-
1243
- /**
1244
- * The ID for the tool call
1245
- */
1246
- tool_call_id?: unknown;
1247
- }
1248
- }
1189
+ export type Message =
1190
+ | SystemMessage
1191
+ | UserMessage
1192
+ | ReasoningMessage
1193
+ | HiddenReasoningMessage
1194
+ | ToolCallMessage
1195
+ | ToolsAPI.ToolReturnMessage
1196
+ | AssistantMessage
1197
+ | ApprovalRequestMessage
1198
+ | ApprovalResponseMessage
1199
+ | SummaryMessage
1200
+ | EventMessage;
1249
1201
 
1250
1202
  export type MessageRole = 'assistant' | 'user' | 'tool' | 'function' | 'system' | 'approval';
1251
1203
 
@@ -2289,14 +2241,15 @@ export declare namespace Messages {
2289
2241
  type ApprovalCreate as ApprovalCreate,
2290
2242
  type ApprovalRequestMessage as ApprovalRequestMessage,
2291
2243
  type ApprovalResponseMessage as ApprovalResponseMessage,
2244
+ type ApprovalReturn as ApprovalReturn,
2292
2245
  type AssistantMessage as AssistantMessage,
2293
2246
  type EventMessage as EventMessage,
2294
2247
  type HiddenReasoningMessage as HiddenReasoningMessage,
2295
2248
  type ImageContent as ImageContent,
2249
+ type InternalMessage as InternalMessage,
2296
2250
  type JobStatus as JobStatus,
2297
2251
  type JobType as JobType,
2298
2252
  type LettaAssistantMessageContentUnion as LettaAssistantMessageContentUnion,
2299
- type LettaMessageUnion as LettaMessageUnion,
2300
2253
  type LettaRequest as LettaRequest,
2301
2254
  type LettaResponse as LettaResponse,
2302
2255
  type LettaStreamingRequest as LettaStreamingRequest,
@@ -2326,7 +2279,7 @@ export declare namespace Messages {
2326
2279
  type UserMessage as UserMessage,
2327
2280
  type MessageCancelResponse as MessageCancelResponse,
2328
2281
  type MessageModifyResponse as MessageModifyResponse,
2329
- type LettaMessageUnionsArrayPage as LettaMessageUnionsArrayPage,
2282
+ type MessagesArrayPage as MessagesArrayPage,
2330
2283
  type MessageListParams as MessageListParams,
2331
2284
  type MessageCancelParams as MessageCancelParams,
2332
2285
  type MessageModifyParams as MessageModifyParams,