letta-client 0.1.232__py3-none-any.whl → 1.7.2__py3-none-any.whl

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 (757) hide show
  1. letta_client/__init__.py +91 -676
  2. letta_client/_base_client.py +2125 -0
  3. letta_client/_client.py +1136 -0
  4. letta_client/_compat.py +219 -0
  5. letta_client/_constants.py +14 -0
  6. letta_client/_exceptions.py +108 -0
  7. letta_client/_files.py +123 -0
  8. letta_client/_models.py +872 -0
  9. letta_client/_qs.py +150 -0
  10. letta_client/_resource.py +43 -0
  11. letta_client/_response.py +832 -0
  12. letta_client/_streaming.py +371 -0
  13. letta_client/_types.py +270 -0
  14. letta_client/_utils/__init__.py +64 -0
  15. letta_client/_utils/_compat.py +45 -0
  16. letta_client/_utils/_datetime_parse.py +136 -0
  17. letta_client/_utils/_logs.py +25 -0
  18. letta_client/_utils/_proxy.py +65 -0
  19. letta_client/_utils/_reflection.py +42 -0
  20. letta_client/_utils/_resources_proxy.py +24 -0
  21. letta_client/_utils/_streams.py +12 -0
  22. letta_client/_utils/_sync.py +58 -0
  23. letta_client/_utils/_transform.py +457 -0
  24. letta_client/_utils/_typing.py +156 -0
  25. letta_client/_utils/_utils.py +421 -0
  26. letta_client/_version.py +4 -0
  27. letta_client/lib/.keep +4 -0
  28. letta_client/pagination.py +280 -0
  29. letta_client/resources/__init__.py +215 -0
  30. letta_client/resources/access_tokens.py +396 -0
  31. letta_client/resources/agents/__init__.py +131 -0
  32. letta_client/resources/agents/agents.py +2148 -0
  33. letta_client/resources/agents/archives.py +260 -0
  34. letta_client/resources/agents/blocks.py +736 -0
  35. letta_client/resources/agents/files.py +541 -0
  36. letta_client/resources/agents/folders.py +422 -0
  37. letta_client/resources/agents/identities.py +260 -0
  38. letta_client/resources/agents/messages.py +1800 -0
  39. letta_client/resources/agents/passages.py +638 -0
  40. letta_client/resources/agents/tools.py +651 -0
  41. letta_client/resources/archives/__init__.py +33 -0
  42. letta_client/resources/archives/archives.py +650 -0
  43. letta_client/resources/archives/passages.py +309 -0
  44. letta_client/resources/blocks/__init__.py +33 -0
  45. letta_client/resources/blocks/agents.py +289 -0
  46. letta_client/resources/blocks/blocks.py +977 -0
  47. letta_client/resources/conversations/__init__.py +33 -0
  48. letta_client/resources/conversations/conversations.py +611 -0
  49. letta_client/resources/conversations/messages.py +650 -0
  50. letta_client/resources/folders/__init__.py +47 -0
  51. letta_client/resources/folders/agents.py +234 -0
  52. letta_client/resources/folders/files.py +581 -0
  53. letta_client/resources/folders/folders.py +734 -0
  54. letta_client/resources/mcp_servers/__init__.py +33 -0
  55. letta_client/resources/mcp_servers/mcp_servers.py +670 -0
  56. letta_client/resources/mcp_servers/tools.py +351 -0
  57. letta_client/resources/messages.py +455 -0
  58. letta_client/resources/models/__init__.py +33 -0
  59. letta_client/resources/models/embeddings.py +149 -0
  60. letta_client/resources/models/models.py +233 -0
  61. letta_client/resources/passages.py +259 -0
  62. letta_client/resources/runs/__init__.py +75 -0
  63. letta_client/resources/runs/messages.py +363 -0
  64. letta_client/resources/runs/runs.py +502 -0
  65. letta_client/resources/runs/steps.py +229 -0
  66. letta_client/resources/runs/trace.py +197 -0
  67. letta_client/resources/runs/usage.py +163 -0
  68. letta_client/resources/steps/__init__.py +75 -0
  69. letta_client/resources/steps/feedback.py +198 -0
  70. letta_client/resources/steps/messages.py +237 -0
  71. letta_client/resources/steps/metrics.py +167 -0
  72. letta_client/resources/steps/steps.py +505 -0
  73. letta_client/resources/steps/trace.py +169 -0
  74. letta_client/resources/tags.py +240 -0
  75. letta_client/resources/templates/__init__.py +33 -0
  76. letta_client/resources/templates/agents.py +229 -0
  77. letta_client/resources/templates/templates.py +540 -0
  78. letta_client/resources/tools.py +1721 -0
  79. letta_client/types/__init__.py +148 -534
  80. letta_client/types/access_token_create_params.py +32 -0
  81. letta_client/types/access_token_create_response.py +34 -0
  82. letta_client/types/access_token_delete_params.py +11 -0
  83. letta_client/types/access_token_list_params.py +23 -0
  84. letta_client/types/access_token_list_response.py +40 -0
  85. letta_client/types/agent_create_params.py +444 -0
  86. letta_client/types/agent_environment_variable.py +40 -63
  87. letta_client/types/agent_export_file_params.py +26 -0
  88. letta_client/types/agent_export_file_response.py +7 -0
  89. letta_client/types/agent_import_file_params.py +57 -0
  90. letta_client/types/agent_import_file_response.py +14 -0
  91. letta_client/types/agent_list_params.py +100 -0
  92. letta_client/types/agent_retrieve_params.py +37 -0
  93. letta_client/types/agent_state.py +651 -138
  94. letta_client/types/agent_type.py +14 -14
  95. letta_client/types/agent_update_params.py +386 -0
  96. letta_client/types/agents/__init__.py +76 -0
  97. letta_client/types/agents/approval_create_param.py +35 -0
  98. letta_client/types/agents/approval_request_message.py +57 -0
  99. letta_client/types/agents/approval_response_message.py +61 -0
  100. letta_client/types/agents/approval_return.py +22 -0
  101. letta_client/types/agents/approval_return_param.py +22 -0
  102. letta_client/types/agents/assistant_message.py +48 -0
  103. letta_client/types/agents/block.py +68 -0
  104. letta_client/types/agents/block_list_params.py +34 -0
  105. letta_client/types/agents/block_update_params.py +63 -0
  106. letta_client/types/agents/event_message.py +40 -0
  107. letta_client/types/agents/file_close_all_response.py +8 -0
  108. letta_client/types/agents/file_list_params.py +40 -0
  109. letta_client/types/agents/file_list_response.py +42 -0
  110. letta_client/types/agents/file_open_response.py +8 -0
  111. letta_client/types/agents/folder_list_params.py +34 -0
  112. letta_client/types/agents/folder_list_response.py +49 -0
  113. letta_client/types/agents/hidden_reasoning_message.py +49 -0
  114. letta_client/types/agents/image_content.py +67 -0
  115. letta_client/types/agents/image_content_param.py +64 -0
  116. letta_client/types/agents/internal_message.py +271 -0
  117. letta_client/types/agents/job_status.py +7 -0
  118. letta_client/types/agents/job_type.py +7 -0
  119. letta_client/types/agents/letta_assistant_message_content_union.py +19 -0
  120. letta_client/types/agents/letta_response.py +76 -0
  121. letta_client/types/agents/letta_streaming_response.py +155 -0
  122. letta_client/types/agents/letta_user_message_content_union.py +14 -0
  123. letta_client/types/agents/message.py +36 -0
  124. letta_client/types/agents/message_cancel_params.py +15 -0
  125. letta_client/types/agents/message_cancel_response.py +8 -0
  126. letta_client/types/agents/message_compact_params.py +145 -0
  127. letta_client/types/agents/message_compact_response.py +13 -0
  128. letta_client/types/agents/message_create_async_params.py +145 -0
  129. letta_client/types/agents/message_create_params.py +181 -0
  130. letta_client/types/agents/message_list_params.py +55 -0
  131. letta_client/types/agents/message_reset_params.py +12 -0
  132. letta_client/types/agents/message_role.py +7 -0
  133. letta_client/types/agents/message_stream_params.py +166 -0
  134. letta_client/types/agents/message_type.py +17 -0
  135. letta_client/types/agents/omitted_reasoning_content.py +20 -0
  136. letta_client/types/agents/omitted_reasoning_content_param.py +20 -0
  137. letta_client/types/agents/passage_create_params.py +23 -0
  138. letta_client/types/agents/passage_create_response.py +10 -0
  139. letta_client/types/agents/passage_list_params.py +28 -0
  140. letta_client/types/agents/passage_list_response.py +10 -0
  141. letta_client/types/agents/passage_search_params.py +35 -0
  142. letta_client/types/agents/passage_search_response.py +29 -0
  143. letta_client/types/agents/reasoning_content.py +27 -0
  144. letta_client/types/agents/reasoning_content_param.py +27 -0
  145. letta_client/types/agents/reasoning_message.py +50 -0
  146. letta_client/types/agents/redacted_reasoning_content.py +18 -0
  147. letta_client/types/agents/redacted_reasoning_content_param.py +17 -0
  148. letta_client/types/agents/run.py +91 -0
  149. letta_client/types/agents/summary_message.py +38 -0
  150. letta_client/types/agents/system_message.py +46 -0
  151. letta_client/types/agents/text_content.py +19 -0
  152. letta_client/types/agents/text_content_param.py +19 -0
  153. letta_client/types/agents/tool_call.py +13 -0
  154. letta_client/types/agents/tool_call_content.py +28 -0
  155. letta_client/types/agents/tool_call_content_param.py +28 -0
  156. letta_client/types/agents/tool_call_delta.py +15 -0
  157. letta_client/types/agents/tool_call_message.py +52 -0
  158. letta_client/types/agents/tool_execution_result.py +33 -0
  159. letta_client/types/agents/tool_list_params.py +34 -0
  160. letta_client/types/agents/tool_return.py +29 -0
  161. letta_client/types/agents/tool_return_content.py +22 -0
  162. letta_client/types/agents/tool_return_content_param.py +21 -0
  163. letta_client/types/agents/tool_return_param.py +30 -0
  164. letta_client/types/agents/tool_run_params.py +16 -0
  165. letta_client/types/agents/tool_update_approval_params.py +21 -0
  166. letta_client/types/agents/user_message.py +50 -0
  167. letta_client/types/anthropic_model_settings.py +62 -0
  168. letta_client/types/anthropic_model_settings_param.py +59 -0
  169. letta_client/types/archive.py +46 -0
  170. letta_client/types/archive_create_params.py +22 -0
  171. letta_client/types/archive_list_params.py +40 -0
  172. letta_client/types/archive_update_params.py +14 -0
  173. letta_client/types/archives/__init__.py +5 -0
  174. letta_client/types/archives/passage_create_params.py +21 -0
  175. letta_client/types/azure_model_settings.py +36 -0
  176. letta_client/types/azure_model_settings_param.py +33 -0
  177. letta_client/types/bedrock_model_settings.py +36 -0
  178. letta_client/types/bedrock_model_settings_param.py +33 -0
  179. letta_client/types/block_create_params.py +59 -0
  180. letta_client/types/block_list_params.py +102 -0
  181. letta_client/types/block_response.py +66 -0
  182. letta_client/types/block_update_params.py +60 -0
  183. letta_client/types/blocks/__init__.py +5 -0
  184. letta_client/types/blocks/agent_list_params.py +61 -0
  185. letta_client/types/child_tool_rule.py +37 -26
  186. letta_client/types/child_tool_rule_param.py +50 -0
  187. letta_client/types/conditional_tool_rule.py +19 -35
  188. letta_client/types/conditional_tool_rule_param.py +31 -0
  189. letta_client/types/continue_tool_rule.py +13 -23
  190. letta_client/types/continue_tool_rule_param.py +22 -0
  191. letta_client/types/conversation.py +42 -0
  192. letta_client/types/conversation_cancel_response.py +8 -0
  193. letta_client/types/conversation_create_params.py +25 -0
  194. letta_client/types/conversation_list_params.py +19 -0
  195. letta_client/types/conversation_list_response.py +10 -0
  196. letta_client/types/conversation_update_params.py +13 -0
  197. letta_client/types/conversations/__init__.py +7 -0
  198. letta_client/types/conversations/message_create_params.py +166 -0
  199. letta_client/types/conversations/message_list_params.py +43 -0
  200. letta_client/types/conversations/message_stream_params.py +28 -0
  201. letta_client/types/create_block_param.py +61 -0
  202. letta_client/types/create_sse_mcp_server_param.py +26 -0
  203. letta_client/types/create_stdio_mcp_server_param.py +25 -0
  204. letta_client/types/create_streamable_http_mcp_server_param.py +26 -0
  205. letta_client/types/deepseek_model_settings.py +36 -0
  206. letta_client/types/deepseek_model_settings_param.py +33 -0
  207. letta_client/types/embedding_config.py +47 -67
  208. letta_client/types/embedding_config_param.py +64 -0
  209. letta_client/types/embedding_model.py +81 -0
  210. letta_client/types/folder.py +28 -66
  211. letta_client/types/folder_create_params.py +33 -0
  212. letta_client/types/folder_list_params.py +37 -0
  213. letta_client/types/folder_update_params.py +27 -0
  214. letta_client/types/folders/__init__.py +12 -0
  215. letta_client/types/folders/agent_list_params.py +34 -0
  216. letta_client/types/folders/agent_list_response.py +8 -0
  217. letta_client/types/folders/file_list_params.py +37 -0
  218. letta_client/types/folders/file_list_response.py +70 -0
  219. letta_client/types/folders/file_retrieve_params.py +15 -0
  220. letta_client/types/folders/file_retrieve_response.py +70 -0
  221. letta_client/types/folders/file_upload_params.py +20 -0
  222. letta_client/types/folders/file_upload_response.py +70 -0
  223. letta_client/types/google_ai_model_settings.py +47 -0
  224. letta_client/types/google_ai_model_settings_param.py +44 -0
  225. letta_client/types/google_vertex_model_settings.py +47 -0
  226. letta_client/types/google_vertex_model_settings_param.py +44 -0
  227. letta_client/types/groq_model_settings.py +36 -0
  228. letta_client/types/groq_model_settings_param.py +33 -0
  229. letta_client/types/health_response.py +13 -0
  230. letta_client/types/init_tool_rule.py +24 -24
  231. letta_client/types/init_tool_rule_param.py +32 -0
  232. letta_client/types/json_object_response_format.py +9 -17
  233. letta_client/types/json_object_response_format_param.py +14 -0
  234. letta_client/types/json_schema_response_format.py +12 -21
  235. letta_client/types/json_schema_response_format_param.py +18 -0
  236. letta_client/types/letta_message_content_union_param.py +26 -0
  237. letta_client/types/llm_config.py +123 -80
  238. letta_client/types/llm_config_param.py +155 -0
  239. letta_client/types/max_count_per_step_tool_rule.py +16 -25
  240. letta_client/types/max_count_per_step_tool_rule_param.py +28 -0
  241. letta_client/types/mcp_server_create_params.py +23 -0
  242. letta_client/types/mcp_server_create_response.py +12 -0
  243. letta_client/types/mcp_server_list_response.py +14 -0
  244. letta_client/types/mcp_server_refresh_params.py +12 -0
  245. letta_client/types/mcp_server_retrieve_response.py +12 -0
  246. letta_client/types/mcp_server_update_params.py +23 -0
  247. letta_client/types/mcp_server_update_response.py +12 -0
  248. letta_client/types/mcp_servers/__init__.py +6 -0
  249. letta_client/types/mcp_servers/tool_list_response.py +10 -0
  250. letta_client/types/mcp_servers/tool_run_params.py +15 -0
  251. letta_client/types/message_create_param.py +38 -0
  252. letta_client/types/message_list_params.py +34 -0
  253. letta_client/types/message_list_response.py +10 -0
  254. letta_client/types/message_retrieve_response.py +10 -0
  255. letta_client/types/message_search_params.py +34 -0
  256. letta_client/types/message_search_response.py +124 -0
  257. letta_client/types/model.py +148 -0
  258. letta_client/types/model_list_params.py +19 -0
  259. letta_client/types/model_list_response.py +10 -0
  260. letta_client/types/models/__init__.py +5 -0
  261. letta_client/types/models/embedding_list_response.py +10 -0
  262. letta_client/types/npm_requirement.py +15 -0
  263. letta_client/types/npm_requirement_param.py +16 -0
  264. letta_client/types/openai_model_settings.py +51 -0
  265. letta_client/types/openai_model_settings_param.py +48 -0
  266. letta_client/types/parent_tool_rule.py +15 -27
  267. letta_client/types/parent_tool_rule_param.py +27 -0
  268. letta_client/types/passage.py +56 -101
  269. letta_client/types/passage_search_params.py +41 -0
  270. letta_client/types/passage_search_response.py +25 -0
  271. letta_client/types/pip_requirement.py +9 -21
  272. letta_client/types/pip_requirement_param.py +16 -0
  273. letta_client/types/provider_category.py +5 -3
  274. letta_client/types/provider_trace.py +43 -48
  275. letta_client/types/provider_type.py +25 -23
  276. letta_client/types/required_before_exit_tool_rule.py +13 -23
  277. letta_client/types/required_before_exit_tool_rule_param.py +22 -0
  278. letta_client/types/requires_approval_tool_rule.py +25 -0
  279. letta_client/types/requires_approval_tool_rule_param.py +25 -0
  280. letta_client/types/run_list_params.py +67 -0
  281. letta_client/types/runs/__init__.py +10 -0
  282. letta_client/types/runs/message_list_params.py +34 -0
  283. letta_client/types/runs/message_stream_params.py +28 -0
  284. letta_client/types/runs/step_list_params.py +28 -0
  285. letta_client/types/runs/trace_retrieve_params.py +12 -0
  286. letta_client/types/runs/trace_retrieve_response.py +8 -0
  287. letta_client/types/runs/usage_retrieve_response.py +31 -0
  288. letta_client/types/sse_mcp_server.py +32 -0
  289. letta_client/types/stdio_mcp_server.py +29 -0
  290. letta_client/types/step.py +71 -97
  291. letta_client/types/step_list_params.py +57 -0
  292. letta_client/types/steps/__init__.py +8 -0
  293. letta_client/types/steps/feedback_create_params.py +18 -0
  294. letta_client/types/steps/message_list_params.py +34 -0
  295. letta_client/types/steps/message_list_response.py +36 -0
  296. letta_client/types/steps/metric_retrieve_response.py +45 -0
  297. letta_client/types/stop_reason_type.py +17 -5
  298. letta_client/types/streamable_http_mcp_server.py +32 -0
  299. letta_client/types/tag_list_params.py +40 -0
  300. letta_client/types/tag_list_response.py +8 -0
  301. letta_client/types/template_create_params.py +46 -0
  302. letta_client/types/template_create_response.py +29 -0
  303. letta_client/types/template_delete_response.py +9 -0
  304. letta_client/types/template_update_params.py +25 -0
  305. letta_client/types/template_update_response.py +13 -0
  306. letta_client/types/templates/__init__.py +6 -0
  307. letta_client/types/templates/agent_create_params.py +50 -0
  308. letta_client/types/templates/agent_create_response.py +20 -0
  309. letta_client/types/terminal_tool_rule.py +13 -23
  310. letta_client/types/terminal_tool_rule_param.py +22 -0
  311. letta_client/types/text_response_format.py +9 -17
  312. letta_client/types/text_response_format_param.py +14 -0
  313. letta_client/types/together_model_settings.py +36 -0
  314. letta_client/types/together_model_settings_param.py +33 -0
  315. letta_client/types/tool.py +154 -81
  316. letta_client/types/tool_create_params.py +53 -0
  317. letta_client/types/tool_list_params.py +57 -0
  318. letta_client/types/tool_return_message.py +44 -31
  319. letta_client/types/tool_search_params.py +27 -0
  320. letta_client/types/tool_search_response.py +10 -0
  321. letta_client/types/tool_search_result.py +27 -0
  322. letta_client/types/tool_type.py +16 -17
  323. letta_client/types/tool_update_params.py +57 -0
  324. letta_client/types/tool_upsert_params.py +53 -0
  325. letta_client/types/update_sse_mcp_server_param.py +26 -0
  326. letta_client/types/update_stdio_mcp_server_param.py +25 -0
  327. letta_client/types/update_streamable_http_mcp_server_param.py +26 -0
  328. letta_client/types/vector_db_provider.py +7 -0
  329. letta_client/types/xai_model_settings.py +36 -0
  330. letta_client/types/xai_model_settings_param.py +33 -0
  331. letta_client-1.7.2.dist-info/METADATA +436 -0
  332. letta_client-1.7.2.dist-info/RECORD +335 -0
  333. {letta_client-0.1.232.dist-info → letta_client-1.7.2.dist-info}/WHEEL +1 -1
  334. letta_client-1.7.2.dist-info/licenses/LICENSE +201 -0
  335. letta_client/agents/__init__.py +0 -77
  336. letta_client/agents/blocks/__init__.py +0 -2
  337. letta_client/agents/blocks/client.py +0 -793
  338. letta_client/agents/client.py +0 -2371
  339. letta_client/agents/context/__init__.py +0 -2
  340. letta_client/agents/context/client.py +0 -149
  341. letta_client/agents/core_memory/__init__.py +0 -2
  342. letta_client/agents/core_memory/client.py +0 -147
  343. letta_client/agents/files/__init__.py +0 -2
  344. letta_client/agents/files/client.py +0 -430
  345. letta_client/agents/folders/__init__.py +0 -2
  346. letta_client/agents/folders/client.py +0 -412
  347. letta_client/agents/groups/__init__.py +0 -2
  348. letta_client/agents/groups/client.py +0 -169
  349. letta_client/agents/memory_variables/__init__.py +0 -5
  350. letta_client/agents/memory_variables/client.py +0 -152
  351. letta_client/agents/memory_variables/types/__init__.py +0 -5
  352. letta_client/agents/memory_variables/types/memory_variables_list_response.py +0 -19
  353. letta_client/agents/messages/__init__.py +0 -15
  354. letta_client/agents/messages/client.py +0 -1638
  355. letta_client/agents/messages/types/__init__.py +0 -13
  356. letta_client/agents/messages/types/letta_streaming_response.py +0 -24
  357. letta_client/agents/messages/types/messages_modify_request.py +0 -11
  358. letta_client/agents/messages/types/messages_modify_response.py +0 -20
  359. letta_client/agents/messages/types/messages_preview_raw_payload_request.py +0 -7
  360. letta_client/agents/passages/__init__.py +0 -2
  361. letta_client/agents/passages/client.py +0 -793
  362. letta_client/agents/sources/__init__.py +0 -2
  363. letta_client/agents/sources/client.py +0 -412
  364. letta_client/agents/templates/__init__.py +0 -5
  365. letta_client/agents/templates/client.py +0 -588
  366. letta_client/agents/templates/types/__init__.py +0 -7
  367. letta_client/agents/templates/types/templates_create_response.py +0 -22
  368. letta_client/agents/templates/types/templates_create_version_request_return_agent_state.py +0 -5
  369. letta_client/agents/templates/types/templates_migrate_response.py +0 -19
  370. letta_client/agents/tools/__init__.py +0 -2
  371. letta_client/agents/tools/client.py +0 -412
  372. letta_client/agents/types/__init__.py +0 -33
  373. letta_client/agents/types/agents_search_request_search_item.py +0 -16
  374. letta_client/agents/types/agents_search_request_search_item_field.py +0 -22
  375. letta_client/agents/types/agents_search_request_search_item_field_operator.py +0 -5
  376. letta_client/agents/types/agents_search_request_search_item_one.py +0 -22
  377. letta_client/agents/types/agents_search_request_search_item_one_operator.py +0 -5
  378. letta_client/agents/types/agents_search_request_search_item_three.py +0 -21
  379. letta_client/agents/types/agents_search_request_search_item_two.py +0 -21
  380. letta_client/agents/types/agents_search_request_search_item_zero.py +0 -20
  381. letta_client/agents/types/agents_search_request_sort_by.py +0 -5
  382. letta_client/agents/types/agents_search_response.py +0 -23
  383. letta_client/agents/types/create_agent_request_response_format.py +0 -8
  384. letta_client/agents/types/create_agent_request_tool_rules_item.py +0 -22
  385. letta_client/agents/types/update_agent_response_format.py +0 -8
  386. letta_client/agents/types/update_agent_tool_rules_item.py +0 -22
  387. letta_client/base_client.py +0 -232
  388. letta_client/batches/__init__.py +0 -2
  389. letta_client/batches/client.py +0 -587
  390. letta_client/blocks/__init__.py +0 -5
  391. letta_client/blocks/agents/__init__.py +0 -2
  392. letta_client/blocks/agents/client.py +0 -171
  393. letta_client/blocks/client.py +0 -1118
  394. letta_client/client.py +0 -661
  395. letta_client/client_side_access_tokens/__init__.py +0 -29
  396. letta_client/client_side_access_tokens/client.py +0 -524
  397. letta_client/client_side_access_tokens/types/__init__.py +0 -43
  398. letta_client/client_side_access_tokens/types/client_side_access_tokens_create_request_policy_item.py +0 -24
  399. letta_client/client_side_access_tokens/types/client_side_access_tokens_create_request_policy_item_access_item.py +0 -7
  400. letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response.py +0 -25
  401. letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response_policy.py +0 -23
  402. letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response_policy_data_item.py +0 -24
  403. letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response_policy_data_item_access_item.py +0 -7
  404. letta_client/client_side_access_tokens/types/client_side_access_tokens_list_client_side_access_tokens_response.py +0 -25
  405. letta_client/client_side_access_tokens/types/client_side_access_tokens_list_client_side_access_tokens_response_tokens_item.py +0 -27
  406. letta_client/client_side_access_tokens/types/client_side_access_tokens_list_client_side_access_tokens_response_tokens_item_policy.py +0 -23
  407. letta_client/client_side_access_tokens/types/client_side_access_tokens_list_client_side_access_tokens_response_tokens_item_policy_data_item.py +0 -24
  408. letta_client/client_side_access_tokens/types/client_side_access_tokens_list_client_side_access_tokens_response_tokens_item_policy_data_item_access_item.py +0 -7
  409. letta_client/core/__init__.py +0 -51
  410. letta_client/core/api_error.py +0 -15
  411. letta_client/core/client_wrapper.py +0 -77
  412. letta_client/core/datetime_utils.py +0 -28
  413. letta_client/core/file.py +0 -67
  414. letta_client/core/http_client.py +0 -499
  415. letta_client/core/jsonable_encoder.py +0 -101
  416. letta_client/core/pydantic_utilities.py +0 -296
  417. letta_client/core/query_encoder.py +0 -58
  418. letta_client/core/remove_none_from_dict.py +0 -11
  419. letta_client/core/request_options.py +0 -35
  420. letta_client/core/serialization.py +0 -272
  421. letta_client/core/unchecked_base_model.py +0 -305
  422. letta_client/embedding_models/__init__.py +0 -2
  423. letta_client/embedding_models/client.py +0 -136
  424. letta_client/environment.py +0 -8
  425. letta_client/errors/__init__.py +0 -17
  426. letta_client/errors/bad_request_error.py +0 -9
  427. letta_client/errors/conflict_error.py +0 -9
  428. letta_client/errors/internal_server_error.py +0 -9
  429. letta_client/errors/not_found_error.py +0 -9
  430. letta_client/errors/payment_required_error.py +0 -9
  431. letta_client/errors/unprocessable_entity_error.py +0 -9
  432. letta_client/folders/__init__.py +0 -5
  433. letta_client/folders/client.py +0 -1307
  434. letta_client/folders/files/__init__.py +0 -2
  435. letta_client/folders/files/client.py +0 -474
  436. letta_client/folders/passages/__init__.py +0 -2
  437. letta_client/folders/passages/client.py +0 -189
  438. letta_client/groups/__init__.py +0 -14
  439. letta_client/groups/client.py +0 -964
  440. letta_client/groups/messages/__init__.py +0 -5
  441. letta_client/groups/messages/client.py +0 -1015
  442. letta_client/groups/messages/types/__init__.py +0 -7
  443. letta_client/groups/messages/types/letta_streaming_response.py +0 -20
  444. letta_client/groups/messages/types/messages_modify_request.py +0 -11
  445. letta_client/groups/messages/types/messages_modify_response.py +0 -20
  446. letta_client/groups/types/__init__.py +0 -6
  447. letta_client/groups/types/group_create_manager_config.py +0 -12
  448. letta_client/groups/types/group_update_manager_config.py +0 -16
  449. letta_client/health/__init__.py +0 -2
  450. letta_client/health/client.py +0 -110
  451. letta_client/identities/__init__.py +0 -5
  452. letta_client/identities/client.py +0 -1201
  453. letta_client/identities/properties/__init__.py +0 -2
  454. letta_client/identities/properties/client.py +0 -183
  455. letta_client/jobs/__init__.py +0 -2
  456. letta_client/jobs/client.py +0 -749
  457. letta_client/messages/__init__.py +0 -2
  458. letta_client/messages/client.py +0 -213
  459. letta_client/models/__init__.py +0 -2
  460. letta_client/models/client.py +0 -174
  461. letta_client/projects/__init__.py +0 -5
  462. letta_client/projects/client.py +0 -150
  463. letta_client/projects/types/__init__.py +0 -6
  464. letta_client/projects/types/projects_list_response.py +0 -23
  465. letta_client/projects/types/projects_list_response_projects_item.py +0 -21
  466. letta_client/providers/__init__.py +0 -2
  467. letta_client/providers/client.py +0 -789
  468. letta_client/runs/__init__.py +0 -5
  469. letta_client/runs/client.py +0 -551
  470. letta_client/runs/messages/__init__.py +0 -2
  471. letta_client/runs/messages/client.py +0 -236
  472. letta_client/runs/steps/__init__.py +0 -2
  473. letta_client/runs/steps/client.py +0 -219
  474. letta_client/runs/usage/__init__.py +0 -2
  475. letta_client/runs/usage/client.py +0 -147
  476. letta_client/sources/__init__.py +0 -5
  477. letta_client/sources/client.py +0 -1462
  478. letta_client/sources/files/__init__.py +0 -2
  479. letta_client/sources/files/client.py +0 -474
  480. letta_client/sources/passages/__init__.py +0 -2
  481. letta_client/sources/passages/client.py +0 -189
  482. letta_client/steps/__init__.py +0 -6
  483. letta_client/steps/client.py +0 -408
  484. letta_client/steps/feedback/__init__.py +0 -2
  485. letta_client/steps/feedback/client.py +0 -168
  486. letta_client/steps/types/__init__.py +0 -5
  487. letta_client/steps/types/steps_list_request_feedback.py +0 -5
  488. letta_client/tags/__init__.py +0 -2
  489. letta_client/tags/client.py +0 -171
  490. letta_client/telemetry/__init__.py +0 -2
  491. letta_client/telemetry/client.py +0 -145
  492. letta_client/templates/__init__.py +0 -18
  493. letta_client/templates/agents/__init__.py +0 -13
  494. letta_client/templates/agents/client.py +0 -256
  495. letta_client/templates/agents/types/__init__.py +0 -11
  496. letta_client/templates/agents/types/agents_create_request_initial_message_sequence_item.py +0 -26
  497. letta_client/templates/agents/types/agents_create_request_initial_message_sequence_item_role.py +0 -7
  498. letta_client/templates/agents/types/agents_create_response.py +0 -20
  499. letta_client/templates/client.py +0 -162
  500. letta_client/templates/types/__init__.py +0 -6
  501. letta_client/templates/types/templates_list_response.py +0 -23
  502. letta_client/templates/types/templates_list_response_templates_item.py +0 -20
  503. letta_client/tools/__init__.py +0 -27
  504. letta_client/tools/client.py +0 -3063
  505. letta_client/tools/types/__init__.py +0 -25
  506. letta_client/tools/types/add_mcp_server_request.py +0 -8
  507. letta_client/tools/types/add_mcp_server_response_item.py +0 -8
  508. letta_client/tools/types/connect_mcp_server_request.py +0 -8
  509. letta_client/tools/types/connect_mcp_server_response_event.py +0 -8
  510. letta_client/tools/types/delete_mcp_server_response_item.py +0 -8
  511. letta_client/tools/types/list_mcp_servers_response_value.py +0 -8
  512. letta_client/tools/types/streaming_response.py +0 -23
  513. letta_client/tools/types/test_mcp_server_request.py +0 -8
  514. letta_client/tools/types/update_mcp_server_request.py +0 -8
  515. letta_client/tools/types/update_mcp_server_response.py +0 -8
  516. letta_client/types/action_model.py +0 -38
  517. letta_client/types/action_parameters_model.py +0 -27
  518. letta_client/types/action_response_model.py +0 -27
  519. letta_client/types/agent_schema.py +0 -49
  520. letta_client/types/agent_schema_tool_rules_item.py +0 -11
  521. letta_client/types/agent_state_response_format.py +0 -8
  522. letta_client/types/agent_state_tool_rules_item.py +0 -22
  523. letta_client/types/app_auth_scheme.py +0 -34
  524. letta_client/types/app_auth_scheme_auth_mode.py +0 -19
  525. letta_client/types/app_model.py +0 -44
  526. letta_client/types/assistant_message.py +0 -42
  527. letta_client/types/assistant_message_content.py +0 -6
  528. letta_client/types/audio.py +0 -19
  529. letta_client/types/auth_request.py +0 -22
  530. letta_client/types/auth_response.py +0 -29
  531. letta_client/types/auth_scheme_field.py +0 -30
  532. letta_client/types/bad_request_error_body.py +0 -19
  533. letta_client/types/base_64_image.py +0 -33
  534. letta_client/types/base_tool_rule_schema.py +0 -20
  535. letta_client/types/batch_job.py +0 -81
  536. letta_client/types/block.py +0 -97
  537. letta_client/types/block_update.py +0 -71
  538. letta_client/types/chat_completion_assistant_message_param.py +0 -29
  539. letta_client/types/chat_completion_assistant_message_param_content.py +0 -8
  540. letta_client/types/chat_completion_assistant_message_param_content_item.py +0 -9
  541. letta_client/types/chat_completion_audio_param.py +0 -22
  542. letta_client/types/chat_completion_audio_param_format.py +0 -5
  543. letta_client/types/chat_completion_audio_param_voice.py +0 -15
  544. letta_client/types/chat_completion_content_part_image_param.py +0 -21
  545. letta_client/types/chat_completion_content_part_input_audio_param.py +0 -21
  546. letta_client/types/chat_completion_content_part_refusal_param.py +0 -20
  547. letta_client/types/chat_completion_content_part_text_param.py +0 -20
  548. letta_client/types/chat_completion_developer_message_param.py +0 -22
  549. letta_client/types/chat_completion_developer_message_param_content.py +0 -6
  550. letta_client/types/chat_completion_function_call_option_param.py +0 -19
  551. letta_client/types/chat_completion_function_message_param.py +0 -21
  552. letta_client/types/chat_completion_message_tool_call.py +0 -22
  553. letta_client/types/chat_completion_message_tool_call_param.py +0 -24
  554. letta_client/types/chat_completion_named_tool_choice_param.py +0 -23
  555. letta_client/types/chat_completion_prediction_content_param.py +0 -21
  556. letta_client/types/chat_completion_prediction_content_param_content.py +0 -6
  557. letta_client/types/chat_completion_stream_options_param.py +0 -19
  558. letta_client/types/chat_completion_system_message_param.py +0 -22
  559. letta_client/types/chat_completion_system_message_param_content.py +0 -6
  560. letta_client/types/chat_completion_tool_message_param.py +0 -22
  561. letta_client/types/chat_completion_tool_message_param_content.py +0 -6
  562. letta_client/types/chat_completion_tool_param.py +0 -21
  563. letta_client/types/chat_completion_user_message_param.py +0 -22
  564. letta_client/types/chat_completion_user_message_param_content.py +0 -6
  565. letta_client/types/chat_completion_user_message_param_content_item.py +0 -14
  566. letta_client/types/child_tool_rule_schema.py +0 -21
  567. letta_client/types/code_input.py +0 -22
  568. letta_client/types/completion_create_params_non_streaming.py +0 -64
  569. letta_client/types/completion_create_params_non_streaming_function_call.py +0 -8
  570. letta_client/types/completion_create_params_non_streaming_messages_item.py +0 -18
  571. letta_client/types/completion_create_params_non_streaming_modalities_item.py +0 -5
  572. letta_client/types/completion_create_params_non_streaming_model.py +0 -62
  573. letta_client/types/completion_create_params_non_streaming_reasoning_effort.py +0 -5
  574. letta_client/types/completion_create_params_non_streaming_response_format.py +0 -10
  575. letta_client/types/completion_create_params_non_streaming_service_tier.py +0 -7
  576. letta_client/types/completion_create_params_non_streaming_stop.py +0 -5
  577. letta_client/types/completion_create_params_non_streaming_tool_choice.py +0 -8
  578. letta_client/types/completion_create_params_streaming.py +0 -64
  579. letta_client/types/completion_create_params_streaming_function_call.py +0 -8
  580. letta_client/types/completion_create_params_streaming_messages_item.py +0 -18
  581. letta_client/types/completion_create_params_streaming_modalities_item.py +0 -5
  582. letta_client/types/completion_create_params_streaming_model.py +0 -62
  583. letta_client/types/completion_create_params_streaming_reasoning_effort.py +0 -5
  584. letta_client/types/completion_create_params_streaming_response_format.py +0 -10
  585. letta_client/types/completion_create_params_streaming_service_tier.py +0 -7
  586. letta_client/types/completion_create_params_streaming_stop.py +0 -5
  587. letta_client/types/completion_create_params_streaming_tool_choice.py +0 -8
  588. letta_client/types/components_schemas_text_content.py +0 -5
  589. letta_client/types/conditional_tool_rule_schema.py +0 -23
  590. letta_client/types/conflict_error_body.py +0 -21
  591. letta_client/types/context_window_overview.py +0 -108
  592. letta_client/types/core_memory_block_schema.py +0 -31
  593. letta_client/types/create_block.py +0 -67
  594. letta_client/types/duplicate_file_handling.py +0 -5
  595. letta_client/types/dynamic_manager.py +0 -33
  596. letta_client/types/dynamic_manager_update.py +0 -33
  597. letta_client/types/e_2_b_sandbox_config.py +0 -32
  598. letta_client/types/embedding_config_embedding_endpoint_type.py +0 -29
  599. letta_client/types/feedback_type.py +0 -5
  600. letta_client/types/file.py +0 -21
  601. letta_client/types/file_block.py +0 -103
  602. letta_client/types/file_file.py +0 -21
  603. letta_client/types/file_metadata.py +0 -103
  604. letta_client/types/file_processing_status.py +0 -5
  605. letta_client/types/file_stats.py +0 -36
  606. letta_client/types/function_call.py +0 -20
  607. letta_client/types/function_definition_input.py +0 -22
  608. letta_client/types/function_definition_output.py +0 -22
  609. letta_client/types/function_output.py +0 -20
  610. letta_client/types/function_tool.py +0 -21
  611. letta_client/types/generate_tool_input.py +0 -42
  612. letta_client/types/generate_tool_output.py +0 -33
  613. letta_client/types/group.py +0 -88
  614. letta_client/types/health.py +0 -24
  615. letta_client/types/hidden_reasoning_message.py +0 -43
  616. letta_client/types/hidden_reasoning_message_state.py +0 -5
  617. letta_client/types/http_validation_error.py +0 -20
  618. letta_client/types/identity.py +0 -59
  619. letta_client/types/identity_property.py +0 -38
  620. letta_client/types/identity_property_type.py +0 -5
  621. letta_client/types/identity_property_value.py +0 -5
  622. letta_client/types/identity_type.py +0 -5
  623. letta_client/types/image_content.py +0 -24
  624. letta_client/types/image_content_source.py +0 -8
  625. letta_client/types/image_url.py +0 -21
  626. letta_client/types/image_url_detail.py +0 -5
  627. letta_client/types/input_audio.py +0 -21
  628. letta_client/types/input_audio_format.py +0 -5
  629. letta_client/types/internal_server_error_body.py +0 -19
  630. letta_client/types/job.py +0 -96
  631. letta_client/types/job_status.py +0 -7
  632. letta_client/types/job_type.py +0 -5
  633. letta_client/types/json_schema.py +0 -26
  634. letta_client/types/letta_batch_messages.py +0 -20
  635. letta_client/types/letta_batch_request.py +0 -59
  636. letta_client/types/letta_image.py +0 -38
  637. letta_client/types/letta_message_content_union.py +0 -13
  638. letta_client/types/letta_message_union.py +0 -20
  639. letta_client/types/letta_ping.py +0 -26
  640. letta_client/types/letta_request.py +0 -54
  641. letta_client/types/letta_request_config.py +0 -38
  642. letta_client/types/letta_response.py +0 -40
  643. letta_client/types/letta_stop_reason.py +0 -32
  644. letta_client/types/letta_streaming_request.py +0 -59
  645. letta_client/types/letta_usage_statistics.py +0 -59
  646. letta_client/types/letta_user_message_content_union.py +0 -7
  647. letta_client/types/llm_config_compatibility_type.py +0 -5
  648. letta_client/types/llm_config_model_endpoint_type.py +0 -31
  649. letta_client/types/llm_config_reasoning_effort.py +0 -5
  650. letta_client/types/local_sandbox_config.py +0 -38
  651. letta_client/types/manager_type.py +0 -7
  652. letta_client/types/max_count_per_step_tool_rule_schema.py +0 -21
  653. letta_client/types/mcp_server_type.py +0 -5
  654. letta_client/types/mcp_tool.py +0 -38
  655. letta_client/types/memory.py +0 -38
  656. letta_client/types/message.py +0 -139
  657. letta_client/types/message_content_item.py +0 -20
  658. letta_client/types/message_create.py +0 -58
  659. letta_client/types/message_create_content.py +0 -6
  660. letta_client/types/message_create_role.py +0 -5
  661. letta_client/types/message_role.py +0 -5
  662. letta_client/types/message_schema.py +0 -29
  663. letta_client/types/message_type.py +0 -16
  664. letta_client/types/not_found_error_body.py +0 -19
  665. letta_client/types/not_found_error_body_message.py +0 -11
  666. letta_client/types/omitted_reasoning_content.py +0 -19
  667. letta_client/types/openai_types_chat_chat_completion_message_tool_call_param_function.py +0 -20
  668. letta_client/types/openai_types_chat_chat_completion_named_tool_choice_param_function.py +0 -19
  669. letta_client/types/openai_types_chat_completion_create_params_function.py +0 -21
  670. letta_client/types/organization.py +0 -38
  671. letta_client/types/organization_create.py +0 -27
  672. letta_client/types/organization_sources_stats.py +0 -42
  673. letta_client/types/organization_update.py +0 -27
  674. letta_client/types/parameter_properties.py +0 -20
  675. letta_client/types/parameters_schema.py +0 -22
  676. letta_client/types/payment_required_error_body.py +0 -20
  677. letta_client/types/provider.py +0 -65
  678. letta_client/types/provider_check.py +0 -38
  679. letta_client/types/reasoning_content.py +0 -33
  680. letta_client/types/reasoning_message.py +0 -44
  681. letta_client/types/reasoning_message_source.py +0 -5
  682. letta_client/types/redacted_reasoning_content.py +0 -23
  683. letta_client/types/response_format_json_object.py +0 -19
  684. letta_client/types/response_format_json_schema.py +0 -21
  685. letta_client/types/response_format_text.py +0 -19
  686. letta_client/types/round_robin_manager.py +0 -23
  687. letta_client/types/round_robin_manager_update.py +0 -23
  688. letta_client/types/run.py +0 -99
  689. letta_client/types/sandbox_config.py +0 -54
  690. letta_client/types/sandbox_config_create.py +0 -23
  691. letta_client/types/sandbox_config_create_config.py +0 -7
  692. letta_client/types/sandbox_config_update.py +0 -27
  693. letta_client/types/sandbox_config_update_config.py +0 -7
  694. letta_client/types/sandbox_environment_variable.py +0 -63
  695. letta_client/types/sandbox_environment_variable_create.py +0 -32
  696. letta_client/types/sandbox_environment_variable_update.py +0 -32
  697. letta_client/types/sandbox_type.py +0 -5
  698. letta_client/types/sleeptime_manager.py +0 -28
  699. letta_client/types/sleeptime_manager_update.py +0 -28
  700. letta_client/types/source.py +0 -81
  701. letta_client/types/source_create.py +0 -57
  702. letta_client/types/source_stats.py +0 -47
  703. letta_client/types/source_update.py +0 -47
  704. letta_client/types/sse_server_config.py +0 -55
  705. letta_client/types/stdio_server_config.py +0 -39
  706. letta_client/types/step_feedback.py +0 -5
  707. letta_client/types/streamable_http_server_config.py +0 -55
  708. letta_client/types/supervisor_manager.py +0 -23
  709. letta_client/types/supervisor_manager_update.py +0 -23
  710. letta_client/types/system_message.py +0 -41
  711. letta_client/types/tag_schema.py +0 -19
  712. letta_client/types/text_content.py +0 -23
  713. letta_client/types/tool_annotations.py +0 -36
  714. letta_client/types/tool_call.py +0 -21
  715. letta_client/types/tool_call_content.py +0 -33
  716. letta_client/types/tool_call_delta.py +0 -21
  717. letta_client/types/tool_call_message.py +0 -39
  718. letta_client/types/tool_call_message_tool_call.py +0 -7
  719. letta_client/types/tool_create.py +0 -58
  720. letta_client/types/tool_env_var_schema.py +0 -23
  721. letta_client/types/tool_json_schema.py +0 -24
  722. letta_client/types/tool_return.py +0 -33
  723. letta_client/types/tool_return_content.py +0 -33
  724. letta_client/types/tool_return_message_status.py +0 -5
  725. letta_client/types/tool_return_status.py +0 -5
  726. letta_client/types/tool_schema.py +0 -35
  727. letta_client/types/update_assistant_message.py +0 -24
  728. letta_client/types/update_assistant_message_content.py +0 -6
  729. letta_client/types/update_reasoning_message.py +0 -20
  730. letta_client/types/update_ssemcp_server.py +0 -41
  731. letta_client/types/update_stdio_mcp_server.py +0 -32
  732. letta_client/types/update_streamable_httpmcp_server.py +0 -46
  733. letta_client/types/update_system_message.py +0 -23
  734. letta_client/types/update_user_message.py +0 -24
  735. letta_client/types/update_user_message_content.py +0 -6
  736. letta_client/types/url_image.py +0 -23
  737. letta_client/types/usage_statistics.py +0 -25
  738. letta_client/types/usage_statistics_completion_token_details.py +0 -19
  739. letta_client/types/usage_statistics_prompt_token_details.py +0 -19
  740. letta_client/types/user.py +0 -52
  741. letta_client/types/user_create.py +0 -22
  742. letta_client/types/user_message.py +0 -42
  743. letta_client/types/user_message_content.py +0 -6
  744. letta_client/types/user_update.py +0 -27
  745. letta_client/types/validation_error.py +0 -22
  746. letta_client/types/validation_error_loc_item.py +0 -5
  747. letta_client/types/voice_sleeptime_manager.py +0 -33
  748. letta_client/types/voice_sleeptime_manager_update.py +0 -33
  749. letta_client/types/web_search_options.py +0 -22
  750. letta_client/types/web_search_options_search_context_size.py +0 -5
  751. letta_client/types/web_search_options_user_location.py +0 -21
  752. letta_client/types/web_search_options_user_location_approximate.py +0 -22
  753. letta_client/version.py +0 -3
  754. letta_client/voice/__init__.py +0 -2
  755. letta_client/voice/client.py +0 -177
  756. letta_client-0.1.232.dist-info/METADATA +0 -190
  757. letta_client-0.1.232.dist-info/RECORD +0 -454
@@ -0,0 +1,1800 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import typing_extensions
6
+ from typing import Any, List, Union, Iterable, Optional, cast
7
+ from typing_extensions import Literal, overload
8
+
9
+ import httpx
10
+
11
+ from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
12
+ from ..._utils import maybe_transform, async_maybe_transform
13
+ from ..._compat import cached_property
14
+ from ..._resource import SyncAPIResource, AsyncAPIResource
15
+ from ..._response import (
16
+ to_raw_response_wrapper,
17
+ to_streamed_response_wrapper,
18
+ async_to_raw_response_wrapper,
19
+ async_to_streamed_response_wrapper,
20
+ )
21
+ from ..._streaming import Stream, AsyncStream
22
+ from ...pagination import SyncArrayPage, AsyncArrayPage
23
+ from ..._base_client import AsyncPaginator, make_request_options
24
+ from ...types.agents import (
25
+ message_list_params,
26
+ message_reset_params,
27
+ message_cancel_params,
28
+ message_create_params,
29
+ message_stream_params,
30
+ message_compact_params,
31
+ message_create_async_params,
32
+ )
33
+ from ...types.agents.run import Run
34
+ from ...types.agent_state import AgentState
35
+ from ...types.agents.message import Message
36
+ from ...types.agents.message_type import MessageType
37
+ from ...types.agents.letta_response import LettaResponse
38
+ from ...types.agents.message_cancel_response import MessageCancelResponse
39
+ from ...types.agents.letta_streaming_response import LettaStreamingResponse
40
+ from ...types.agents.message_compact_response import MessageCompactResponse
41
+
42
+ __all__ = ["MessagesResource", "AsyncMessagesResource"]
43
+
44
+
45
+ class MessagesResource(SyncAPIResource):
46
+ @cached_property
47
+ def with_raw_response(self) -> MessagesResourceWithRawResponse:
48
+ """
49
+ This property can be used as a prefix for any HTTP method call to return
50
+ the raw response object instead of the parsed content.
51
+
52
+ For more information, see https://www.github.com/letta-ai/letta-python#accessing-raw-response-data-eg-headers
53
+ """
54
+ return MessagesResourceWithRawResponse(self)
55
+
56
+ @cached_property
57
+ def with_streaming_response(self) -> MessagesResourceWithStreamingResponse:
58
+ """
59
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
60
+
61
+ For more information, see https://www.github.com/letta-ai/letta-python#with_streaming_response
62
+ """
63
+ return MessagesResourceWithStreamingResponse(self)
64
+
65
+ @overload
66
+ def create(
67
+ self,
68
+ agent_id: str,
69
+ *,
70
+ assistant_message_tool_kwarg: str | Omit = omit,
71
+ assistant_message_tool_name: str | Omit = omit,
72
+ background: bool | Omit = omit,
73
+ client_tools: Optional[Iterable[message_create_params.ClientTool]] | Omit = omit,
74
+ enable_thinking: str | Omit = omit,
75
+ include_pings: bool | Omit = omit,
76
+ include_return_message_types: Optional[List[MessageType]] | Omit = omit,
77
+ input: Union[str, Iterable[message_create_params.InputUnionMember1], None] | Omit = omit,
78
+ max_steps: int | Omit = omit,
79
+ messages: Optional[Iterable[message_create_params.Message]] | Omit = omit,
80
+ override_model: Optional[str] | Omit = omit,
81
+ stream_tokens: bool | Omit = omit,
82
+ streaming: Literal[False] | Omit = omit,
83
+ use_assistant_message: bool | Omit = omit,
84
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
85
+ # The extra values given here take precedence over values defined on the client or passed to this method.
86
+ extra_headers: Headers | None = None,
87
+ extra_query: Query | None = None,
88
+ extra_body: Body | None = None,
89
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
90
+ ) -> LettaResponse:
91
+ """Process a user message and return the agent's response.
92
+
93
+ This endpoint accepts a
94
+ message from a user and processes it through the agent.
95
+
96
+ The response format is controlled by the `streaming` field in the request body:
97
+
98
+ - If `streaming=false` (default): Returns a complete LettaResponse with all
99
+ messages
100
+ - If `streaming=true`: Returns a Server-Sent Events (SSE) stream
101
+
102
+ Additional streaming options (only used when streaming=true):
103
+
104
+ - `stream_tokens`: Stream individual tokens instead of complete steps
105
+ - `include_pings`: Include keepalive pings to prevent connection timeouts
106
+ - `background`: Process the request in the background
107
+
108
+ Args:
109
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
110
+
111
+ assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
112
+ for legacy agent types, but deprecated for letta_v1_agent onward.
113
+
114
+ assistant_message_tool_name: The name of the designated message tool. Still supported for legacy agent types,
115
+ but deprecated for letta_v1_agent onward.
116
+
117
+ background: Whether to process the request in the background (only used when
118
+ streaming=true).
119
+
120
+ client_tools: Client-side tools that the agent can call. When the agent calls a client-side
121
+ tool, execution pauses and returns control to the client to execute the tool and
122
+ provide the result via a ToolReturn.
123
+
124
+ enable_thinking: If set to True, enables reasoning before responses or tool calls from the agent.
125
+
126
+ include_pings: Whether to include periodic keepalive ping messages in the stream to prevent
127
+ connection timeouts (only used when streaming=true).
128
+
129
+ include_return_message_types: Only return specified message types in the response. If `None` (default) returns
130
+ all messages.
131
+
132
+ input:
133
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
134
+ 'user', 'content': input}].
135
+
136
+ max_steps: Maximum number of steps the agent should take to process the request.
137
+
138
+ messages: The messages to be sent to the agent.
139
+
140
+ override_model: Model handle to use for this request instead of the agent's default model. This
141
+ allows sending a message to a different model without changing the agent's
142
+ configuration.
143
+
144
+ stream_tokens: Flag to determine if individual tokens should be streamed, rather than streaming
145
+ per step (only used when streaming=true).
146
+
147
+ streaming: If True, returns a streaming response (Server-Sent Events). If False (default),
148
+ returns a complete response.
149
+
150
+ use_assistant_message: Whether the server should parse specific tool call arguments (default
151
+ `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
152
+ types, but deprecated for letta_v1_agent onward.
153
+
154
+ extra_headers: Send extra headers
155
+
156
+ extra_query: Add additional query parameters to the request
157
+
158
+ extra_body: Add additional JSON properties to the request
159
+
160
+ timeout: Override the client-level default timeout for this request, in seconds
161
+ """
162
+ ...
163
+
164
+ @overload
165
+ def create(
166
+ self,
167
+ agent_id: str,
168
+ *,
169
+ streaming: Literal[True],
170
+ assistant_message_tool_kwarg: str | Omit = omit,
171
+ assistant_message_tool_name: str | Omit = omit,
172
+ background: bool | Omit = omit,
173
+ client_tools: Optional[Iterable[message_create_params.ClientTool]] | Omit = omit,
174
+ enable_thinking: str | Omit = omit,
175
+ include_pings: bool | Omit = omit,
176
+ include_return_message_types: Optional[List[MessageType]] | Omit = omit,
177
+ input: Union[str, Iterable[message_create_params.InputUnionMember1], None] | Omit = omit,
178
+ max_steps: int | Omit = omit,
179
+ messages: Optional[Iterable[message_create_params.Message]] | Omit = omit,
180
+ override_model: Optional[str] | Omit = omit,
181
+ stream_tokens: bool | Omit = omit,
182
+ use_assistant_message: bool | Omit = omit,
183
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
184
+ # The extra values given here take precedence over values defined on the client or passed to this method.
185
+ extra_headers: Headers | None = None,
186
+ extra_query: Query | None = None,
187
+ extra_body: Body | None = None,
188
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
189
+ ) -> Stream[LettaStreamingResponse]:
190
+ """Process a user message and return the agent's response.
191
+
192
+ This endpoint accepts a
193
+ message from a user and processes it through the agent.
194
+
195
+ The response format is controlled by the `streaming` field in the request body:
196
+
197
+ - If `streaming=false` (default): Returns a complete LettaResponse with all
198
+ messages
199
+ - If `streaming=true`: Returns a Server-Sent Events (SSE) stream
200
+
201
+ Additional streaming options (only used when streaming=true):
202
+
203
+ - `stream_tokens`: Stream individual tokens instead of complete steps
204
+ - `include_pings`: Include keepalive pings to prevent connection timeouts
205
+ - `background`: Process the request in the background
206
+
207
+ Args:
208
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
209
+
210
+ streaming: If True, returns a streaming response (Server-Sent Events). If False (default),
211
+ returns a complete response.
212
+
213
+ assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
214
+ for legacy agent types, but deprecated for letta_v1_agent onward.
215
+
216
+ assistant_message_tool_name: The name of the designated message tool. Still supported for legacy agent types,
217
+ but deprecated for letta_v1_agent onward.
218
+
219
+ background: Whether to process the request in the background (only used when
220
+ streaming=true).
221
+
222
+ client_tools: Client-side tools that the agent can call. When the agent calls a client-side
223
+ tool, execution pauses and returns control to the client to execute the tool and
224
+ provide the result via a ToolReturn.
225
+
226
+ enable_thinking: If set to True, enables reasoning before responses or tool calls from the agent.
227
+
228
+ include_pings: Whether to include periodic keepalive ping messages in the stream to prevent
229
+ connection timeouts (only used when streaming=true).
230
+
231
+ include_return_message_types: Only return specified message types in the response. If `None` (default) returns
232
+ all messages.
233
+
234
+ input:
235
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
236
+ 'user', 'content': input}].
237
+
238
+ max_steps: Maximum number of steps the agent should take to process the request.
239
+
240
+ messages: The messages to be sent to the agent.
241
+
242
+ override_model: Model handle to use for this request instead of the agent's default model. This
243
+ allows sending a message to a different model without changing the agent's
244
+ configuration.
245
+
246
+ stream_tokens: Flag to determine if individual tokens should be streamed, rather than streaming
247
+ per step (only used when streaming=true).
248
+
249
+ use_assistant_message: Whether the server should parse specific tool call arguments (default
250
+ `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
251
+ types, but deprecated for letta_v1_agent onward.
252
+
253
+ extra_headers: Send extra headers
254
+
255
+ extra_query: Add additional query parameters to the request
256
+
257
+ extra_body: Add additional JSON properties to the request
258
+
259
+ timeout: Override the client-level default timeout for this request, in seconds
260
+ """
261
+ ...
262
+
263
+ @overload
264
+ def create(
265
+ self,
266
+ agent_id: str,
267
+ *,
268
+ streaming: bool,
269
+ assistant_message_tool_kwarg: str | Omit = omit,
270
+ assistant_message_tool_name: str | Omit = omit,
271
+ background: bool | Omit = omit,
272
+ client_tools: Optional[Iterable[message_create_params.ClientTool]] | Omit = omit,
273
+ enable_thinking: str | Omit = omit,
274
+ include_pings: bool | Omit = omit,
275
+ include_return_message_types: Optional[List[MessageType]] | Omit = omit,
276
+ input: Union[str, Iterable[message_create_params.InputUnionMember1], None] | Omit = omit,
277
+ max_steps: int | Omit = omit,
278
+ messages: Optional[Iterable[message_create_params.Message]] | Omit = omit,
279
+ override_model: Optional[str] | Omit = omit,
280
+ stream_tokens: bool | Omit = omit,
281
+ use_assistant_message: bool | Omit = omit,
282
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
283
+ # The extra values given here take precedence over values defined on the client or passed to this method.
284
+ extra_headers: Headers | None = None,
285
+ extra_query: Query | None = None,
286
+ extra_body: Body | None = None,
287
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
288
+ ) -> LettaResponse | Stream[LettaStreamingResponse]:
289
+ """Process a user message and return the agent's response.
290
+
291
+ This endpoint accepts a
292
+ message from a user and processes it through the agent.
293
+
294
+ The response format is controlled by the `streaming` field in the request body:
295
+
296
+ - If `streaming=false` (default): Returns a complete LettaResponse with all
297
+ messages
298
+ - If `streaming=true`: Returns a Server-Sent Events (SSE) stream
299
+
300
+ Additional streaming options (only used when streaming=true):
301
+
302
+ - `stream_tokens`: Stream individual tokens instead of complete steps
303
+ - `include_pings`: Include keepalive pings to prevent connection timeouts
304
+ - `background`: Process the request in the background
305
+
306
+ Args:
307
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
308
+
309
+ streaming: If True, returns a streaming response (Server-Sent Events). If False (default),
310
+ returns a complete response.
311
+
312
+ assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
313
+ for legacy agent types, but deprecated for letta_v1_agent onward.
314
+
315
+ assistant_message_tool_name: The name of the designated message tool. Still supported for legacy agent types,
316
+ but deprecated for letta_v1_agent onward.
317
+
318
+ background: Whether to process the request in the background (only used when
319
+ streaming=true).
320
+
321
+ client_tools: Client-side tools that the agent can call. When the agent calls a client-side
322
+ tool, execution pauses and returns control to the client to execute the tool and
323
+ provide the result via a ToolReturn.
324
+
325
+ enable_thinking: If set to True, enables reasoning before responses or tool calls from the agent.
326
+
327
+ include_pings: Whether to include periodic keepalive ping messages in the stream to prevent
328
+ connection timeouts (only used when streaming=true).
329
+
330
+ include_return_message_types: Only return specified message types in the response. If `None` (default) returns
331
+ all messages.
332
+
333
+ input:
334
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
335
+ 'user', 'content': input}].
336
+
337
+ max_steps: Maximum number of steps the agent should take to process the request.
338
+
339
+ messages: The messages to be sent to the agent.
340
+
341
+ override_model: Model handle to use for this request instead of the agent's default model. This
342
+ allows sending a message to a different model without changing the agent's
343
+ configuration.
344
+
345
+ stream_tokens: Flag to determine if individual tokens should be streamed, rather than streaming
346
+ per step (only used when streaming=true).
347
+
348
+ use_assistant_message: Whether the server should parse specific tool call arguments (default
349
+ `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
350
+ types, but deprecated for letta_v1_agent onward.
351
+
352
+ extra_headers: Send extra headers
353
+
354
+ extra_query: Add additional query parameters to the request
355
+
356
+ extra_body: Add additional JSON properties to the request
357
+
358
+ timeout: Override the client-level default timeout for this request, in seconds
359
+ """
360
+ ...
361
+
362
+ def create(
363
+ self,
364
+ agent_id: str,
365
+ *,
366
+ assistant_message_tool_kwarg: str | Omit = omit,
367
+ assistant_message_tool_name: str | Omit = omit,
368
+ background: bool | Omit = omit,
369
+ client_tools: Optional[Iterable[message_create_params.ClientTool]] | Omit = omit,
370
+ enable_thinking: str | Omit = omit,
371
+ include_pings: bool | Omit = omit,
372
+ include_return_message_types: Optional[List[MessageType]] | Omit = omit,
373
+ input: Union[str, Iterable[message_create_params.InputUnionMember1], None] | Omit = omit,
374
+ max_steps: int | Omit = omit,
375
+ messages: Optional[Iterable[message_create_params.Message]] | Omit = omit,
376
+ override_model: Optional[str] | Omit = omit,
377
+ stream_tokens: bool | Omit = omit,
378
+ streaming: Literal[False] | Literal[True] | Omit = omit,
379
+ use_assistant_message: bool | Omit = omit,
380
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
381
+ # The extra values given here take precedence over values defined on the client or passed to this method.
382
+ extra_headers: Headers | None = None,
383
+ extra_query: Query | None = None,
384
+ extra_body: Body | None = None,
385
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
386
+ ) -> LettaResponse | Stream[LettaStreamingResponse]:
387
+ if not agent_id:
388
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
389
+ return self._post(
390
+ f"/v1/agents/{agent_id}/messages",
391
+ body=maybe_transform(
392
+ {
393
+ "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
394
+ "assistant_message_tool_name": assistant_message_tool_name,
395
+ "background": background,
396
+ "client_tools": client_tools,
397
+ "enable_thinking": enable_thinking,
398
+ "include_pings": include_pings,
399
+ "include_return_message_types": include_return_message_types,
400
+ "input": input,
401
+ "max_steps": max_steps,
402
+ "messages": messages,
403
+ "override_model": override_model,
404
+ "stream_tokens": stream_tokens,
405
+ "streaming": streaming,
406
+ "use_assistant_message": use_assistant_message,
407
+ },
408
+ message_create_params.MessageCreateParamsStreaming
409
+ if streaming
410
+ else message_create_params.MessageCreateParamsNonStreaming,
411
+ ),
412
+ options=make_request_options(
413
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
414
+ ),
415
+ cast_to=LettaResponse,
416
+ stream=streaming or False,
417
+ stream_cls=Stream[LettaStreamingResponse],
418
+ )
419
+
420
+ def list(
421
+ self,
422
+ agent_id: str,
423
+ *,
424
+ after: Optional[str] | Omit = omit,
425
+ assistant_message_tool_kwarg: str | Omit = omit,
426
+ assistant_message_tool_name: str | Omit = omit,
427
+ before: Optional[str] | Omit = omit,
428
+ conversation_id: Optional[str] | Omit = omit,
429
+ group_id: Optional[str] | Omit = omit,
430
+ include_err: Optional[bool] | Omit = omit,
431
+ limit: Optional[int] | Omit = omit,
432
+ order: Literal["asc", "desc"] | Omit = omit,
433
+ order_by: Literal["created_at"] | Omit = omit,
434
+ use_assistant_message: bool | Omit = omit,
435
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
436
+ # The extra values given here take precedence over values defined on the client or passed to this method.
437
+ extra_headers: Headers | None = None,
438
+ extra_query: Query | None = None,
439
+ extra_body: Body | None = None,
440
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
441
+ ) -> SyncArrayPage[Message]:
442
+ """
443
+ Retrieve message history for an agent.
444
+
445
+ Args:
446
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
447
+
448
+ after: Message ID cursor for pagination. Returns messages that come after this message
449
+ ID in the specified sort order
450
+
451
+ assistant_message_tool_kwarg: The name of the message argument.
452
+
453
+ assistant_message_tool_name: The name of the designated message tool.
454
+
455
+ before: Message ID cursor for pagination. Returns messages that come before this message
456
+ ID in the specified sort order
457
+
458
+ conversation_id: Conversation ID to filter messages by.
459
+
460
+ group_id: Group ID to filter messages by.
461
+
462
+ include_err: Whether to include error messages and error statuses. For debugging purposes
463
+ only.
464
+
465
+ limit: Maximum number of messages to return
466
+
467
+ order: Sort order for messages by creation time. 'asc' for oldest first, 'desc' for
468
+ newest first
469
+
470
+ order_by: Field to sort by
471
+
472
+ use_assistant_message: Whether to use assistant messages
473
+
474
+ extra_headers: Send extra headers
475
+
476
+ extra_query: Add additional query parameters to the request
477
+
478
+ extra_body: Add additional JSON properties to the request
479
+
480
+ timeout: Override the client-level default timeout for this request, in seconds
481
+ """
482
+ if not agent_id:
483
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
484
+ return self._get_api_list(
485
+ f"/v1/agents/{agent_id}/messages",
486
+ page=SyncArrayPage[Message],
487
+ options=make_request_options(
488
+ extra_headers=extra_headers,
489
+ extra_query=extra_query,
490
+ extra_body=extra_body,
491
+ timeout=timeout,
492
+ query=maybe_transform(
493
+ {
494
+ "after": after,
495
+ "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
496
+ "assistant_message_tool_name": assistant_message_tool_name,
497
+ "before": before,
498
+ "conversation_id": conversation_id,
499
+ "group_id": group_id,
500
+ "include_err": include_err,
501
+ "limit": limit,
502
+ "order": order,
503
+ "order_by": order_by,
504
+ "use_assistant_message": use_assistant_message,
505
+ },
506
+ message_list_params.MessageListParams,
507
+ ),
508
+ ),
509
+ model=cast(Any, Message), # Union types cannot be passed in as arguments in the type system
510
+ )
511
+
512
+ def cancel(
513
+ self,
514
+ agent_id: str,
515
+ *,
516
+ run_ids: Optional[SequenceNotStr[str]] | Omit = omit,
517
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
518
+ # The extra values given here take precedence over values defined on the client or passed to this method.
519
+ extra_headers: Headers | None = None,
520
+ extra_query: Query | None = None,
521
+ extra_body: Body | None = None,
522
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
523
+ ) -> MessageCancelResponse:
524
+ """Cancel runs associated with an agent.
525
+
526
+ If run_ids are passed in, cancel those in
527
+ particular.
528
+
529
+ Note to cancel active runs associated with an agent, redis is required.
530
+
531
+ Args:
532
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
533
+
534
+ run_ids: Optional list of run IDs to cancel
535
+
536
+ extra_headers: Send extra headers
537
+
538
+ extra_query: Add additional query parameters to the request
539
+
540
+ extra_body: Add additional JSON properties to the request
541
+
542
+ timeout: Override the client-level default timeout for this request, in seconds
543
+ """
544
+ if not agent_id:
545
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
546
+ return self._post(
547
+ f"/v1/agents/{agent_id}/messages/cancel",
548
+ body=maybe_transform({"run_ids": run_ids}, message_cancel_params.MessageCancelParams),
549
+ options=make_request_options(
550
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
551
+ ),
552
+ cast_to=MessageCancelResponse,
553
+ )
554
+
555
+ def compact(
556
+ self,
557
+ agent_id: str,
558
+ *,
559
+ compaction_settings: Optional[message_compact_params.CompactionSettings] | Omit = omit,
560
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
561
+ # The extra values given here take precedence over values defined on the client or passed to this method.
562
+ extra_headers: Headers | None = None,
563
+ extra_query: Query | None = None,
564
+ extra_body: Body | None = None,
565
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
566
+ ) -> MessageCompactResponse:
567
+ """
568
+ Summarize an agent's conversation history.
569
+
570
+ Args:
571
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
572
+
573
+ compaction_settings: Configuration for conversation compaction / summarization.
574
+
575
+ `model` is the only required user-facing field – it specifies the summarizer
576
+ model handle (e.g. `"openai/gpt-4o-mini"`). Per-model settings (temperature, max
577
+ tokens, etc.) are derived from the default configuration for that handle.
578
+
579
+ extra_headers: Send extra headers
580
+
581
+ extra_query: Add additional query parameters to the request
582
+
583
+ extra_body: Add additional JSON properties to the request
584
+
585
+ timeout: Override the client-level default timeout for this request, in seconds
586
+ """
587
+ if not agent_id:
588
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
589
+ return self._post(
590
+ f"/v1/agents/{agent_id}/summarize",
591
+ body=maybe_transform(
592
+ {"compaction_settings": compaction_settings}, message_compact_params.MessageCompactParams
593
+ ),
594
+ options=make_request_options(
595
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
596
+ ),
597
+ cast_to=MessageCompactResponse,
598
+ )
599
+
600
+ def create_async(
601
+ self,
602
+ agent_id: str,
603
+ *,
604
+ assistant_message_tool_kwarg: str | Omit = omit,
605
+ assistant_message_tool_name: str | Omit = omit,
606
+ callback_url: Optional[str] | Omit = omit,
607
+ client_tools: Optional[Iterable[message_create_async_params.ClientTool]] | Omit = omit,
608
+ enable_thinking: str | Omit = omit,
609
+ include_return_message_types: Optional[List[MessageType]] | Omit = omit,
610
+ input: Union[str, Iterable[message_create_async_params.InputUnionMember1], None] | Omit = omit,
611
+ max_steps: int | Omit = omit,
612
+ messages: Optional[Iterable[message_create_async_params.Message]] | Omit = omit,
613
+ override_model: Optional[str] | Omit = omit,
614
+ use_assistant_message: bool | Omit = omit,
615
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
616
+ # The extra values given here take precedence over values defined on the client or passed to this method.
617
+ extra_headers: Headers | None = None,
618
+ extra_query: Query | None = None,
619
+ extra_body: Body | None = None,
620
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
621
+ ) -> Run:
622
+ """Asynchronously process a user message and return a run object.
623
+
624
+ The actual
625
+ processing happens in the background, and the status can be checked using the
626
+ run ID.
627
+
628
+ This is "asynchronous" in the sense that it's a background run and explicitly
629
+ must be fetched by the run ID.
630
+
631
+ Args:
632
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
633
+
634
+ assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
635
+ for legacy agent types, but deprecated for letta_v1_agent onward.
636
+
637
+ assistant_message_tool_name: The name of the designated message tool. Still supported for legacy agent types,
638
+ but deprecated for letta_v1_agent onward.
639
+
640
+ callback_url: Optional callback URL to POST to when the job completes
641
+
642
+ client_tools: Client-side tools that the agent can call. When the agent calls a client-side
643
+ tool, execution pauses and returns control to the client to execute the tool and
644
+ provide the result via a ToolReturn.
645
+
646
+ enable_thinking: If set to True, enables reasoning before responses or tool calls from the agent.
647
+
648
+ include_return_message_types: Only return specified message types in the response. If `None` (default) returns
649
+ all messages.
650
+
651
+ input:
652
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
653
+ 'user', 'content': input}].
654
+
655
+ max_steps: Maximum number of steps the agent should take to process the request.
656
+
657
+ messages: The messages to be sent to the agent.
658
+
659
+ override_model: Model handle to use for this request instead of the agent's default model. This
660
+ allows sending a message to a different model without changing the agent's
661
+ configuration.
662
+
663
+ use_assistant_message: Whether the server should parse specific tool call arguments (default
664
+ `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
665
+ types, but deprecated for letta_v1_agent onward.
666
+
667
+ extra_headers: Send extra headers
668
+
669
+ extra_query: Add additional query parameters to the request
670
+
671
+ extra_body: Add additional JSON properties to the request
672
+
673
+ timeout: Override the client-level default timeout for this request, in seconds
674
+ """
675
+ if not agent_id:
676
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
677
+ return self._post(
678
+ f"/v1/agents/{agent_id}/messages/async",
679
+ body=maybe_transform(
680
+ {
681
+ "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
682
+ "assistant_message_tool_name": assistant_message_tool_name,
683
+ "callback_url": callback_url,
684
+ "client_tools": client_tools,
685
+ "enable_thinking": enable_thinking,
686
+ "include_return_message_types": include_return_message_types,
687
+ "input": input,
688
+ "max_steps": max_steps,
689
+ "messages": messages,
690
+ "override_model": override_model,
691
+ "use_assistant_message": use_assistant_message,
692
+ },
693
+ message_create_async_params.MessageCreateAsyncParams,
694
+ ),
695
+ options=make_request_options(
696
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
697
+ ),
698
+ cast_to=Run,
699
+ )
700
+
701
+ def reset(
702
+ self,
703
+ agent_id: str,
704
+ *,
705
+ add_default_initial_messages: bool | Omit = omit,
706
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
707
+ # The extra values given here take precedence over values defined on the client or passed to this method.
708
+ extra_headers: Headers | None = None,
709
+ extra_query: Query | None = None,
710
+ extra_body: Body | None = None,
711
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
712
+ ) -> Optional[AgentState]:
713
+ """
714
+ Resets the messages for an agent
715
+
716
+ Args:
717
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
718
+
719
+ add_default_initial_messages: If true, adds the default initial messages after resetting.
720
+
721
+ extra_headers: Send extra headers
722
+
723
+ extra_query: Add additional query parameters to the request
724
+
725
+ extra_body: Add additional JSON properties to the request
726
+
727
+ timeout: Override the client-level default timeout for this request, in seconds
728
+ """
729
+ if not agent_id:
730
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
731
+ return self._patch(
732
+ f"/v1/agents/{agent_id}/reset-messages",
733
+ body=maybe_transform(
734
+ {"add_default_initial_messages": add_default_initial_messages}, message_reset_params.MessageResetParams
735
+ ),
736
+ options=make_request_options(
737
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
738
+ ),
739
+ cast_to=AgentState,
740
+ )
741
+
742
+ @typing_extensions.deprecated("deprecated")
743
+ def stream(
744
+ self,
745
+ agent_id: str,
746
+ *,
747
+ assistant_message_tool_kwarg: str | Omit = omit,
748
+ assistant_message_tool_name: str | Omit = omit,
749
+ background: bool | Omit = omit,
750
+ client_tools: Optional[Iterable[message_stream_params.ClientTool]] | Omit = omit,
751
+ enable_thinking: str | Omit = omit,
752
+ include_pings: bool | Omit = omit,
753
+ include_return_message_types: Optional[List[MessageType]] | Omit = omit,
754
+ input: Union[str, Iterable[message_stream_params.InputUnionMember1], None] | Omit = omit,
755
+ max_steps: int | Omit = omit,
756
+ messages: Optional[Iterable[message_stream_params.Message]] | Omit = omit,
757
+ override_model: Optional[str] | Omit = omit,
758
+ stream_tokens: bool | Omit = omit,
759
+ streaming: bool | Omit = omit,
760
+ use_assistant_message: bool | Omit = omit,
761
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
762
+ # The extra values given here take precedence over values defined on the client or passed to this method.
763
+ extra_headers: Headers | None = None,
764
+ extra_query: Query | None = None,
765
+ extra_body: Body | None = None,
766
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
767
+ ) -> Stream[LettaStreamingResponse]:
768
+ """
769
+ Process a user message and return the agent's response.
770
+
771
+ Deprecated: Use the `POST /{agent_id}/messages` endpoint with `streaming=true`
772
+ in the request body instead.
773
+
774
+ This endpoint accepts a message from a user and processes it through the agent.
775
+ It will stream the steps of the response always, and stream the tokens if
776
+ 'stream_tokens' is set to True.
777
+
778
+ Args:
779
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
780
+
781
+ assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
782
+ for legacy agent types, but deprecated for letta_v1_agent onward.
783
+
784
+ assistant_message_tool_name: The name of the designated message tool. Still supported for legacy agent types,
785
+ but deprecated for letta_v1_agent onward.
786
+
787
+ background: Whether to process the request in the background (only used when
788
+ streaming=true).
789
+
790
+ client_tools: Client-side tools that the agent can call. When the agent calls a client-side
791
+ tool, execution pauses and returns control to the client to execute the tool and
792
+ provide the result via a ToolReturn.
793
+
794
+ enable_thinking: If set to True, enables reasoning before responses or tool calls from the agent.
795
+
796
+ include_pings: Whether to include periodic keepalive ping messages in the stream to prevent
797
+ connection timeouts (only used when streaming=true).
798
+
799
+ include_return_message_types: Only return specified message types in the response. If `None` (default) returns
800
+ all messages.
801
+
802
+ input:
803
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
804
+ 'user', 'content': input}].
805
+
806
+ max_steps: Maximum number of steps the agent should take to process the request.
807
+
808
+ messages: The messages to be sent to the agent.
809
+
810
+ override_model: Model handle to use for this request instead of the agent's default model. This
811
+ allows sending a message to a different model without changing the agent's
812
+ configuration.
813
+
814
+ stream_tokens: Flag to determine if individual tokens should be streamed, rather than streaming
815
+ per step (only used when streaming=true).
816
+
817
+ streaming: If True, returns a streaming response (Server-Sent Events). If False (default),
818
+ returns a complete response.
819
+
820
+ use_assistant_message: Whether the server should parse specific tool call arguments (default
821
+ `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
822
+ types, but deprecated for letta_v1_agent onward.
823
+
824
+ extra_headers: Send extra headers
825
+
826
+ extra_query: Add additional query parameters to the request
827
+
828
+ extra_body: Add additional JSON properties to the request
829
+
830
+ timeout: Override the client-level default timeout for this request, in seconds
831
+ """
832
+ if not agent_id:
833
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
834
+ return self._post(
835
+ f"/v1/agents/{agent_id}/messages/stream",
836
+ body=maybe_transform(
837
+ {
838
+ "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
839
+ "assistant_message_tool_name": assistant_message_tool_name,
840
+ "background": background,
841
+ "client_tools": client_tools,
842
+ "enable_thinking": enable_thinking,
843
+ "include_pings": include_pings,
844
+ "include_return_message_types": include_return_message_types,
845
+ "input": input,
846
+ "max_steps": max_steps,
847
+ "messages": messages,
848
+ "override_model": override_model,
849
+ "stream_tokens": stream_tokens,
850
+ "streaming": streaming,
851
+ "use_assistant_message": use_assistant_message,
852
+ },
853
+ message_stream_params.MessageStreamParams,
854
+ ),
855
+ options=make_request_options(
856
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
857
+ ),
858
+ cast_to=cast(
859
+ Any, LettaStreamingResponse
860
+ ), # Union types cannot be passed in as arguments in the type system
861
+ stream=True,
862
+ stream_cls=Stream[LettaStreamingResponse],
863
+ )
864
+
865
+
866
+ class AsyncMessagesResource(AsyncAPIResource):
867
+ @cached_property
868
+ def with_raw_response(self) -> AsyncMessagesResourceWithRawResponse:
869
+ """
870
+ This property can be used as a prefix for any HTTP method call to return
871
+ the raw response object instead of the parsed content.
872
+
873
+ For more information, see https://www.github.com/letta-ai/letta-python#accessing-raw-response-data-eg-headers
874
+ """
875
+ return AsyncMessagesResourceWithRawResponse(self)
876
+
877
+ @cached_property
878
+ def with_streaming_response(self) -> AsyncMessagesResourceWithStreamingResponse:
879
+ """
880
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
881
+
882
+ For more information, see https://www.github.com/letta-ai/letta-python#with_streaming_response
883
+ """
884
+ return AsyncMessagesResourceWithStreamingResponse(self)
885
+
886
+ @overload
887
+ async def create(
888
+ self,
889
+ agent_id: str,
890
+ *,
891
+ assistant_message_tool_kwarg: str | Omit = omit,
892
+ assistant_message_tool_name: str | Omit = omit,
893
+ background: bool | Omit = omit,
894
+ client_tools: Optional[Iterable[message_create_params.ClientTool]] | Omit = omit,
895
+ enable_thinking: str | Omit = omit,
896
+ include_pings: bool | Omit = omit,
897
+ include_return_message_types: Optional[List[MessageType]] | Omit = omit,
898
+ input: Union[str, Iterable[message_create_params.InputUnionMember1], None] | Omit = omit,
899
+ max_steps: int | Omit = omit,
900
+ messages: Optional[Iterable[message_create_params.Message]] | Omit = omit,
901
+ override_model: Optional[str] | Omit = omit,
902
+ stream_tokens: bool | Omit = omit,
903
+ streaming: Literal[False] | Omit = omit,
904
+ use_assistant_message: bool | Omit = omit,
905
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
906
+ # The extra values given here take precedence over values defined on the client or passed to this method.
907
+ extra_headers: Headers | None = None,
908
+ extra_query: Query | None = None,
909
+ extra_body: Body | None = None,
910
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
911
+ ) -> LettaResponse:
912
+ """Process a user message and return the agent's response.
913
+
914
+ This endpoint accepts a
915
+ message from a user and processes it through the agent.
916
+
917
+ The response format is controlled by the `streaming` field in the request body:
918
+
919
+ - If `streaming=false` (default): Returns a complete LettaResponse with all
920
+ messages
921
+ - If `streaming=true`: Returns a Server-Sent Events (SSE) stream
922
+
923
+ Additional streaming options (only used when streaming=true):
924
+
925
+ - `stream_tokens`: Stream individual tokens instead of complete steps
926
+ - `include_pings`: Include keepalive pings to prevent connection timeouts
927
+ - `background`: Process the request in the background
928
+
929
+ Args:
930
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
931
+
932
+ assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
933
+ for legacy agent types, but deprecated for letta_v1_agent onward.
934
+
935
+ assistant_message_tool_name: The name of the designated message tool. Still supported for legacy agent types,
936
+ but deprecated for letta_v1_agent onward.
937
+
938
+ background: Whether to process the request in the background (only used when
939
+ streaming=true).
940
+
941
+ client_tools: Client-side tools that the agent can call. When the agent calls a client-side
942
+ tool, execution pauses and returns control to the client to execute the tool and
943
+ provide the result via a ToolReturn.
944
+
945
+ enable_thinking: If set to True, enables reasoning before responses or tool calls from the agent.
946
+
947
+ include_pings: Whether to include periodic keepalive ping messages in the stream to prevent
948
+ connection timeouts (only used when streaming=true).
949
+
950
+ include_return_message_types: Only return specified message types in the response. If `None` (default) returns
951
+ all messages.
952
+
953
+ input:
954
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
955
+ 'user', 'content': input}].
956
+
957
+ max_steps: Maximum number of steps the agent should take to process the request.
958
+
959
+ messages: The messages to be sent to the agent.
960
+
961
+ override_model: Model handle to use for this request instead of the agent's default model. This
962
+ allows sending a message to a different model without changing the agent's
963
+ configuration.
964
+
965
+ stream_tokens: Flag to determine if individual tokens should be streamed, rather than streaming
966
+ per step (only used when streaming=true).
967
+
968
+ streaming: If True, returns a streaming response (Server-Sent Events). If False (default),
969
+ returns a complete response.
970
+
971
+ use_assistant_message: Whether the server should parse specific tool call arguments (default
972
+ `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
973
+ types, but deprecated for letta_v1_agent onward.
974
+
975
+ extra_headers: Send extra headers
976
+
977
+ extra_query: Add additional query parameters to the request
978
+
979
+ extra_body: Add additional JSON properties to the request
980
+
981
+ timeout: Override the client-level default timeout for this request, in seconds
982
+ """
983
+ ...
984
+
985
+ @overload
986
+ async def create(
987
+ self,
988
+ agent_id: str,
989
+ *,
990
+ streaming: Literal[True],
991
+ assistant_message_tool_kwarg: str | Omit = omit,
992
+ assistant_message_tool_name: str | Omit = omit,
993
+ background: bool | Omit = omit,
994
+ client_tools: Optional[Iterable[message_create_params.ClientTool]] | Omit = omit,
995
+ enable_thinking: str | Omit = omit,
996
+ include_pings: bool | Omit = omit,
997
+ include_return_message_types: Optional[List[MessageType]] | Omit = omit,
998
+ input: Union[str, Iterable[message_create_params.InputUnionMember1], None] | Omit = omit,
999
+ max_steps: int | Omit = omit,
1000
+ messages: Optional[Iterable[message_create_params.Message]] | Omit = omit,
1001
+ override_model: Optional[str] | Omit = omit,
1002
+ stream_tokens: bool | Omit = omit,
1003
+ use_assistant_message: bool | Omit = omit,
1004
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1005
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1006
+ extra_headers: Headers | None = None,
1007
+ extra_query: Query | None = None,
1008
+ extra_body: Body | None = None,
1009
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1010
+ ) -> AsyncStream[LettaStreamingResponse]:
1011
+ """Process a user message and return the agent's response.
1012
+
1013
+ This endpoint accepts a
1014
+ message from a user and processes it through the agent.
1015
+
1016
+ The response format is controlled by the `streaming` field in the request body:
1017
+
1018
+ - If `streaming=false` (default): Returns a complete LettaResponse with all
1019
+ messages
1020
+ - If `streaming=true`: Returns a Server-Sent Events (SSE) stream
1021
+
1022
+ Additional streaming options (only used when streaming=true):
1023
+
1024
+ - `stream_tokens`: Stream individual tokens instead of complete steps
1025
+ - `include_pings`: Include keepalive pings to prevent connection timeouts
1026
+ - `background`: Process the request in the background
1027
+
1028
+ Args:
1029
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
1030
+
1031
+ streaming: If True, returns a streaming response (Server-Sent Events). If False (default),
1032
+ returns a complete response.
1033
+
1034
+ assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
1035
+ for legacy agent types, but deprecated for letta_v1_agent onward.
1036
+
1037
+ assistant_message_tool_name: The name of the designated message tool. Still supported for legacy agent types,
1038
+ but deprecated for letta_v1_agent onward.
1039
+
1040
+ background: Whether to process the request in the background (only used when
1041
+ streaming=true).
1042
+
1043
+ client_tools: Client-side tools that the agent can call. When the agent calls a client-side
1044
+ tool, execution pauses and returns control to the client to execute the tool and
1045
+ provide the result via a ToolReturn.
1046
+
1047
+ enable_thinking: If set to True, enables reasoning before responses or tool calls from the agent.
1048
+
1049
+ include_pings: Whether to include periodic keepalive ping messages in the stream to prevent
1050
+ connection timeouts (only used when streaming=true).
1051
+
1052
+ include_return_message_types: Only return specified message types in the response. If `None` (default) returns
1053
+ all messages.
1054
+
1055
+ input:
1056
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
1057
+ 'user', 'content': input}].
1058
+
1059
+ max_steps: Maximum number of steps the agent should take to process the request.
1060
+
1061
+ messages: The messages to be sent to the agent.
1062
+
1063
+ override_model: Model handle to use for this request instead of the agent's default model. This
1064
+ allows sending a message to a different model without changing the agent's
1065
+ configuration.
1066
+
1067
+ stream_tokens: Flag to determine if individual tokens should be streamed, rather than streaming
1068
+ per step (only used when streaming=true).
1069
+
1070
+ use_assistant_message: Whether the server should parse specific tool call arguments (default
1071
+ `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
1072
+ types, but deprecated for letta_v1_agent onward.
1073
+
1074
+ extra_headers: Send extra headers
1075
+
1076
+ extra_query: Add additional query parameters to the request
1077
+
1078
+ extra_body: Add additional JSON properties to the request
1079
+
1080
+ timeout: Override the client-level default timeout for this request, in seconds
1081
+ """
1082
+ ...
1083
+
1084
+ @overload
1085
+ async def create(
1086
+ self,
1087
+ agent_id: str,
1088
+ *,
1089
+ streaming: bool,
1090
+ assistant_message_tool_kwarg: str | Omit = omit,
1091
+ assistant_message_tool_name: str | Omit = omit,
1092
+ background: bool | Omit = omit,
1093
+ client_tools: Optional[Iterable[message_create_params.ClientTool]] | Omit = omit,
1094
+ enable_thinking: str | Omit = omit,
1095
+ include_pings: bool | Omit = omit,
1096
+ include_return_message_types: Optional[List[MessageType]] | Omit = omit,
1097
+ input: Union[str, Iterable[message_create_params.InputUnionMember1], None] | Omit = omit,
1098
+ max_steps: int | Omit = omit,
1099
+ messages: Optional[Iterable[message_create_params.Message]] | Omit = omit,
1100
+ override_model: Optional[str] | Omit = omit,
1101
+ stream_tokens: bool | Omit = omit,
1102
+ use_assistant_message: bool | Omit = omit,
1103
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1104
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1105
+ extra_headers: Headers | None = None,
1106
+ extra_query: Query | None = None,
1107
+ extra_body: Body | None = None,
1108
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1109
+ ) -> LettaResponse | AsyncStream[LettaStreamingResponse]:
1110
+ """Process a user message and return the agent's response.
1111
+
1112
+ This endpoint accepts a
1113
+ message from a user and processes it through the agent.
1114
+
1115
+ The response format is controlled by the `streaming` field in the request body:
1116
+
1117
+ - If `streaming=false` (default): Returns a complete LettaResponse with all
1118
+ messages
1119
+ - If `streaming=true`: Returns a Server-Sent Events (SSE) stream
1120
+
1121
+ Additional streaming options (only used when streaming=true):
1122
+
1123
+ - `stream_tokens`: Stream individual tokens instead of complete steps
1124
+ - `include_pings`: Include keepalive pings to prevent connection timeouts
1125
+ - `background`: Process the request in the background
1126
+
1127
+ Args:
1128
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
1129
+
1130
+ streaming: If True, returns a streaming response (Server-Sent Events). If False (default),
1131
+ returns a complete response.
1132
+
1133
+ assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
1134
+ for legacy agent types, but deprecated for letta_v1_agent onward.
1135
+
1136
+ assistant_message_tool_name: The name of the designated message tool. Still supported for legacy agent types,
1137
+ but deprecated for letta_v1_agent onward.
1138
+
1139
+ background: Whether to process the request in the background (only used when
1140
+ streaming=true).
1141
+
1142
+ client_tools: Client-side tools that the agent can call. When the agent calls a client-side
1143
+ tool, execution pauses and returns control to the client to execute the tool and
1144
+ provide the result via a ToolReturn.
1145
+
1146
+ enable_thinking: If set to True, enables reasoning before responses or tool calls from the agent.
1147
+
1148
+ include_pings: Whether to include periodic keepalive ping messages in the stream to prevent
1149
+ connection timeouts (only used when streaming=true).
1150
+
1151
+ include_return_message_types: Only return specified message types in the response. If `None` (default) returns
1152
+ all messages.
1153
+
1154
+ input:
1155
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
1156
+ 'user', 'content': input}].
1157
+
1158
+ max_steps: Maximum number of steps the agent should take to process the request.
1159
+
1160
+ messages: The messages to be sent to the agent.
1161
+
1162
+ override_model: Model handle to use for this request instead of the agent's default model. This
1163
+ allows sending a message to a different model without changing the agent's
1164
+ configuration.
1165
+
1166
+ stream_tokens: Flag to determine if individual tokens should be streamed, rather than streaming
1167
+ per step (only used when streaming=true).
1168
+
1169
+ use_assistant_message: Whether the server should parse specific tool call arguments (default
1170
+ `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
1171
+ types, but deprecated for letta_v1_agent onward.
1172
+
1173
+ extra_headers: Send extra headers
1174
+
1175
+ extra_query: Add additional query parameters to the request
1176
+
1177
+ extra_body: Add additional JSON properties to the request
1178
+
1179
+ timeout: Override the client-level default timeout for this request, in seconds
1180
+ """
1181
+ ...
1182
+
1183
+ async def create(
1184
+ self,
1185
+ agent_id: str,
1186
+ *,
1187
+ assistant_message_tool_kwarg: str | Omit = omit,
1188
+ assistant_message_tool_name: str | Omit = omit,
1189
+ background: bool | Omit = omit,
1190
+ client_tools: Optional[Iterable[message_create_params.ClientTool]] | Omit = omit,
1191
+ enable_thinking: str | Omit = omit,
1192
+ include_pings: bool | Omit = omit,
1193
+ include_return_message_types: Optional[List[MessageType]] | Omit = omit,
1194
+ input: Union[str, Iterable[message_create_params.InputUnionMember1], None] | Omit = omit,
1195
+ max_steps: int | Omit = omit,
1196
+ messages: Optional[Iterable[message_create_params.Message]] | Omit = omit,
1197
+ override_model: Optional[str] | Omit = omit,
1198
+ stream_tokens: bool | Omit = omit,
1199
+ streaming: Literal[False] | Literal[True] | Omit = omit,
1200
+ use_assistant_message: bool | Omit = omit,
1201
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1202
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1203
+ extra_headers: Headers | None = None,
1204
+ extra_query: Query | None = None,
1205
+ extra_body: Body | None = None,
1206
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1207
+ ) -> LettaResponse | AsyncStream[LettaStreamingResponse]:
1208
+ if not agent_id:
1209
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
1210
+ return await self._post(
1211
+ f"/v1/agents/{agent_id}/messages",
1212
+ body=await async_maybe_transform(
1213
+ {
1214
+ "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
1215
+ "assistant_message_tool_name": assistant_message_tool_name,
1216
+ "background": background,
1217
+ "client_tools": client_tools,
1218
+ "enable_thinking": enable_thinking,
1219
+ "include_pings": include_pings,
1220
+ "include_return_message_types": include_return_message_types,
1221
+ "input": input,
1222
+ "max_steps": max_steps,
1223
+ "messages": messages,
1224
+ "override_model": override_model,
1225
+ "stream_tokens": stream_tokens,
1226
+ "streaming": streaming,
1227
+ "use_assistant_message": use_assistant_message,
1228
+ },
1229
+ message_create_params.MessageCreateParamsStreaming
1230
+ if streaming
1231
+ else message_create_params.MessageCreateParamsNonStreaming,
1232
+ ),
1233
+ options=make_request_options(
1234
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1235
+ ),
1236
+ cast_to=LettaResponse,
1237
+ stream=streaming or False,
1238
+ stream_cls=AsyncStream[LettaStreamingResponse],
1239
+ )
1240
+
1241
+ def list(
1242
+ self,
1243
+ agent_id: str,
1244
+ *,
1245
+ after: Optional[str] | Omit = omit,
1246
+ assistant_message_tool_kwarg: str | Omit = omit,
1247
+ assistant_message_tool_name: str | Omit = omit,
1248
+ before: Optional[str] | Omit = omit,
1249
+ conversation_id: Optional[str] | Omit = omit,
1250
+ group_id: Optional[str] | Omit = omit,
1251
+ include_err: Optional[bool] | Omit = omit,
1252
+ limit: Optional[int] | Omit = omit,
1253
+ order: Literal["asc", "desc"] | Omit = omit,
1254
+ order_by: Literal["created_at"] | Omit = omit,
1255
+ use_assistant_message: bool | Omit = omit,
1256
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1257
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1258
+ extra_headers: Headers | None = None,
1259
+ extra_query: Query | None = None,
1260
+ extra_body: Body | None = None,
1261
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1262
+ ) -> AsyncPaginator[Message, AsyncArrayPage[Message]]:
1263
+ """
1264
+ Retrieve message history for an agent.
1265
+
1266
+ Args:
1267
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
1268
+
1269
+ after: Message ID cursor for pagination. Returns messages that come after this message
1270
+ ID in the specified sort order
1271
+
1272
+ assistant_message_tool_kwarg: The name of the message argument.
1273
+
1274
+ assistant_message_tool_name: The name of the designated message tool.
1275
+
1276
+ before: Message ID cursor for pagination. Returns messages that come before this message
1277
+ ID in the specified sort order
1278
+
1279
+ conversation_id: Conversation ID to filter messages by.
1280
+
1281
+ group_id: Group ID to filter messages by.
1282
+
1283
+ include_err: Whether to include error messages and error statuses. For debugging purposes
1284
+ only.
1285
+
1286
+ limit: Maximum number of messages to return
1287
+
1288
+ order: Sort order for messages by creation time. 'asc' for oldest first, 'desc' for
1289
+ newest first
1290
+
1291
+ order_by: Field to sort by
1292
+
1293
+ use_assistant_message: Whether to use assistant messages
1294
+
1295
+ extra_headers: Send extra headers
1296
+
1297
+ extra_query: Add additional query parameters to the request
1298
+
1299
+ extra_body: Add additional JSON properties to the request
1300
+
1301
+ timeout: Override the client-level default timeout for this request, in seconds
1302
+ """
1303
+ if not agent_id:
1304
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
1305
+ return self._get_api_list(
1306
+ f"/v1/agents/{agent_id}/messages",
1307
+ page=AsyncArrayPage[Message],
1308
+ options=make_request_options(
1309
+ extra_headers=extra_headers,
1310
+ extra_query=extra_query,
1311
+ extra_body=extra_body,
1312
+ timeout=timeout,
1313
+ query=maybe_transform(
1314
+ {
1315
+ "after": after,
1316
+ "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
1317
+ "assistant_message_tool_name": assistant_message_tool_name,
1318
+ "before": before,
1319
+ "conversation_id": conversation_id,
1320
+ "group_id": group_id,
1321
+ "include_err": include_err,
1322
+ "limit": limit,
1323
+ "order": order,
1324
+ "order_by": order_by,
1325
+ "use_assistant_message": use_assistant_message,
1326
+ },
1327
+ message_list_params.MessageListParams,
1328
+ ),
1329
+ ),
1330
+ model=cast(Any, Message), # Union types cannot be passed in as arguments in the type system
1331
+ )
1332
+
1333
+ async def cancel(
1334
+ self,
1335
+ agent_id: str,
1336
+ *,
1337
+ run_ids: Optional[SequenceNotStr[str]] | Omit = omit,
1338
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1339
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1340
+ extra_headers: Headers | None = None,
1341
+ extra_query: Query | None = None,
1342
+ extra_body: Body | None = None,
1343
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1344
+ ) -> MessageCancelResponse:
1345
+ """Cancel runs associated with an agent.
1346
+
1347
+ If run_ids are passed in, cancel those in
1348
+ particular.
1349
+
1350
+ Note to cancel active runs associated with an agent, redis is required.
1351
+
1352
+ Args:
1353
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
1354
+
1355
+ run_ids: Optional list of run IDs to cancel
1356
+
1357
+ extra_headers: Send extra headers
1358
+
1359
+ extra_query: Add additional query parameters to the request
1360
+
1361
+ extra_body: Add additional JSON properties to the request
1362
+
1363
+ timeout: Override the client-level default timeout for this request, in seconds
1364
+ """
1365
+ if not agent_id:
1366
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
1367
+ return await self._post(
1368
+ f"/v1/agents/{agent_id}/messages/cancel",
1369
+ body=await async_maybe_transform({"run_ids": run_ids}, message_cancel_params.MessageCancelParams),
1370
+ options=make_request_options(
1371
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1372
+ ),
1373
+ cast_to=MessageCancelResponse,
1374
+ )
1375
+
1376
+ async def compact(
1377
+ self,
1378
+ agent_id: str,
1379
+ *,
1380
+ compaction_settings: Optional[message_compact_params.CompactionSettings] | Omit = omit,
1381
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1382
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1383
+ extra_headers: Headers | None = None,
1384
+ extra_query: Query | None = None,
1385
+ extra_body: Body | None = None,
1386
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1387
+ ) -> MessageCompactResponse:
1388
+ """
1389
+ Summarize an agent's conversation history.
1390
+
1391
+ Args:
1392
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
1393
+
1394
+ compaction_settings: Configuration for conversation compaction / summarization.
1395
+
1396
+ `model` is the only required user-facing field – it specifies the summarizer
1397
+ model handle (e.g. `"openai/gpt-4o-mini"`). Per-model settings (temperature, max
1398
+ tokens, etc.) are derived from the default configuration for that handle.
1399
+
1400
+ extra_headers: Send extra headers
1401
+
1402
+ extra_query: Add additional query parameters to the request
1403
+
1404
+ extra_body: Add additional JSON properties to the request
1405
+
1406
+ timeout: Override the client-level default timeout for this request, in seconds
1407
+ """
1408
+ if not agent_id:
1409
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
1410
+ return await self._post(
1411
+ f"/v1/agents/{agent_id}/summarize",
1412
+ body=await async_maybe_transform(
1413
+ {"compaction_settings": compaction_settings}, message_compact_params.MessageCompactParams
1414
+ ),
1415
+ options=make_request_options(
1416
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1417
+ ),
1418
+ cast_to=MessageCompactResponse,
1419
+ )
1420
+
1421
+ async def create_async(
1422
+ self,
1423
+ agent_id: str,
1424
+ *,
1425
+ assistant_message_tool_kwarg: str | Omit = omit,
1426
+ assistant_message_tool_name: str | Omit = omit,
1427
+ callback_url: Optional[str] | Omit = omit,
1428
+ client_tools: Optional[Iterable[message_create_async_params.ClientTool]] | Omit = omit,
1429
+ enable_thinking: str | Omit = omit,
1430
+ include_return_message_types: Optional[List[MessageType]] | Omit = omit,
1431
+ input: Union[str, Iterable[message_create_async_params.InputUnionMember1], None] | Omit = omit,
1432
+ max_steps: int | Omit = omit,
1433
+ messages: Optional[Iterable[message_create_async_params.Message]] | Omit = omit,
1434
+ override_model: Optional[str] | Omit = omit,
1435
+ use_assistant_message: bool | Omit = omit,
1436
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1437
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1438
+ extra_headers: Headers | None = None,
1439
+ extra_query: Query | None = None,
1440
+ extra_body: Body | None = None,
1441
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1442
+ ) -> Run:
1443
+ """Asynchronously process a user message and return a run object.
1444
+
1445
+ The actual
1446
+ processing happens in the background, and the status can be checked using the
1447
+ run ID.
1448
+
1449
+ This is "asynchronous" in the sense that it's a background run and explicitly
1450
+ must be fetched by the run ID.
1451
+
1452
+ Args:
1453
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
1454
+
1455
+ assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
1456
+ for legacy agent types, but deprecated for letta_v1_agent onward.
1457
+
1458
+ assistant_message_tool_name: The name of the designated message tool. Still supported for legacy agent types,
1459
+ but deprecated for letta_v1_agent onward.
1460
+
1461
+ callback_url: Optional callback URL to POST to when the job completes
1462
+
1463
+ client_tools: Client-side tools that the agent can call. When the agent calls a client-side
1464
+ tool, execution pauses and returns control to the client to execute the tool and
1465
+ provide the result via a ToolReturn.
1466
+
1467
+ enable_thinking: If set to True, enables reasoning before responses or tool calls from the agent.
1468
+
1469
+ include_return_message_types: Only return specified message types in the response. If `None` (default) returns
1470
+ all messages.
1471
+
1472
+ input:
1473
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
1474
+ 'user', 'content': input}].
1475
+
1476
+ max_steps: Maximum number of steps the agent should take to process the request.
1477
+
1478
+ messages: The messages to be sent to the agent.
1479
+
1480
+ override_model: Model handle to use for this request instead of the agent's default model. This
1481
+ allows sending a message to a different model without changing the agent's
1482
+ configuration.
1483
+
1484
+ use_assistant_message: Whether the server should parse specific tool call arguments (default
1485
+ `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
1486
+ types, but deprecated for letta_v1_agent onward.
1487
+
1488
+ extra_headers: Send extra headers
1489
+
1490
+ extra_query: Add additional query parameters to the request
1491
+
1492
+ extra_body: Add additional JSON properties to the request
1493
+
1494
+ timeout: Override the client-level default timeout for this request, in seconds
1495
+ """
1496
+ if not agent_id:
1497
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
1498
+ return await self._post(
1499
+ f"/v1/agents/{agent_id}/messages/async",
1500
+ body=await async_maybe_transform(
1501
+ {
1502
+ "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
1503
+ "assistant_message_tool_name": assistant_message_tool_name,
1504
+ "callback_url": callback_url,
1505
+ "client_tools": client_tools,
1506
+ "enable_thinking": enable_thinking,
1507
+ "include_return_message_types": include_return_message_types,
1508
+ "input": input,
1509
+ "max_steps": max_steps,
1510
+ "messages": messages,
1511
+ "override_model": override_model,
1512
+ "use_assistant_message": use_assistant_message,
1513
+ },
1514
+ message_create_async_params.MessageCreateAsyncParams,
1515
+ ),
1516
+ options=make_request_options(
1517
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1518
+ ),
1519
+ cast_to=Run,
1520
+ )
1521
+
1522
+ async def reset(
1523
+ self,
1524
+ agent_id: str,
1525
+ *,
1526
+ add_default_initial_messages: bool | Omit = omit,
1527
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1528
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1529
+ extra_headers: Headers | None = None,
1530
+ extra_query: Query | None = None,
1531
+ extra_body: Body | None = None,
1532
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1533
+ ) -> Optional[AgentState]:
1534
+ """
1535
+ Resets the messages for an agent
1536
+
1537
+ Args:
1538
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
1539
+
1540
+ add_default_initial_messages: If true, adds the default initial messages after resetting.
1541
+
1542
+ extra_headers: Send extra headers
1543
+
1544
+ extra_query: Add additional query parameters to the request
1545
+
1546
+ extra_body: Add additional JSON properties to the request
1547
+
1548
+ timeout: Override the client-level default timeout for this request, in seconds
1549
+ """
1550
+ if not agent_id:
1551
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
1552
+ return await self._patch(
1553
+ f"/v1/agents/{agent_id}/reset-messages",
1554
+ body=await async_maybe_transform(
1555
+ {"add_default_initial_messages": add_default_initial_messages}, message_reset_params.MessageResetParams
1556
+ ),
1557
+ options=make_request_options(
1558
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1559
+ ),
1560
+ cast_to=AgentState,
1561
+ )
1562
+
1563
+ @typing_extensions.deprecated("deprecated")
1564
+ async def stream(
1565
+ self,
1566
+ agent_id: str,
1567
+ *,
1568
+ assistant_message_tool_kwarg: str | Omit = omit,
1569
+ assistant_message_tool_name: str | Omit = omit,
1570
+ background: bool | Omit = omit,
1571
+ client_tools: Optional[Iterable[message_stream_params.ClientTool]] | Omit = omit,
1572
+ enable_thinking: str | Omit = omit,
1573
+ include_pings: bool | Omit = omit,
1574
+ include_return_message_types: Optional[List[MessageType]] | Omit = omit,
1575
+ input: Union[str, Iterable[message_stream_params.InputUnionMember1], None] | Omit = omit,
1576
+ max_steps: int | Omit = omit,
1577
+ messages: Optional[Iterable[message_stream_params.Message]] | Omit = omit,
1578
+ override_model: Optional[str] | Omit = omit,
1579
+ stream_tokens: bool | Omit = omit,
1580
+ streaming: bool | Omit = omit,
1581
+ use_assistant_message: bool | Omit = omit,
1582
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1583
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1584
+ extra_headers: Headers | None = None,
1585
+ extra_query: Query | None = None,
1586
+ extra_body: Body | None = None,
1587
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1588
+ ) -> AsyncStream[LettaStreamingResponse]:
1589
+ """
1590
+ Process a user message and return the agent's response.
1591
+
1592
+ Deprecated: Use the `POST /{agent_id}/messages` endpoint with `streaming=true`
1593
+ in the request body instead.
1594
+
1595
+ This endpoint accepts a message from a user and processes it through the agent.
1596
+ It will stream the steps of the response always, and stream the tokens if
1597
+ 'stream_tokens' is set to True.
1598
+
1599
+ Args:
1600
+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
1601
+
1602
+ assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
1603
+ for legacy agent types, but deprecated for letta_v1_agent onward.
1604
+
1605
+ assistant_message_tool_name: The name of the designated message tool. Still supported for legacy agent types,
1606
+ but deprecated for letta_v1_agent onward.
1607
+
1608
+ background: Whether to process the request in the background (only used when
1609
+ streaming=true).
1610
+
1611
+ client_tools: Client-side tools that the agent can call. When the agent calls a client-side
1612
+ tool, execution pauses and returns control to the client to execute the tool and
1613
+ provide the result via a ToolReturn.
1614
+
1615
+ enable_thinking: If set to True, enables reasoning before responses or tool calls from the agent.
1616
+
1617
+ include_pings: Whether to include periodic keepalive ping messages in the stream to prevent
1618
+ connection timeouts (only used when streaming=true).
1619
+
1620
+ include_return_message_types: Only return specified message types in the response. If `None` (default) returns
1621
+ all messages.
1622
+
1623
+ input:
1624
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
1625
+ 'user', 'content': input}].
1626
+
1627
+ max_steps: Maximum number of steps the agent should take to process the request.
1628
+
1629
+ messages: The messages to be sent to the agent.
1630
+
1631
+ override_model: Model handle to use for this request instead of the agent's default model. This
1632
+ allows sending a message to a different model without changing the agent's
1633
+ configuration.
1634
+
1635
+ stream_tokens: Flag to determine if individual tokens should be streamed, rather than streaming
1636
+ per step (only used when streaming=true).
1637
+
1638
+ streaming: If True, returns a streaming response (Server-Sent Events). If False (default),
1639
+ returns a complete response.
1640
+
1641
+ use_assistant_message: Whether the server should parse specific tool call arguments (default
1642
+ `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
1643
+ types, but deprecated for letta_v1_agent onward.
1644
+
1645
+ extra_headers: Send extra headers
1646
+
1647
+ extra_query: Add additional query parameters to the request
1648
+
1649
+ extra_body: Add additional JSON properties to the request
1650
+
1651
+ timeout: Override the client-level default timeout for this request, in seconds
1652
+ """
1653
+ if not agent_id:
1654
+ raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
1655
+ return await self._post(
1656
+ f"/v1/agents/{agent_id}/messages/stream",
1657
+ body=await async_maybe_transform(
1658
+ {
1659
+ "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
1660
+ "assistant_message_tool_name": assistant_message_tool_name,
1661
+ "background": background,
1662
+ "client_tools": client_tools,
1663
+ "enable_thinking": enable_thinking,
1664
+ "include_pings": include_pings,
1665
+ "include_return_message_types": include_return_message_types,
1666
+ "input": input,
1667
+ "max_steps": max_steps,
1668
+ "messages": messages,
1669
+ "override_model": override_model,
1670
+ "stream_tokens": stream_tokens,
1671
+ "streaming": streaming,
1672
+ "use_assistant_message": use_assistant_message,
1673
+ },
1674
+ message_stream_params.MessageStreamParams,
1675
+ ),
1676
+ options=make_request_options(
1677
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1678
+ ),
1679
+ cast_to=cast(
1680
+ Any, LettaStreamingResponse
1681
+ ), # Union types cannot be passed in as arguments in the type system
1682
+ stream=True,
1683
+ stream_cls=AsyncStream[LettaStreamingResponse],
1684
+ )
1685
+
1686
+
1687
+ class MessagesResourceWithRawResponse:
1688
+ def __init__(self, messages: MessagesResource) -> None:
1689
+ self._messages = messages
1690
+
1691
+ self.create = to_raw_response_wrapper(
1692
+ messages.create,
1693
+ )
1694
+ self.list = to_raw_response_wrapper(
1695
+ messages.list,
1696
+ )
1697
+ self.cancel = to_raw_response_wrapper(
1698
+ messages.cancel,
1699
+ )
1700
+ self.compact = to_raw_response_wrapper(
1701
+ messages.compact,
1702
+ )
1703
+ self.create_async = to_raw_response_wrapper(
1704
+ messages.create_async,
1705
+ )
1706
+ self.reset = to_raw_response_wrapper(
1707
+ messages.reset,
1708
+ )
1709
+ self.stream = ( # pyright: ignore[reportDeprecated]
1710
+ to_raw_response_wrapper(
1711
+ messages.stream, # pyright: ignore[reportDeprecated],
1712
+ )
1713
+ )
1714
+
1715
+
1716
+ class AsyncMessagesResourceWithRawResponse:
1717
+ def __init__(self, messages: AsyncMessagesResource) -> None:
1718
+ self._messages = messages
1719
+
1720
+ self.create = async_to_raw_response_wrapper(
1721
+ messages.create,
1722
+ )
1723
+ self.list = async_to_raw_response_wrapper(
1724
+ messages.list,
1725
+ )
1726
+ self.cancel = async_to_raw_response_wrapper(
1727
+ messages.cancel,
1728
+ )
1729
+ self.compact = async_to_raw_response_wrapper(
1730
+ messages.compact,
1731
+ )
1732
+ self.create_async = async_to_raw_response_wrapper(
1733
+ messages.create_async,
1734
+ )
1735
+ self.reset = async_to_raw_response_wrapper(
1736
+ messages.reset,
1737
+ )
1738
+ self.stream = ( # pyright: ignore[reportDeprecated]
1739
+ async_to_raw_response_wrapper(
1740
+ messages.stream, # pyright: ignore[reportDeprecated],
1741
+ )
1742
+ )
1743
+
1744
+
1745
+ class MessagesResourceWithStreamingResponse:
1746
+ def __init__(self, messages: MessagesResource) -> None:
1747
+ self._messages = messages
1748
+
1749
+ self.create = to_streamed_response_wrapper(
1750
+ messages.create,
1751
+ )
1752
+ self.list = to_streamed_response_wrapper(
1753
+ messages.list,
1754
+ )
1755
+ self.cancel = to_streamed_response_wrapper(
1756
+ messages.cancel,
1757
+ )
1758
+ self.compact = to_streamed_response_wrapper(
1759
+ messages.compact,
1760
+ )
1761
+ self.create_async = to_streamed_response_wrapper(
1762
+ messages.create_async,
1763
+ )
1764
+ self.reset = to_streamed_response_wrapper(
1765
+ messages.reset,
1766
+ )
1767
+ self.stream = ( # pyright: ignore[reportDeprecated]
1768
+ to_streamed_response_wrapper(
1769
+ messages.stream, # pyright: ignore[reportDeprecated],
1770
+ )
1771
+ )
1772
+
1773
+
1774
+ class AsyncMessagesResourceWithStreamingResponse:
1775
+ def __init__(self, messages: AsyncMessagesResource) -> None:
1776
+ self._messages = messages
1777
+
1778
+ self.create = async_to_streamed_response_wrapper(
1779
+ messages.create,
1780
+ )
1781
+ self.list = async_to_streamed_response_wrapper(
1782
+ messages.list,
1783
+ )
1784
+ self.cancel = async_to_streamed_response_wrapper(
1785
+ messages.cancel,
1786
+ )
1787
+ self.compact = async_to_streamed_response_wrapper(
1788
+ messages.compact,
1789
+ )
1790
+ self.create_async = async_to_streamed_response_wrapper(
1791
+ messages.create_async,
1792
+ )
1793
+ self.reset = async_to_streamed_response_wrapper(
1794
+ messages.reset,
1795
+ )
1796
+ self.stream = ( # pyright: ignore[reportDeprecated]
1797
+ async_to_streamed_response_wrapper(
1798
+ messages.stream, # pyright: ignore[reportDeprecated],
1799
+ )
1800
+ )