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
@@ -1,2371 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
- from ..core.client_wrapper import SyncClientWrapper
5
- from .context.client import ContextClient
6
- from .tools.client import ToolsClient
7
- from .sources.client import SourcesClient
8
- from .folders.client import FoldersClient
9
- from .files.client import FilesClient
10
- from .core_memory.client import CoreMemoryClient
11
- from .blocks.client import BlocksClient
12
- from .passages.client import PassagesClient
13
- from .messages.client import MessagesClient
14
- from .groups.client import GroupsClient
15
- from .templates.client import TemplatesClient
16
- from .memory_variables.client import MemoryVariablesClient
17
- from ..core.request_options import RequestOptions
18
- from ..types.agent_state import AgentState
19
- from ..core.unchecked_base_model import construct_type
20
- from ..errors.unprocessable_entity_error import UnprocessableEntityError
21
- from ..types.http_validation_error import HttpValidationError
22
- from json.decoder import JSONDecodeError
23
- from ..core.api_error import ApiError
24
- from ..types.create_block import CreateBlock
25
- from .types.create_agent_request_tool_rules_item import CreateAgentRequestToolRulesItem
26
- from ..types.agent_type import AgentType
27
- from ..types.llm_config import LlmConfig
28
- from ..types.embedding_config import EmbeddingConfig
29
- from ..types.message_create import MessageCreate
30
- from .types.create_agent_request_response_format import CreateAgentRequestResponseFormat
31
- from ..core.serialization import convert_and_respect_annotation_metadata
32
- from ..core.jsonable_encoder import jsonable_encoder
33
- from .. import core
34
- from .types.update_agent_tool_rules_item import UpdateAgentToolRulesItem
35
- from .types.update_agent_response_format import UpdateAgentResponseFormat
36
- import datetime as dt
37
- from .types.agents_search_request_search_item import AgentsSearchRequestSearchItem
38
- from .types.agents_search_request_sort_by import AgentsSearchRequestSortBy
39
- from .types.agents_search_response import AgentsSearchResponse
40
- from ..core.client_wrapper import AsyncClientWrapper
41
- from .context.client import AsyncContextClient
42
- from .tools.client import AsyncToolsClient
43
- from .sources.client import AsyncSourcesClient
44
- from .folders.client import AsyncFoldersClient
45
- from .files.client import AsyncFilesClient
46
- from .core_memory.client import AsyncCoreMemoryClient
47
- from .blocks.client import AsyncBlocksClient
48
- from .passages.client import AsyncPassagesClient
49
- from .messages.client import AsyncMessagesClient
50
- from .groups.client import AsyncGroupsClient
51
- from .templates.client import AsyncTemplatesClient
52
- from .memory_variables.client import AsyncMemoryVariablesClient
53
-
54
- # this is used as the default value for optional parameters
55
- OMIT = typing.cast(typing.Any, ...)
56
-
57
-
58
- class AgentsClient:
59
- def __init__(self, *, client_wrapper: SyncClientWrapper):
60
- self._client_wrapper = client_wrapper
61
- self.context = ContextClient(client_wrapper=self._client_wrapper)
62
- self.tools = ToolsClient(client_wrapper=self._client_wrapper)
63
- self.sources = SourcesClient(client_wrapper=self._client_wrapper)
64
- self.folders = FoldersClient(client_wrapper=self._client_wrapper)
65
- self.files = FilesClient(client_wrapper=self._client_wrapper)
66
- self.core_memory = CoreMemoryClient(client_wrapper=self._client_wrapper)
67
- self.blocks = BlocksClient(client_wrapper=self._client_wrapper)
68
- self.passages = PassagesClient(client_wrapper=self._client_wrapper)
69
- self.messages = MessagesClient(client_wrapper=self._client_wrapper)
70
- self.groups = GroupsClient(client_wrapper=self._client_wrapper)
71
- self.templates = TemplatesClient(client_wrapper=self._client_wrapper)
72
- self.memory_variables = MemoryVariablesClient(client_wrapper=self._client_wrapper)
73
-
74
- def list(
75
- self,
76
- *,
77
- name: typing.Optional[str] = None,
78
- tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
79
- match_all_tags: typing.Optional[bool] = None,
80
- before: typing.Optional[str] = None,
81
- after: typing.Optional[str] = None,
82
- limit: typing.Optional[int] = None,
83
- query_text: typing.Optional[str] = None,
84
- project_id: typing.Optional[str] = None,
85
- template_id: typing.Optional[str] = None,
86
- base_template_id: typing.Optional[str] = None,
87
- identity_id: typing.Optional[str] = None,
88
- identifier_keys: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
89
- include_relationships: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
90
- ascending: typing.Optional[bool] = None,
91
- sort_by: typing.Optional[str] = None,
92
- request_options: typing.Optional[RequestOptions] = None,
93
- ) -> typing.List[AgentState]:
94
- """
95
- List all agents associated with a given user.
96
-
97
- This endpoint retrieves a list of all agents and their configurations
98
- associated with the specified user ID.
99
-
100
- Parameters
101
- ----------
102
- name : typing.Optional[str]
103
- Name of the agent
104
-
105
- tags : typing.Optional[typing.Union[str, typing.Sequence[str]]]
106
- List of tags to filter agents by
107
-
108
- match_all_tags : typing.Optional[bool]
109
- If True, only returns agents that match ALL given tags. Otherwise, return agents that have ANY of the passed-in tags.
110
-
111
- before : typing.Optional[str]
112
- Cursor for pagination
113
-
114
- after : typing.Optional[str]
115
- Cursor for pagination
116
-
117
- limit : typing.Optional[int]
118
- Limit for pagination
119
-
120
- query_text : typing.Optional[str]
121
- Search agents by name
122
-
123
- project_id : typing.Optional[str]
124
- Search agents by project ID
125
-
126
- template_id : typing.Optional[str]
127
- Search agents by template ID
128
-
129
- base_template_id : typing.Optional[str]
130
- Search agents by base template ID
131
-
132
- identity_id : typing.Optional[str]
133
- Search agents by identity ID
134
-
135
- identifier_keys : typing.Optional[typing.Union[str, typing.Sequence[str]]]
136
- Search agents by identifier keys
137
-
138
- include_relationships : typing.Optional[typing.Union[str, typing.Sequence[str]]]
139
- Specify which relational fields (e.g., 'tools', 'sources', 'memory') to include in the response. If not provided, all relationships are loaded by default. Using this can optimize performance by reducing unnecessary joins.
140
-
141
- ascending : typing.Optional[bool]
142
- Whether to sort agents oldest to newest (True) or newest to oldest (False, default)
143
-
144
- sort_by : typing.Optional[str]
145
- Field to sort by. Options: 'created_at' (default), 'last_run_completion'
146
-
147
- request_options : typing.Optional[RequestOptions]
148
- Request-specific configuration.
149
-
150
- Returns
151
- -------
152
- typing.List[AgentState]
153
- Successful Response
154
-
155
- Examples
156
- --------
157
- from letta_client import Letta
158
-
159
- client = Letta(
160
- project="YOUR_PROJECT",
161
- token="YOUR_TOKEN",
162
- )
163
- client.agents.list()
164
- """
165
- _response = self._client_wrapper.httpx_client.request(
166
- "v1/agents/",
167
- method="GET",
168
- params={
169
- "name": name,
170
- "tags": tags,
171
- "match_all_tags": match_all_tags,
172
- "before": before,
173
- "after": after,
174
- "limit": limit,
175
- "query_text": query_text,
176
- "project_id": project_id,
177
- "template_id": template_id,
178
- "base_template_id": base_template_id,
179
- "identity_id": identity_id,
180
- "identifier_keys": identifier_keys,
181
- "include_relationships": include_relationships,
182
- "ascending": ascending,
183
- "sort_by": sort_by,
184
- },
185
- request_options=request_options,
186
- )
187
- try:
188
- if 200 <= _response.status_code < 300:
189
- return typing.cast(
190
- typing.List[AgentState],
191
- construct_type(
192
- type_=typing.List[AgentState], # type: ignore
193
- object_=_response.json(),
194
- ),
195
- )
196
- if _response.status_code == 422:
197
- raise UnprocessableEntityError(
198
- typing.cast(
199
- HttpValidationError,
200
- construct_type(
201
- type_=HttpValidationError, # type: ignore
202
- object_=_response.json(),
203
- ),
204
- )
205
- )
206
- _response_json = _response.json()
207
- except JSONDecodeError:
208
- raise ApiError(status_code=_response.status_code, body=_response.text)
209
- raise ApiError(status_code=_response.status_code, body=_response_json)
210
-
211
- def create(
212
- self,
213
- *,
214
- name: typing.Optional[str] = OMIT,
215
- memory_blocks: typing.Optional[typing.Sequence[CreateBlock]] = OMIT,
216
- tools: typing.Optional[typing.Sequence[str]] = OMIT,
217
- tool_ids: typing.Optional[typing.Sequence[str]] = OMIT,
218
- source_ids: typing.Optional[typing.Sequence[str]] = OMIT,
219
- block_ids: typing.Optional[typing.Sequence[str]] = OMIT,
220
- tool_rules: typing.Optional[typing.Sequence[CreateAgentRequestToolRulesItem]] = OMIT,
221
- tags: typing.Optional[typing.Sequence[str]] = OMIT,
222
- system: typing.Optional[str] = OMIT,
223
- agent_type: typing.Optional[AgentType] = OMIT,
224
- llm_config: typing.Optional[LlmConfig] = OMIT,
225
- embedding_config: typing.Optional[EmbeddingConfig] = OMIT,
226
- initial_message_sequence: typing.Optional[typing.Sequence[MessageCreate]] = OMIT,
227
- include_base_tools: typing.Optional[bool] = OMIT,
228
- include_multi_agent_tools: typing.Optional[bool] = OMIT,
229
- include_base_tool_rules: typing.Optional[bool] = OMIT,
230
- include_default_source: typing.Optional[bool] = OMIT,
231
- description: typing.Optional[str] = OMIT,
232
- metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
233
- model: typing.Optional[str] = OMIT,
234
- embedding: typing.Optional[str] = OMIT,
235
- context_window_limit: typing.Optional[int] = OMIT,
236
- embedding_chunk_size: typing.Optional[int] = OMIT,
237
- max_tokens: typing.Optional[int] = OMIT,
238
- max_reasoning_tokens: typing.Optional[int] = OMIT,
239
- enable_reasoner: typing.Optional[bool] = OMIT,
240
- from_template: typing.Optional[str] = OMIT,
241
- template: typing.Optional[bool] = OMIT,
242
- project: typing.Optional[str] = OMIT,
243
- tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
244
- memory_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
245
- project_id: typing.Optional[str] = OMIT,
246
- template_id: typing.Optional[str] = OMIT,
247
- base_template_id: typing.Optional[str] = OMIT,
248
- identity_ids: typing.Optional[typing.Sequence[str]] = OMIT,
249
- message_buffer_autoclear: typing.Optional[bool] = OMIT,
250
- enable_sleeptime: typing.Optional[bool] = OMIT,
251
- response_format: typing.Optional[CreateAgentRequestResponseFormat] = OMIT,
252
- timezone: typing.Optional[str] = OMIT,
253
- max_files_open: typing.Optional[int] = OMIT,
254
- per_file_view_window_char_limit: typing.Optional[int] = OMIT,
255
- request_options: typing.Optional[RequestOptions] = None,
256
- ) -> AgentState:
257
- """
258
- Create a new agent with the specified configuration.
259
-
260
- Parameters
261
- ----------
262
- name : typing.Optional[str]
263
- The name of the agent.
264
-
265
- memory_blocks : typing.Optional[typing.Sequence[CreateBlock]]
266
- The blocks to create in the agent's in-context memory.
267
-
268
- tools : typing.Optional[typing.Sequence[str]]
269
- The tools used by the agent.
270
-
271
- tool_ids : typing.Optional[typing.Sequence[str]]
272
- The ids of the tools used by the agent.
273
-
274
- source_ids : typing.Optional[typing.Sequence[str]]
275
- The ids of the sources used by the agent.
276
-
277
- block_ids : typing.Optional[typing.Sequence[str]]
278
- The ids of the blocks used by the agent.
279
-
280
- tool_rules : typing.Optional[typing.Sequence[CreateAgentRequestToolRulesItem]]
281
- The tool rules governing the agent.
282
-
283
- tags : typing.Optional[typing.Sequence[str]]
284
- The tags associated with the agent.
285
-
286
- system : typing.Optional[str]
287
- The system prompt used by the agent.
288
-
289
- agent_type : typing.Optional[AgentType]
290
- The type of agent.
291
-
292
- llm_config : typing.Optional[LlmConfig]
293
- The LLM configuration used by the agent.
294
-
295
- embedding_config : typing.Optional[EmbeddingConfig]
296
- The embedding configuration used by the agent.
297
-
298
- initial_message_sequence : typing.Optional[typing.Sequence[MessageCreate]]
299
- The initial set of messages to put in the agent's in-context memory.
300
-
301
- include_base_tools : typing.Optional[bool]
302
- If true, attaches the Letta core tools (e.g. core_memory related functions).
303
-
304
- include_multi_agent_tools : typing.Optional[bool]
305
- If true, attaches the Letta multi-agent tools (e.g. sending a message to another agent).
306
-
307
- include_base_tool_rules : typing.Optional[bool]
308
- If true, attaches the Letta base tool rules (e.g. deny all tools not explicitly allowed).
309
-
310
- include_default_source : typing.Optional[bool]
311
- If true, automatically creates and attaches a default data source for this agent.
312
-
313
- description : typing.Optional[str]
314
- The description of the agent.
315
-
316
- metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
317
- The metadata of the agent.
318
-
319
- model : typing.Optional[str]
320
- The LLM configuration handle used by the agent, specified in the format provider/model-name, as an alternative to specifying llm_config.
321
-
322
- embedding : typing.Optional[str]
323
- The embedding configuration handle used by the agent, specified in the format provider/model-name.
324
-
325
- context_window_limit : typing.Optional[int]
326
- The context window limit used by the agent.
327
-
328
- embedding_chunk_size : typing.Optional[int]
329
- The embedding chunk size used by the agent.
330
-
331
- max_tokens : typing.Optional[int]
332
- The maximum number of tokens to generate, including reasoning step. If not set, the model will use its default value.
333
-
334
- max_reasoning_tokens : typing.Optional[int]
335
- The maximum number of tokens to generate for reasoning step. If not set, the model will use its default value.
336
-
337
- enable_reasoner : typing.Optional[bool]
338
- Whether to enable internal extended thinking step for a reasoner model.
339
-
340
- from_template : typing.Optional[str]
341
- The template id used to configure the agent
342
-
343
- template : typing.Optional[bool]
344
- Whether the agent is a template
345
-
346
- project : typing.Optional[str]
347
- Deprecated: Project should now be passed via the X-Project header instead of in the request body. If using the sdk, this can be done via the new x_project field below.
348
-
349
- tool_exec_environment_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
350
- The environment variables for tool execution specific to this agent.
351
-
352
- memory_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
353
- The variables that should be set for the agent.
354
-
355
- project_id : typing.Optional[str]
356
- The id of the project the agent belongs to.
357
-
358
- template_id : typing.Optional[str]
359
- The id of the template the agent belongs to.
360
-
361
- base_template_id : typing.Optional[str]
362
- The base template id of the agent.
363
-
364
- identity_ids : typing.Optional[typing.Sequence[str]]
365
- The ids of the identities associated with this agent.
366
-
367
- message_buffer_autoclear : typing.Optional[bool]
368
- If set to True, the agent will not remember previous messages (though the agent will still retain state via core memory blocks and archival/recall memory). Not recommended unless you have an advanced use case.
369
-
370
- enable_sleeptime : typing.Optional[bool]
371
- If set to True, memory management will move to a background agent thread.
372
-
373
- response_format : typing.Optional[CreateAgentRequestResponseFormat]
374
- The response format for the agent.
375
-
376
- timezone : typing.Optional[str]
377
- The timezone of the agent (IANA format).
378
-
379
- max_files_open : typing.Optional[int]
380
- Maximum number of files that can be open at once for this agent. Setting this too high may exceed the context window, which will break the agent.
381
-
382
- per_file_view_window_char_limit : typing.Optional[int]
383
- The per-file view window character limit for this agent. Setting this too high may exceed the context window, which will break the agent.
384
-
385
- request_options : typing.Optional[RequestOptions]
386
- Request-specific configuration.
387
-
388
- Returns
389
- -------
390
- AgentState
391
- Successful Response
392
-
393
- Examples
394
- --------
395
- from letta_client import Letta
396
-
397
- client = Letta(
398
- project="YOUR_PROJECT",
399
- token="YOUR_TOKEN",
400
- )
401
- client.agents.create()
402
- """
403
- _response = self._client_wrapper.httpx_client.request(
404
- "v1/agents/",
405
- method="POST",
406
- json={
407
- "name": name,
408
- "memory_blocks": convert_and_respect_annotation_metadata(
409
- object_=memory_blocks, annotation=typing.Sequence[CreateBlock], direction="write"
410
- ),
411
- "tools": tools,
412
- "tool_ids": tool_ids,
413
- "source_ids": source_ids,
414
- "block_ids": block_ids,
415
- "tool_rules": convert_and_respect_annotation_metadata(
416
- object_=tool_rules, annotation=typing.Sequence[CreateAgentRequestToolRulesItem], direction="write"
417
- ),
418
- "tags": tags,
419
- "system": system,
420
- "agent_type": agent_type,
421
- "llm_config": convert_and_respect_annotation_metadata(
422
- object_=llm_config, annotation=LlmConfig, direction="write"
423
- ),
424
- "embedding_config": convert_and_respect_annotation_metadata(
425
- object_=embedding_config, annotation=EmbeddingConfig, direction="write"
426
- ),
427
- "initial_message_sequence": convert_and_respect_annotation_metadata(
428
- object_=initial_message_sequence, annotation=typing.Sequence[MessageCreate], direction="write"
429
- ),
430
- "include_base_tools": include_base_tools,
431
- "include_multi_agent_tools": include_multi_agent_tools,
432
- "include_base_tool_rules": include_base_tool_rules,
433
- "include_default_source": include_default_source,
434
- "description": description,
435
- "metadata": metadata,
436
- "model": model,
437
- "embedding": embedding,
438
- "context_window_limit": context_window_limit,
439
- "embedding_chunk_size": embedding_chunk_size,
440
- "max_tokens": max_tokens,
441
- "max_reasoning_tokens": max_reasoning_tokens,
442
- "enable_reasoner": enable_reasoner,
443
- "from_template": from_template,
444
- "template": template,
445
- "project": project,
446
- "tool_exec_environment_variables": tool_exec_environment_variables,
447
- "memory_variables": memory_variables,
448
- "project_id": project_id,
449
- "template_id": template_id,
450
- "base_template_id": base_template_id,
451
- "identity_ids": identity_ids,
452
- "message_buffer_autoclear": message_buffer_autoclear,
453
- "enable_sleeptime": enable_sleeptime,
454
- "response_format": convert_and_respect_annotation_metadata(
455
- object_=response_format, annotation=CreateAgentRequestResponseFormat, direction="write"
456
- ),
457
- "timezone": timezone,
458
- "max_files_open": max_files_open,
459
- "per_file_view_window_char_limit": per_file_view_window_char_limit,
460
- },
461
- headers={
462
- "content-type": "application/json",
463
- },
464
- request_options=request_options,
465
- omit=OMIT,
466
- )
467
- try:
468
- if 200 <= _response.status_code < 300:
469
- return typing.cast(
470
- AgentState,
471
- construct_type(
472
- type_=AgentState, # type: ignore
473
- object_=_response.json(),
474
- ),
475
- )
476
- if _response.status_code == 422:
477
- raise UnprocessableEntityError(
478
- typing.cast(
479
- HttpValidationError,
480
- construct_type(
481
- type_=HttpValidationError, # type: ignore
482
- object_=_response.json(),
483
- ),
484
- )
485
- )
486
- _response_json = _response.json()
487
- except JSONDecodeError:
488
- raise ApiError(status_code=_response.status_code, body=_response.text)
489
- raise ApiError(status_code=_response.status_code, body=_response_json)
490
-
491
- def count(self, *, request_options: typing.Optional[RequestOptions] = None) -> int:
492
- """
493
- Get the count of all agents associated with a given user.
494
-
495
- Parameters
496
- ----------
497
- request_options : typing.Optional[RequestOptions]
498
- Request-specific configuration.
499
-
500
- Returns
501
- -------
502
- int
503
- Successful Response
504
-
505
- Examples
506
- --------
507
- from letta_client import Letta
508
-
509
- client = Letta(
510
- project="YOUR_PROJECT",
511
- token="YOUR_TOKEN",
512
- )
513
- client.agents.count()
514
- """
515
- _response = self._client_wrapper.httpx_client.request(
516
- "v1/agents/count",
517
- method="GET",
518
- request_options=request_options,
519
- )
520
- try:
521
- if 200 <= _response.status_code < 300:
522
- return typing.cast(
523
- int,
524
- construct_type(
525
- type_=int, # type: ignore
526
- object_=_response.json(),
527
- ),
528
- )
529
- if _response.status_code == 422:
530
- raise UnprocessableEntityError(
531
- typing.cast(
532
- HttpValidationError,
533
- construct_type(
534
- type_=HttpValidationError, # type: ignore
535
- object_=_response.json(),
536
- ),
537
- )
538
- )
539
- _response_json = _response.json()
540
- except JSONDecodeError:
541
- raise ApiError(status_code=_response.status_code, body=_response.text)
542
- raise ApiError(status_code=_response.status_code, body=_response_json)
543
-
544
- def export_file(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> str:
545
- """
546
- Export the serialized JSON representation of an agent, formatted with indentation.
547
-
548
- Parameters
549
- ----------
550
- agent_id : str
551
-
552
- request_options : typing.Optional[RequestOptions]
553
- Request-specific configuration.
554
-
555
- Returns
556
- -------
557
- str
558
- Successful Response
559
-
560
- Examples
561
- --------
562
- from letta_client import Letta
563
-
564
- client = Letta(
565
- project="YOUR_PROJECT",
566
- token="YOUR_TOKEN",
567
- )
568
- client.agents.export_file(
569
- agent_id="agent_id",
570
- )
571
- """
572
- _response = self._client_wrapper.httpx_client.request(
573
- f"v1/agents/{jsonable_encoder(agent_id)}/export",
574
- method="GET",
575
- request_options=request_options,
576
- )
577
- try:
578
- if 200 <= _response.status_code < 300:
579
- return typing.cast(
580
- str,
581
- construct_type(
582
- type_=str, # type: ignore
583
- object_=_response.json(),
584
- ),
585
- )
586
- if _response.status_code == 422:
587
- raise UnprocessableEntityError(
588
- typing.cast(
589
- HttpValidationError,
590
- construct_type(
591
- type_=HttpValidationError, # type: ignore
592
- object_=_response.json(),
593
- ),
594
- )
595
- )
596
- _response_json = _response.json()
597
- except JSONDecodeError:
598
- raise ApiError(status_code=_response.status_code, body=_response.text)
599
- raise ApiError(status_code=_response.status_code, body=_response_json)
600
-
601
- def import_file(
602
- self,
603
- *,
604
- file: core.File,
605
- append_copy_suffix: typing.Optional[bool] = None,
606
- override_existing_tools: typing.Optional[bool] = None,
607
- project_id: typing.Optional[str] = None,
608
- strip_messages: typing.Optional[bool] = None,
609
- request_options: typing.Optional[RequestOptions] = None,
610
- ) -> AgentState:
611
- """
612
- Import a serialized agent file and recreate the agent in the system.
613
-
614
- Parameters
615
- ----------
616
- file : core.File
617
- See core.File for more documentation
618
-
619
- append_copy_suffix : typing.Optional[bool]
620
- If set to True, appends "_copy" to the end of the agent name.
621
-
622
- override_existing_tools : typing.Optional[bool]
623
- If set to True, existing tools can get their source code overwritten by the uploaded tool definitions. Note that Letta core tools can never be updated externally.
624
-
625
- project_id : typing.Optional[str]
626
- The project ID to associate the uploaded agent with.
627
-
628
- strip_messages : typing.Optional[bool]
629
- If set to True, strips all messages from the agent before importing.
630
-
631
- request_options : typing.Optional[RequestOptions]
632
- Request-specific configuration.
633
-
634
- Returns
635
- -------
636
- AgentState
637
- Successful Response
638
-
639
- Examples
640
- --------
641
- from letta_client import Letta
642
-
643
- client = Letta(
644
- project="YOUR_PROJECT",
645
- token="YOUR_TOKEN",
646
- )
647
- client.agents.import_file()
648
- """
649
- _response = self._client_wrapper.httpx_client.request(
650
- "v1/agents/import",
651
- method="POST",
652
- params={
653
- "append_copy_suffix": append_copy_suffix,
654
- "override_existing_tools": override_existing_tools,
655
- "project_id": project_id,
656
- "strip_messages": strip_messages,
657
- },
658
- data={},
659
- files={
660
- "file": file,
661
- },
662
- request_options=request_options,
663
- omit=OMIT,
664
- )
665
- try:
666
- if 200 <= _response.status_code < 300:
667
- return typing.cast(
668
- AgentState,
669
- construct_type(
670
- type_=AgentState, # type: ignore
671
- object_=_response.json(),
672
- ),
673
- )
674
- if _response.status_code == 422:
675
- raise UnprocessableEntityError(
676
- typing.cast(
677
- HttpValidationError,
678
- construct_type(
679
- type_=HttpValidationError, # type: ignore
680
- object_=_response.json(),
681
- ),
682
- )
683
- )
684
- _response_json = _response.json()
685
- except JSONDecodeError:
686
- raise ApiError(status_code=_response.status_code, body=_response.text)
687
- raise ApiError(status_code=_response.status_code, body=_response_json)
688
-
689
- def retrieve(
690
- self,
691
- agent_id: str,
692
- *,
693
- include_relationships: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
694
- request_options: typing.Optional[RequestOptions] = None,
695
- ) -> AgentState:
696
- """
697
- Get the state of the agent.
698
-
699
- Parameters
700
- ----------
701
- agent_id : str
702
-
703
- include_relationships : typing.Optional[typing.Union[str, typing.Sequence[str]]]
704
- Specify which relational fields (e.g., 'tools', 'sources', 'memory') to include in the response. If not provided, all relationships are loaded by default. Using this can optimize performance by reducing unnecessary joins.
705
-
706
- request_options : typing.Optional[RequestOptions]
707
- Request-specific configuration.
708
-
709
- Returns
710
- -------
711
- AgentState
712
- Successful Response
713
-
714
- Examples
715
- --------
716
- from letta_client import Letta
717
-
718
- client = Letta(
719
- project="YOUR_PROJECT",
720
- token="YOUR_TOKEN",
721
- )
722
- client.agents.retrieve(
723
- agent_id="agent_id",
724
- )
725
- """
726
- _response = self._client_wrapper.httpx_client.request(
727
- f"v1/agents/{jsonable_encoder(agent_id)}",
728
- method="GET",
729
- params={
730
- "include_relationships": include_relationships,
731
- },
732
- request_options=request_options,
733
- )
734
- try:
735
- if 200 <= _response.status_code < 300:
736
- return typing.cast(
737
- AgentState,
738
- construct_type(
739
- type_=AgentState, # type: ignore
740
- object_=_response.json(),
741
- ),
742
- )
743
- if _response.status_code == 422:
744
- raise UnprocessableEntityError(
745
- typing.cast(
746
- HttpValidationError,
747
- construct_type(
748
- type_=HttpValidationError, # type: ignore
749
- object_=_response.json(),
750
- ),
751
- )
752
- )
753
- _response_json = _response.json()
754
- except JSONDecodeError:
755
- raise ApiError(status_code=_response.status_code, body=_response.text)
756
- raise ApiError(status_code=_response.status_code, body=_response_json)
757
-
758
- def delete(
759
- self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
760
- ) -> typing.Optional[typing.Any]:
761
- """
762
- Delete an agent.
763
-
764
- Parameters
765
- ----------
766
- agent_id : str
767
-
768
- request_options : typing.Optional[RequestOptions]
769
- Request-specific configuration.
770
-
771
- Returns
772
- -------
773
- typing.Optional[typing.Any]
774
- Successful Response
775
-
776
- Examples
777
- --------
778
- from letta_client import Letta
779
-
780
- client = Letta(
781
- project="YOUR_PROJECT",
782
- token="YOUR_TOKEN",
783
- )
784
- client.agents.delete(
785
- agent_id="agent_id",
786
- )
787
- """
788
- _response = self._client_wrapper.httpx_client.request(
789
- f"v1/agents/{jsonable_encoder(agent_id)}",
790
- method="DELETE",
791
- request_options=request_options,
792
- )
793
- try:
794
- if 200 <= _response.status_code < 300:
795
- return typing.cast(
796
- typing.Optional[typing.Any],
797
- construct_type(
798
- type_=typing.Optional[typing.Any], # type: ignore
799
- object_=_response.json(),
800
- ),
801
- )
802
- if _response.status_code == 422:
803
- raise UnprocessableEntityError(
804
- typing.cast(
805
- HttpValidationError,
806
- construct_type(
807
- type_=HttpValidationError, # type: ignore
808
- object_=_response.json(),
809
- ),
810
- )
811
- )
812
- _response_json = _response.json()
813
- except JSONDecodeError:
814
- raise ApiError(status_code=_response.status_code, body=_response.text)
815
- raise ApiError(status_code=_response.status_code, body=_response_json)
816
-
817
- def modify(
818
- self,
819
- agent_id: str,
820
- *,
821
- name: typing.Optional[str] = OMIT,
822
- tool_ids: typing.Optional[typing.Sequence[str]] = OMIT,
823
- source_ids: typing.Optional[typing.Sequence[str]] = OMIT,
824
- block_ids: typing.Optional[typing.Sequence[str]] = OMIT,
825
- tags: typing.Optional[typing.Sequence[str]] = OMIT,
826
- system: typing.Optional[str] = OMIT,
827
- tool_rules: typing.Optional[typing.Sequence[UpdateAgentToolRulesItem]] = OMIT,
828
- llm_config: typing.Optional[LlmConfig] = OMIT,
829
- embedding_config: typing.Optional[EmbeddingConfig] = OMIT,
830
- message_ids: typing.Optional[typing.Sequence[str]] = OMIT,
831
- description: typing.Optional[str] = OMIT,
832
- metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
833
- tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
834
- project_id: typing.Optional[str] = OMIT,
835
- template_id: typing.Optional[str] = OMIT,
836
- base_template_id: typing.Optional[str] = OMIT,
837
- identity_ids: typing.Optional[typing.Sequence[str]] = OMIT,
838
- message_buffer_autoclear: typing.Optional[bool] = OMIT,
839
- model: typing.Optional[str] = OMIT,
840
- embedding: typing.Optional[str] = OMIT,
841
- enable_sleeptime: typing.Optional[bool] = OMIT,
842
- response_format: typing.Optional[UpdateAgentResponseFormat] = OMIT,
843
- last_run_completion: typing.Optional[dt.datetime] = OMIT,
844
- last_run_duration_ms: typing.Optional[int] = OMIT,
845
- timezone: typing.Optional[str] = OMIT,
846
- max_files_open: typing.Optional[int] = OMIT,
847
- per_file_view_window_char_limit: typing.Optional[int] = OMIT,
848
- request_options: typing.Optional[RequestOptions] = None,
849
- ) -> AgentState:
850
- """
851
- Update an existing agent
852
-
853
- Parameters
854
- ----------
855
- agent_id : str
856
-
857
- name : typing.Optional[str]
858
- The name of the agent.
859
-
860
- tool_ids : typing.Optional[typing.Sequence[str]]
861
- The ids of the tools used by the agent.
862
-
863
- source_ids : typing.Optional[typing.Sequence[str]]
864
- The ids of the sources used by the agent.
865
-
866
- block_ids : typing.Optional[typing.Sequence[str]]
867
- The ids of the blocks used by the agent.
868
-
869
- tags : typing.Optional[typing.Sequence[str]]
870
- The tags associated with the agent.
871
-
872
- system : typing.Optional[str]
873
- The system prompt used by the agent.
874
-
875
- tool_rules : typing.Optional[typing.Sequence[UpdateAgentToolRulesItem]]
876
- The tool rules governing the agent.
877
-
878
- llm_config : typing.Optional[LlmConfig]
879
- The LLM configuration used by the agent.
880
-
881
- embedding_config : typing.Optional[EmbeddingConfig]
882
- The embedding configuration used by the agent.
883
-
884
- message_ids : typing.Optional[typing.Sequence[str]]
885
- The ids of the messages in the agent's in-context memory.
886
-
887
- description : typing.Optional[str]
888
- The description of the agent.
889
-
890
- metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
891
- The metadata of the agent.
892
-
893
- tool_exec_environment_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
894
- The environment variables for tool execution specific to this agent.
895
-
896
- project_id : typing.Optional[str]
897
- The id of the project the agent belongs to.
898
-
899
- template_id : typing.Optional[str]
900
- The id of the template the agent belongs to.
901
-
902
- base_template_id : typing.Optional[str]
903
- The base template id of the agent.
904
-
905
- identity_ids : typing.Optional[typing.Sequence[str]]
906
- The ids of the identities associated with this agent.
907
-
908
- message_buffer_autoclear : typing.Optional[bool]
909
- If set to True, the agent will not remember previous messages (though the agent will still retain state via core memory blocks and archival/recall memory). Not recommended unless you have an advanced use case.
910
-
911
- model : typing.Optional[str]
912
- The LLM configuration handle used by the agent, specified in the format provider/model-name, as an alternative to specifying llm_config.
913
-
914
- embedding : typing.Optional[str]
915
- The embedding configuration handle used by the agent, specified in the format provider/model-name.
916
-
917
- enable_sleeptime : typing.Optional[bool]
918
- If set to True, memory management will move to a background agent thread.
919
-
920
- response_format : typing.Optional[UpdateAgentResponseFormat]
921
- The response format for the agent.
922
-
923
- last_run_completion : typing.Optional[dt.datetime]
924
- The timestamp when the agent last completed a run.
925
-
926
- last_run_duration_ms : typing.Optional[int]
927
- The duration in milliseconds of the agent's last run.
928
-
929
- timezone : typing.Optional[str]
930
- The timezone of the agent (IANA format).
931
-
932
- max_files_open : typing.Optional[int]
933
- Maximum number of files that can be open at once for this agent. Setting this too high may exceed the context window, which will break the agent.
934
-
935
- per_file_view_window_char_limit : typing.Optional[int]
936
- The per-file view window character limit for this agent. Setting this too high may exceed the context window, which will break the agent.
937
-
938
- request_options : typing.Optional[RequestOptions]
939
- Request-specific configuration.
940
-
941
- Returns
942
- -------
943
- AgentState
944
- Successful Response
945
-
946
- Examples
947
- --------
948
- from letta_client import Letta
949
-
950
- client = Letta(
951
- project="YOUR_PROJECT",
952
- token="YOUR_TOKEN",
953
- )
954
- client.agents.modify(
955
- agent_id="agent_id",
956
- )
957
- """
958
- _response = self._client_wrapper.httpx_client.request(
959
- f"v1/agents/{jsonable_encoder(agent_id)}",
960
- method="PATCH",
961
- json={
962
- "name": name,
963
- "tool_ids": tool_ids,
964
- "source_ids": source_ids,
965
- "block_ids": block_ids,
966
- "tags": tags,
967
- "system": system,
968
- "tool_rules": convert_and_respect_annotation_metadata(
969
- object_=tool_rules, annotation=typing.Sequence[UpdateAgentToolRulesItem], direction="write"
970
- ),
971
- "llm_config": convert_and_respect_annotation_metadata(
972
- object_=llm_config, annotation=LlmConfig, direction="write"
973
- ),
974
- "embedding_config": convert_and_respect_annotation_metadata(
975
- object_=embedding_config, annotation=EmbeddingConfig, direction="write"
976
- ),
977
- "message_ids": message_ids,
978
- "description": description,
979
- "metadata": metadata,
980
- "tool_exec_environment_variables": tool_exec_environment_variables,
981
- "project_id": project_id,
982
- "template_id": template_id,
983
- "base_template_id": base_template_id,
984
- "identity_ids": identity_ids,
985
- "message_buffer_autoclear": message_buffer_autoclear,
986
- "model": model,
987
- "embedding": embedding,
988
- "enable_sleeptime": enable_sleeptime,
989
- "response_format": convert_and_respect_annotation_metadata(
990
- object_=response_format, annotation=UpdateAgentResponseFormat, direction="write"
991
- ),
992
- "last_run_completion": last_run_completion,
993
- "last_run_duration_ms": last_run_duration_ms,
994
- "timezone": timezone,
995
- "max_files_open": max_files_open,
996
- "per_file_view_window_char_limit": per_file_view_window_char_limit,
997
- },
998
- headers={
999
- "content-type": "application/json",
1000
- },
1001
- request_options=request_options,
1002
- omit=OMIT,
1003
- )
1004
- try:
1005
- if 200 <= _response.status_code < 300:
1006
- return typing.cast(
1007
- AgentState,
1008
- construct_type(
1009
- type_=AgentState, # type: ignore
1010
- object_=_response.json(),
1011
- ),
1012
- )
1013
- if _response.status_code == 422:
1014
- raise UnprocessableEntityError(
1015
- typing.cast(
1016
- HttpValidationError,
1017
- construct_type(
1018
- type_=HttpValidationError, # type: ignore
1019
- object_=_response.json(),
1020
- ),
1021
- )
1022
- )
1023
- _response_json = _response.json()
1024
- except JSONDecodeError:
1025
- raise ApiError(status_code=_response.status_code, body=_response.text)
1026
- raise ApiError(status_code=_response.status_code, body=_response_json)
1027
-
1028
- def summarize_agent_conversation(
1029
- self, agent_id: str, *, max_message_length: int, request_options: typing.Optional[RequestOptions] = None
1030
- ) -> None:
1031
- """
1032
- Summarize an agent's conversation history to a target message length.
1033
-
1034
- This endpoint summarizes the current message history for a given agent,
1035
- truncating and compressing it down to the specified `max_message_length`.
1036
-
1037
- Parameters
1038
- ----------
1039
- agent_id : str
1040
-
1041
- max_message_length : int
1042
- Maximum number of messages to retain after summarization.
1043
-
1044
- request_options : typing.Optional[RequestOptions]
1045
- Request-specific configuration.
1046
-
1047
- Returns
1048
- -------
1049
- None
1050
-
1051
- Examples
1052
- --------
1053
- from letta_client import Letta
1054
-
1055
- client = Letta(
1056
- project="YOUR_PROJECT",
1057
- token="YOUR_TOKEN",
1058
- )
1059
- client.agents.summarize_agent_conversation(
1060
- agent_id="agent_id",
1061
- max_message_length=1,
1062
- )
1063
- """
1064
- _response = self._client_wrapper.httpx_client.request(
1065
- f"v1/agents/{jsonable_encoder(agent_id)}/summarize",
1066
- method="POST",
1067
- params={
1068
- "max_message_length": max_message_length,
1069
- },
1070
- request_options=request_options,
1071
- )
1072
- try:
1073
- if 200 <= _response.status_code < 300:
1074
- return
1075
- if _response.status_code == 422:
1076
- raise UnprocessableEntityError(
1077
- typing.cast(
1078
- HttpValidationError,
1079
- construct_type(
1080
- type_=HttpValidationError, # type: ignore
1081
- object_=_response.json(),
1082
- ),
1083
- )
1084
- )
1085
- _response_json = _response.json()
1086
- except JSONDecodeError:
1087
- raise ApiError(status_code=_response.status_code, body=_response.text)
1088
- raise ApiError(status_code=_response.status_code, body=_response_json)
1089
-
1090
- def search(
1091
- self,
1092
- *,
1093
- search: typing.Optional[typing.Sequence[AgentsSearchRequestSearchItem]] = OMIT,
1094
- project_id: typing.Optional[str] = OMIT,
1095
- combinator: typing.Optional[typing.Literal["AND"]] = OMIT,
1096
- limit: typing.Optional[float] = OMIT,
1097
- after: typing.Optional[str] = OMIT,
1098
- sort_by: typing.Optional[AgentsSearchRequestSortBy] = OMIT,
1099
- ascending: typing.Optional[bool] = OMIT,
1100
- request_options: typing.Optional[RequestOptions] = None,
1101
- ) -> AgentsSearchResponse:
1102
- """
1103
- <Note>This endpoint is only available on Letta Cloud.</Note>
1104
-
1105
- Search deployed agents.
1106
-
1107
- Parameters
1108
- ----------
1109
- search : typing.Optional[typing.Sequence[AgentsSearchRequestSearchItem]]
1110
-
1111
- project_id : typing.Optional[str]
1112
-
1113
- combinator : typing.Optional[typing.Literal["AND"]]
1114
-
1115
- limit : typing.Optional[float]
1116
-
1117
- after : typing.Optional[str]
1118
-
1119
- sort_by : typing.Optional[AgentsSearchRequestSortBy]
1120
-
1121
- ascending : typing.Optional[bool]
1122
-
1123
- request_options : typing.Optional[RequestOptions]
1124
- Request-specific configuration.
1125
-
1126
- Returns
1127
- -------
1128
- AgentsSearchResponse
1129
- 200
1130
-
1131
- Examples
1132
- --------
1133
- from letta_client import Letta
1134
-
1135
- client = Letta(
1136
- project="YOUR_PROJECT",
1137
- token="YOUR_TOKEN",
1138
- )
1139
- client.agents.search()
1140
- """
1141
- _response = self._client_wrapper.httpx_client.request(
1142
- "v1/agents/search",
1143
- method="POST",
1144
- json={
1145
- "search": convert_and_respect_annotation_metadata(
1146
- object_=search, annotation=typing.Sequence[AgentsSearchRequestSearchItem], direction="write"
1147
- ),
1148
- "project_id": project_id,
1149
- "combinator": combinator,
1150
- "limit": limit,
1151
- "after": after,
1152
- "sortBy": sort_by,
1153
- "ascending": ascending,
1154
- },
1155
- headers={
1156
- "content-type": "application/json",
1157
- },
1158
- request_options=request_options,
1159
- omit=OMIT,
1160
- )
1161
- try:
1162
- if 200 <= _response.status_code < 300:
1163
- return typing.cast(
1164
- AgentsSearchResponse,
1165
- construct_type(
1166
- type_=AgentsSearchResponse, # type: ignore
1167
- object_=_response.json(),
1168
- ),
1169
- )
1170
- _response_json = _response.json()
1171
- except JSONDecodeError:
1172
- raise ApiError(status_code=_response.status_code, body=_response.text)
1173
- raise ApiError(status_code=_response.status_code, body=_response_json)
1174
-
1175
-
1176
- class AsyncAgentsClient:
1177
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
1178
- self._client_wrapper = client_wrapper
1179
- self.context = AsyncContextClient(client_wrapper=self._client_wrapper)
1180
- self.tools = AsyncToolsClient(client_wrapper=self._client_wrapper)
1181
- self.sources = AsyncSourcesClient(client_wrapper=self._client_wrapper)
1182
- self.folders = AsyncFoldersClient(client_wrapper=self._client_wrapper)
1183
- self.files = AsyncFilesClient(client_wrapper=self._client_wrapper)
1184
- self.core_memory = AsyncCoreMemoryClient(client_wrapper=self._client_wrapper)
1185
- self.blocks = AsyncBlocksClient(client_wrapper=self._client_wrapper)
1186
- self.passages = AsyncPassagesClient(client_wrapper=self._client_wrapper)
1187
- self.messages = AsyncMessagesClient(client_wrapper=self._client_wrapper)
1188
- self.groups = AsyncGroupsClient(client_wrapper=self._client_wrapper)
1189
- self.templates = AsyncTemplatesClient(client_wrapper=self._client_wrapper)
1190
- self.memory_variables = AsyncMemoryVariablesClient(client_wrapper=self._client_wrapper)
1191
-
1192
- async def list(
1193
- self,
1194
- *,
1195
- name: typing.Optional[str] = None,
1196
- tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
1197
- match_all_tags: typing.Optional[bool] = None,
1198
- before: typing.Optional[str] = None,
1199
- after: typing.Optional[str] = None,
1200
- limit: typing.Optional[int] = None,
1201
- query_text: typing.Optional[str] = None,
1202
- project_id: typing.Optional[str] = None,
1203
- template_id: typing.Optional[str] = None,
1204
- base_template_id: typing.Optional[str] = None,
1205
- identity_id: typing.Optional[str] = None,
1206
- identifier_keys: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
1207
- include_relationships: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
1208
- ascending: typing.Optional[bool] = None,
1209
- sort_by: typing.Optional[str] = None,
1210
- request_options: typing.Optional[RequestOptions] = None,
1211
- ) -> typing.List[AgentState]:
1212
- """
1213
- List all agents associated with a given user.
1214
-
1215
- This endpoint retrieves a list of all agents and their configurations
1216
- associated with the specified user ID.
1217
-
1218
- Parameters
1219
- ----------
1220
- name : typing.Optional[str]
1221
- Name of the agent
1222
-
1223
- tags : typing.Optional[typing.Union[str, typing.Sequence[str]]]
1224
- List of tags to filter agents by
1225
-
1226
- match_all_tags : typing.Optional[bool]
1227
- If True, only returns agents that match ALL given tags. Otherwise, return agents that have ANY of the passed-in tags.
1228
-
1229
- before : typing.Optional[str]
1230
- Cursor for pagination
1231
-
1232
- after : typing.Optional[str]
1233
- Cursor for pagination
1234
-
1235
- limit : typing.Optional[int]
1236
- Limit for pagination
1237
-
1238
- query_text : typing.Optional[str]
1239
- Search agents by name
1240
-
1241
- project_id : typing.Optional[str]
1242
- Search agents by project ID
1243
-
1244
- template_id : typing.Optional[str]
1245
- Search agents by template ID
1246
-
1247
- base_template_id : typing.Optional[str]
1248
- Search agents by base template ID
1249
-
1250
- identity_id : typing.Optional[str]
1251
- Search agents by identity ID
1252
-
1253
- identifier_keys : typing.Optional[typing.Union[str, typing.Sequence[str]]]
1254
- Search agents by identifier keys
1255
-
1256
- include_relationships : typing.Optional[typing.Union[str, typing.Sequence[str]]]
1257
- Specify which relational fields (e.g., 'tools', 'sources', 'memory') to include in the response. If not provided, all relationships are loaded by default. Using this can optimize performance by reducing unnecessary joins.
1258
-
1259
- ascending : typing.Optional[bool]
1260
- Whether to sort agents oldest to newest (True) or newest to oldest (False, default)
1261
-
1262
- sort_by : typing.Optional[str]
1263
- Field to sort by. Options: 'created_at' (default), 'last_run_completion'
1264
-
1265
- request_options : typing.Optional[RequestOptions]
1266
- Request-specific configuration.
1267
-
1268
- Returns
1269
- -------
1270
- typing.List[AgentState]
1271
- Successful Response
1272
-
1273
- Examples
1274
- --------
1275
- import asyncio
1276
-
1277
- from letta_client import AsyncLetta
1278
-
1279
- client = AsyncLetta(
1280
- project="YOUR_PROJECT",
1281
- token="YOUR_TOKEN",
1282
- )
1283
-
1284
-
1285
- async def main() -> None:
1286
- await client.agents.list()
1287
-
1288
-
1289
- asyncio.run(main())
1290
- """
1291
- _response = await self._client_wrapper.httpx_client.request(
1292
- "v1/agents/",
1293
- method="GET",
1294
- params={
1295
- "name": name,
1296
- "tags": tags,
1297
- "match_all_tags": match_all_tags,
1298
- "before": before,
1299
- "after": after,
1300
- "limit": limit,
1301
- "query_text": query_text,
1302
- "project_id": project_id,
1303
- "template_id": template_id,
1304
- "base_template_id": base_template_id,
1305
- "identity_id": identity_id,
1306
- "identifier_keys": identifier_keys,
1307
- "include_relationships": include_relationships,
1308
- "ascending": ascending,
1309
- "sort_by": sort_by,
1310
- },
1311
- request_options=request_options,
1312
- )
1313
- try:
1314
- if 200 <= _response.status_code < 300:
1315
- return typing.cast(
1316
- typing.List[AgentState],
1317
- construct_type(
1318
- type_=typing.List[AgentState], # type: ignore
1319
- object_=_response.json(),
1320
- ),
1321
- )
1322
- if _response.status_code == 422:
1323
- raise UnprocessableEntityError(
1324
- typing.cast(
1325
- HttpValidationError,
1326
- construct_type(
1327
- type_=HttpValidationError, # type: ignore
1328
- object_=_response.json(),
1329
- ),
1330
- )
1331
- )
1332
- _response_json = _response.json()
1333
- except JSONDecodeError:
1334
- raise ApiError(status_code=_response.status_code, body=_response.text)
1335
- raise ApiError(status_code=_response.status_code, body=_response_json)
1336
-
1337
- async def create(
1338
- self,
1339
- *,
1340
- name: typing.Optional[str] = OMIT,
1341
- memory_blocks: typing.Optional[typing.Sequence[CreateBlock]] = OMIT,
1342
- tools: typing.Optional[typing.Sequence[str]] = OMIT,
1343
- tool_ids: typing.Optional[typing.Sequence[str]] = OMIT,
1344
- source_ids: typing.Optional[typing.Sequence[str]] = OMIT,
1345
- block_ids: typing.Optional[typing.Sequence[str]] = OMIT,
1346
- tool_rules: typing.Optional[typing.Sequence[CreateAgentRequestToolRulesItem]] = OMIT,
1347
- tags: typing.Optional[typing.Sequence[str]] = OMIT,
1348
- system: typing.Optional[str] = OMIT,
1349
- agent_type: typing.Optional[AgentType] = OMIT,
1350
- llm_config: typing.Optional[LlmConfig] = OMIT,
1351
- embedding_config: typing.Optional[EmbeddingConfig] = OMIT,
1352
- initial_message_sequence: typing.Optional[typing.Sequence[MessageCreate]] = OMIT,
1353
- include_base_tools: typing.Optional[bool] = OMIT,
1354
- include_multi_agent_tools: typing.Optional[bool] = OMIT,
1355
- include_base_tool_rules: typing.Optional[bool] = OMIT,
1356
- include_default_source: typing.Optional[bool] = OMIT,
1357
- description: typing.Optional[str] = OMIT,
1358
- metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
1359
- model: typing.Optional[str] = OMIT,
1360
- embedding: typing.Optional[str] = OMIT,
1361
- context_window_limit: typing.Optional[int] = OMIT,
1362
- embedding_chunk_size: typing.Optional[int] = OMIT,
1363
- max_tokens: typing.Optional[int] = OMIT,
1364
- max_reasoning_tokens: typing.Optional[int] = OMIT,
1365
- enable_reasoner: typing.Optional[bool] = OMIT,
1366
- from_template: typing.Optional[str] = OMIT,
1367
- template: typing.Optional[bool] = OMIT,
1368
- project: typing.Optional[str] = OMIT,
1369
- tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
1370
- memory_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
1371
- project_id: typing.Optional[str] = OMIT,
1372
- template_id: typing.Optional[str] = OMIT,
1373
- base_template_id: typing.Optional[str] = OMIT,
1374
- identity_ids: typing.Optional[typing.Sequence[str]] = OMIT,
1375
- message_buffer_autoclear: typing.Optional[bool] = OMIT,
1376
- enable_sleeptime: typing.Optional[bool] = OMIT,
1377
- response_format: typing.Optional[CreateAgentRequestResponseFormat] = OMIT,
1378
- timezone: typing.Optional[str] = OMIT,
1379
- max_files_open: typing.Optional[int] = OMIT,
1380
- per_file_view_window_char_limit: typing.Optional[int] = OMIT,
1381
- request_options: typing.Optional[RequestOptions] = None,
1382
- ) -> AgentState:
1383
- """
1384
- Create a new agent with the specified configuration.
1385
-
1386
- Parameters
1387
- ----------
1388
- name : typing.Optional[str]
1389
- The name of the agent.
1390
-
1391
- memory_blocks : typing.Optional[typing.Sequence[CreateBlock]]
1392
- The blocks to create in the agent's in-context memory.
1393
-
1394
- tools : typing.Optional[typing.Sequence[str]]
1395
- The tools used by the agent.
1396
-
1397
- tool_ids : typing.Optional[typing.Sequence[str]]
1398
- The ids of the tools used by the agent.
1399
-
1400
- source_ids : typing.Optional[typing.Sequence[str]]
1401
- The ids of the sources used by the agent.
1402
-
1403
- block_ids : typing.Optional[typing.Sequence[str]]
1404
- The ids of the blocks used by the agent.
1405
-
1406
- tool_rules : typing.Optional[typing.Sequence[CreateAgentRequestToolRulesItem]]
1407
- The tool rules governing the agent.
1408
-
1409
- tags : typing.Optional[typing.Sequence[str]]
1410
- The tags associated with the agent.
1411
-
1412
- system : typing.Optional[str]
1413
- The system prompt used by the agent.
1414
-
1415
- agent_type : typing.Optional[AgentType]
1416
- The type of agent.
1417
-
1418
- llm_config : typing.Optional[LlmConfig]
1419
- The LLM configuration used by the agent.
1420
-
1421
- embedding_config : typing.Optional[EmbeddingConfig]
1422
- The embedding configuration used by the agent.
1423
-
1424
- initial_message_sequence : typing.Optional[typing.Sequence[MessageCreate]]
1425
- The initial set of messages to put in the agent's in-context memory.
1426
-
1427
- include_base_tools : typing.Optional[bool]
1428
- If true, attaches the Letta core tools (e.g. core_memory related functions).
1429
-
1430
- include_multi_agent_tools : typing.Optional[bool]
1431
- If true, attaches the Letta multi-agent tools (e.g. sending a message to another agent).
1432
-
1433
- include_base_tool_rules : typing.Optional[bool]
1434
- If true, attaches the Letta base tool rules (e.g. deny all tools not explicitly allowed).
1435
-
1436
- include_default_source : typing.Optional[bool]
1437
- If true, automatically creates and attaches a default data source for this agent.
1438
-
1439
- description : typing.Optional[str]
1440
- The description of the agent.
1441
-
1442
- metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1443
- The metadata of the agent.
1444
-
1445
- model : typing.Optional[str]
1446
- The LLM configuration handle used by the agent, specified in the format provider/model-name, as an alternative to specifying llm_config.
1447
-
1448
- embedding : typing.Optional[str]
1449
- The embedding configuration handle used by the agent, specified in the format provider/model-name.
1450
-
1451
- context_window_limit : typing.Optional[int]
1452
- The context window limit used by the agent.
1453
-
1454
- embedding_chunk_size : typing.Optional[int]
1455
- The embedding chunk size used by the agent.
1456
-
1457
- max_tokens : typing.Optional[int]
1458
- The maximum number of tokens to generate, including reasoning step. If not set, the model will use its default value.
1459
-
1460
- max_reasoning_tokens : typing.Optional[int]
1461
- The maximum number of tokens to generate for reasoning step. If not set, the model will use its default value.
1462
-
1463
- enable_reasoner : typing.Optional[bool]
1464
- Whether to enable internal extended thinking step for a reasoner model.
1465
-
1466
- from_template : typing.Optional[str]
1467
- The template id used to configure the agent
1468
-
1469
- template : typing.Optional[bool]
1470
- Whether the agent is a template
1471
-
1472
- project : typing.Optional[str]
1473
- Deprecated: Project should now be passed via the X-Project header instead of in the request body. If using the sdk, this can be done via the new x_project field below.
1474
-
1475
- tool_exec_environment_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
1476
- The environment variables for tool execution specific to this agent.
1477
-
1478
- memory_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
1479
- The variables that should be set for the agent.
1480
-
1481
- project_id : typing.Optional[str]
1482
- The id of the project the agent belongs to.
1483
-
1484
- template_id : typing.Optional[str]
1485
- The id of the template the agent belongs to.
1486
-
1487
- base_template_id : typing.Optional[str]
1488
- The base template id of the agent.
1489
-
1490
- identity_ids : typing.Optional[typing.Sequence[str]]
1491
- The ids of the identities associated with this agent.
1492
-
1493
- message_buffer_autoclear : typing.Optional[bool]
1494
- If set to True, the agent will not remember previous messages (though the agent will still retain state via core memory blocks and archival/recall memory). Not recommended unless you have an advanced use case.
1495
-
1496
- enable_sleeptime : typing.Optional[bool]
1497
- If set to True, memory management will move to a background agent thread.
1498
-
1499
- response_format : typing.Optional[CreateAgentRequestResponseFormat]
1500
- The response format for the agent.
1501
-
1502
- timezone : typing.Optional[str]
1503
- The timezone of the agent (IANA format).
1504
-
1505
- max_files_open : typing.Optional[int]
1506
- Maximum number of files that can be open at once for this agent. Setting this too high may exceed the context window, which will break the agent.
1507
-
1508
- per_file_view_window_char_limit : typing.Optional[int]
1509
- The per-file view window character limit for this agent. Setting this too high may exceed the context window, which will break the agent.
1510
-
1511
- request_options : typing.Optional[RequestOptions]
1512
- Request-specific configuration.
1513
-
1514
- Returns
1515
- -------
1516
- AgentState
1517
- Successful Response
1518
-
1519
- Examples
1520
- --------
1521
- import asyncio
1522
-
1523
- from letta_client import AsyncLetta
1524
-
1525
- client = AsyncLetta(
1526
- project="YOUR_PROJECT",
1527
- token="YOUR_TOKEN",
1528
- )
1529
-
1530
-
1531
- async def main() -> None:
1532
- await client.agents.create()
1533
-
1534
-
1535
- asyncio.run(main())
1536
- """
1537
- _response = await self._client_wrapper.httpx_client.request(
1538
- "v1/agents/",
1539
- method="POST",
1540
- json={
1541
- "name": name,
1542
- "memory_blocks": convert_and_respect_annotation_metadata(
1543
- object_=memory_blocks, annotation=typing.Sequence[CreateBlock], direction="write"
1544
- ),
1545
- "tools": tools,
1546
- "tool_ids": tool_ids,
1547
- "source_ids": source_ids,
1548
- "block_ids": block_ids,
1549
- "tool_rules": convert_and_respect_annotation_metadata(
1550
- object_=tool_rules, annotation=typing.Sequence[CreateAgentRequestToolRulesItem], direction="write"
1551
- ),
1552
- "tags": tags,
1553
- "system": system,
1554
- "agent_type": agent_type,
1555
- "llm_config": convert_and_respect_annotation_metadata(
1556
- object_=llm_config, annotation=LlmConfig, direction="write"
1557
- ),
1558
- "embedding_config": convert_and_respect_annotation_metadata(
1559
- object_=embedding_config, annotation=EmbeddingConfig, direction="write"
1560
- ),
1561
- "initial_message_sequence": convert_and_respect_annotation_metadata(
1562
- object_=initial_message_sequence, annotation=typing.Sequence[MessageCreate], direction="write"
1563
- ),
1564
- "include_base_tools": include_base_tools,
1565
- "include_multi_agent_tools": include_multi_agent_tools,
1566
- "include_base_tool_rules": include_base_tool_rules,
1567
- "include_default_source": include_default_source,
1568
- "description": description,
1569
- "metadata": metadata,
1570
- "model": model,
1571
- "embedding": embedding,
1572
- "context_window_limit": context_window_limit,
1573
- "embedding_chunk_size": embedding_chunk_size,
1574
- "max_tokens": max_tokens,
1575
- "max_reasoning_tokens": max_reasoning_tokens,
1576
- "enable_reasoner": enable_reasoner,
1577
- "from_template": from_template,
1578
- "template": template,
1579
- "project": project,
1580
- "tool_exec_environment_variables": tool_exec_environment_variables,
1581
- "memory_variables": memory_variables,
1582
- "project_id": project_id,
1583
- "template_id": template_id,
1584
- "base_template_id": base_template_id,
1585
- "identity_ids": identity_ids,
1586
- "message_buffer_autoclear": message_buffer_autoclear,
1587
- "enable_sleeptime": enable_sleeptime,
1588
- "response_format": convert_and_respect_annotation_metadata(
1589
- object_=response_format, annotation=CreateAgentRequestResponseFormat, direction="write"
1590
- ),
1591
- "timezone": timezone,
1592
- "max_files_open": max_files_open,
1593
- "per_file_view_window_char_limit": per_file_view_window_char_limit,
1594
- },
1595
- headers={
1596
- "content-type": "application/json",
1597
- },
1598
- request_options=request_options,
1599
- omit=OMIT,
1600
- )
1601
- try:
1602
- if 200 <= _response.status_code < 300:
1603
- return typing.cast(
1604
- AgentState,
1605
- construct_type(
1606
- type_=AgentState, # type: ignore
1607
- object_=_response.json(),
1608
- ),
1609
- )
1610
- if _response.status_code == 422:
1611
- raise UnprocessableEntityError(
1612
- typing.cast(
1613
- HttpValidationError,
1614
- construct_type(
1615
- type_=HttpValidationError, # type: ignore
1616
- object_=_response.json(),
1617
- ),
1618
- )
1619
- )
1620
- _response_json = _response.json()
1621
- except JSONDecodeError:
1622
- raise ApiError(status_code=_response.status_code, body=_response.text)
1623
- raise ApiError(status_code=_response.status_code, body=_response_json)
1624
-
1625
- async def count(self, *, request_options: typing.Optional[RequestOptions] = None) -> int:
1626
- """
1627
- Get the count of all agents associated with a given user.
1628
-
1629
- Parameters
1630
- ----------
1631
- request_options : typing.Optional[RequestOptions]
1632
- Request-specific configuration.
1633
-
1634
- Returns
1635
- -------
1636
- int
1637
- Successful Response
1638
-
1639
- Examples
1640
- --------
1641
- import asyncio
1642
-
1643
- from letta_client import AsyncLetta
1644
-
1645
- client = AsyncLetta(
1646
- project="YOUR_PROJECT",
1647
- token="YOUR_TOKEN",
1648
- )
1649
-
1650
-
1651
- async def main() -> None:
1652
- await client.agents.count()
1653
-
1654
-
1655
- asyncio.run(main())
1656
- """
1657
- _response = await self._client_wrapper.httpx_client.request(
1658
- "v1/agents/count",
1659
- method="GET",
1660
- request_options=request_options,
1661
- )
1662
- try:
1663
- if 200 <= _response.status_code < 300:
1664
- return typing.cast(
1665
- int,
1666
- construct_type(
1667
- type_=int, # type: ignore
1668
- object_=_response.json(),
1669
- ),
1670
- )
1671
- if _response.status_code == 422:
1672
- raise UnprocessableEntityError(
1673
- typing.cast(
1674
- HttpValidationError,
1675
- construct_type(
1676
- type_=HttpValidationError, # type: ignore
1677
- object_=_response.json(),
1678
- ),
1679
- )
1680
- )
1681
- _response_json = _response.json()
1682
- except JSONDecodeError:
1683
- raise ApiError(status_code=_response.status_code, body=_response.text)
1684
- raise ApiError(status_code=_response.status_code, body=_response_json)
1685
-
1686
- async def export_file(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> str:
1687
- """
1688
- Export the serialized JSON representation of an agent, formatted with indentation.
1689
-
1690
- Parameters
1691
- ----------
1692
- agent_id : str
1693
-
1694
- request_options : typing.Optional[RequestOptions]
1695
- Request-specific configuration.
1696
-
1697
- Returns
1698
- -------
1699
- str
1700
- Successful Response
1701
-
1702
- Examples
1703
- --------
1704
- import asyncio
1705
-
1706
- from letta_client import AsyncLetta
1707
-
1708
- client = AsyncLetta(
1709
- project="YOUR_PROJECT",
1710
- token="YOUR_TOKEN",
1711
- )
1712
-
1713
-
1714
- async def main() -> None:
1715
- await client.agents.export_file(
1716
- agent_id="agent_id",
1717
- )
1718
-
1719
-
1720
- asyncio.run(main())
1721
- """
1722
- _response = await self._client_wrapper.httpx_client.request(
1723
- f"v1/agents/{jsonable_encoder(agent_id)}/export",
1724
- method="GET",
1725
- request_options=request_options,
1726
- )
1727
- try:
1728
- if 200 <= _response.status_code < 300:
1729
- return typing.cast(
1730
- str,
1731
- construct_type(
1732
- type_=str, # type: ignore
1733
- object_=_response.json(),
1734
- ),
1735
- )
1736
- if _response.status_code == 422:
1737
- raise UnprocessableEntityError(
1738
- typing.cast(
1739
- HttpValidationError,
1740
- construct_type(
1741
- type_=HttpValidationError, # type: ignore
1742
- object_=_response.json(),
1743
- ),
1744
- )
1745
- )
1746
- _response_json = _response.json()
1747
- except JSONDecodeError:
1748
- raise ApiError(status_code=_response.status_code, body=_response.text)
1749
- raise ApiError(status_code=_response.status_code, body=_response_json)
1750
-
1751
- async def import_file(
1752
- self,
1753
- *,
1754
- file: core.File,
1755
- append_copy_suffix: typing.Optional[bool] = None,
1756
- override_existing_tools: typing.Optional[bool] = None,
1757
- project_id: typing.Optional[str] = None,
1758
- strip_messages: typing.Optional[bool] = None,
1759
- request_options: typing.Optional[RequestOptions] = None,
1760
- ) -> AgentState:
1761
- """
1762
- Import a serialized agent file and recreate the agent in the system.
1763
-
1764
- Parameters
1765
- ----------
1766
- file : core.File
1767
- See core.File for more documentation
1768
-
1769
- append_copy_suffix : typing.Optional[bool]
1770
- If set to True, appends "_copy" to the end of the agent name.
1771
-
1772
- override_existing_tools : typing.Optional[bool]
1773
- If set to True, existing tools can get their source code overwritten by the uploaded tool definitions. Note that Letta core tools can never be updated externally.
1774
-
1775
- project_id : typing.Optional[str]
1776
- The project ID to associate the uploaded agent with.
1777
-
1778
- strip_messages : typing.Optional[bool]
1779
- If set to True, strips all messages from the agent before importing.
1780
-
1781
- request_options : typing.Optional[RequestOptions]
1782
- Request-specific configuration.
1783
-
1784
- Returns
1785
- -------
1786
- AgentState
1787
- Successful Response
1788
-
1789
- Examples
1790
- --------
1791
- import asyncio
1792
-
1793
- from letta_client import AsyncLetta
1794
-
1795
- client = AsyncLetta(
1796
- project="YOUR_PROJECT",
1797
- token="YOUR_TOKEN",
1798
- )
1799
-
1800
-
1801
- async def main() -> None:
1802
- await client.agents.import_file()
1803
-
1804
-
1805
- asyncio.run(main())
1806
- """
1807
- _response = await self._client_wrapper.httpx_client.request(
1808
- "v1/agents/import",
1809
- method="POST",
1810
- params={
1811
- "append_copy_suffix": append_copy_suffix,
1812
- "override_existing_tools": override_existing_tools,
1813
- "project_id": project_id,
1814
- "strip_messages": strip_messages,
1815
- },
1816
- data={},
1817
- files={
1818
- "file": file,
1819
- },
1820
- request_options=request_options,
1821
- omit=OMIT,
1822
- )
1823
- try:
1824
- if 200 <= _response.status_code < 300:
1825
- return typing.cast(
1826
- AgentState,
1827
- construct_type(
1828
- type_=AgentState, # type: ignore
1829
- object_=_response.json(),
1830
- ),
1831
- )
1832
- if _response.status_code == 422:
1833
- raise UnprocessableEntityError(
1834
- typing.cast(
1835
- HttpValidationError,
1836
- construct_type(
1837
- type_=HttpValidationError, # type: ignore
1838
- object_=_response.json(),
1839
- ),
1840
- )
1841
- )
1842
- _response_json = _response.json()
1843
- except JSONDecodeError:
1844
- raise ApiError(status_code=_response.status_code, body=_response.text)
1845
- raise ApiError(status_code=_response.status_code, body=_response_json)
1846
-
1847
- async def retrieve(
1848
- self,
1849
- agent_id: str,
1850
- *,
1851
- include_relationships: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
1852
- request_options: typing.Optional[RequestOptions] = None,
1853
- ) -> AgentState:
1854
- """
1855
- Get the state of the agent.
1856
-
1857
- Parameters
1858
- ----------
1859
- agent_id : str
1860
-
1861
- include_relationships : typing.Optional[typing.Union[str, typing.Sequence[str]]]
1862
- Specify which relational fields (e.g., 'tools', 'sources', 'memory') to include in the response. If not provided, all relationships are loaded by default. Using this can optimize performance by reducing unnecessary joins.
1863
-
1864
- request_options : typing.Optional[RequestOptions]
1865
- Request-specific configuration.
1866
-
1867
- Returns
1868
- -------
1869
- AgentState
1870
- Successful Response
1871
-
1872
- Examples
1873
- --------
1874
- import asyncio
1875
-
1876
- from letta_client import AsyncLetta
1877
-
1878
- client = AsyncLetta(
1879
- project="YOUR_PROJECT",
1880
- token="YOUR_TOKEN",
1881
- )
1882
-
1883
-
1884
- async def main() -> None:
1885
- await client.agents.retrieve(
1886
- agent_id="agent_id",
1887
- )
1888
-
1889
-
1890
- asyncio.run(main())
1891
- """
1892
- _response = await self._client_wrapper.httpx_client.request(
1893
- f"v1/agents/{jsonable_encoder(agent_id)}",
1894
- method="GET",
1895
- params={
1896
- "include_relationships": include_relationships,
1897
- },
1898
- request_options=request_options,
1899
- )
1900
- try:
1901
- if 200 <= _response.status_code < 300:
1902
- return typing.cast(
1903
- AgentState,
1904
- construct_type(
1905
- type_=AgentState, # type: ignore
1906
- object_=_response.json(),
1907
- ),
1908
- )
1909
- if _response.status_code == 422:
1910
- raise UnprocessableEntityError(
1911
- typing.cast(
1912
- HttpValidationError,
1913
- construct_type(
1914
- type_=HttpValidationError, # type: ignore
1915
- object_=_response.json(),
1916
- ),
1917
- )
1918
- )
1919
- _response_json = _response.json()
1920
- except JSONDecodeError:
1921
- raise ApiError(status_code=_response.status_code, body=_response.text)
1922
- raise ApiError(status_code=_response.status_code, body=_response_json)
1923
-
1924
- async def delete(
1925
- self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
1926
- ) -> typing.Optional[typing.Any]:
1927
- """
1928
- Delete an agent.
1929
-
1930
- Parameters
1931
- ----------
1932
- agent_id : str
1933
-
1934
- request_options : typing.Optional[RequestOptions]
1935
- Request-specific configuration.
1936
-
1937
- Returns
1938
- -------
1939
- typing.Optional[typing.Any]
1940
- Successful Response
1941
-
1942
- Examples
1943
- --------
1944
- import asyncio
1945
-
1946
- from letta_client import AsyncLetta
1947
-
1948
- client = AsyncLetta(
1949
- project="YOUR_PROJECT",
1950
- token="YOUR_TOKEN",
1951
- )
1952
-
1953
-
1954
- async def main() -> None:
1955
- await client.agents.delete(
1956
- agent_id="agent_id",
1957
- )
1958
-
1959
-
1960
- asyncio.run(main())
1961
- """
1962
- _response = await self._client_wrapper.httpx_client.request(
1963
- f"v1/agents/{jsonable_encoder(agent_id)}",
1964
- method="DELETE",
1965
- request_options=request_options,
1966
- )
1967
- try:
1968
- if 200 <= _response.status_code < 300:
1969
- return typing.cast(
1970
- typing.Optional[typing.Any],
1971
- construct_type(
1972
- type_=typing.Optional[typing.Any], # type: ignore
1973
- object_=_response.json(),
1974
- ),
1975
- )
1976
- if _response.status_code == 422:
1977
- raise UnprocessableEntityError(
1978
- typing.cast(
1979
- HttpValidationError,
1980
- construct_type(
1981
- type_=HttpValidationError, # type: ignore
1982
- object_=_response.json(),
1983
- ),
1984
- )
1985
- )
1986
- _response_json = _response.json()
1987
- except JSONDecodeError:
1988
- raise ApiError(status_code=_response.status_code, body=_response.text)
1989
- raise ApiError(status_code=_response.status_code, body=_response_json)
1990
-
1991
- async def modify(
1992
- self,
1993
- agent_id: str,
1994
- *,
1995
- name: typing.Optional[str] = OMIT,
1996
- tool_ids: typing.Optional[typing.Sequence[str]] = OMIT,
1997
- source_ids: typing.Optional[typing.Sequence[str]] = OMIT,
1998
- block_ids: typing.Optional[typing.Sequence[str]] = OMIT,
1999
- tags: typing.Optional[typing.Sequence[str]] = OMIT,
2000
- system: typing.Optional[str] = OMIT,
2001
- tool_rules: typing.Optional[typing.Sequence[UpdateAgentToolRulesItem]] = OMIT,
2002
- llm_config: typing.Optional[LlmConfig] = OMIT,
2003
- embedding_config: typing.Optional[EmbeddingConfig] = OMIT,
2004
- message_ids: typing.Optional[typing.Sequence[str]] = OMIT,
2005
- description: typing.Optional[str] = OMIT,
2006
- metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
2007
- tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
2008
- project_id: typing.Optional[str] = OMIT,
2009
- template_id: typing.Optional[str] = OMIT,
2010
- base_template_id: typing.Optional[str] = OMIT,
2011
- identity_ids: typing.Optional[typing.Sequence[str]] = OMIT,
2012
- message_buffer_autoclear: typing.Optional[bool] = OMIT,
2013
- model: typing.Optional[str] = OMIT,
2014
- embedding: typing.Optional[str] = OMIT,
2015
- enable_sleeptime: typing.Optional[bool] = OMIT,
2016
- response_format: typing.Optional[UpdateAgentResponseFormat] = OMIT,
2017
- last_run_completion: typing.Optional[dt.datetime] = OMIT,
2018
- last_run_duration_ms: typing.Optional[int] = OMIT,
2019
- timezone: typing.Optional[str] = OMIT,
2020
- max_files_open: typing.Optional[int] = OMIT,
2021
- per_file_view_window_char_limit: typing.Optional[int] = OMIT,
2022
- request_options: typing.Optional[RequestOptions] = None,
2023
- ) -> AgentState:
2024
- """
2025
- Update an existing agent
2026
-
2027
- Parameters
2028
- ----------
2029
- agent_id : str
2030
-
2031
- name : typing.Optional[str]
2032
- The name of the agent.
2033
-
2034
- tool_ids : typing.Optional[typing.Sequence[str]]
2035
- The ids of the tools used by the agent.
2036
-
2037
- source_ids : typing.Optional[typing.Sequence[str]]
2038
- The ids of the sources used by the agent.
2039
-
2040
- block_ids : typing.Optional[typing.Sequence[str]]
2041
- The ids of the blocks used by the agent.
2042
-
2043
- tags : typing.Optional[typing.Sequence[str]]
2044
- The tags associated with the agent.
2045
-
2046
- system : typing.Optional[str]
2047
- The system prompt used by the agent.
2048
-
2049
- tool_rules : typing.Optional[typing.Sequence[UpdateAgentToolRulesItem]]
2050
- The tool rules governing the agent.
2051
-
2052
- llm_config : typing.Optional[LlmConfig]
2053
- The LLM configuration used by the agent.
2054
-
2055
- embedding_config : typing.Optional[EmbeddingConfig]
2056
- The embedding configuration used by the agent.
2057
-
2058
- message_ids : typing.Optional[typing.Sequence[str]]
2059
- The ids of the messages in the agent's in-context memory.
2060
-
2061
- description : typing.Optional[str]
2062
- The description of the agent.
2063
-
2064
- metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
2065
- The metadata of the agent.
2066
-
2067
- tool_exec_environment_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
2068
- The environment variables for tool execution specific to this agent.
2069
-
2070
- project_id : typing.Optional[str]
2071
- The id of the project the agent belongs to.
2072
-
2073
- template_id : typing.Optional[str]
2074
- The id of the template the agent belongs to.
2075
-
2076
- base_template_id : typing.Optional[str]
2077
- The base template id of the agent.
2078
-
2079
- identity_ids : typing.Optional[typing.Sequence[str]]
2080
- The ids of the identities associated with this agent.
2081
-
2082
- message_buffer_autoclear : typing.Optional[bool]
2083
- If set to True, the agent will not remember previous messages (though the agent will still retain state via core memory blocks and archival/recall memory). Not recommended unless you have an advanced use case.
2084
-
2085
- model : typing.Optional[str]
2086
- The LLM configuration handle used by the agent, specified in the format provider/model-name, as an alternative to specifying llm_config.
2087
-
2088
- embedding : typing.Optional[str]
2089
- The embedding configuration handle used by the agent, specified in the format provider/model-name.
2090
-
2091
- enable_sleeptime : typing.Optional[bool]
2092
- If set to True, memory management will move to a background agent thread.
2093
-
2094
- response_format : typing.Optional[UpdateAgentResponseFormat]
2095
- The response format for the agent.
2096
-
2097
- last_run_completion : typing.Optional[dt.datetime]
2098
- The timestamp when the agent last completed a run.
2099
-
2100
- last_run_duration_ms : typing.Optional[int]
2101
- The duration in milliseconds of the agent's last run.
2102
-
2103
- timezone : typing.Optional[str]
2104
- The timezone of the agent (IANA format).
2105
-
2106
- max_files_open : typing.Optional[int]
2107
- Maximum number of files that can be open at once for this agent. Setting this too high may exceed the context window, which will break the agent.
2108
-
2109
- per_file_view_window_char_limit : typing.Optional[int]
2110
- The per-file view window character limit for this agent. Setting this too high may exceed the context window, which will break the agent.
2111
-
2112
- request_options : typing.Optional[RequestOptions]
2113
- Request-specific configuration.
2114
-
2115
- Returns
2116
- -------
2117
- AgentState
2118
- Successful Response
2119
-
2120
- Examples
2121
- --------
2122
- import asyncio
2123
-
2124
- from letta_client import AsyncLetta
2125
-
2126
- client = AsyncLetta(
2127
- project="YOUR_PROJECT",
2128
- token="YOUR_TOKEN",
2129
- )
2130
-
2131
-
2132
- async def main() -> None:
2133
- await client.agents.modify(
2134
- agent_id="agent_id",
2135
- )
2136
-
2137
-
2138
- asyncio.run(main())
2139
- """
2140
- _response = await self._client_wrapper.httpx_client.request(
2141
- f"v1/agents/{jsonable_encoder(agent_id)}",
2142
- method="PATCH",
2143
- json={
2144
- "name": name,
2145
- "tool_ids": tool_ids,
2146
- "source_ids": source_ids,
2147
- "block_ids": block_ids,
2148
- "tags": tags,
2149
- "system": system,
2150
- "tool_rules": convert_and_respect_annotation_metadata(
2151
- object_=tool_rules, annotation=typing.Sequence[UpdateAgentToolRulesItem], direction="write"
2152
- ),
2153
- "llm_config": convert_and_respect_annotation_metadata(
2154
- object_=llm_config, annotation=LlmConfig, direction="write"
2155
- ),
2156
- "embedding_config": convert_and_respect_annotation_metadata(
2157
- object_=embedding_config, annotation=EmbeddingConfig, direction="write"
2158
- ),
2159
- "message_ids": message_ids,
2160
- "description": description,
2161
- "metadata": metadata,
2162
- "tool_exec_environment_variables": tool_exec_environment_variables,
2163
- "project_id": project_id,
2164
- "template_id": template_id,
2165
- "base_template_id": base_template_id,
2166
- "identity_ids": identity_ids,
2167
- "message_buffer_autoclear": message_buffer_autoclear,
2168
- "model": model,
2169
- "embedding": embedding,
2170
- "enable_sleeptime": enable_sleeptime,
2171
- "response_format": convert_and_respect_annotation_metadata(
2172
- object_=response_format, annotation=UpdateAgentResponseFormat, direction="write"
2173
- ),
2174
- "last_run_completion": last_run_completion,
2175
- "last_run_duration_ms": last_run_duration_ms,
2176
- "timezone": timezone,
2177
- "max_files_open": max_files_open,
2178
- "per_file_view_window_char_limit": per_file_view_window_char_limit,
2179
- },
2180
- headers={
2181
- "content-type": "application/json",
2182
- },
2183
- request_options=request_options,
2184
- omit=OMIT,
2185
- )
2186
- try:
2187
- if 200 <= _response.status_code < 300:
2188
- return typing.cast(
2189
- AgentState,
2190
- construct_type(
2191
- type_=AgentState, # type: ignore
2192
- object_=_response.json(),
2193
- ),
2194
- )
2195
- if _response.status_code == 422:
2196
- raise UnprocessableEntityError(
2197
- typing.cast(
2198
- HttpValidationError,
2199
- construct_type(
2200
- type_=HttpValidationError, # type: ignore
2201
- object_=_response.json(),
2202
- ),
2203
- )
2204
- )
2205
- _response_json = _response.json()
2206
- except JSONDecodeError:
2207
- raise ApiError(status_code=_response.status_code, body=_response.text)
2208
- raise ApiError(status_code=_response.status_code, body=_response_json)
2209
-
2210
- async def summarize_agent_conversation(
2211
- self, agent_id: str, *, max_message_length: int, request_options: typing.Optional[RequestOptions] = None
2212
- ) -> None:
2213
- """
2214
- Summarize an agent's conversation history to a target message length.
2215
-
2216
- This endpoint summarizes the current message history for a given agent,
2217
- truncating and compressing it down to the specified `max_message_length`.
2218
-
2219
- Parameters
2220
- ----------
2221
- agent_id : str
2222
-
2223
- max_message_length : int
2224
- Maximum number of messages to retain after summarization.
2225
-
2226
- request_options : typing.Optional[RequestOptions]
2227
- Request-specific configuration.
2228
-
2229
- Returns
2230
- -------
2231
- None
2232
-
2233
- Examples
2234
- --------
2235
- import asyncio
2236
-
2237
- from letta_client import AsyncLetta
2238
-
2239
- client = AsyncLetta(
2240
- project="YOUR_PROJECT",
2241
- token="YOUR_TOKEN",
2242
- )
2243
-
2244
-
2245
- async def main() -> None:
2246
- await client.agents.summarize_agent_conversation(
2247
- agent_id="agent_id",
2248
- max_message_length=1,
2249
- )
2250
-
2251
-
2252
- asyncio.run(main())
2253
- """
2254
- _response = await self._client_wrapper.httpx_client.request(
2255
- f"v1/agents/{jsonable_encoder(agent_id)}/summarize",
2256
- method="POST",
2257
- params={
2258
- "max_message_length": max_message_length,
2259
- },
2260
- request_options=request_options,
2261
- )
2262
- try:
2263
- if 200 <= _response.status_code < 300:
2264
- return
2265
- if _response.status_code == 422:
2266
- raise UnprocessableEntityError(
2267
- typing.cast(
2268
- HttpValidationError,
2269
- construct_type(
2270
- type_=HttpValidationError, # type: ignore
2271
- object_=_response.json(),
2272
- ),
2273
- )
2274
- )
2275
- _response_json = _response.json()
2276
- except JSONDecodeError:
2277
- raise ApiError(status_code=_response.status_code, body=_response.text)
2278
- raise ApiError(status_code=_response.status_code, body=_response_json)
2279
-
2280
- async def search(
2281
- self,
2282
- *,
2283
- search: typing.Optional[typing.Sequence[AgentsSearchRequestSearchItem]] = OMIT,
2284
- project_id: typing.Optional[str] = OMIT,
2285
- combinator: typing.Optional[typing.Literal["AND"]] = OMIT,
2286
- limit: typing.Optional[float] = OMIT,
2287
- after: typing.Optional[str] = OMIT,
2288
- sort_by: typing.Optional[AgentsSearchRequestSortBy] = OMIT,
2289
- ascending: typing.Optional[bool] = OMIT,
2290
- request_options: typing.Optional[RequestOptions] = None,
2291
- ) -> AgentsSearchResponse:
2292
- """
2293
- <Note>This endpoint is only available on Letta Cloud.</Note>
2294
-
2295
- Search deployed agents.
2296
-
2297
- Parameters
2298
- ----------
2299
- search : typing.Optional[typing.Sequence[AgentsSearchRequestSearchItem]]
2300
-
2301
- project_id : typing.Optional[str]
2302
-
2303
- combinator : typing.Optional[typing.Literal["AND"]]
2304
-
2305
- limit : typing.Optional[float]
2306
-
2307
- after : typing.Optional[str]
2308
-
2309
- sort_by : typing.Optional[AgentsSearchRequestSortBy]
2310
-
2311
- ascending : typing.Optional[bool]
2312
-
2313
- request_options : typing.Optional[RequestOptions]
2314
- Request-specific configuration.
2315
-
2316
- Returns
2317
- -------
2318
- AgentsSearchResponse
2319
- 200
2320
-
2321
- Examples
2322
- --------
2323
- import asyncio
2324
-
2325
- from letta_client import AsyncLetta
2326
-
2327
- client = AsyncLetta(
2328
- project="YOUR_PROJECT",
2329
- token="YOUR_TOKEN",
2330
- )
2331
-
2332
-
2333
- async def main() -> None:
2334
- await client.agents.search()
2335
-
2336
-
2337
- asyncio.run(main())
2338
- """
2339
- _response = await self._client_wrapper.httpx_client.request(
2340
- "v1/agents/search",
2341
- method="POST",
2342
- json={
2343
- "search": convert_and_respect_annotation_metadata(
2344
- object_=search, annotation=typing.Sequence[AgentsSearchRequestSearchItem], direction="write"
2345
- ),
2346
- "project_id": project_id,
2347
- "combinator": combinator,
2348
- "limit": limit,
2349
- "after": after,
2350
- "sortBy": sort_by,
2351
- "ascending": ascending,
2352
- },
2353
- headers={
2354
- "content-type": "application/json",
2355
- },
2356
- request_options=request_options,
2357
- omit=OMIT,
2358
- )
2359
- try:
2360
- if 200 <= _response.status_code < 300:
2361
- return typing.cast(
2362
- AgentsSearchResponse,
2363
- construct_type(
2364
- type_=AgentsSearchResponse, # type: ignore
2365
- object_=_response.json(),
2366
- ),
2367
- )
2368
- _response_json = _response.json()
2369
- except JSONDecodeError:
2370
- raise ApiError(status_code=_response.status_code, body=_response.text)
2371
- raise ApiError(status_code=_response.status_code, body=_response_json)