letta-client 0.1.226__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.
- letta_client/__init__.py +91 -672
- letta_client/_base_client.py +2125 -0
- letta_client/_client.py +1136 -0
- letta_client/_compat.py +219 -0
- letta_client/_constants.py +14 -0
- letta_client/_exceptions.py +108 -0
- letta_client/_files.py +123 -0
- letta_client/_models.py +872 -0
- letta_client/_qs.py +150 -0
- letta_client/_resource.py +43 -0
- letta_client/_response.py +832 -0
- letta_client/_streaming.py +371 -0
- letta_client/_types.py +270 -0
- letta_client/_utils/__init__.py +64 -0
- letta_client/_utils/_compat.py +45 -0
- letta_client/_utils/_datetime_parse.py +136 -0
- letta_client/_utils/_logs.py +25 -0
- letta_client/_utils/_proxy.py +65 -0
- letta_client/_utils/_reflection.py +42 -0
- letta_client/_utils/_resources_proxy.py +24 -0
- letta_client/_utils/_streams.py +12 -0
- letta_client/_utils/_sync.py +58 -0
- letta_client/_utils/_transform.py +457 -0
- letta_client/_utils/_typing.py +156 -0
- letta_client/_utils/_utils.py +421 -0
- letta_client/_version.py +4 -0
- letta_client/lib/.keep +4 -0
- letta_client/pagination.py +280 -0
- letta_client/resources/__init__.py +215 -0
- letta_client/resources/access_tokens.py +396 -0
- letta_client/resources/agents/__init__.py +131 -0
- letta_client/resources/agents/agents.py +2148 -0
- letta_client/resources/agents/archives.py +260 -0
- letta_client/resources/agents/blocks.py +736 -0
- letta_client/resources/agents/files.py +541 -0
- letta_client/resources/agents/folders.py +422 -0
- letta_client/resources/agents/identities.py +260 -0
- letta_client/resources/agents/messages.py +1800 -0
- letta_client/resources/agents/passages.py +638 -0
- letta_client/resources/agents/tools.py +651 -0
- letta_client/resources/archives/__init__.py +33 -0
- letta_client/resources/archives/archives.py +650 -0
- letta_client/resources/archives/passages.py +309 -0
- letta_client/resources/blocks/__init__.py +33 -0
- letta_client/resources/blocks/agents.py +289 -0
- letta_client/resources/blocks/blocks.py +977 -0
- letta_client/resources/conversations/__init__.py +33 -0
- letta_client/resources/conversations/conversations.py +611 -0
- letta_client/resources/conversations/messages.py +650 -0
- letta_client/resources/folders/__init__.py +47 -0
- letta_client/resources/folders/agents.py +234 -0
- letta_client/resources/folders/files.py +581 -0
- letta_client/resources/folders/folders.py +734 -0
- letta_client/resources/mcp_servers/__init__.py +33 -0
- letta_client/resources/mcp_servers/mcp_servers.py +670 -0
- letta_client/resources/mcp_servers/tools.py +351 -0
- letta_client/resources/messages.py +455 -0
- letta_client/resources/models/__init__.py +33 -0
- letta_client/resources/models/embeddings.py +149 -0
- letta_client/resources/models/models.py +233 -0
- letta_client/resources/passages.py +259 -0
- letta_client/resources/runs/__init__.py +75 -0
- letta_client/resources/runs/messages.py +363 -0
- letta_client/resources/runs/runs.py +502 -0
- letta_client/resources/runs/steps.py +229 -0
- letta_client/resources/runs/trace.py +197 -0
- letta_client/resources/runs/usage.py +163 -0
- letta_client/resources/steps/__init__.py +75 -0
- letta_client/resources/steps/feedback.py +198 -0
- letta_client/resources/steps/messages.py +237 -0
- letta_client/resources/steps/metrics.py +167 -0
- letta_client/resources/steps/steps.py +505 -0
- letta_client/resources/steps/trace.py +169 -0
- letta_client/resources/tags.py +240 -0
- letta_client/resources/templates/__init__.py +33 -0
- letta_client/resources/templates/agents.py +229 -0
- letta_client/resources/templates/templates.py +540 -0
- letta_client/resources/tools.py +1721 -0
- letta_client/types/__init__.py +148 -530
- letta_client/types/access_token_create_params.py +32 -0
- letta_client/types/access_token_create_response.py +34 -0
- letta_client/types/access_token_delete_params.py +11 -0
- letta_client/types/access_token_list_params.py +23 -0
- letta_client/types/access_token_list_response.py +40 -0
- letta_client/types/agent_create_params.py +444 -0
- letta_client/types/agent_environment_variable.py +40 -63
- letta_client/types/agent_export_file_params.py +26 -0
- letta_client/types/agent_export_file_response.py +7 -0
- letta_client/types/agent_import_file_params.py +57 -0
- letta_client/types/agent_import_file_response.py +14 -0
- letta_client/types/agent_list_params.py +100 -0
- letta_client/types/agent_retrieve_params.py +37 -0
- letta_client/types/agent_state.py +651 -138
- letta_client/types/agent_type.py +14 -14
- letta_client/types/agent_update_params.py +386 -0
- letta_client/types/agents/__init__.py +76 -0
- letta_client/types/agents/approval_create_param.py +35 -0
- letta_client/types/agents/approval_request_message.py +57 -0
- letta_client/types/agents/approval_response_message.py +61 -0
- letta_client/types/agents/approval_return.py +22 -0
- letta_client/types/agents/approval_return_param.py +22 -0
- letta_client/types/agents/assistant_message.py +48 -0
- letta_client/types/agents/block.py +68 -0
- letta_client/types/agents/block_list_params.py +34 -0
- letta_client/types/agents/block_update_params.py +63 -0
- letta_client/types/agents/event_message.py +40 -0
- letta_client/types/agents/file_close_all_response.py +8 -0
- letta_client/types/agents/file_list_params.py +40 -0
- letta_client/types/agents/file_list_response.py +42 -0
- letta_client/types/agents/file_open_response.py +8 -0
- letta_client/types/agents/folder_list_params.py +34 -0
- letta_client/types/agents/folder_list_response.py +49 -0
- letta_client/types/agents/hidden_reasoning_message.py +49 -0
- letta_client/types/agents/image_content.py +67 -0
- letta_client/types/agents/image_content_param.py +64 -0
- letta_client/types/agents/internal_message.py +271 -0
- letta_client/types/agents/job_status.py +7 -0
- letta_client/types/agents/job_type.py +7 -0
- letta_client/types/agents/letta_assistant_message_content_union.py +19 -0
- letta_client/types/agents/letta_response.py +76 -0
- letta_client/types/agents/letta_streaming_response.py +155 -0
- letta_client/types/agents/letta_user_message_content_union.py +14 -0
- letta_client/types/agents/message.py +36 -0
- letta_client/types/agents/message_cancel_params.py +15 -0
- letta_client/types/agents/message_cancel_response.py +8 -0
- letta_client/types/agents/message_compact_params.py +145 -0
- letta_client/types/agents/message_compact_response.py +13 -0
- letta_client/types/agents/message_create_async_params.py +145 -0
- letta_client/types/agents/message_create_params.py +181 -0
- letta_client/types/agents/message_list_params.py +55 -0
- letta_client/types/agents/message_reset_params.py +12 -0
- letta_client/types/agents/message_role.py +7 -0
- letta_client/types/agents/message_stream_params.py +166 -0
- letta_client/types/agents/message_type.py +17 -0
- letta_client/types/agents/omitted_reasoning_content.py +20 -0
- letta_client/types/agents/omitted_reasoning_content_param.py +20 -0
- letta_client/types/agents/passage_create_params.py +23 -0
- letta_client/types/agents/passage_create_response.py +10 -0
- letta_client/types/agents/passage_list_params.py +28 -0
- letta_client/types/agents/passage_list_response.py +10 -0
- letta_client/types/agents/passage_search_params.py +35 -0
- letta_client/types/agents/passage_search_response.py +29 -0
- letta_client/types/agents/reasoning_content.py +27 -0
- letta_client/types/agents/reasoning_content_param.py +27 -0
- letta_client/types/agents/reasoning_message.py +50 -0
- letta_client/types/agents/redacted_reasoning_content.py +18 -0
- letta_client/types/agents/redacted_reasoning_content_param.py +17 -0
- letta_client/types/agents/run.py +91 -0
- letta_client/types/agents/summary_message.py +38 -0
- letta_client/types/agents/system_message.py +46 -0
- letta_client/types/agents/text_content.py +19 -0
- letta_client/types/agents/text_content_param.py +19 -0
- letta_client/types/agents/tool_call.py +13 -0
- letta_client/types/agents/tool_call_content.py +28 -0
- letta_client/types/agents/tool_call_content_param.py +28 -0
- letta_client/types/agents/tool_call_delta.py +15 -0
- letta_client/types/agents/tool_call_message.py +52 -0
- letta_client/types/agents/tool_execution_result.py +33 -0
- letta_client/types/agents/tool_list_params.py +34 -0
- letta_client/types/agents/tool_return.py +29 -0
- letta_client/types/agents/tool_return_content.py +22 -0
- letta_client/types/agents/tool_return_content_param.py +21 -0
- letta_client/types/agents/tool_return_param.py +30 -0
- letta_client/types/agents/tool_run_params.py +16 -0
- letta_client/types/agents/tool_update_approval_params.py +21 -0
- letta_client/types/agents/user_message.py +50 -0
- letta_client/types/anthropic_model_settings.py +62 -0
- letta_client/types/anthropic_model_settings_param.py +59 -0
- letta_client/types/archive.py +46 -0
- letta_client/types/archive_create_params.py +22 -0
- letta_client/types/archive_list_params.py +40 -0
- letta_client/types/archive_update_params.py +14 -0
- letta_client/types/archives/__init__.py +5 -0
- letta_client/types/archives/passage_create_params.py +21 -0
- letta_client/types/azure_model_settings.py +36 -0
- letta_client/types/azure_model_settings_param.py +33 -0
- letta_client/types/bedrock_model_settings.py +36 -0
- letta_client/types/bedrock_model_settings_param.py +33 -0
- letta_client/types/block_create_params.py +59 -0
- letta_client/types/block_list_params.py +102 -0
- letta_client/types/block_response.py +66 -0
- letta_client/types/block_update_params.py +60 -0
- letta_client/types/blocks/__init__.py +5 -0
- letta_client/types/blocks/agent_list_params.py +61 -0
- letta_client/types/child_tool_rule.py +37 -26
- letta_client/types/child_tool_rule_param.py +50 -0
- letta_client/types/conditional_tool_rule.py +19 -35
- letta_client/types/conditional_tool_rule_param.py +31 -0
- letta_client/types/continue_tool_rule.py +13 -23
- letta_client/types/continue_tool_rule_param.py +22 -0
- letta_client/types/conversation.py +42 -0
- letta_client/types/conversation_cancel_response.py +8 -0
- letta_client/types/conversation_create_params.py +25 -0
- letta_client/types/conversation_list_params.py +19 -0
- letta_client/types/conversation_list_response.py +10 -0
- letta_client/types/conversation_update_params.py +13 -0
- letta_client/types/conversations/__init__.py +7 -0
- letta_client/types/conversations/message_create_params.py +166 -0
- letta_client/types/conversations/message_list_params.py +43 -0
- letta_client/types/conversations/message_stream_params.py +28 -0
- letta_client/types/create_block_param.py +61 -0
- letta_client/types/create_sse_mcp_server_param.py +26 -0
- letta_client/types/create_stdio_mcp_server_param.py +25 -0
- letta_client/types/create_streamable_http_mcp_server_param.py +26 -0
- letta_client/types/deepseek_model_settings.py +36 -0
- letta_client/types/deepseek_model_settings_param.py +33 -0
- letta_client/types/embedding_config.py +47 -67
- letta_client/types/embedding_config_param.py +64 -0
- letta_client/types/embedding_model.py +81 -0
- letta_client/types/folder.py +28 -66
- letta_client/types/folder_create_params.py +33 -0
- letta_client/types/folder_list_params.py +37 -0
- letta_client/types/folder_update_params.py +27 -0
- letta_client/types/folders/__init__.py +12 -0
- letta_client/types/folders/agent_list_params.py +34 -0
- letta_client/types/folders/agent_list_response.py +8 -0
- letta_client/types/folders/file_list_params.py +37 -0
- letta_client/types/folders/file_list_response.py +70 -0
- letta_client/types/folders/file_retrieve_params.py +15 -0
- letta_client/types/folders/file_retrieve_response.py +70 -0
- letta_client/types/folders/file_upload_params.py +20 -0
- letta_client/types/folders/file_upload_response.py +70 -0
- letta_client/types/google_ai_model_settings.py +47 -0
- letta_client/types/google_ai_model_settings_param.py +44 -0
- letta_client/types/google_vertex_model_settings.py +47 -0
- letta_client/types/google_vertex_model_settings_param.py +44 -0
- letta_client/types/groq_model_settings.py +36 -0
- letta_client/types/groq_model_settings_param.py +33 -0
- letta_client/types/health_response.py +13 -0
- letta_client/types/init_tool_rule.py +24 -24
- letta_client/types/init_tool_rule_param.py +32 -0
- letta_client/types/json_object_response_format.py +9 -17
- letta_client/types/json_object_response_format_param.py +14 -0
- letta_client/types/json_schema_response_format.py +12 -21
- letta_client/types/json_schema_response_format_param.py +18 -0
- letta_client/types/letta_message_content_union_param.py +26 -0
- letta_client/types/llm_config.py +124 -75
- letta_client/types/llm_config_param.py +155 -0
- letta_client/types/max_count_per_step_tool_rule.py +16 -25
- letta_client/types/max_count_per_step_tool_rule_param.py +28 -0
- letta_client/types/mcp_server_create_params.py +23 -0
- letta_client/types/mcp_server_create_response.py +12 -0
- letta_client/types/mcp_server_list_response.py +14 -0
- letta_client/types/mcp_server_refresh_params.py +12 -0
- letta_client/types/mcp_server_retrieve_response.py +12 -0
- letta_client/types/mcp_server_update_params.py +23 -0
- letta_client/types/mcp_server_update_response.py +12 -0
- letta_client/types/mcp_servers/__init__.py +6 -0
- letta_client/types/mcp_servers/tool_list_response.py +10 -0
- letta_client/types/mcp_servers/tool_run_params.py +15 -0
- letta_client/types/message_create_param.py +38 -0
- letta_client/types/message_list_params.py +34 -0
- letta_client/types/message_list_response.py +10 -0
- letta_client/types/message_retrieve_response.py +10 -0
- letta_client/types/message_search_params.py +34 -0
- letta_client/types/message_search_response.py +124 -0
- letta_client/types/model.py +148 -0
- letta_client/types/model_list_params.py +19 -0
- letta_client/types/model_list_response.py +10 -0
- letta_client/types/models/__init__.py +5 -0
- letta_client/types/models/embedding_list_response.py +10 -0
- letta_client/types/npm_requirement.py +15 -0
- letta_client/types/npm_requirement_param.py +16 -0
- letta_client/types/openai_model_settings.py +51 -0
- letta_client/types/openai_model_settings_param.py +48 -0
- letta_client/types/parent_tool_rule.py +15 -27
- letta_client/types/parent_tool_rule_param.py +27 -0
- letta_client/types/passage.py +56 -101
- letta_client/types/passage_search_params.py +41 -0
- letta_client/types/passage_search_response.py +25 -0
- letta_client/types/pip_requirement.py +9 -21
- letta_client/types/pip_requirement_param.py +16 -0
- letta_client/types/provider_category.py +5 -3
- letta_client/types/provider_trace.py +43 -48
- letta_client/types/provider_type.py +25 -23
- letta_client/types/required_before_exit_tool_rule.py +13 -23
- letta_client/types/required_before_exit_tool_rule_param.py +22 -0
- letta_client/types/requires_approval_tool_rule.py +25 -0
- letta_client/types/requires_approval_tool_rule_param.py +25 -0
- letta_client/types/run_list_params.py +67 -0
- letta_client/types/runs/__init__.py +10 -0
- letta_client/types/runs/message_list_params.py +34 -0
- letta_client/types/runs/message_stream_params.py +28 -0
- letta_client/types/runs/step_list_params.py +28 -0
- letta_client/types/runs/trace_retrieve_params.py +12 -0
- letta_client/types/runs/trace_retrieve_response.py +8 -0
- letta_client/types/runs/usage_retrieve_response.py +31 -0
- letta_client/types/sse_mcp_server.py +32 -0
- letta_client/types/stdio_mcp_server.py +29 -0
- letta_client/types/step.py +71 -97
- letta_client/types/step_list_params.py +57 -0
- letta_client/types/steps/__init__.py +8 -0
- letta_client/types/steps/feedback_create_params.py +18 -0
- letta_client/types/steps/message_list_params.py +34 -0
- letta_client/types/steps/message_list_response.py +36 -0
- letta_client/types/steps/metric_retrieve_response.py +45 -0
- letta_client/types/stop_reason_type.py +17 -5
- letta_client/types/streamable_http_mcp_server.py +32 -0
- letta_client/types/tag_list_params.py +40 -0
- letta_client/types/tag_list_response.py +8 -0
- letta_client/types/template_create_params.py +46 -0
- letta_client/types/template_create_response.py +29 -0
- letta_client/types/template_delete_response.py +9 -0
- letta_client/types/template_update_params.py +25 -0
- letta_client/types/template_update_response.py +13 -0
- letta_client/types/templates/__init__.py +6 -0
- letta_client/types/templates/agent_create_params.py +50 -0
- letta_client/types/templates/agent_create_response.py +20 -0
- letta_client/types/terminal_tool_rule.py +13 -23
- letta_client/types/terminal_tool_rule_param.py +22 -0
- letta_client/types/text_response_format.py +9 -17
- letta_client/types/text_response_format_param.py +14 -0
- letta_client/types/together_model_settings.py +36 -0
- letta_client/types/together_model_settings_param.py +33 -0
- letta_client/types/tool.py +154 -81
- letta_client/types/tool_create_params.py +53 -0
- letta_client/types/tool_list_params.py +57 -0
- letta_client/types/tool_return_message.py +44 -31
- letta_client/types/tool_search_params.py +27 -0
- letta_client/types/tool_search_response.py +10 -0
- letta_client/types/tool_search_result.py +27 -0
- letta_client/types/tool_type.py +16 -17
- letta_client/types/tool_update_params.py +57 -0
- letta_client/types/tool_upsert_params.py +53 -0
- letta_client/types/update_sse_mcp_server_param.py +26 -0
- letta_client/types/update_stdio_mcp_server_param.py +25 -0
- letta_client/types/update_streamable_http_mcp_server_param.py +26 -0
- letta_client/types/vector_db_provider.py +7 -0
- letta_client/types/xai_model_settings.py +36 -0
- letta_client/types/xai_model_settings_param.py +33 -0
- letta_client-1.7.2.dist-info/METADATA +436 -0
- letta_client-1.7.2.dist-info/RECORD +335 -0
- {letta_client-0.1.226.dist-info → letta_client-1.7.2.dist-info}/WHEEL +1 -1
- letta_client-1.7.2.dist-info/licenses/LICENSE +201 -0
- letta_client/agents/__init__.py +0 -77
- letta_client/agents/blocks/__init__.py +0 -2
- letta_client/agents/blocks/client.py +0 -793
- letta_client/agents/client.py +0 -2371
- letta_client/agents/context/__init__.py +0 -2
- letta_client/agents/context/client.py +0 -149
- letta_client/agents/core_memory/__init__.py +0 -2
- letta_client/agents/core_memory/client.py +0 -147
- letta_client/agents/files/__init__.py +0 -2
- letta_client/agents/files/client.py +0 -430
- letta_client/agents/folders/__init__.py +0 -2
- letta_client/agents/folders/client.py +0 -412
- letta_client/agents/groups/__init__.py +0 -2
- letta_client/agents/groups/client.py +0 -169
- letta_client/agents/memory_variables/__init__.py +0 -5
- letta_client/agents/memory_variables/client.py +0 -152
- letta_client/agents/memory_variables/types/__init__.py +0 -5
- letta_client/agents/memory_variables/types/memory_variables_list_response.py +0 -19
- letta_client/agents/messages/__init__.py +0 -15
- letta_client/agents/messages/client.py +0 -1638
- letta_client/agents/messages/types/__init__.py +0 -13
- letta_client/agents/messages/types/letta_streaming_response.py +0 -22
- letta_client/agents/messages/types/messages_modify_request.py +0 -11
- letta_client/agents/messages/types/messages_modify_response.py +0 -20
- letta_client/agents/messages/types/messages_preview_raw_payload_request.py +0 -7
- letta_client/agents/passages/__init__.py +0 -2
- letta_client/agents/passages/client.py +0 -793
- letta_client/agents/sources/__init__.py +0 -2
- letta_client/agents/sources/client.py +0 -412
- letta_client/agents/templates/__init__.py +0 -5
- letta_client/agents/templates/client.py +0 -588
- letta_client/agents/templates/types/__init__.py +0 -7
- letta_client/agents/templates/types/templates_create_response.py +0 -22
- letta_client/agents/templates/types/templates_create_version_request_return_agent_state.py +0 -5
- letta_client/agents/templates/types/templates_migrate_response.py +0 -19
- letta_client/agents/tools/__init__.py +0 -2
- letta_client/agents/tools/client.py +0 -412
- letta_client/agents/types/__init__.py +0 -33
- letta_client/agents/types/agents_search_request_search_item.py +0 -16
- letta_client/agents/types/agents_search_request_search_item_field.py +0 -22
- letta_client/agents/types/agents_search_request_search_item_field_operator.py +0 -5
- letta_client/agents/types/agents_search_request_search_item_one.py +0 -22
- letta_client/agents/types/agents_search_request_search_item_one_operator.py +0 -5
- letta_client/agents/types/agents_search_request_search_item_three.py +0 -21
- letta_client/agents/types/agents_search_request_search_item_two.py +0 -21
- letta_client/agents/types/agents_search_request_search_item_zero.py +0 -20
- letta_client/agents/types/agents_search_request_sort_by.py +0 -5
- letta_client/agents/types/agents_search_response.py +0 -23
- letta_client/agents/types/create_agent_request_response_format.py +0 -8
- letta_client/agents/types/create_agent_request_tool_rules_item.py +0 -22
- letta_client/agents/types/update_agent_response_format.py +0 -8
- letta_client/agents/types/update_agent_tool_rules_item.py +0 -22
- letta_client/base_client.py +0 -232
- letta_client/batches/__init__.py +0 -2
- letta_client/batches/client.py +0 -587
- letta_client/blocks/__init__.py +0 -5
- letta_client/blocks/agents/__init__.py +0 -2
- letta_client/blocks/agents/client.py +0 -171
- letta_client/blocks/client.py +0 -1038
- letta_client/client.py +0 -661
- letta_client/client_side_access_tokens/__init__.py +0 -29
- letta_client/client_side_access_tokens/client.py +0 -524
- letta_client/client_side_access_tokens/types/__init__.py +0 -43
- letta_client/client_side_access_tokens/types/client_side_access_tokens_create_request_policy_item.py +0 -24
- letta_client/client_side_access_tokens/types/client_side_access_tokens_create_request_policy_item_access_item.py +0 -7
- letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response.py +0 -25
- letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response_policy.py +0 -23
- letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response_policy_data_item.py +0 -24
- letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response_policy_data_item_access_item.py +0 -7
- letta_client/client_side_access_tokens/types/client_side_access_tokens_list_client_side_access_tokens_response.py +0 -25
- letta_client/client_side_access_tokens/types/client_side_access_tokens_list_client_side_access_tokens_response_tokens_item.py +0 -27
- letta_client/client_side_access_tokens/types/client_side_access_tokens_list_client_side_access_tokens_response_tokens_item_policy.py +0 -23
- 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
- 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
- letta_client/core/__init__.py +0 -51
- letta_client/core/api_error.py +0 -15
- letta_client/core/client_wrapper.py +0 -77
- letta_client/core/datetime_utils.py +0 -28
- letta_client/core/file.py +0 -67
- letta_client/core/http_client.py +0 -499
- letta_client/core/jsonable_encoder.py +0 -101
- letta_client/core/pydantic_utilities.py +0 -296
- letta_client/core/query_encoder.py +0 -58
- letta_client/core/remove_none_from_dict.py +0 -11
- letta_client/core/request_options.py +0 -35
- letta_client/core/serialization.py +0 -272
- letta_client/core/unchecked_base_model.py +0 -305
- letta_client/embedding_models/__init__.py +0 -2
- letta_client/embedding_models/client.py +0 -136
- letta_client/environment.py +0 -8
- letta_client/errors/__init__.py +0 -17
- letta_client/errors/bad_request_error.py +0 -9
- letta_client/errors/conflict_error.py +0 -9
- letta_client/errors/internal_server_error.py +0 -9
- letta_client/errors/not_found_error.py +0 -9
- letta_client/errors/payment_required_error.py +0 -9
- letta_client/errors/unprocessable_entity_error.py +0 -9
- letta_client/folders/__init__.py +0 -5
- letta_client/folders/client.py +0 -1307
- letta_client/folders/files/__init__.py +0 -2
- letta_client/folders/files/client.py +0 -474
- letta_client/folders/passages/__init__.py +0 -2
- letta_client/folders/passages/client.py +0 -189
- letta_client/groups/__init__.py +0 -14
- letta_client/groups/client.py +0 -964
- letta_client/groups/messages/__init__.py +0 -5
- letta_client/groups/messages/client.py +0 -1015
- letta_client/groups/messages/types/__init__.py +0 -7
- letta_client/groups/messages/types/letta_streaming_response.py +0 -20
- letta_client/groups/messages/types/messages_modify_request.py +0 -11
- letta_client/groups/messages/types/messages_modify_response.py +0 -20
- letta_client/groups/types/__init__.py +0 -6
- letta_client/groups/types/group_create_manager_config.py +0 -12
- letta_client/groups/types/group_update_manager_config.py +0 -16
- letta_client/health/__init__.py +0 -2
- letta_client/health/client.py +0 -110
- letta_client/identities/__init__.py +0 -5
- letta_client/identities/client.py +0 -1201
- letta_client/identities/properties/__init__.py +0 -2
- letta_client/identities/properties/client.py +0 -183
- letta_client/jobs/__init__.py +0 -2
- letta_client/jobs/client.py +0 -749
- letta_client/messages/__init__.py +0 -2
- letta_client/messages/client.py +0 -213
- letta_client/models/__init__.py +0 -2
- letta_client/models/client.py +0 -174
- letta_client/projects/__init__.py +0 -5
- letta_client/projects/client.py +0 -150
- letta_client/projects/types/__init__.py +0 -6
- letta_client/projects/types/projects_list_response.py +0 -23
- letta_client/projects/types/projects_list_response_projects_item.py +0 -21
- letta_client/providers/__init__.py +0 -2
- letta_client/providers/client.py +0 -789
- letta_client/runs/__init__.py +0 -5
- letta_client/runs/client.py +0 -551
- letta_client/runs/messages/__init__.py +0 -2
- letta_client/runs/messages/client.py +0 -236
- letta_client/runs/steps/__init__.py +0 -2
- letta_client/runs/steps/client.py +0 -219
- letta_client/runs/usage/__init__.py +0 -2
- letta_client/runs/usage/client.py +0 -147
- letta_client/sources/__init__.py +0 -5
- letta_client/sources/client.py +0 -1462
- letta_client/sources/files/__init__.py +0 -2
- letta_client/sources/files/client.py +0 -474
- letta_client/sources/passages/__init__.py +0 -2
- letta_client/sources/passages/client.py +0 -189
- letta_client/steps/__init__.py +0 -6
- letta_client/steps/client.py +0 -408
- letta_client/steps/feedback/__init__.py +0 -2
- letta_client/steps/feedback/client.py +0 -168
- letta_client/steps/types/__init__.py +0 -5
- letta_client/steps/types/steps_list_request_feedback.py +0 -5
- letta_client/tags/__init__.py +0 -2
- letta_client/tags/client.py +0 -171
- letta_client/telemetry/__init__.py +0 -2
- letta_client/telemetry/client.py +0 -145
- letta_client/templates/__init__.py +0 -18
- letta_client/templates/agents/__init__.py +0 -13
- letta_client/templates/agents/client.py +0 -256
- letta_client/templates/agents/types/__init__.py +0 -11
- letta_client/templates/agents/types/agents_create_request_initial_message_sequence_item.py +0 -26
- letta_client/templates/agents/types/agents_create_request_initial_message_sequence_item_role.py +0 -7
- letta_client/templates/agents/types/agents_create_response.py +0 -20
- letta_client/templates/client.py +0 -162
- letta_client/templates/types/__init__.py +0 -6
- letta_client/templates/types/templates_list_response.py +0 -23
- letta_client/templates/types/templates_list_response_templates_item.py +0 -20
- letta_client/tools/__init__.py +0 -27
- letta_client/tools/client.py +0 -3063
- letta_client/tools/types/__init__.py +0 -25
- letta_client/tools/types/add_mcp_server_request.py +0 -8
- letta_client/tools/types/add_mcp_server_response_item.py +0 -8
- letta_client/tools/types/connect_mcp_server_request.py +0 -8
- letta_client/tools/types/connect_mcp_server_response_event.py +0 -8
- letta_client/tools/types/delete_mcp_server_response_item.py +0 -8
- letta_client/tools/types/list_mcp_servers_response_value.py +0 -8
- letta_client/tools/types/streaming_response.py +0 -23
- letta_client/tools/types/test_mcp_server_request.py +0 -8
- letta_client/tools/types/update_mcp_server_request.py +0 -8
- letta_client/tools/types/update_mcp_server_response.py +0 -8
- letta_client/types/action_model.py +0 -38
- letta_client/types/action_parameters_model.py +0 -27
- letta_client/types/action_response_model.py +0 -27
- letta_client/types/agent_schema.py +0 -49
- letta_client/types/agent_schema_tool_rules_item.py +0 -11
- letta_client/types/agent_state_response_format.py +0 -8
- letta_client/types/agent_state_tool_rules_item.py +0 -22
- letta_client/types/app_auth_scheme.py +0 -34
- letta_client/types/app_auth_scheme_auth_mode.py +0 -19
- letta_client/types/app_model.py +0 -44
- letta_client/types/assistant_message.py +0 -42
- letta_client/types/assistant_message_content.py +0 -6
- letta_client/types/audio.py +0 -19
- letta_client/types/auth_request.py +0 -22
- letta_client/types/auth_response.py +0 -29
- letta_client/types/auth_scheme_field.py +0 -30
- letta_client/types/bad_request_error_body.py +0 -19
- letta_client/types/base_64_image.py +0 -33
- letta_client/types/base_tool_rule_schema.py +0 -20
- letta_client/types/batch_job.py +0 -81
- letta_client/types/block.py +0 -97
- letta_client/types/block_update.py +0 -71
- letta_client/types/chat_completion_assistant_message_param.py +0 -29
- letta_client/types/chat_completion_assistant_message_param_content.py +0 -8
- letta_client/types/chat_completion_assistant_message_param_content_item.py +0 -9
- letta_client/types/chat_completion_audio_param.py +0 -22
- letta_client/types/chat_completion_audio_param_format.py +0 -5
- letta_client/types/chat_completion_audio_param_voice.py +0 -18
- letta_client/types/chat_completion_content_part_image_param.py +0 -21
- letta_client/types/chat_completion_content_part_input_audio_param.py +0 -21
- letta_client/types/chat_completion_content_part_refusal_param.py +0 -20
- letta_client/types/chat_completion_content_part_text_param.py +0 -20
- letta_client/types/chat_completion_developer_message_param.py +0 -22
- letta_client/types/chat_completion_developer_message_param_content.py +0 -6
- letta_client/types/chat_completion_function_call_option_param.py +0 -19
- letta_client/types/chat_completion_function_message_param.py +0 -21
- letta_client/types/chat_completion_message_tool_call.py +0 -22
- letta_client/types/chat_completion_message_tool_call_param.py +0 -24
- letta_client/types/chat_completion_named_tool_choice_param.py +0 -23
- letta_client/types/chat_completion_prediction_content_param.py +0 -21
- letta_client/types/chat_completion_prediction_content_param_content.py +0 -6
- letta_client/types/chat_completion_stream_options_param.py +0 -19
- letta_client/types/chat_completion_system_message_param.py +0 -22
- letta_client/types/chat_completion_system_message_param_content.py +0 -6
- letta_client/types/chat_completion_tool_message_param.py +0 -22
- letta_client/types/chat_completion_tool_message_param_content.py +0 -6
- letta_client/types/chat_completion_tool_param.py +0 -21
- letta_client/types/chat_completion_user_message_param.py +0 -22
- letta_client/types/chat_completion_user_message_param_content.py +0 -6
- letta_client/types/chat_completion_user_message_param_content_item.py +0 -14
- letta_client/types/child_tool_rule_schema.py +0 -21
- letta_client/types/code_input.py +0 -22
- letta_client/types/completion_create_params_non_streaming.py +0 -64
- letta_client/types/completion_create_params_non_streaming_function_call.py +0 -8
- letta_client/types/completion_create_params_non_streaming_messages_item.py +0 -18
- letta_client/types/completion_create_params_non_streaming_modalities_item.py +0 -5
- letta_client/types/completion_create_params_non_streaming_model.py +0 -62
- letta_client/types/completion_create_params_non_streaming_reasoning_effort.py +0 -5
- letta_client/types/completion_create_params_non_streaming_response_format.py +0 -10
- letta_client/types/completion_create_params_non_streaming_service_tier.py +0 -7
- letta_client/types/completion_create_params_non_streaming_stop.py +0 -5
- letta_client/types/completion_create_params_non_streaming_tool_choice.py +0 -8
- letta_client/types/completion_create_params_streaming.py +0 -64
- letta_client/types/completion_create_params_streaming_function_call.py +0 -8
- letta_client/types/completion_create_params_streaming_messages_item.py +0 -18
- letta_client/types/completion_create_params_streaming_modalities_item.py +0 -5
- letta_client/types/completion_create_params_streaming_model.py +0 -62
- letta_client/types/completion_create_params_streaming_reasoning_effort.py +0 -5
- letta_client/types/completion_create_params_streaming_response_format.py +0 -10
- letta_client/types/completion_create_params_streaming_service_tier.py +0 -7
- letta_client/types/completion_create_params_streaming_stop.py +0 -5
- letta_client/types/completion_create_params_streaming_tool_choice.py +0 -8
- letta_client/types/components_schemas_text_content.py +0 -5
- letta_client/types/conditional_tool_rule_schema.py +0 -23
- letta_client/types/conflict_error_body.py +0 -21
- letta_client/types/context_window_overview.py +0 -108
- letta_client/types/core_memory_block_schema.py +0 -31
- letta_client/types/create_block.py +0 -67
- letta_client/types/duplicate_file_handling.py +0 -5
- letta_client/types/dynamic_manager.py +0 -33
- letta_client/types/dynamic_manager_update.py +0 -33
- letta_client/types/e_2_b_sandbox_config.py +0 -32
- letta_client/types/embedding_config_embedding_endpoint_type.py +0 -29
- letta_client/types/feedback_type.py +0 -5
- letta_client/types/file.py +0 -21
- letta_client/types/file_block.py +0 -103
- letta_client/types/file_file.py +0 -21
- letta_client/types/file_metadata.py +0 -108
- letta_client/types/file_processing_status.py +0 -5
- letta_client/types/file_stats.py +0 -36
- letta_client/types/function_call.py +0 -20
- letta_client/types/function_definition_input.py +0 -22
- letta_client/types/function_definition_output.py +0 -22
- letta_client/types/function_output.py +0 -20
- letta_client/types/function_tool.py +0 -21
- letta_client/types/generate_tool_input.py +0 -42
- letta_client/types/generate_tool_output.py +0 -33
- letta_client/types/group.py +0 -88
- letta_client/types/health.py +0 -24
- letta_client/types/hidden_reasoning_message.py +0 -43
- letta_client/types/hidden_reasoning_message_state.py +0 -5
- letta_client/types/http_validation_error.py +0 -20
- letta_client/types/identity.py +0 -59
- letta_client/types/identity_property.py +0 -38
- letta_client/types/identity_property_type.py +0 -5
- letta_client/types/identity_property_value.py +0 -5
- letta_client/types/identity_type.py +0 -5
- letta_client/types/image_content.py +0 -24
- letta_client/types/image_content_source.py +0 -8
- letta_client/types/image_url.py +0 -21
- letta_client/types/image_url_detail.py +0 -5
- letta_client/types/input_audio.py +0 -21
- letta_client/types/input_audio_format.py +0 -5
- letta_client/types/internal_server_error_body.py +0 -19
- letta_client/types/job.py +0 -96
- letta_client/types/job_status.py +0 -7
- letta_client/types/job_type.py +0 -5
- letta_client/types/json_schema.py +0 -26
- letta_client/types/letta_batch_messages.py +0 -20
- letta_client/types/letta_batch_request.py +0 -59
- letta_client/types/letta_image.py +0 -38
- letta_client/types/letta_message_content_union.py +0 -13
- letta_client/types/letta_message_union.py +0 -20
- letta_client/types/letta_request.py +0 -54
- letta_client/types/letta_request_config.py +0 -38
- letta_client/types/letta_response.py +0 -40
- letta_client/types/letta_stop_reason.py +0 -32
- letta_client/types/letta_streaming_request.py +0 -59
- letta_client/types/letta_usage_statistics.py +0 -59
- letta_client/types/letta_user_message_content_union.py +0 -7
- letta_client/types/llm_config_model_endpoint_type.py +0 -31
- letta_client/types/llm_config_reasoning_effort.py +0 -5
- letta_client/types/local_sandbox_config.py +0 -38
- letta_client/types/manager_type.py +0 -7
- letta_client/types/max_count_per_step_tool_rule_schema.py +0 -21
- letta_client/types/mcp_server_type.py +0 -5
- letta_client/types/mcp_tool.py +0 -38
- letta_client/types/memory.py +0 -38
- letta_client/types/message.py +0 -139
- letta_client/types/message_content_item.py +0 -20
- letta_client/types/message_create.py +0 -58
- letta_client/types/message_create_content.py +0 -6
- letta_client/types/message_create_role.py +0 -5
- letta_client/types/message_role.py +0 -5
- letta_client/types/message_schema.py +0 -29
- letta_client/types/message_type.py +0 -16
- letta_client/types/not_found_error_body.py +0 -19
- letta_client/types/not_found_error_body_message.py +0 -11
- letta_client/types/omitted_reasoning_content.py +0 -19
- letta_client/types/openai_types_chat_chat_completion_message_tool_call_param_function.py +0 -20
- letta_client/types/openai_types_chat_chat_completion_named_tool_choice_param_function.py +0 -19
- letta_client/types/openai_types_chat_completion_create_params_function.py +0 -21
- letta_client/types/organization.py +0 -38
- letta_client/types/organization_create.py +0 -27
- letta_client/types/organization_sources_stats.py +0 -42
- letta_client/types/organization_update.py +0 -27
- letta_client/types/parameter_properties.py +0 -20
- letta_client/types/parameters_schema.py +0 -22
- letta_client/types/payment_required_error_body.py +0 -20
- letta_client/types/provider.py +0 -65
- letta_client/types/provider_check.py +0 -38
- letta_client/types/reasoning_content.py +0 -33
- letta_client/types/reasoning_message.py +0 -44
- letta_client/types/reasoning_message_source.py +0 -5
- letta_client/types/redacted_reasoning_content.py +0 -23
- letta_client/types/response_format_json_object.py +0 -19
- letta_client/types/response_format_json_schema.py +0 -21
- letta_client/types/response_format_text.py +0 -19
- letta_client/types/round_robin_manager.py +0 -23
- letta_client/types/round_robin_manager_update.py +0 -23
- letta_client/types/run.py +0 -99
- letta_client/types/sandbox_config.py +0 -54
- letta_client/types/sandbox_config_create.py +0 -23
- letta_client/types/sandbox_config_create_config.py +0 -7
- letta_client/types/sandbox_config_update.py +0 -27
- letta_client/types/sandbox_config_update_config.py +0 -7
- letta_client/types/sandbox_environment_variable.py +0 -63
- letta_client/types/sandbox_environment_variable_create.py +0 -32
- letta_client/types/sandbox_environment_variable_update.py +0 -32
- letta_client/types/sandbox_type.py +0 -5
- letta_client/types/sleeptime_manager.py +0 -28
- letta_client/types/sleeptime_manager_update.py +0 -28
- letta_client/types/source.py +0 -81
- letta_client/types/source_create.py +0 -57
- letta_client/types/source_stats.py +0 -47
- letta_client/types/source_update.py +0 -47
- letta_client/types/sse_server_config.py +0 -55
- letta_client/types/stdio_server_config.py +0 -39
- letta_client/types/step_feedback.py +0 -5
- letta_client/types/streamable_http_server_config.py +0 -55
- letta_client/types/supervisor_manager.py +0 -23
- letta_client/types/supervisor_manager_update.py +0 -23
- letta_client/types/system_message.py +0 -41
- letta_client/types/tag_schema.py +0 -19
- letta_client/types/text_content.py +0 -23
- letta_client/types/tool_annotations.py +0 -36
- letta_client/types/tool_call.py +0 -21
- letta_client/types/tool_call_content.py +0 -33
- letta_client/types/tool_call_delta.py +0 -21
- letta_client/types/tool_call_message.py +0 -39
- letta_client/types/tool_call_message_tool_call.py +0 -7
- letta_client/types/tool_create.py +0 -58
- letta_client/types/tool_env_var_schema.py +0 -23
- letta_client/types/tool_json_schema.py +0 -24
- letta_client/types/tool_return.py +0 -33
- letta_client/types/tool_return_content.py +0 -33
- letta_client/types/tool_return_message_status.py +0 -5
- letta_client/types/tool_return_status.py +0 -5
- letta_client/types/tool_schema.py +0 -35
- letta_client/types/update_assistant_message.py +0 -24
- letta_client/types/update_assistant_message_content.py +0 -6
- letta_client/types/update_reasoning_message.py +0 -20
- letta_client/types/update_ssemcp_server.py +0 -41
- letta_client/types/update_stdio_mcp_server.py +0 -32
- letta_client/types/update_streamable_httpmcp_server.py +0 -46
- letta_client/types/update_system_message.py +0 -23
- letta_client/types/update_user_message.py +0 -24
- letta_client/types/update_user_message_content.py +0 -6
- letta_client/types/url_image.py +0 -23
- letta_client/types/usage_statistics.py +0 -25
- letta_client/types/usage_statistics_completion_token_details.py +0 -19
- letta_client/types/usage_statistics_prompt_token_details.py +0 -19
- letta_client/types/user.py +0 -52
- letta_client/types/user_create.py +0 -22
- letta_client/types/user_message.py +0 -42
- letta_client/types/user_message_content.py +0 -6
- letta_client/types/user_update.py +0 -27
- letta_client/types/validation_error.py +0 -22
- letta_client/types/validation_error_loc_item.py +0 -5
- letta_client/types/voice_sleeptime_manager.py +0 -33
- letta_client/types/voice_sleeptime_manager_update.py +0 -33
- letta_client/types/web_search_options.py +0 -22
- letta_client/types/web_search_options_search_context_size.py +0 -5
- letta_client/types/web_search_options_user_location.py +0 -21
- letta_client/types/web_search_options_user_location_approximate.py +0 -22
- letta_client/version.py +0 -3
- letta_client/voice/__init__.py +0 -2
- letta_client/voice/client.py +0 -177
- letta_client-0.1.226.dist-info/METADATA +0 -190
- letta_client-0.1.226.dist-info/RECORD +0 -452
|
@@ -0,0 +1,2148 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Dict, List, Union, Mapping, Iterable, Optional, cast
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from typing_extensions import Literal
|
|
8
|
+
|
|
9
|
+
import httpx
|
|
10
|
+
|
|
11
|
+
from .files import (
|
|
12
|
+
FilesResource,
|
|
13
|
+
AsyncFilesResource,
|
|
14
|
+
FilesResourceWithRawResponse,
|
|
15
|
+
AsyncFilesResourceWithRawResponse,
|
|
16
|
+
FilesResourceWithStreamingResponse,
|
|
17
|
+
AsyncFilesResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
19
|
+
from .tools import (
|
|
20
|
+
ToolsResource,
|
|
21
|
+
AsyncToolsResource,
|
|
22
|
+
ToolsResourceWithRawResponse,
|
|
23
|
+
AsyncToolsResourceWithRawResponse,
|
|
24
|
+
ToolsResourceWithStreamingResponse,
|
|
25
|
+
AsyncToolsResourceWithStreamingResponse,
|
|
26
|
+
)
|
|
27
|
+
from .blocks import (
|
|
28
|
+
BlocksResource,
|
|
29
|
+
AsyncBlocksResource,
|
|
30
|
+
BlocksResourceWithRawResponse,
|
|
31
|
+
AsyncBlocksResourceWithRawResponse,
|
|
32
|
+
BlocksResourceWithStreamingResponse,
|
|
33
|
+
AsyncBlocksResourceWithStreamingResponse,
|
|
34
|
+
)
|
|
35
|
+
from ...types import (
|
|
36
|
+
AgentType,
|
|
37
|
+
StopReasonType,
|
|
38
|
+
agent_list_params,
|
|
39
|
+
agent_create_params,
|
|
40
|
+
agent_update_params,
|
|
41
|
+
agent_retrieve_params,
|
|
42
|
+
agent_export_file_params,
|
|
43
|
+
agent_import_file_params,
|
|
44
|
+
)
|
|
45
|
+
from .folders import (
|
|
46
|
+
FoldersResource,
|
|
47
|
+
AsyncFoldersResource,
|
|
48
|
+
FoldersResourceWithRawResponse,
|
|
49
|
+
AsyncFoldersResourceWithRawResponse,
|
|
50
|
+
FoldersResourceWithStreamingResponse,
|
|
51
|
+
AsyncFoldersResourceWithStreamingResponse,
|
|
52
|
+
)
|
|
53
|
+
from ..._types import (
|
|
54
|
+
Body,
|
|
55
|
+
Omit,
|
|
56
|
+
Query,
|
|
57
|
+
Headers,
|
|
58
|
+
NotGiven,
|
|
59
|
+
FileTypes,
|
|
60
|
+
SequenceNotStr,
|
|
61
|
+
omit,
|
|
62
|
+
not_given,
|
|
63
|
+
)
|
|
64
|
+
from ..._utils import extract_files, maybe_transform, strip_not_given, deepcopy_minimal, async_maybe_transform
|
|
65
|
+
from .archives import (
|
|
66
|
+
ArchivesResource,
|
|
67
|
+
AsyncArchivesResource,
|
|
68
|
+
ArchivesResourceWithRawResponse,
|
|
69
|
+
AsyncArchivesResourceWithRawResponse,
|
|
70
|
+
ArchivesResourceWithStreamingResponse,
|
|
71
|
+
AsyncArchivesResourceWithStreamingResponse,
|
|
72
|
+
)
|
|
73
|
+
from .messages import (
|
|
74
|
+
MessagesResource,
|
|
75
|
+
AsyncMessagesResource,
|
|
76
|
+
MessagesResourceWithRawResponse,
|
|
77
|
+
AsyncMessagesResourceWithRawResponse,
|
|
78
|
+
MessagesResourceWithStreamingResponse,
|
|
79
|
+
AsyncMessagesResourceWithStreamingResponse,
|
|
80
|
+
)
|
|
81
|
+
from .passages import (
|
|
82
|
+
PassagesResource,
|
|
83
|
+
AsyncPassagesResource,
|
|
84
|
+
PassagesResourceWithRawResponse,
|
|
85
|
+
AsyncPassagesResourceWithRawResponse,
|
|
86
|
+
PassagesResourceWithStreamingResponse,
|
|
87
|
+
AsyncPassagesResourceWithStreamingResponse,
|
|
88
|
+
)
|
|
89
|
+
from ..._compat import cached_property
|
|
90
|
+
from .identities import (
|
|
91
|
+
IdentitiesResource,
|
|
92
|
+
AsyncIdentitiesResource,
|
|
93
|
+
IdentitiesResourceWithRawResponse,
|
|
94
|
+
AsyncIdentitiesResourceWithRawResponse,
|
|
95
|
+
IdentitiesResourceWithStreamingResponse,
|
|
96
|
+
AsyncIdentitiesResourceWithStreamingResponse,
|
|
97
|
+
)
|
|
98
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
99
|
+
from ..._response import (
|
|
100
|
+
to_raw_response_wrapper,
|
|
101
|
+
to_streamed_response_wrapper,
|
|
102
|
+
async_to_raw_response_wrapper,
|
|
103
|
+
async_to_streamed_response_wrapper,
|
|
104
|
+
)
|
|
105
|
+
from ...pagination import SyncArrayPage, AsyncArrayPage
|
|
106
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
107
|
+
from ...types.agent_type import AgentType
|
|
108
|
+
from ...types.agent_state import AgentState
|
|
109
|
+
from ...types.llm_config_param import LlmConfigParam
|
|
110
|
+
from ...types.stop_reason_type import StopReasonType
|
|
111
|
+
from ...types.create_block_param import CreateBlockParam
|
|
112
|
+
from ...types.message_create_param import MessageCreateParam
|
|
113
|
+
from ...types.embedding_config_param import EmbeddingConfigParam
|
|
114
|
+
from ...types.agent_import_file_response import AgentImportFileResponse
|
|
115
|
+
|
|
116
|
+
__all__ = ["AgentsResource", "AsyncAgentsResource"]
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class AgentsResource(SyncAPIResource):
|
|
120
|
+
@cached_property
|
|
121
|
+
def messages(self) -> MessagesResource:
|
|
122
|
+
return MessagesResource(self._client)
|
|
123
|
+
|
|
124
|
+
@cached_property
|
|
125
|
+
def blocks(self) -> BlocksResource:
|
|
126
|
+
return BlocksResource(self._client)
|
|
127
|
+
|
|
128
|
+
@cached_property
|
|
129
|
+
def tools(self) -> ToolsResource:
|
|
130
|
+
return ToolsResource(self._client)
|
|
131
|
+
|
|
132
|
+
@cached_property
|
|
133
|
+
def folders(self) -> FoldersResource:
|
|
134
|
+
return FoldersResource(self._client)
|
|
135
|
+
|
|
136
|
+
@cached_property
|
|
137
|
+
def files(self) -> FilesResource:
|
|
138
|
+
return FilesResource(self._client)
|
|
139
|
+
|
|
140
|
+
@cached_property
|
|
141
|
+
def archives(self) -> ArchivesResource:
|
|
142
|
+
return ArchivesResource(self._client)
|
|
143
|
+
|
|
144
|
+
@cached_property
|
|
145
|
+
def passages(self) -> PassagesResource:
|
|
146
|
+
return PassagesResource(self._client)
|
|
147
|
+
|
|
148
|
+
@cached_property
|
|
149
|
+
def identities(self) -> IdentitiesResource:
|
|
150
|
+
return IdentitiesResource(self._client)
|
|
151
|
+
|
|
152
|
+
@cached_property
|
|
153
|
+
def with_raw_response(self) -> AgentsResourceWithRawResponse:
|
|
154
|
+
"""
|
|
155
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
156
|
+
the raw response object instead of the parsed content.
|
|
157
|
+
|
|
158
|
+
For more information, see https://www.github.com/letta-ai/letta-python#accessing-raw-response-data-eg-headers
|
|
159
|
+
"""
|
|
160
|
+
return AgentsResourceWithRawResponse(self)
|
|
161
|
+
|
|
162
|
+
@cached_property
|
|
163
|
+
def with_streaming_response(self) -> AgentsResourceWithStreamingResponse:
|
|
164
|
+
"""
|
|
165
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
166
|
+
|
|
167
|
+
For more information, see https://www.github.com/letta-ai/letta-python#with_streaming_response
|
|
168
|
+
"""
|
|
169
|
+
return AgentsResourceWithStreamingResponse(self)
|
|
170
|
+
|
|
171
|
+
def create(
|
|
172
|
+
self,
|
|
173
|
+
*,
|
|
174
|
+
agent_type: AgentType | Omit = omit,
|
|
175
|
+
base_template_id: Optional[str] | Omit = omit,
|
|
176
|
+
block_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
177
|
+
compaction_settings: Optional[agent_create_params.CompactionSettings] | Omit = omit,
|
|
178
|
+
context_window_limit: Optional[int] | Omit = omit,
|
|
179
|
+
description: Optional[str] | Omit = omit,
|
|
180
|
+
embedding: Optional[str] | Omit = omit,
|
|
181
|
+
embedding_chunk_size: Optional[int] | Omit = omit,
|
|
182
|
+
embedding_config: Optional[EmbeddingConfigParam] | Omit = omit,
|
|
183
|
+
enable_reasoner: Optional[bool] | Omit = omit,
|
|
184
|
+
enable_sleeptime: Optional[bool] | Omit = omit,
|
|
185
|
+
folder_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
186
|
+
from_template: Optional[str] | Omit = omit,
|
|
187
|
+
hidden: Optional[bool] | Omit = omit,
|
|
188
|
+
identity_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
189
|
+
include_base_tool_rules: Optional[bool] | Omit = omit,
|
|
190
|
+
include_base_tools: bool | Omit = omit,
|
|
191
|
+
include_default_source: bool | Omit = omit,
|
|
192
|
+
include_multi_agent_tools: bool | Omit = omit,
|
|
193
|
+
initial_message_sequence: Optional[Iterable[MessageCreateParam]] | Omit = omit,
|
|
194
|
+
llm_config: Optional[LlmConfigParam] | Omit = omit,
|
|
195
|
+
max_files_open: Optional[int] | Omit = omit,
|
|
196
|
+
max_reasoning_tokens: Optional[int] | Omit = omit,
|
|
197
|
+
max_tokens: Optional[int] | Omit = omit,
|
|
198
|
+
memory_blocks: Optional[Iterable[CreateBlockParam]] | Omit = omit,
|
|
199
|
+
memory_variables: Optional[Dict[str, str]] | Omit = omit,
|
|
200
|
+
message_buffer_autoclear: bool | Omit = omit,
|
|
201
|
+
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
202
|
+
model: Optional[str] | Omit = omit,
|
|
203
|
+
model_settings: Optional[agent_create_params.ModelSettings] | Omit = omit,
|
|
204
|
+
name: str | Omit = omit,
|
|
205
|
+
parallel_tool_calls: Optional[bool] | Omit = omit,
|
|
206
|
+
per_file_view_window_char_limit: Optional[int] | Omit = omit,
|
|
207
|
+
project: Optional[str] | Omit = omit,
|
|
208
|
+
project_id: Optional[str] | Omit = omit,
|
|
209
|
+
reasoning: Optional[bool] | Omit = omit,
|
|
210
|
+
response_format: Optional[agent_create_params.ResponseFormat] | Omit = omit,
|
|
211
|
+
secrets: Optional[Dict[str, str]] | Omit = omit,
|
|
212
|
+
source_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
213
|
+
system: Optional[str] | Omit = omit,
|
|
214
|
+
tags: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
215
|
+
template: bool | Omit = omit,
|
|
216
|
+
template_id: Optional[str] | Omit = omit,
|
|
217
|
+
timezone: Optional[str] | Omit = omit,
|
|
218
|
+
tool_exec_environment_variables: Optional[Dict[str, str]] | Omit = omit,
|
|
219
|
+
tool_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
220
|
+
tool_rules: Optional[Iterable[agent_create_params.ToolRule]] | Omit = omit,
|
|
221
|
+
tools: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
222
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
223
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
224
|
+
extra_headers: Headers | None = None,
|
|
225
|
+
extra_query: Query | None = None,
|
|
226
|
+
extra_body: Body | None = None,
|
|
227
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
228
|
+
) -> AgentState:
|
|
229
|
+
"""
|
|
230
|
+
Create an agent.
|
|
231
|
+
|
|
232
|
+
Args:
|
|
233
|
+
agent_type: The type of agent.
|
|
234
|
+
|
|
235
|
+
base_template_id: Deprecated: No longer used. The base template id of the agent.
|
|
236
|
+
|
|
237
|
+
block_ids: The ids of the blocks used by the agent.
|
|
238
|
+
|
|
239
|
+
compaction_settings: Configuration for conversation compaction / summarization.
|
|
240
|
+
|
|
241
|
+
`model` is the only required user-facing field – it specifies the summarizer
|
|
242
|
+
model handle (e.g. `"openai/gpt-4o-mini"`). Per-model settings (temperature, max
|
|
243
|
+
tokens, etc.) are derived from the default configuration for that handle.
|
|
244
|
+
|
|
245
|
+
context_window_limit: The context window limit used by the agent.
|
|
246
|
+
|
|
247
|
+
description: The description of the agent.
|
|
248
|
+
|
|
249
|
+
embedding: The embedding model handle used by the agent (format: provider/model-name).
|
|
250
|
+
|
|
251
|
+
embedding_chunk_size: Deprecated: No longer used. The embedding chunk size used by the agent.
|
|
252
|
+
|
|
253
|
+
embedding_config: Configuration for embedding model connection and processing parameters.
|
|
254
|
+
|
|
255
|
+
enable_reasoner: Deprecated: Use `model` field to configure reasoning instead. Whether to enable
|
|
256
|
+
internal extended thinking step for a reasoner model.
|
|
257
|
+
|
|
258
|
+
enable_sleeptime: If set to True, memory management will move to a background agent thread.
|
|
259
|
+
|
|
260
|
+
folder_ids: The ids of the folders used by the agent.
|
|
261
|
+
|
|
262
|
+
from_template: Deprecated: please use the 'create agents from a template' endpoint instead.
|
|
263
|
+
|
|
264
|
+
hidden: Deprecated: No longer used. If set to True, the agent will be hidden.
|
|
265
|
+
|
|
266
|
+
identity_ids: The ids of the identities associated with this agent.
|
|
267
|
+
|
|
268
|
+
include_base_tool_rules: If true, attaches the Letta base tool rules (e.g. deny all tools not explicitly
|
|
269
|
+
allowed).
|
|
270
|
+
|
|
271
|
+
include_base_tools: If true, attaches the Letta core tools (e.g. core_memory related functions).
|
|
272
|
+
|
|
273
|
+
include_default_source: If true, automatically creates and attaches a default data source for this
|
|
274
|
+
agent.
|
|
275
|
+
|
|
276
|
+
include_multi_agent_tools: If true, attaches the Letta multi-agent tools (e.g. sending a message to another
|
|
277
|
+
agent).
|
|
278
|
+
|
|
279
|
+
initial_message_sequence: The initial set of messages to put in the agent's in-context memory.
|
|
280
|
+
|
|
281
|
+
llm_config: Configuration for Language Model (LLM) connection and generation parameters.
|
|
282
|
+
|
|
283
|
+
.. deprecated:: LLMConfig is deprecated and should not be used as an input or
|
|
284
|
+
return type in API calls. Use the schemas in letta.schemas.model (ModelSettings,
|
|
285
|
+
OpenAIModelSettings, etc.) instead. For conversion, use the \\__to_model() method
|
|
286
|
+
or Model.\\__from_llm_config() method.
|
|
287
|
+
|
|
288
|
+
max_files_open: Maximum number of files that can be open at once for this agent. Setting this
|
|
289
|
+
too high may exceed the context window, which will break the agent.
|
|
290
|
+
|
|
291
|
+
max_reasoning_tokens: Deprecated: Use `model` field to configure reasoning tokens instead. The maximum
|
|
292
|
+
number of tokens to generate for reasoning step.
|
|
293
|
+
|
|
294
|
+
max_tokens: Deprecated: Use `model` field to configure max output tokens instead. The
|
|
295
|
+
maximum number of tokens to generate, including reasoning step.
|
|
296
|
+
|
|
297
|
+
memory_blocks: The blocks to create in the agent's in-context memory.
|
|
298
|
+
|
|
299
|
+
memory_variables: Deprecated: Only relevant for creating agents from a template. Use the 'create
|
|
300
|
+
agents from a template' endpoint instead.
|
|
301
|
+
|
|
302
|
+
message_buffer_autoclear: If set to True, the agent will not remember previous messages (though the agent
|
|
303
|
+
will still retain state via core memory blocks and archival/recall memory). Not
|
|
304
|
+
recommended unless you have an advanced use case.
|
|
305
|
+
|
|
306
|
+
metadata: The metadata of the agent.
|
|
307
|
+
|
|
308
|
+
model: The model handle for the agent to use (format: provider/model-name).
|
|
309
|
+
|
|
310
|
+
model_settings: The model settings for the agent.
|
|
311
|
+
|
|
312
|
+
name: The name of the agent.
|
|
313
|
+
|
|
314
|
+
parallel_tool_calls: Deprecated: Use `model_settings` to configure parallel tool calls instead. If
|
|
315
|
+
set to True, enables parallel tool calling.
|
|
316
|
+
|
|
317
|
+
per_file_view_window_char_limit: The per-file view window character limit for this agent. Setting this too high
|
|
318
|
+
may exceed the context window, which will break the agent.
|
|
319
|
+
|
|
320
|
+
project: Deprecated: Project should now be passed via the X-Project header instead of in
|
|
321
|
+
the request body. If using the SDK, this can be done via the x_project
|
|
322
|
+
parameter.
|
|
323
|
+
|
|
324
|
+
project_id: Deprecated: No longer used. The id of the project the agent belongs to.
|
|
325
|
+
|
|
326
|
+
reasoning: Deprecated: Use `model` field to configure reasoning instead. Whether to enable
|
|
327
|
+
reasoning for this agent.
|
|
328
|
+
|
|
329
|
+
response_format: Deprecated: Use `model_settings` field to configure response format instead. The
|
|
330
|
+
response format for the agent.
|
|
331
|
+
|
|
332
|
+
secrets: The environment variables for tool execution specific to this agent.
|
|
333
|
+
|
|
334
|
+
source_ids: Deprecated: Use `folder_ids` field instead. The ids of the sources used by the
|
|
335
|
+
agent.
|
|
336
|
+
|
|
337
|
+
system: The system prompt used by the agent.
|
|
338
|
+
|
|
339
|
+
tags: The tags associated with the agent.
|
|
340
|
+
|
|
341
|
+
template: Deprecated: No longer used.
|
|
342
|
+
|
|
343
|
+
template_id: Deprecated: No longer used. The id of the template the agent belongs to.
|
|
344
|
+
|
|
345
|
+
timezone: The timezone of the agent (IANA format).
|
|
346
|
+
|
|
347
|
+
tool_exec_environment_variables: Deprecated: Use `secrets` field instead. Environment variables for tool
|
|
348
|
+
execution.
|
|
349
|
+
|
|
350
|
+
tool_ids: The ids of the tools used by the agent.
|
|
351
|
+
|
|
352
|
+
tool_rules: The tool rules governing the agent.
|
|
353
|
+
|
|
354
|
+
tools: The tools used by the agent.
|
|
355
|
+
|
|
356
|
+
extra_headers: Send extra headers
|
|
357
|
+
|
|
358
|
+
extra_query: Add additional query parameters to the request
|
|
359
|
+
|
|
360
|
+
extra_body: Add additional JSON properties to the request
|
|
361
|
+
|
|
362
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
363
|
+
"""
|
|
364
|
+
return self._post(
|
|
365
|
+
"/v1/agents/",
|
|
366
|
+
body=maybe_transform(
|
|
367
|
+
{
|
|
368
|
+
"agent_type": agent_type,
|
|
369
|
+
"base_template_id": base_template_id,
|
|
370
|
+
"block_ids": block_ids,
|
|
371
|
+
"compaction_settings": compaction_settings,
|
|
372
|
+
"context_window_limit": context_window_limit,
|
|
373
|
+
"description": description,
|
|
374
|
+
"embedding": embedding,
|
|
375
|
+
"embedding_chunk_size": embedding_chunk_size,
|
|
376
|
+
"embedding_config": embedding_config,
|
|
377
|
+
"enable_reasoner": enable_reasoner,
|
|
378
|
+
"enable_sleeptime": enable_sleeptime,
|
|
379
|
+
"folder_ids": folder_ids,
|
|
380
|
+
"from_template": from_template,
|
|
381
|
+
"hidden": hidden,
|
|
382
|
+
"identity_ids": identity_ids,
|
|
383
|
+
"include_base_tool_rules": include_base_tool_rules,
|
|
384
|
+
"include_base_tools": include_base_tools,
|
|
385
|
+
"include_default_source": include_default_source,
|
|
386
|
+
"include_multi_agent_tools": include_multi_agent_tools,
|
|
387
|
+
"initial_message_sequence": initial_message_sequence,
|
|
388
|
+
"llm_config": llm_config,
|
|
389
|
+
"max_files_open": max_files_open,
|
|
390
|
+
"max_reasoning_tokens": max_reasoning_tokens,
|
|
391
|
+
"max_tokens": max_tokens,
|
|
392
|
+
"memory_blocks": memory_blocks,
|
|
393
|
+
"memory_variables": memory_variables,
|
|
394
|
+
"message_buffer_autoclear": message_buffer_autoclear,
|
|
395
|
+
"metadata": metadata,
|
|
396
|
+
"model": model,
|
|
397
|
+
"model_settings": model_settings,
|
|
398
|
+
"name": name,
|
|
399
|
+
"parallel_tool_calls": parallel_tool_calls,
|
|
400
|
+
"per_file_view_window_char_limit": per_file_view_window_char_limit,
|
|
401
|
+
"project": project,
|
|
402
|
+
"project_id": project_id,
|
|
403
|
+
"reasoning": reasoning,
|
|
404
|
+
"response_format": response_format,
|
|
405
|
+
"secrets": secrets,
|
|
406
|
+
"source_ids": source_ids,
|
|
407
|
+
"system": system,
|
|
408
|
+
"tags": tags,
|
|
409
|
+
"template": template,
|
|
410
|
+
"template_id": template_id,
|
|
411
|
+
"timezone": timezone,
|
|
412
|
+
"tool_exec_environment_variables": tool_exec_environment_variables,
|
|
413
|
+
"tool_ids": tool_ids,
|
|
414
|
+
"tool_rules": tool_rules,
|
|
415
|
+
"tools": tools,
|
|
416
|
+
},
|
|
417
|
+
agent_create_params.AgentCreateParams,
|
|
418
|
+
),
|
|
419
|
+
options=make_request_options(
|
|
420
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
421
|
+
),
|
|
422
|
+
cast_to=AgentState,
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
def retrieve(
|
|
426
|
+
self,
|
|
427
|
+
agent_id: str,
|
|
428
|
+
*,
|
|
429
|
+
include: List[
|
|
430
|
+
Literal[
|
|
431
|
+
"agent.blocks",
|
|
432
|
+
"agent.identities",
|
|
433
|
+
"agent.managed_group",
|
|
434
|
+
"agent.pending_approval",
|
|
435
|
+
"agent.secrets",
|
|
436
|
+
"agent.sources",
|
|
437
|
+
"agent.tags",
|
|
438
|
+
"agent.tools",
|
|
439
|
+
]
|
|
440
|
+
]
|
|
441
|
+
| Omit = omit,
|
|
442
|
+
include_relationships: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
443
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
444
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
445
|
+
extra_headers: Headers | None = None,
|
|
446
|
+
extra_query: Query | None = None,
|
|
447
|
+
extra_body: Body | None = None,
|
|
448
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
449
|
+
) -> AgentState:
|
|
450
|
+
"""
|
|
451
|
+
Get the state of the agent.
|
|
452
|
+
|
|
453
|
+
Args:
|
|
454
|
+
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
455
|
+
|
|
456
|
+
include: Specify which relational fields to include in the response. No relationships are
|
|
457
|
+
included by default.
|
|
458
|
+
|
|
459
|
+
include_relationships: Specify which relational fields (e.g., 'tools', 'sources', 'memory') to include
|
|
460
|
+
in the response. If not provided, all relationships are loaded by default. Using
|
|
461
|
+
this can optimize performance by reducing unnecessary joins.This is a legacy
|
|
462
|
+
parameter, and no longer supported after 1.0.0 SDK versions.
|
|
463
|
+
|
|
464
|
+
extra_headers: Send extra headers
|
|
465
|
+
|
|
466
|
+
extra_query: Add additional query parameters to the request
|
|
467
|
+
|
|
468
|
+
extra_body: Add additional JSON properties to the request
|
|
469
|
+
|
|
470
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
471
|
+
"""
|
|
472
|
+
if not agent_id:
|
|
473
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
474
|
+
return self._get(
|
|
475
|
+
f"/v1/agents/{agent_id}",
|
|
476
|
+
options=make_request_options(
|
|
477
|
+
extra_headers=extra_headers,
|
|
478
|
+
extra_query=extra_query,
|
|
479
|
+
extra_body=extra_body,
|
|
480
|
+
timeout=timeout,
|
|
481
|
+
query=maybe_transform(
|
|
482
|
+
{
|
|
483
|
+
"include": include,
|
|
484
|
+
"include_relationships": include_relationships,
|
|
485
|
+
},
|
|
486
|
+
agent_retrieve_params.AgentRetrieveParams,
|
|
487
|
+
),
|
|
488
|
+
),
|
|
489
|
+
cast_to=AgentState,
|
|
490
|
+
)
|
|
491
|
+
|
|
492
|
+
def update(
|
|
493
|
+
self,
|
|
494
|
+
agent_id: str,
|
|
495
|
+
*,
|
|
496
|
+
base_template_id: Optional[str] | Omit = omit,
|
|
497
|
+
block_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
498
|
+
compaction_settings: Optional[agent_update_params.CompactionSettings] | Omit = omit,
|
|
499
|
+
context_window_limit: Optional[int] | Omit = omit,
|
|
500
|
+
description: Optional[str] | Omit = omit,
|
|
501
|
+
embedding: Optional[str] | Omit = omit,
|
|
502
|
+
embedding_config: Optional[EmbeddingConfigParam] | Omit = omit,
|
|
503
|
+
enable_sleeptime: Optional[bool] | Omit = omit,
|
|
504
|
+
folder_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
505
|
+
hidden: Optional[bool] | Omit = omit,
|
|
506
|
+
identity_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
507
|
+
last_run_completion: Union[str, datetime, None] | Omit = omit,
|
|
508
|
+
last_run_duration_ms: Optional[int] | Omit = omit,
|
|
509
|
+
last_stop_reason: Optional[StopReasonType] | Omit = omit,
|
|
510
|
+
llm_config: Optional[LlmConfigParam] | Omit = omit,
|
|
511
|
+
max_files_open: Optional[int] | Omit = omit,
|
|
512
|
+
max_tokens: Optional[int] | Omit = omit,
|
|
513
|
+
message_buffer_autoclear: Optional[bool] | Omit = omit,
|
|
514
|
+
message_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
515
|
+
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
516
|
+
model: Optional[str] | Omit = omit,
|
|
517
|
+
model_settings: Optional[agent_update_params.ModelSettings] | Omit = omit,
|
|
518
|
+
name: Optional[str] | Omit = omit,
|
|
519
|
+
parallel_tool_calls: Optional[bool] | Omit = omit,
|
|
520
|
+
per_file_view_window_char_limit: Optional[int] | Omit = omit,
|
|
521
|
+
project_id: Optional[str] | Omit = omit,
|
|
522
|
+
reasoning: Optional[bool] | Omit = omit,
|
|
523
|
+
response_format: Optional[agent_update_params.ResponseFormat] | Omit = omit,
|
|
524
|
+
secrets: Optional[Dict[str, str]] | Omit = omit,
|
|
525
|
+
source_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
526
|
+
system: Optional[str] | Omit = omit,
|
|
527
|
+
tags: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
528
|
+
template_id: Optional[str] | Omit = omit,
|
|
529
|
+
timezone: Optional[str] | Omit = omit,
|
|
530
|
+
tool_exec_environment_variables: Optional[Dict[str, str]] | Omit = omit,
|
|
531
|
+
tool_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
532
|
+
tool_rules: Optional[Iterable[agent_update_params.ToolRule]] | Omit = omit,
|
|
533
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
534
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
535
|
+
extra_headers: Headers | None = None,
|
|
536
|
+
extra_query: Query | None = None,
|
|
537
|
+
extra_body: Body | None = None,
|
|
538
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
539
|
+
) -> AgentState:
|
|
540
|
+
"""
|
|
541
|
+
Update an existing agent.
|
|
542
|
+
|
|
543
|
+
Args:
|
|
544
|
+
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
545
|
+
|
|
546
|
+
base_template_id: The base template id of the agent.
|
|
547
|
+
|
|
548
|
+
block_ids: The ids of the blocks used by the agent.
|
|
549
|
+
|
|
550
|
+
compaction_settings: Configuration for conversation compaction / summarization.
|
|
551
|
+
|
|
552
|
+
`model` is the only required user-facing field – it specifies the summarizer
|
|
553
|
+
model handle (e.g. `"openai/gpt-4o-mini"`). Per-model settings (temperature, max
|
|
554
|
+
tokens, etc.) are derived from the default configuration for that handle.
|
|
555
|
+
|
|
556
|
+
context_window_limit: The context window limit used by the agent.
|
|
557
|
+
|
|
558
|
+
description: The description of the agent.
|
|
559
|
+
|
|
560
|
+
embedding: The embedding model handle used by the agent (format: provider/model-name).
|
|
561
|
+
|
|
562
|
+
embedding_config: Configuration for embedding model connection and processing parameters.
|
|
563
|
+
|
|
564
|
+
enable_sleeptime: If set to True, memory management will move to a background agent thread.
|
|
565
|
+
|
|
566
|
+
folder_ids: The ids of the folders used by the agent.
|
|
567
|
+
|
|
568
|
+
hidden: If set to True, the agent will be hidden.
|
|
569
|
+
|
|
570
|
+
identity_ids: The ids of the identities associated with this agent.
|
|
571
|
+
|
|
572
|
+
last_run_completion: The timestamp when the agent last completed a run.
|
|
573
|
+
|
|
574
|
+
last_run_duration_ms: The duration in milliseconds of the agent's last run.
|
|
575
|
+
|
|
576
|
+
last_stop_reason: The stop reason from the agent's last run.
|
|
577
|
+
|
|
578
|
+
llm_config: Configuration for Language Model (LLM) connection and generation parameters.
|
|
579
|
+
|
|
580
|
+
.. deprecated:: LLMConfig is deprecated and should not be used as an input or
|
|
581
|
+
return type in API calls. Use the schemas in letta.schemas.model (ModelSettings,
|
|
582
|
+
OpenAIModelSettings, etc.) instead. For conversion, use the \\__to_model() method
|
|
583
|
+
or Model.\\__from_llm_config() method.
|
|
584
|
+
|
|
585
|
+
max_files_open: Maximum number of files that can be open at once for this agent. Setting this
|
|
586
|
+
too high may exceed the context window, which will break the agent.
|
|
587
|
+
|
|
588
|
+
max_tokens: Deprecated: Use `model` field to configure max output tokens instead. The
|
|
589
|
+
maximum number of tokens to generate, including reasoning step.
|
|
590
|
+
|
|
591
|
+
message_buffer_autoclear: If set to True, the agent will not remember previous messages (though the agent
|
|
592
|
+
will still retain state via core memory blocks and archival/recall memory). Not
|
|
593
|
+
recommended unless you have an advanced use case.
|
|
594
|
+
|
|
595
|
+
message_ids: The ids of the messages in the agent's in-context memory.
|
|
596
|
+
|
|
597
|
+
metadata: The metadata of the agent.
|
|
598
|
+
|
|
599
|
+
model: The model handle used by the agent (format: provider/model-name).
|
|
600
|
+
|
|
601
|
+
model_settings: The model settings for the agent.
|
|
602
|
+
|
|
603
|
+
name: The name of the agent.
|
|
604
|
+
|
|
605
|
+
parallel_tool_calls: Deprecated: Use `model_settings` to configure parallel tool calls instead. If
|
|
606
|
+
set to True, enables parallel tool calling.
|
|
607
|
+
|
|
608
|
+
per_file_view_window_char_limit: The per-file view window character limit for this agent. Setting this too high
|
|
609
|
+
may exceed the context window, which will break the agent.
|
|
610
|
+
|
|
611
|
+
project_id: The id of the project the agent belongs to.
|
|
612
|
+
|
|
613
|
+
reasoning: Deprecated: Use `model` field to configure reasoning instead. Whether to enable
|
|
614
|
+
reasoning for this agent.
|
|
615
|
+
|
|
616
|
+
response_format: Deprecated: Use `model_settings` field to configure response format instead. The
|
|
617
|
+
response format for the agent.
|
|
618
|
+
|
|
619
|
+
secrets: The environment variables for tool execution specific to this agent.
|
|
620
|
+
|
|
621
|
+
source_ids: Deprecated: Use `folder_ids` field instead. The ids of the sources used by the
|
|
622
|
+
agent.
|
|
623
|
+
|
|
624
|
+
system: The system prompt used by the agent.
|
|
625
|
+
|
|
626
|
+
tags: The tags associated with the agent.
|
|
627
|
+
|
|
628
|
+
template_id: The id of the template the agent belongs to.
|
|
629
|
+
|
|
630
|
+
timezone: The timezone of the agent (IANA format).
|
|
631
|
+
|
|
632
|
+
tool_exec_environment_variables: Deprecated: use `secrets` field instead
|
|
633
|
+
|
|
634
|
+
tool_ids: The ids of the tools used by the agent.
|
|
635
|
+
|
|
636
|
+
tool_rules: The tool rules governing the agent.
|
|
637
|
+
|
|
638
|
+
extra_headers: Send extra headers
|
|
639
|
+
|
|
640
|
+
extra_query: Add additional query parameters to the request
|
|
641
|
+
|
|
642
|
+
extra_body: Add additional JSON properties to the request
|
|
643
|
+
|
|
644
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
645
|
+
"""
|
|
646
|
+
if not agent_id:
|
|
647
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
648
|
+
return self._patch(
|
|
649
|
+
f"/v1/agents/{agent_id}",
|
|
650
|
+
body=maybe_transform(
|
|
651
|
+
{
|
|
652
|
+
"base_template_id": base_template_id,
|
|
653
|
+
"block_ids": block_ids,
|
|
654
|
+
"compaction_settings": compaction_settings,
|
|
655
|
+
"context_window_limit": context_window_limit,
|
|
656
|
+
"description": description,
|
|
657
|
+
"embedding": embedding,
|
|
658
|
+
"embedding_config": embedding_config,
|
|
659
|
+
"enable_sleeptime": enable_sleeptime,
|
|
660
|
+
"folder_ids": folder_ids,
|
|
661
|
+
"hidden": hidden,
|
|
662
|
+
"identity_ids": identity_ids,
|
|
663
|
+
"last_run_completion": last_run_completion,
|
|
664
|
+
"last_run_duration_ms": last_run_duration_ms,
|
|
665
|
+
"last_stop_reason": last_stop_reason,
|
|
666
|
+
"llm_config": llm_config,
|
|
667
|
+
"max_files_open": max_files_open,
|
|
668
|
+
"max_tokens": max_tokens,
|
|
669
|
+
"message_buffer_autoclear": message_buffer_autoclear,
|
|
670
|
+
"message_ids": message_ids,
|
|
671
|
+
"metadata": metadata,
|
|
672
|
+
"model": model,
|
|
673
|
+
"model_settings": model_settings,
|
|
674
|
+
"name": name,
|
|
675
|
+
"parallel_tool_calls": parallel_tool_calls,
|
|
676
|
+
"per_file_view_window_char_limit": per_file_view_window_char_limit,
|
|
677
|
+
"project_id": project_id,
|
|
678
|
+
"reasoning": reasoning,
|
|
679
|
+
"response_format": response_format,
|
|
680
|
+
"secrets": secrets,
|
|
681
|
+
"source_ids": source_ids,
|
|
682
|
+
"system": system,
|
|
683
|
+
"tags": tags,
|
|
684
|
+
"template_id": template_id,
|
|
685
|
+
"timezone": timezone,
|
|
686
|
+
"tool_exec_environment_variables": tool_exec_environment_variables,
|
|
687
|
+
"tool_ids": tool_ids,
|
|
688
|
+
"tool_rules": tool_rules,
|
|
689
|
+
},
|
|
690
|
+
agent_update_params.AgentUpdateParams,
|
|
691
|
+
),
|
|
692
|
+
options=make_request_options(
|
|
693
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
694
|
+
),
|
|
695
|
+
cast_to=AgentState,
|
|
696
|
+
)
|
|
697
|
+
|
|
698
|
+
def list(
|
|
699
|
+
self,
|
|
700
|
+
*,
|
|
701
|
+
after: Optional[str] | Omit = omit,
|
|
702
|
+
ascending: bool | Omit = omit,
|
|
703
|
+
base_template_id: Optional[str] | Omit = omit,
|
|
704
|
+
before: Optional[str] | Omit = omit,
|
|
705
|
+
identifier_keys: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
706
|
+
identity_id: Optional[str] | Omit = omit,
|
|
707
|
+
include: List[
|
|
708
|
+
Literal[
|
|
709
|
+
"agent.blocks",
|
|
710
|
+
"agent.identities",
|
|
711
|
+
"agent.managed_group",
|
|
712
|
+
"agent.pending_approval",
|
|
713
|
+
"agent.secrets",
|
|
714
|
+
"agent.sources",
|
|
715
|
+
"agent.tags",
|
|
716
|
+
"agent.tools",
|
|
717
|
+
]
|
|
718
|
+
]
|
|
719
|
+
| Omit = omit,
|
|
720
|
+
include_relationships: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
721
|
+
last_stop_reason: Optional[StopReasonType] | Omit = omit,
|
|
722
|
+
limit: Optional[int] | Omit = omit,
|
|
723
|
+
match_all_tags: bool | Omit = omit,
|
|
724
|
+
name: Optional[str] | Omit = omit,
|
|
725
|
+
order: Literal["asc", "desc"] | Omit = omit,
|
|
726
|
+
order_by: Literal["created_at", "last_run_completion"] | Omit = omit,
|
|
727
|
+
project_id: Optional[str] | Omit = omit,
|
|
728
|
+
query_text: Optional[str] | Omit = omit,
|
|
729
|
+
sort_by: Optional[str] | Omit = omit,
|
|
730
|
+
tags: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
731
|
+
template_id: Optional[str] | Omit = omit,
|
|
732
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
733
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
734
|
+
extra_headers: Headers | None = None,
|
|
735
|
+
extra_query: Query | None = None,
|
|
736
|
+
extra_body: Body | None = None,
|
|
737
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
738
|
+
) -> SyncArrayPage[AgentState]:
|
|
739
|
+
"""
|
|
740
|
+
Get a list of all agents.
|
|
741
|
+
|
|
742
|
+
Args:
|
|
743
|
+
after: Cursor for pagination
|
|
744
|
+
|
|
745
|
+
ascending: Whether to sort agents oldest to newest (True) or newest to oldest (False,
|
|
746
|
+
default)
|
|
747
|
+
|
|
748
|
+
base_template_id: Search agents by base template ID
|
|
749
|
+
|
|
750
|
+
before: Cursor for pagination
|
|
751
|
+
|
|
752
|
+
identifier_keys: Search agents by identifier keys
|
|
753
|
+
|
|
754
|
+
identity_id: Search agents by identity ID
|
|
755
|
+
|
|
756
|
+
include: Specify which relational fields to include in the response. No relationships are
|
|
757
|
+
included by default.
|
|
758
|
+
|
|
759
|
+
include_relationships: Specify which relational fields (e.g., 'tools', 'sources', 'memory') to include
|
|
760
|
+
in the response. If not provided, all relationships are loaded by default. Using
|
|
761
|
+
this can optimize performance by reducing unnecessary joins.This is a legacy
|
|
762
|
+
parameter, and no longer supported after 1.0.0 SDK versions.
|
|
763
|
+
|
|
764
|
+
last_stop_reason: Filter agents by their last stop reason.
|
|
765
|
+
|
|
766
|
+
limit: Limit for pagination
|
|
767
|
+
|
|
768
|
+
match_all_tags: If True, only returns agents that match ALL given tags. Otherwise, return agents
|
|
769
|
+
that have ANY of the passed-in tags.
|
|
770
|
+
|
|
771
|
+
name: Name of the agent
|
|
772
|
+
|
|
773
|
+
order: Sort order for agents by creation time. 'asc' for oldest first, 'desc' for
|
|
774
|
+
newest first
|
|
775
|
+
|
|
776
|
+
order_by: Field to sort by
|
|
777
|
+
|
|
778
|
+
project_id: Search agents by project ID - this will default to your default project on cloud
|
|
779
|
+
|
|
780
|
+
query_text: Search agents by name
|
|
781
|
+
|
|
782
|
+
sort_by: Field to sort by. Options: 'created_at' (default), 'last_run_completion'
|
|
783
|
+
|
|
784
|
+
tags: List of tags to filter agents by
|
|
785
|
+
|
|
786
|
+
template_id: Search agents by template ID
|
|
787
|
+
|
|
788
|
+
extra_headers: Send extra headers
|
|
789
|
+
|
|
790
|
+
extra_query: Add additional query parameters to the request
|
|
791
|
+
|
|
792
|
+
extra_body: Add additional JSON properties to the request
|
|
793
|
+
|
|
794
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
795
|
+
"""
|
|
796
|
+
return self._get_api_list(
|
|
797
|
+
"/v1/agents/",
|
|
798
|
+
page=SyncArrayPage[AgentState],
|
|
799
|
+
options=make_request_options(
|
|
800
|
+
extra_headers=extra_headers,
|
|
801
|
+
extra_query=extra_query,
|
|
802
|
+
extra_body=extra_body,
|
|
803
|
+
timeout=timeout,
|
|
804
|
+
query=maybe_transform(
|
|
805
|
+
{
|
|
806
|
+
"after": after,
|
|
807
|
+
"ascending": ascending,
|
|
808
|
+
"base_template_id": base_template_id,
|
|
809
|
+
"before": before,
|
|
810
|
+
"identifier_keys": identifier_keys,
|
|
811
|
+
"identity_id": identity_id,
|
|
812
|
+
"include": include,
|
|
813
|
+
"include_relationships": include_relationships,
|
|
814
|
+
"last_stop_reason": last_stop_reason,
|
|
815
|
+
"limit": limit,
|
|
816
|
+
"match_all_tags": match_all_tags,
|
|
817
|
+
"name": name,
|
|
818
|
+
"order": order,
|
|
819
|
+
"order_by": order_by,
|
|
820
|
+
"project_id": project_id,
|
|
821
|
+
"query_text": query_text,
|
|
822
|
+
"sort_by": sort_by,
|
|
823
|
+
"tags": tags,
|
|
824
|
+
"template_id": template_id,
|
|
825
|
+
},
|
|
826
|
+
agent_list_params.AgentListParams,
|
|
827
|
+
),
|
|
828
|
+
),
|
|
829
|
+
model=AgentState,
|
|
830
|
+
)
|
|
831
|
+
|
|
832
|
+
def delete(
|
|
833
|
+
self,
|
|
834
|
+
agent_id: str,
|
|
835
|
+
*,
|
|
836
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
837
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
838
|
+
extra_headers: Headers | None = None,
|
|
839
|
+
extra_query: Query | None = None,
|
|
840
|
+
extra_body: Body | None = None,
|
|
841
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
842
|
+
) -> object:
|
|
843
|
+
"""
|
|
844
|
+
Delete an agent.
|
|
845
|
+
|
|
846
|
+
Args:
|
|
847
|
+
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
848
|
+
|
|
849
|
+
extra_headers: Send extra headers
|
|
850
|
+
|
|
851
|
+
extra_query: Add additional query parameters to the request
|
|
852
|
+
|
|
853
|
+
extra_body: Add additional JSON properties to the request
|
|
854
|
+
|
|
855
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
856
|
+
"""
|
|
857
|
+
if not agent_id:
|
|
858
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
859
|
+
return self._delete(
|
|
860
|
+
f"/v1/agents/{agent_id}",
|
|
861
|
+
options=make_request_options(
|
|
862
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
863
|
+
),
|
|
864
|
+
cast_to=object,
|
|
865
|
+
)
|
|
866
|
+
|
|
867
|
+
def export_file(
|
|
868
|
+
self,
|
|
869
|
+
agent_id: str,
|
|
870
|
+
*,
|
|
871
|
+
conversation_id: Optional[str] | Omit = omit,
|
|
872
|
+
max_steps: int | Omit = omit,
|
|
873
|
+
use_legacy_format: bool | Omit = omit,
|
|
874
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
875
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
876
|
+
extra_headers: Headers | None = None,
|
|
877
|
+
extra_query: Query | None = None,
|
|
878
|
+
extra_body: Body | None = None,
|
|
879
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
880
|
+
) -> str:
|
|
881
|
+
"""
|
|
882
|
+
Export the serialized JSON representation of an agent, formatted with
|
|
883
|
+
indentation.
|
|
884
|
+
|
|
885
|
+
Args:
|
|
886
|
+
conversation_id: Conversation ID to export. If provided, uses messages from this conversation
|
|
887
|
+
instead of the agent's global message history.
|
|
888
|
+
|
|
889
|
+
use_legacy_format: If True, exports using the legacy single-agent 'v1' format with inline
|
|
890
|
+
tools/blocks. If False, exports using the new multi-entity 'v2' format, with
|
|
891
|
+
separate agents, tools, blocks, files, etc.
|
|
892
|
+
|
|
893
|
+
extra_headers: Send extra headers
|
|
894
|
+
|
|
895
|
+
extra_query: Add additional query parameters to the request
|
|
896
|
+
|
|
897
|
+
extra_body: Add additional JSON properties to the request
|
|
898
|
+
|
|
899
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
900
|
+
"""
|
|
901
|
+
if not agent_id:
|
|
902
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
903
|
+
return self._get(
|
|
904
|
+
f"/v1/agents/{agent_id}/export",
|
|
905
|
+
options=make_request_options(
|
|
906
|
+
extra_headers=extra_headers,
|
|
907
|
+
extra_query=extra_query,
|
|
908
|
+
extra_body=extra_body,
|
|
909
|
+
timeout=timeout,
|
|
910
|
+
query=maybe_transform(
|
|
911
|
+
{
|
|
912
|
+
"conversation_id": conversation_id,
|
|
913
|
+
"max_steps": max_steps,
|
|
914
|
+
"use_legacy_format": use_legacy_format,
|
|
915
|
+
},
|
|
916
|
+
agent_export_file_params.AgentExportFileParams,
|
|
917
|
+
),
|
|
918
|
+
),
|
|
919
|
+
cast_to=str,
|
|
920
|
+
)
|
|
921
|
+
|
|
922
|
+
def import_file(
|
|
923
|
+
self,
|
|
924
|
+
*,
|
|
925
|
+
file: FileTypes,
|
|
926
|
+
append_copy_suffix: bool | Omit = omit,
|
|
927
|
+
embedding: Optional[str] | Omit = omit,
|
|
928
|
+
env_vars_json: Optional[str] | Omit = omit,
|
|
929
|
+
name: Optional[str] | Omit = omit,
|
|
930
|
+
override_embedding_handle: Optional[str] | Omit = omit,
|
|
931
|
+
override_existing_tools: bool | Omit = omit,
|
|
932
|
+
override_name: Optional[str] | Omit = omit,
|
|
933
|
+
project_id: Optional[str] | Omit = omit,
|
|
934
|
+
secrets: Optional[str] | Omit = omit,
|
|
935
|
+
strip_messages: bool | Omit = omit,
|
|
936
|
+
x_override_embedding_model: str | Omit = omit,
|
|
937
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
938
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
939
|
+
extra_headers: Headers | None = None,
|
|
940
|
+
extra_query: Query | None = None,
|
|
941
|
+
extra_body: Body | None = None,
|
|
942
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
943
|
+
) -> AgentImportFileResponse:
|
|
944
|
+
"""Import a serialized agent file and recreate the agent(s) in the system.
|
|
945
|
+
|
|
946
|
+
Returns
|
|
947
|
+
the IDs of all imported agents.
|
|
948
|
+
|
|
949
|
+
Args:
|
|
950
|
+
append_copy_suffix: If set to True, appends "\\__copy" to the end of the agent name.
|
|
951
|
+
|
|
952
|
+
embedding: Embedding handle to override with.
|
|
953
|
+
|
|
954
|
+
env_vars_json: Environment variables as a JSON string to pass to the agent for tool execution.
|
|
955
|
+
Use 'secrets' instead.
|
|
956
|
+
|
|
957
|
+
name: If provided, overrides the agent name with this value.
|
|
958
|
+
|
|
959
|
+
override_embedding_handle: Override import with specific embedding handle. Use 'embedding' instead.
|
|
960
|
+
|
|
961
|
+
override_existing_tools: If set to True, existing tools can get their source code overwritten by the
|
|
962
|
+
uploaded tool definitions. Note that Letta core tools can never be updated
|
|
963
|
+
externally.
|
|
964
|
+
|
|
965
|
+
override_name: If provided, overrides the agent name with this value. Use 'name' instead.
|
|
966
|
+
|
|
967
|
+
project_id: The project ID to associate the uploaded agent with. This is now passed via
|
|
968
|
+
headers.
|
|
969
|
+
|
|
970
|
+
secrets: Secrets as a JSON string to pass to the agent for tool execution.
|
|
971
|
+
|
|
972
|
+
strip_messages: If set to True, strips all messages from the agent before importing.
|
|
973
|
+
|
|
974
|
+
extra_headers: Send extra headers
|
|
975
|
+
|
|
976
|
+
extra_query: Add additional query parameters to the request
|
|
977
|
+
|
|
978
|
+
extra_body: Add additional JSON properties to the request
|
|
979
|
+
|
|
980
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
981
|
+
"""
|
|
982
|
+
extra_headers = {
|
|
983
|
+
**strip_not_given({"x-override-embedding-model": x_override_embedding_model}),
|
|
984
|
+
**(extra_headers or {}),
|
|
985
|
+
}
|
|
986
|
+
body = deepcopy_minimal(
|
|
987
|
+
{
|
|
988
|
+
"file": file,
|
|
989
|
+
"append_copy_suffix": append_copy_suffix,
|
|
990
|
+
"embedding": embedding,
|
|
991
|
+
"env_vars_json": env_vars_json,
|
|
992
|
+
"name": name,
|
|
993
|
+
"override_embedding_handle": override_embedding_handle,
|
|
994
|
+
"override_existing_tools": override_existing_tools,
|
|
995
|
+
"override_name": override_name,
|
|
996
|
+
"project_id": project_id,
|
|
997
|
+
"secrets": secrets,
|
|
998
|
+
"strip_messages": strip_messages,
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
|
1002
|
+
# It should be noted that the actual Content-Type header that will be
|
|
1003
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
1004
|
+
# multipart/form-data; boundary=---abc--
|
|
1005
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
1006
|
+
return self._post(
|
|
1007
|
+
"/v1/agents/import",
|
|
1008
|
+
body=maybe_transform(body, agent_import_file_params.AgentImportFileParams),
|
|
1009
|
+
files=files,
|
|
1010
|
+
options=make_request_options(
|
|
1011
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1012
|
+
),
|
|
1013
|
+
cast_to=AgentImportFileResponse,
|
|
1014
|
+
)
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
class AsyncAgentsResource(AsyncAPIResource):
|
|
1018
|
+
@cached_property
|
|
1019
|
+
def messages(self) -> AsyncMessagesResource:
|
|
1020
|
+
return AsyncMessagesResource(self._client)
|
|
1021
|
+
|
|
1022
|
+
@cached_property
|
|
1023
|
+
def blocks(self) -> AsyncBlocksResource:
|
|
1024
|
+
return AsyncBlocksResource(self._client)
|
|
1025
|
+
|
|
1026
|
+
@cached_property
|
|
1027
|
+
def tools(self) -> AsyncToolsResource:
|
|
1028
|
+
return AsyncToolsResource(self._client)
|
|
1029
|
+
|
|
1030
|
+
@cached_property
|
|
1031
|
+
def folders(self) -> AsyncFoldersResource:
|
|
1032
|
+
return AsyncFoldersResource(self._client)
|
|
1033
|
+
|
|
1034
|
+
@cached_property
|
|
1035
|
+
def files(self) -> AsyncFilesResource:
|
|
1036
|
+
return AsyncFilesResource(self._client)
|
|
1037
|
+
|
|
1038
|
+
@cached_property
|
|
1039
|
+
def archives(self) -> AsyncArchivesResource:
|
|
1040
|
+
return AsyncArchivesResource(self._client)
|
|
1041
|
+
|
|
1042
|
+
@cached_property
|
|
1043
|
+
def passages(self) -> AsyncPassagesResource:
|
|
1044
|
+
return AsyncPassagesResource(self._client)
|
|
1045
|
+
|
|
1046
|
+
@cached_property
|
|
1047
|
+
def identities(self) -> AsyncIdentitiesResource:
|
|
1048
|
+
return AsyncIdentitiesResource(self._client)
|
|
1049
|
+
|
|
1050
|
+
@cached_property
|
|
1051
|
+
def with_raw_response(self) -> AsyncAgentsResourceWithRawResponse:
|
|
1052
|
+
"""
|
|
1053
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
1054
|
+
the raw response object instead of the parsed content.
|
|
1055
|
+
|
|
1056
|
+
For more information, see https://www.github.com/letta-ai/letta-python#accessing-raw-response-data-eg-headers
|
|
1057
|
+
"""
|
|
1058
|
+
return AsyncAgentsResourceWithRawResponse(self)
|
|
1059
|
+
|
|
1060
|
+
@cached_property
|
|
1061
|
+
def with_streaming_response(self) -> AsyncAgentsResourceWithStreamingResponse:
|
|
1062
|
+
"""
|
|
1063
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
1064
|
+
|
|
1065
|
+
For more information, see https://www.github.com/letta-ai/letta-python#with_streaming_response
|
|
1066
|
+
"""
|
|
1067
|
+
return AsyncAgentsResourceWithStreamingResponse(self)
|
|
1068
|
+
|
|
1069
|
+
async def create(
|
|
1070
|
+
self,
|
|
1071
|
+
*,
|
|
1072
|
+
agent_type: AgentType | Omit = omit,
|
|
1073
|
+
base_template_id: Optional[str] | Omit = omit,
|
|
1074
|
+
block_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1075
|
+
compaction_settings: Optional[agent_create_params.CompactionSettings] | Omit = omit,
|
|
1076
|
+
context_window_limit: Optional[int] | Omit = omit,
|
|
1077
|
+
description: Optional[str] | Omit = omit,
|
|
1078
|
+
embedding: Optional[str] | Omit = omit,
|
|
1079
|
+
embedding_chunk_size: Optional[int] | Omit = omit,
|
|
1080
|
+
embedding_config: Optional[EmbeddingConfigParam] | Omit = omit,
|
|
1081
|
+
enable_reasoner: Optional[bool] | Omit = omit,
|
|
1082
|
+
enable_sleeptime: Optional[bool] | Omit = omit,
|
|
1083
|
+
folder_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1084
|
+
from_template: Optional[str] | Omit = omit,
|
|
1085
|
+
hidden: Optional[bool] | Omit = omit,
|
|
1086
|
+
identity_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1087
|
+
include_base_tool_rules: Optional[bool] | Omit = omit,
|
|
1088
|
+
include_base_tools: bool | Omit = omit,
|
|
1089
|
+
include_default_source: bool | Omit = omit,
|
|
1090
|
+
include_multi_agent_tools: bool | Omit = omit,
|
|
1091
|
+
initial_message_sequence: Optional[Iterable[MessageCreateParam]] | Omit = omit,
|
|
1092
|
+
llm_config: Optional[LlmConfigParam] | Omit = omit,
|
|
1093
|
+
max_files_open: Optional[int] | Omit = omit,
|
|
1094
|
+
max_reasoning_tokens: Optional[int] | Omit = omit,
|
|
1095
|
+
max_tokens: Optional[int] | Omit = omit,
|
|
1096
|
+
memory_blocks: Optional[Iterable[CreateBlockParam]] | Omit = omit,
|
|
1097
|
+
memory_variables: Optional[Dict[str, str]] | Omit = omit,
|
|
1098
|
+
message_buffer_autoclear: bool | Omit = omit,
|
|
1099
|
+
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
1100
|
+
model: Optional[str] | Omit = omit,
|
|
1101
|
+
model_settings: Optional[agent_create_params.ModelSettings] | Omit = omit,
|
|
1102
|
+
name: str | Omit = omit,
|
|
1103
|
+
parallel_tool_calls: Optional[bool] | Omit = omit,
|
|
1104
|
+
per_file_view_window_char_limit: Optional[int] | Omit = omit,
|
|
1105
|
+
project: Optional[str] | Omit = omit,
|
|
1106
|
+
project_id: Optional[str] | Omit = omit,
|
|
1107
|
+
reasoning: Optional[bool] | Omit = omit,
|
|
1108
|
+
response_format: Optional[agent_create_params.ResponseFormat] | Omit = omit,
|
|
1109
|
+
secrets: Optional[Dict[str, str]] | Omit = omit,
|
|
1110
|
+
source_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1111
|
+
system: Optional[str] | Omit = omit,
|
|
1112
|
+
tags: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1113
|
+
template: bool | Omit = omit,
|
|
1114
|
+
template_id: Optional[str] | Omit = omit,
|
|
1115
|
+
timezone: Optional[str] | Omit = omit,
|
|
1116
|
+
tool_exec_environment_variables: Optional[Dict[str, str]] | Omit = omit,
|
|
1117
|
+
tool_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1118
|
+
tool_rules: Optional[Iterable[agent_create_params.ToolRule]] | Omit = omit,
|
|
1119
|
+
tools: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1120
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1121
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1122
|
+
extra_headers: Headers | None = None,
|
|
1123
|
+
extra_query: Query | None = None,
|
|
1124
|
+
extra_body: Body | None = None,
|
|
1125
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1126
|
+
) -> AgentState:
|
|
1127
|
+
"""
|
|
1128
|
+
Create an agent.
|
|
1129
|
+
|
|
1130
|
+
Args:
|
|
1131
|
+
agent_type: The type of agent.
|
|
1132
|
+
|
|
1133
|
+
base_template_id: Deprecated: No longer used. The base template id of the agent.
|
|
1134
|
+
|
|
1135
|
+
block_ids: The ids of the blocks used by the agent.
|
|
1136
|
+
|
|
1137
|
+
compaction_settings: Configuration for conversation compaction / summarization.
|
|
1138
|
+
|
|
1139
|
+
`model` is the only required user-facing field – it specifies the summarizer
|
|
1140
|
+
model handle (e.g. `"openai/gpt-4o-mini"`). Per-model settings (temperature, max
|
|
1141
|
+
tokens, etc.) are derived from the default configuration for that handle.
|
|
1142
|
+
|
|
1143
|
+
context_window_limit: The context window limit used by the agent.
|
|
1144
|
+
|
|
1145
|
+
description: The description of the agent.
|
|
1146
|
+
|
|
1147
|
+
embedding: The embedding model handle used by the agent (format: provider/model-name).
|
|
1148
|
+
|
|
1149
|
+
embedding_chunk_size: Deprecated: No longer used. The embedding chunk size used by the agent.
|
|
1150
|
+
|
|
1151
|
+
embedding_config: Configuration for embedding model connection and processing parameters.
|
|
1152
|
+
|
|
1153
|
+
enable_reasoner: Deprecated: Use `model` field to configure reasoning instead. Whether to enable
|
|
1154
|
+
internal extended thinking step for a reasoner model.
|
|
1155
|
+
|
|
1156
|
+
enable_sleeptime: If set to True, memory management will move to a background agent thread.
|
|
1157
|
+
|
|
1158
|
+
folder_ids: The ids of the folders used by the agent.
|
|
1159
|
+
|
|
1160
|
+
from_template: Deprecated: please use the 'create agents from a template' endpoint instead.
|
|
1161
|
+
|
|
1162
|
+
hidden: Deprecated: No longer used. If set to True, the agent will be hidden.
|
|
1163
|
+
|
|
1164
|
+
identity_ids: The ids of the identities associated with this agent.
|
|
1165
|
+
|
|
1166
|
+
include_base_tool_rules: If true, attaches the Letta base tool rules (e.g. deny all tools not explicitly
|
|
1167
|
+
allowed).
|
|
1168
|
+
|
|
1169
|
+
include_base_tools: If true, attaches the Letta core tools (e.g. core_memory related functions).
|
|
1170
|
+
|
|
1171
|
+
include_default_source: If true, automatically creates and attaches a default data source for this
|
|
1172
|
+
agent.
|
|
1173
|
+
|
|
1174
|
+
include_multi_agent_tools: If true, attaches the Letta multi-agent tools (e.g. sending a message to another
|
|
1175
|
+
agent).
|
|
1176
|
+
|
|
1177
|
+
initial_message_sequence: The initial set of messages to put in the agent's in-context memory.
|
|
1178
|
+
|
|
1179
|
+
llm_config: Configuration for Language Model (LLM) connection and generation parameters.
|
|
1180
|
+
|
|
1181
|
+
.. deprecated:: LLMConfig is deprecated and should not be used as an input or
|
|
1182
|
+
return type in API calls. Use the schemas in letta.schemas.model (ModelSettings,
|
|
1183
|
+
OpenAIModelSettings, etc.) instead. For conversion, use the \\__to_model() method
|
|
1184
|
+
or Model.\\__from_llm_config() method.
|
|
1185
|
+
|
|
1186
|
+
max_files_open: Maximum number of files that can be open at once for this agent. Setting this
|
|
1187
|
+
too high may exceed the context window, which will break the agent.
|
|
1188
|
+
|
|
1189
|
+
max_reasoning_tokens: Deprecated: Use `model` field to configure reasoning tokens instead. The maximum
|
|
1190
|
+
number of tokens to generate for reasoning step.
|
|
1191
|
+
|
|
1192
|
+
max_tokens: Deprecated: Use `model` field to configure max output tokens instead. The
|
|
1193
|
+
maximum number of tokens to generate, including reasoning step.
|
|
1194
|
+
|
|
1195
|
+
memory_blocks: The blocks to create in the agent's in-context memory.
|
|
1196
|
+
|
|
1197
|
+
memory_variables: Deprecated: Only relevant for creating agents from a template. Use the 'create
|
|
1198
|
+
agents from a template' endpoint instead.
|
|
1199
|
+
|
|
1200
|
+
message_buffer_autoclear: If set to True, the agent will not remember previous messages (though the agent
|
|
1201
|
+
will still retain state via core memory blocks and archival/recall memory). Not
|
|
1202
|
+
recommended unless you have an advanced use case.
|
|
1203
|
+
|
|
1204
|
+
metadata: The metadata of the agent.
|
|
1205
|
+
|
|
1206
|
+
model: The model handle for the agent to use (format: provider/model-name).
|
|
1207
|
+
|
|
1208
|
+
model_settings: The model settings for the agent.
|
|
1209
|
+
|
|
1210
|
+
name: The name of the agent.
|
|
1211
|
+
|
|
1212
|
+
parallel_tool_calls: Deprecated: Use `model_settings` to configure parallel tool calls instead. If
|
|
1213
|
+
set to True, enables parallel tool calling.
|
|
1214
|
+
|
|
1215
|
+
per_file_view_window_char_limit: The per-file view window character limit for this agent. Setting this too high
|
|
1216
|
+
may exceed the context window, which will break the agent.
|
|
1217
|
+
|
|
1218
|
+
project: Deprecated: Project should now be passed via the X-Project header instead of in
|
|
1219
|
+
the request body. If using the SDK, this can be done via the x_project
|
|
1220
|
+
parameter.
|
|
1221
|
+
|
|
1222
|
+
project_id: Deprecated: No longer used. The id of the project the agent belongs to.
|
|
1223
|
+
|
|
1224
|
+
reasoning: Deprecated: Use `model` field to configure reasoning instead. Whether to enable
|
|
1225
|
+
reasoning for this agent.
|
|
1226
|
+
|
|
1227
|
+
response_format: Deprecated: Use `model_settings` field to configure response format instead. The
|
|
1228
|
+
response format for the agent.
|
|
1229
|
+
|
|
1230
|
+
secrets: The environment variables for tool execution specific to this agent.
|
|
1231
|
+
|
|
1232
|
+
source_ids: Deprecated: Use `folder_ids` field instead. The ids of the sources used by the
|
|
1233
|
+
agent.
|
|
1234
|
+
|
|
1235
|
+
system: The system prompt used by the agent.
|
|
1236
|
+
|
|
1237
|
+
tags: The tags associated with the agent.
|
|
1238
|
+
|
|
1239
|
+
template: Deprecated: No longer used.
|
|
1240
|
+
|
|
1241
|
+
template_id: Deprecated: No longer used. The id of the template the agent belongs to.
|
|
1242
|
+
|
|
1243
|
+
timezone: The timezone of the agent (IANA format).
|
|
1244
|
+
|
|
1245
|
+
tool_exec_environment_variables: Deprecated: Use `secrets` field instead. Environment variables for tool
|
|
1246
|
+
execution.
|
|
1247
|
+
|
|
1248
|
+
tool_ids: The ids of the tools used by the agent.
|
|
1249
|
+
|
|
1250
|
+
tool_rules: The tool rules governing the agent.
|
|
1251
|
+
|
|
1252
|
+
tools: The tools used by the agent.
|
|
1253
|
+
|
|
1254
|
+
extra_headers: Send extra headers
|
|
1255
|
+
|
|
1256
|
+
extra_query: Add additional query parameters to the request
|
|
1257
|
+
|
|
1258
|
+
extra_body: Add additional JSON properties to the request
|
|
1259
|
+
|
|
1260
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1261
|
+
"""
|
|
1262
|
+
return await self._post(
|
|
1263
|
+
"/v1/agents/",
|
|
1264
|
+
body=await async_maybe_transform(
|
|
1265
|
+
{
|
|
1266
|
+
"agent_type": agent_type,
|
|
1267
|
+
"base_template_id": base_template_id,
|
|
1268
|
+
"block_ids": block_ids,
|
|
1269
|
+
"compaction_settings": compaction_settings,
|
|
1270
|
+
"context_window_limit": context_window_limit,
|
|
1271
|
+
"description": description,
|
|
1272
|
+
"embedding": embedding,
|
|
1273
|
+
"embedding_chunk_size": embedding_chunk_size,
|
|
1274
|
+
"embedding_config": embedding_config,
|
|
1275
|
+
"enable_reasoner": enable_reasoner,
|
|
1276
|
+
"enable_sleeptime": enable_sleeptime,
|
|
1277
|
+
"folder_ids": folder_ids,
|
|
1278
|
+
"from_template": from_template,
|
|
1279
|
+
"hidden": hidden,
|
|
1280
|
+
"identity_ids": identity_ids,
|
|
1281
|
+
"include_base_tool_rules": include_base_tool_rules,
|
|
1282
|
+
"include_base_tools": include_base_tools,
|
|
1283
|
+
"include_default_source": include_default_source,
|
|
1284
|
+
"include_multi_agent_tools": include_multi_agent_tools,
|
|
1285
|
+
"initial_message_sequence": initial_message_sequence,
|
|
1286
|
+
"llm_config": llm_config,
|
|
1287
|
+
"max_files_open": max_files_open,
|
|
1288
|
+
"max_reasoning_tokens": max_reasoning_tokens,
|
|
1289
|
+
"max_tokens": max_tokens,
|
|
1290
|
+
"memory_blocks": memory_blocks,
|
|
1291
|
+
"memory_variables": memory_variables,
|
|
1292
|
+
"message_buffer_autoclear": message_buffer_autoclear,
|
|
1293
|
+
"metadata": metadata,
|
|
1294
|
+
"model": model,
|
|
1295
|
+
"model_settings": model_settings,
|
|
1296
|
+
"name": name,
|
|
1297
|
+
"parallel_tool_calls": parallel_tool_calls,
|
|
1298
|
+
"per_file_view_window_char_limit": per_file_view_window_char_limit,
|
|
1299
|
+
"project": project,
|
|
1300
|
+
"project_id": project_id,
|
|
1301
|
+
"reasoning": reasoning,
|
|
1302
|
+
"response_format": response_format,
|
|
1303
|
+
"secrets": secrets,
|
|
1304
|
+
"source_ids": source_ids,
|
|
1305
|
+
"system": system,
|
|
1306
|
+
"tags": tags,
|
|
1307
|
+
"template": template,
|
|
1308
|
+
"template_id": template_id,
|
|
1309
|
+
"timezone": timezone,
|
|
1310
|
+
"tool_exec_environment_variables": tool_exec_environment_variables,
|
|
1311
|
+
"tool_ids": tool_ids,
|
|
1312
|
+
"tool_rules": tool_rules,
|
|
1313
|
+
"tools": tools,
|
|
1314
|
+
},
|
|
1315
|
+
agent_create_params.AgentCreateParams,
|
|
1316
|
+
),
|
|
1317
|
+
options=make_request_options(
|
|
1318
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1319
|
+
),
|
|
1320
|
+
cast_to=AgentState,
|
|
1321
|
+
)
|
|
1322
|
+
|
|
1323
|
+
async def retrieve(
|
|
1324
|
+
self,
|
|
1325
|
+
agent_id: str,
|
|
1326
|
+
*,
|
|
1327
|
+
include: List[
|
|
1328
|
+
Literal[
|
|
1329
|
+
"agent.blocks",
|
|
1330
|
+
"agent.identities",
|
|
1331
|
+
"agent.managed_group",
|
|
1332
|
+
"agent.pending_approval",
|
|
1333
|
+
"agent.secrets",
|
|
1334
|
+
"agent.sources",
|
|
1335
|
+
"agent.tags",
|
|
1336
|
+
"agent.tools",
|
|
1337
|
+
]
|
|
1338
|
+
]
|
|
1339
|
+
| Omit = omit,
|
|
1340
|
+
include_relationships: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1341
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1342
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1343
|
+
extra_headers: Headers | None = None,
|
|
1344
|
+
extra_query: Query | None = None,
|
|
1345
|
+
extra_body: Body | None = None,
|
|
1346
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1347
|
+
) -> AgentState:
|
|
1348
|
+
"""
|
|
1349
|
+
Get the state of the agent.
|
|
1350
|
+
|
|
1351
|
+
Args:
|
|
1352
|
+
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
1353
|
+
|
|
1354
|
+
include: Specify which relational fields to include in the response. No relationships are
|
|
1355
|
+
included by default.
|
|
1356
|
+
|
|
1357
|
+
include_relationships: Specify which relational fields (e.g., 'tools', 'sources', 'memory') to include
|
|
1358
|
+
in the response. If not provided, all relationships are loaded by default. Using
|
|
1359
|
+
this can optimize performance by reducing unnecessary joins.This is a legacy
|
|
1360
|
+
parameter, and no longer supported after 1.0.0 SDK versions.
|
|
1361
|
+
|
|
1362
|
+
extra_headers: Send extra headers
|
|
1363
|
+
|
|
1364
|
+
extra_query: Add additional query parameters to the request
|
|
1365
|
+
|
|
1366
|
+
extra_body: Add additional JSON properties to the request
|
|
1367
|
+
|
|
1368
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1369
|
+
"""
|
|
1370
|
+
if not agent_id:
|
|
1371
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
1372
|
+
return await self._get(
|
|
1373
|
+
f"/v1/agents/{agent_id}",
|
|
1374
|
+
options=make_request_options(
|
|
1375
|
+
extra_headers=extra_headers,
|
|
1376
|
+
extra_query=extra_query,
|
|
1377
|
+
extra_body=extra_body,
|
|
1378
|
+
timeout=timeout,
|
|
1379
|
+
query=await async_maybe_transform(
|
|
1380
|
+
{
|
|
1381
|
+
"include": include,
|
|
1382
|
+
"include_relationships": include_relationships,
|
|
1383
|
+
},
|
|
1384
|
+
agent_retrieve_params.AgentRetrieveParams,
|
|
1385
|
+
),
|
|
1386
|
+
),
|
|
1387
|
+
cast_to=AgentState,
|
|
1388
|
+
)
|
|
1389
|
+
|
|
1390
|
+
async def update(
|
|
1391
|
+
self,
|
|
1392
|
+
agent_id: str,
|
|
1393
|
+
*,
|
|
1394
|
+
base_template_id: Optional[str] | Omit = omit,
|
|
1395
|
+
block_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1396
|
+
compaction_settings: Optional[agent_update_params.CompactionSettings] | Omit = omit,
|
|
1397
|
+
context_window_limit: Optional[int] | Omit = omit,
|
|
1398
|
+
description: Optional[str] | Omit = omit,
|
|
1399
|
+
embedding: Optional[str] | Omit = omit,
|
|
1400
|
+
embedding_config: Optional[EmbeddingConfigParam] | Omit = omit,
|
|
1401
|
+
enable_sleeptime: Optional[bool] | Omit = omit,
|
|
1402
|
+
folder_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1403
|
+
hidden: Optional[bool] | Omit = omit,
|
|
1404
|
+
identity_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1405
|
+
last_run_completion: Union[str, datetime, None] | Omit = omit,
|
|
1406
|
+
last_run_duration_ms: Optional[int] | Omit = omit,
|
|
1407
|
+
last_stop_reason: Optional[StopReasonType] | Omit = omit,
|
|
1408
|
+
llm_config: Optional[LlmConfigParam] | Omit = omit,
|
|
1409
|
+
max_files_open: Optional[int] | Omit = omit,
|
|
1410
|
+
max_tokens: Optional[int] | Omit = omit,
|
|
1411
|
+
message_buffer_autoclear: Optional[bool] | Omit = omit,
|
|
1412
|
+
message_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1413
|
+
metadata: Optional[Dict[str, object]] | Omit = omit,
|
|
1414
|
+
model: Optional[str] | Omit = omit,
|
|
1415
|
+
model_settings: Optional[agent_update_params.ModelSettings] | Omit = omit,
|
|
1416
|
+
name: Optional[str] | Omit = omit,
|
|
1417
|
+
parallel_tool_calls: Optional[bool] | Omit = omit,
|
|
1418
|
+
per_file_view_window_char_limit: Optional[int] | Omit = omit,
|
|
1419
|
+
project_id: Optional[str] | Omit = omit,
|
|
1420
|
+
reasoning: Optional[bool] | Omit = omit,
|
|
1421
|
+
response_format: Optional[agent_update_params.ResponseFormat] | Omit = omit,
|
|
1422
|
+
secrets: Optional[Dict[str, str]] | Omit = omit,
|
|
1423
|
+
source_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1424
|
+
system: Optional[str] | Omit = omit,
|
|
1425
|
+
tags: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1426
|
+
template_id: Optional[str] | Omit = omit,
|
|
1427
|
+
timezone: Optional[str] | Omit = omit,
|
|
1428
|
+
tool_exec_environment_variables: Optional[Dict[str, str]] | Omit = omit,
|
|
1429
|
+
tool_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1430
|
+
tool_rules: Optional[Iterable[agent_update_params.ToolRule]] | Omit = omit,
|
|
1431
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1432
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1433
|
+
extra_headers: Headers | None = None,
|
|
1434
|
+
extra_query: Query | None = None,
|
|
1435
|
+
extra_body: Body | None = None,
|
|
1436
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1437
|
+
) -> AgentState:
|
|
1438
|
+
"""
|
|
1439
|
+
Update an existing agent.
|
|
1440
|
+
|
|
1441
|
+
Args:
|
|
1442
|
+
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
1443
|
+
|
|
1444
|
+
base_template_id: The base template id of the agent.
|
|
1445
|
+
|
|
1446
|
+
block_ids: The ids of the blocks used by the agent.
|
|
1447
|
+
|
|
1448
|
+
compaction_settings: Configuration for conversation compaction / summarization.
|
|
1449
|
+
|
|
1450
|
+
`model` is the only required user-facing field – it specifies the summarizer
|
|
1451
|
+
model handle (e.g. `"openai/gpt-4o-mini"`). Per-model settings (temperature, max
|
|
1452
|
+
tokens, etc.) are derived from the default configuration for that handle.
|
|
1453
|
+
|
|
1454
|
+
context_window_limit: The context window limit used by the agent.
|
|
1455
|
+
|
|
1456
|
+
description: The description of the agent.
|
|
1457
|
+
|
|
1458
|
+
embedding: The embedding model handle used by the agent (format: provider/model-name).
|
|
1459
|
+
|
|
1460
|
+
embedding_config: Configuration for embedding model connection and processing parameters.
|
|
1461
|
+
|
|
1462
|
+
enable_sleeptime: If set to True, memory management will move to a background agent thread.
|
|
1463
|
+
|
|
1464
|
+
folder_ids: The ids of the folders used by the agent.
|
|
1465
|
+
|
|
1466
|
+
hidden: If set to True, the agent will be hidden.
|
|
1467
|
+
|
|
1468
|
+
identity_ids: The ids of the identities associated with this agent.
|
|
1469
|
+
|
|
1470
|
+
last_run_completion: The timestamp when the agent last completed a run.
|
|
1471
|
+
|
|
1472
|
+
last_run_duration_ms: The duration in milliseconds of the agent's last run.
|
|
1473
|
+
|
|
1474
|
+
last_stop_reason: The stop reason from the agent's last run.
|
|
1475
|
+
|
|
1476
|
+
llm_config: Configuration for Language Model (LLM) connection and generation parameters.
|
|
1477
|
+
|
|
1478
|
+
.. deprecated:: LLMConfig is deprecated and should not be used as an input or
|
|
1479
|
+
return type in API calls. Use the schemas in letta.schemas.model (ModelSettings,
|
|
1480
|
+
OpenAIModelSettings, etc.) instead. For conversion, use the \\__to_model() method
|
|
1481
|
+
or Model.\\__from_llm_config() method.
|
|
1482
|
+
|
|
1483
|
+
max_files_open: Maximum number of files that can be open at once for this agent. Setting this
|
|
1484
|
+
too high may exceed the context window, which will break the agent.
|
|
1485
|
+
|
|
1486
|
+
max_tokens: Deprecated: Use `model` field to configure max output tokens instead. The
|
|
1487
|
+
maximum number of tokens to generate, including reasoning step.
|
|
1488
|
+
|
|
1489
|
+
message_buffer_autoclear: If set to True, the agent will not remember previous messages (though the agent
|
|
1490
|
+
will still retain state via core memory blocks and archival/recall memory). Not
|
|
1491
|
+
recommended unless you have an advanced use case.
|
|
1492
|
+
|
|
1493
|
+
message_ids: The ids of the messages in the agent's in-context memory.
|
|
1494
|
+
|
|
1495
|
+
metadata: The metadata of the agent.
|
|
1496
|
+
|
|
1497
|
+
model: The model handle used by the agent (format: provider/model-name).
|
|
1498
|
+
|
|
1499
|
+
model_settings: The model settings for the agent.
|
|
1500
|
+
|
|
1501
|
+
name: The name of the agent.
|
|
1502
|
+
|
|
1503
|
+
parallel_tool_calls: Deprecated: Use `model_settings` to configure parallel tool calls instead. If
|
|
1504
|
+
set to True, enables parallel tool calling.
|
|
1505
|
+
|
|
1506
|
+
per_file_view_window_char_limit: The per-file view window character limit for this agent. Setting this too high
|
|
1507
|
+
may exceed the context window, which will break the agent.
|
|
1508
|
+
|
|
1509
|
+
project_id: The id of the project the agent belongs to.
|
|
1510
|
+
|
|
1511
|
+
reasoning: Deprecated: Use `model` field to configure reasoning instead. Whether to enable
|
|
1512
|
+
reasoning for this agent.
|
|
1513
|
+
|
|
1514
|
+
response_format: Deprecated: Use `model_settings` field to configure response format instead. The
|
|
1515
|
+
response format for the agent.
|
|
1516
|
+
|
|
1517
|
+
secrets: The environment variables for tool execution specific to this agent.
|
|
1518
|
+
|
|
1519
|
+
source_ids: Deprecated: Use `folder_ids` field instead. The ids of the sources used by the
|
|
1520
|
+
agent.
|
|
1521
|
+
|
|
1522
|
+
system: The system prompt used by the agent.
|
|
1523
|
+
|
|
1524
|
+
tags: The tags associated with the agent.
|
|
1525
|
+
|
|
1526
|
+
template_id: The id of the template the agent belongs to.
|
|
1527
|
+
|
|
1528
|
+
timezone: The timezone of the agent (IANA format).
|
|
1529
|
+
|
|
1530
|
+
tool_exec_environment_variables: Deprecated: use `secrets` field instead
|
|
1531
|
+
|
|
1532
|
+
tool_ids: The ids of the tools used by the agent.
|
|
1533
|
+
|
|
1534
|
+
tool_rules: The tool rules governing the agent.
|
|
1535
|
+
|
|
1536
|
+
extra_headers: Send extra headers
|
|
1537
|
+
|
|
1538
|
+
extra_query: Add additional query parameters to the request
|
|
1539
|
+
|
|
1540
|
+
extra_body: Add additional JSON properties to the request
|
|
1541
|
+
|
|
1542
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1543
|
+
"""
|
|
1544
|
+
if not agent_id:
|
|
1545
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
1546
|
+
return await self._patch(
|
|
1547
|
+
f"/v1/agents/{agent_id}",
|
|
1548
|
+
body=await async_maybe_transform(
|
|
1549
|
+
{
|
|
1550
|
+
"base_template_id": base_template_id,
|
|
1551
|
+
"block_ids": block_ids,
|
|
1552
|
+
"compaction_settings": compaction_settings,
|
|
1553
|
+
"context_window_limit": context_window_limit,
|
|
1554
|
+
"description": description,
|
|
1555
|
+
"embedding": embedding,
|
|
1556
|
+
"embedding_config": embedding_config,
|
|
1557
|
+
"enable_sleeptime": enable_sleeptime,
|
|
1558
|
+
"folder_ids": folder_ids,
|
|
1559
|
+
"hidden": hidden,
|
|
1560
|
+
"identity_ids": identity_ids,
|
|
1561
|
+
"last_run_completion": last_run_completion,
|
|
1562
|
+
"last_run_duration_ms": last_run_duration_ms,
|
|
1563
|
+
"last_stop_reason": last_stop_reason,
|
|
1564
|
+
"llm_config": llm_config,
|
|
1565
|
+
"max_files_open": max_files_open,
|
|
1566
|
+
"max_tokens": max_tokens,
|
|
1567
|
+
"message_buffer_autoclear": message_buffer_autoclear,
|
|
1568
|
+
"message_ids": message_ids,
|
|
1569
|
+
"metadata": metadata,
|
|
1570
|
+
"model": model,
|
|
1571
|
+
"model_settings": model_settings,
|
|
1572
|
+
"name": name,
|
|
1573
|
+
"parallel_tool_calls": parallel_tool_calls,
|
|
1574
|
+
"per_file_view_window_char_limit": per_file_view_window_char_limit,
|
|
1575
|
+
"project_id": project_id,
|
|
1576
|
+
"reasoning": reasoning,
|
|
1577
|
+
"response_format": response_format,
|
|
1578
|
+
"secrets": secrets,
|
|
1579
|
+
"source_ids": source_ids,
|
|
1580
|
+
"system": system,
|
|
1581
|
+
"tags": tags,
|
|
1582
|
+
"template_id": template_id,
|
|
1583
|
+
"timezone": timezone,
|
|
1584
|
+
"tool_exec_environment_variables": tool_exec_environment_variables,
|
|
1585
|
+
"tool_ids": tool_ids,
|
|
1586
|
+
"tool_rules": tool_rules,
|
|
1587
|
+
},
|
|
1588
|
+
agent_update_params.AgentUpdateParams,
|
|
1589
|
+
),
|
|
1590
|
+
options=make_request_options(
|
|
1591
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1592
|
+
),
|
|
1593
|
+
cast_to=AgentState,
|
|
1594
|
+
)
|
|
1595
|
+
|
|
1596
|
+
def list(
|
|
1597
|
+
self,
|
|
1598
|
+
*,
|
|
1599
|
+
after: Optional[str] | Omit = omit,
|
|
1600
|
+
ascending: bool | Omit = omit,
|
|
1601
|
+
base_template_id: Optional[str] | Omit = omit,
|
|
1602
|
+
before: Optional[str] | Omit = omit,
|
|
1603
|
+
identifier_keys: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1604
|
+
identity_id: Optional[str] | Omit = omit,
|
|
1605
|
+
include: List[
|
|
1606
|
+
Literal[
|
|
1607
|
+
"agent.blocks",
|
|
1608
|
+
"agent.identities",
|
|
1609
|
+
"agent.managed_group",
|
|
1610
|
+
"agent.pending_approval",
|
|
1611
|
+
"agent.secrets",
|
|
1612
|
+
"agent.sources",
|
|
1613
|
+
"agent.tags",
|
|
1614
|
+
"agent.tools",
|
|
1615
|
+
]
|
|
1616
|
+
]
|
|
1617
|
+
| Omit = omit,
|
|
1618
|
+
include_relationships: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1619
|
+
last_stop_reason: Optional[StopReasonType] | Omit = omit,
|
|
1620
|
+
limit: Optional[int] | Omit = omit,
|
|
1621
|
+
match_all_tags: bool | Omit = omit,
|
|
1622
|
+
name: Optional[str] | Omit = omit,
|
|
1623
|
+
order: Literal["asc", "desc"] | Omit = omit,
|
|
1624
|
+
order_by: Literal["created_at", "last_run_completion"] | Omit = omit,
|
|
1625
|
+
project_id: Optional[str] | Omit = omit,
|
|
1626
|
+
query_text: Optional[str] | Omit = omit,
|
|
1627
|
+
sort_by: Optional[str] | Omit = omit,
|
|
1628
|
+
tags: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1629
|
+
template_id: Optional[str] | Omit = omit,
|
|
1630
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1631
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1632
|
+
extra_headers: Headers | None = None,
|
|
1633
|
+
extra_query: Query | None = None,
|
|
1634
|
+
extra_body: Body | None = None,
|
|
1635
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1636
|
+
) -> AsyncPaginator[AgentState, AsyncArrayPage[AgentState]]:
|
|
1637
|
+
"""
|
|
1638
|
+
Get a list of all agents.
|
|
1639
|
+
|
|
1640
|
+
Args:
|
|
1641
|
+
after: Cursor for pagination
|
|
1642
|
+
|
|
1643
|
+
ascending: Whether to sort agents oldest to newest (True) or newest to oldest (False,
|
|
1644
|
+
default)
|
|
1645
|
+
|
|
1646
|
+
base_template_id: Search agents by base template ID
|
|
1647
|
+
|
|
1648
|
+
before: Cursor for pagination
|
|
1649
|
+
|
|
1650
|
+
identifier_keys: Search agents by identifier keys
|
|
1651
|
+
|
|
1652
|
+
identity_id: Search agents by identity ID
|
|
1653
|
+
|
|
1654
|
+
include: Specify which relational fields to include in the response. No relationships are
|
|
1655
|
+
included by default.
|
|
1656
|
+
|
|
1657
|
+
include_relationships: Specify which relational fields (e.g., 'tools', 'sources', 'memory') to include
|
|
1658
|
+
in the response. If not provided, all relationships are loaded by default. Using
|
|
1659
|
+
this can optimize performance by reducing unnecessary joins.This is a legacy
|
|
1660
|
+
parameter, and no longer supported after 1.0.0 SDK versions.
|
|
1661
|
+
|
|
1662
|
+
last_stop_reason: Filter agents by their last stop reason.
|
|
1663
|
+
|
|
1664
|
+
limit: Limit for pagination
|
|
1665
|
+
|
|
1666
|
+
match_all_tags: If True, only returns agents that match ALL given tags. Otherwise, return agents
|
|
1667
|
+
that have ANY of the passed-in tags.
|
|
1668
|
+
|
|
1669
|
+
name: Name of the agent
|
|
1670
|
+
|
|
1671
|
+
order: Sort order for agents by creation time. 'asc' for oldest first, 'desc' for
|
|
1672
|
+
newest first
|
|
1673
|
+
|
|
1674
|
+
order_by: Field to sort by
|
|
1675
|
+
|
|
1676
|
+
project_id: Search agents by project ID - this will default to your default project on cloud
|
|
1677
|
+
|
|
1678
|
+
query_text: Search agents by name
|
|
1679
|
+
|
|
1680
|
+
sort_by: Field to sort by. Options: 'created_at' (default), 'last_run_completion'
|
|
1681
|
+
|
|
1682
|
+
tags: List of tags to filter agents by
|
|
1683
|
+
|
|
1684
|
+
template_id: Search agents by template ID
|
|
1685
|
+
|
|
1686
|
+
extra_headers: Send extra headers
|
|
1687
|
+
|
|
1688
|
+
extra_query: Add additional query parameters to the request
|
|
1689
|
+
|
|
1690
|
+
extra_body: Add additional JSON properties to the request
|
|
1691
|
+
|
|
1692
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1693
|
+
"""
|
|
1694
|
+
return self._get_api_list(
|
|
1695
|
+
"/v1/agents/",
|
|
1696
|
+
page=AsyncArrayPage[AgentState],
|
|
1697
|
+
options=make_request_options(
|
|
1698
|
+
extra_headers=extra_headers,
|
|
1699
|
+
extra_query=extra_query,
|
|
1700
|
+
extra_body=extra_body,
|
|
1701
|
+
timeout=timeout,
|
|
1702
|
+
query=maybe_transform(
|
|
1703
|
+
{
|
|
1704
|
+
"after": after,
|
|
1705
|
+
"ascending": ascending,
|
|
1706
|
+
"base_template_id": base_template_id,
|
|
1707
|
+
"before": before,
|
|
1708
|
+
"identifier_keys": identifier_keys,
|
|
1709
|
+
"identity_id": identity_id,
|
|
1710
|
+
"include": include,
|
|
1711
|
+
"include_relationships": include_relationships,
|
|
1712
|
+
"last_stop_reason": last_stop_reason,
|
|
1713
|
+
"limit": limit,
|
|
1714
|
+
"match_all_tags": match_all_tags,
|
|
1715
|
+
"name": name,
|
|
1716
|
+
"order": order,
|
|
1717
|
+
"order_by": order_by,
|
|
1718
|
+
"project_id": project_id,
|
|
1719
|
+
"query_text": query_text,
|
|
1720
|
+
"sort_by": sort_by,
|
|
1721
|
+
"tags": tags,
|
|
1722
|
+
"template_id": template_id,
|
|
1723
|
+
},
|
|
1724
|
+
agent_list_params.AgentListParams,
|
|
1725
|
+
),
|
|
1726
|
+
),
|
|
1727
|
+
model=AgentState,
|
|
1728
|
+
)
|
|
1729
|
+
|
|
1730
|
+
async def delete(
|
|
1731
|
+
self,
|
|
1732
|
+
agent_id: str,
|
|
1733
|
+
*,
|
|
1734
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1735
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1736
|
+
extra_headers: Headers | None = None,
|
|
1737
|
+
extra_query: Query | None = None,
|
|
1738
|
+
extra_body: Body | None = None,
|
|
1739
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1740
|
+
) -> object:
|
|
1741
|
+
"""
|
|
1742
|
+
Delete an agent.
|
|
1743
|
+
|
|
1744
|
+
Args:
|
|
1745
|
+
agent_id: The ID of the agent in the format 'agent-<uuid4>'
|
|
1746
|
+
|
|
1747
|
+
extra_headers: Send extra headers
|
|
1748
|
+
|
|
1749
|
+
extra_query: Add additional query parameters to the request
|
|
1750
|
+
|
|
1751
|
+
extra_body: Add additional JSON properties to the request
|
|
1752
|
+
|
|
1753
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1754
|
+
"""
|
|
1755
|
+
if not agent_id:
|
|
1756
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
1757
|
+
return await self._delete(
|
|
1758
|
+
f"/v1/agents/{agent_id}",
|
|
1759
|
+
options=make_request_options(
|
|
1760
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1761
|
+
),
|
|
1762
|
+
cast_to=object,
|
|
1763
|
+
)
|
|
1764
|
+
|
|
1765
|
+
async def export_file(
|
|
1766
|
+
self,
|
|
1767
|
+
agent_id: str,
|
|
1768
|
+
*,
|
|
1769
|
+
conversation_id: Optional[str] | Omit = omit,
|
|
1770
|
+
max_steps: int | Omit = omit,
|
|
1771
|
+
use_legacy_format: bool | Omit = omit,
|
|
1772
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1773
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1774
|
+
extra_headers: Headers | None = None,
|
|
1775
|
+
extra_query: Query | None = None,
|
|
1776
|
+
extra_body: Body | None = None,
|
|
1777
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1778
|
+
) -> str:
|
|
1779
|
+
"""
|
|
1780
|
+
Export the serialized JSON representation of an agent, formatted with
|
|
1781
|
+
indentation.
|
|
1782
|
+
|
|
1783
|
+
Args:
|
|
1784
|
+
conversation_id: Conversation ID to export. If provided, uses messages from this conversation
|
|
1785
|
+
instead of the agent's global message history.
|
|
1786
|
+
|
|
1787
|
+
use_legacy_format: If True, exports using the legacy single-agent 'v1' format with inline
|
|
1788
|
+
tools/blocks. If False, exports using the new multi-entity 'v2' format, with
|
|
1789
|
+
separate agents, tools, blocks, files, etc.
|
|
1790
|
+
|
|
1791
|
+
extra_headers: Send extra headers
|
|
1792
|
+
|
|
1793
|
+
extra_query: Add additional query parameters to the request
|
|
1794
|
+
|
|
1795
|
+
extra_body: Add additional JSON properties to the request
|
|
1796
|
+
|
|
1797
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1798
|
+
"""
|
|
1799
|
+
if not agent_id:
|
|
1800
|
+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
1801
|
+
return await self._get(
|
|
1802
|
+
f"/v1/agents/{agent_id}/export",
|
|
1803
|
+
options=make_request_options(
|
|
1804
|
+
extra_headers=extra_headers,
|
|
1805
|
+
extra_query=extra_query,
|
|
1806
|
+
extra_body=extra_body,
|
|
1807
|
+
timeout=timeout,
|
|
1808
|
+
query=await async_maybe_transform(
|
|
1809
|
+
{
|
|
1810
|
+
"conversation_id": conversation_id,
|
|
1811
|
+
"max_steps": max_steps,
|
|
1812
|
+
"use_legacy_format": use_legacy_format,
|
|
1813
|
+
},
|
|
1814
|
+
agent_export_file_params.AgentExportFileParams,
|
|
1815
|
+
),
|
|
1816
|
+
),
|
|
1817
|
+
cast_to=str,
|
|
1818
|
+
)
|
|
1819
|
+
|
|
1820
|
+
async def import_file(
|
|
1821
|
+
self,
|
|
1822
|
+
*,
|
|
1823
|
+
file: FileTypes,
|
|
1824
|
+
append_copy_suffix: bool | Omit = omit,
|
|
1825
|
+
embedding: Optional[str] | Omit = omit,
|
|
1826
|
+
env_vars_json: Optional[str] | Omit = omit,
|
|
1827
|
+
name: Optional[str] | Omit = omit,
|
|
1828
|
+
override_embedding_handle: Optional[str] | Omit = omit,
|
|
1829
|
+
override_existing_tools: bool | Omit = omit,
|
|
1830
|
+
override_name: Optional[str] | Omit = omit,
|
|
1831
|
+
project_id: Optional[str] | Omit = omit,
|
|
1832
|
+
secrets: Optional[str] | Omit = omit,
|
|
1833
|
+
strip_messages: bool | Omit = omit,
|
|
1834
|
+
x_override_embedding_model: str | Omit = omit,
|
|
1835
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1836
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1837
|
+
extra_headers: Headers | None = None,
|
|
1838
|
+
extra_query: Query | None = None,
|
|
1839
|
+
extra_body: Body | None = None,
|
|
1840
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1841
|
+
) -> AgentImportFileResponse:
|
|
1842
|
+
"""Import a serialized agent file and recreate the agent(s) in the system.
|
|
1843
|
+
|
|
1844
|
+
Returns
|
|
1845
|
+
the IDs of all imported agents.
|
|
1846
|
+
|
|
1847
|
+
Args:
|
|
1848
|
+
append_copy_suffix: If set to True, appends "\\__copy" to the end of the agent name.
|
|
1849
|
+
|
|
1850
|
+
embedding: Embedding handle to override with.
|
|
1851
|
+
|
|
1852
|
+
env_vars_json: Environment variables as a JSON string to pass to the agent for tool execution.
|
|
1853
|
+
Use 'secrets' instead.
|
|
1854
|
+
|
|
1855
|
+
name: If provided, overrides the agent name with this value.
|
|
1856
|
+
|
|
1857
|
+
override_embedding_handle: Override import with specific embedding handle. Use 'embedding' instead.
|
|
1858
|
+
|
|
1859
|
+
override_existing_tools: If set to True, existing tools can get their source code overwritten by the
|
|
1860
|
+
uploaded tool definitions. Note that Letta core tools can never be updated
|
|
1861
|
+
externally.
|
|
1862
|
+
|
|
1863
|
+
override_name: If provided, overrides the agent name with this value. Use 'name' instead.
|
|
1864
|
+
|
|
1865
|
+
project_id: The project ID to associate the uploaded agent with. This is now passed via
|
|
1866
|
+
headers.
|
|
1867
|
+
|
|
1868
|
+
secrets: Secrets as a JSON string to pass to the agent for tool execution.
|
|
1869
|
+
|
|
1870
|
+
strip_messages: If set to True, strips all messages from the agent before importing.
|
|
1871
|
+
|
|
1872
|
+
extra_headers: Send extra headers
|
|
1873
|
+
|
|
1874
|
+
extra_query: Add additional query parameters to the request
|
|
1875
|
+
|
|
1876
|
+
extra_body: Add additional JSON properties to the request
|
|
1877
|
+
|
|
1878
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1879
|
+
"""
|
|
1880
|
+
extra_headers = {
|
|
1881
|
+
**strip_not_given({"x-override-embedding-model": x_override_embedding_model}),
|
|
1882
|
+
**(extra_headers or {}),
|
|
1883
|
+
}
|
|
1884
|
+
body = deepcopy_minimal(
|
|
1885
|
+
{
|
|
1886
|
+
"file": file,
|
|
1887
|
+
"append_copy_suffix": append_copy_suffix,
|
|
1888
|
+
"embedding": embedding,
|
|
1889
|
+
"env_vars_json": env_vars_json,
|
|
1890
|
+
"name": name,
|
|
1891
|
+
"override_embedding_handle": override_embedding_handle,
|
|
1892
|
+
"override_existing_tools": override_existing_tools,
|
|
1893
|
+
"override_name": override_name,
|
|
1894
|
+
"project_id": project_id,
|
|
1895
|
+
"secrets": secrets,
|
|
1896
|
+
"strip_messages": strip_messages,
|
|
1897
|
+
}
|
|
1898
|
+
)
|
|
1899
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
|
1900
|
+
# It should be noted that the actual Content-Type header that will be
|
|
1901
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
1902
|
+
# multipart/form-data; boundary=---abc--
|
|
1903
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
1904
|
+
return await self._post(
|
|
1905
|
+
"/v1/agents/import",
|
|
1906
|
+
body=await async_maybe_transform(body, agent_import_file_params.AgentImportFileParams),
|
|
1907
|
+
files=files,
|
|
1908
|
+
options=make_request_options(
|
|
1909
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1910
|
+
),
|
|
1911
|
+
cast_to=AgentImportFileResponse,
|
|
1912
|
+
)
|
|
1913
|
+
|
|
1914
|
+
|
|
1915
|
+
class AgentsResourceWithRawResponse:
|
|
1916
|
+
def __init__(self, agents: AgentsResource) -> None:
|
|
1917
|
+
self._agents = agents
|
|
1918
|
+
|
|
1919
|
+
self.create = to_raw_response_wrapper(
|
|
1920
|
+
agents.create,
|
|
1921
|
+
)
|
|
1922
|
+
self.retrieve = to_raw_response_wrapper(
|
|
1923
|
+
agents.retrieve,
|
|
1924
|
+
)
|
|
1925
|
+
self.update = to_raw_response_wrapper(
|
|
1926
|
+
agents.update,
|
|
1927
|
+
)
|
|
1928
|
+
self.list = to_raw_response_wrapper(
|
|
1929
|
+
agents.list,
|
|
1930
|
+
)
|
|
1931
|
+
self.delete = to_raw_response_wrapper(
|
|
1932
|
+
agents.delete,
|
|
1933
|
+
)
|
|
1934
|
+
self.export_file = to_raw_response_wrapper(
|
|
1935
|
+
agents.export_file,
|
|
1936
|
+
)
|
|
1937
|
+
self.import_file = to_raw_response_wrapper(
|
|
1938
|
+
agents.import_file,
|
|
1939
|
+
)
|
|
1940
|
+
|
|
1941
|
+
@cached_property
|
|
1942
|
+
def messages(self) -> MessagesResourceWithRawResponse:
|
|
1943
|
+
return MessagesResourceWithRawResponse(self._agents.messages)
|
|
1944
|
+
|
|
1945
|
+
@cached_property
|
|
1946
|
+
def blocks(self) -> BlocksResourceWithRawResponse:
|
|
1947
|
+
return BlocksResourceWithRawResponse(self._agents.blocks)
|
|
1948
|
+
|
|
1949
|
+
@cached_property
|
|
1950
|
+
def tools(self) -> ToolsResourceWithRawResponse:
|
|
1951
|
+
return ToolsResourceWithRawResponse(self._agents.tools)
|
|
1952
|
+
|
|
1953
|
+
@cached_property
|
|
1954
|
+
def folders(self) -> FoldersResourceWithRawResponse:
|
|
1955
|
+
return FoldersResourceWithRawResponse(self._agents.folders)
|
|
1956
|
+
|
|
1957
|
+
@cached_property
|
|
1958
|
+
def files(self) -> FilesResourceWithRawResponse:
|
|
1959
|
+
return FilesResourceWithRawResponse(self._agents.files)
|
|
1960
|
+
|
|
1961
|
+
@cached_property
|
|
1962
|
+
def archives(self) -> ArchivesResourceWithRawResponse:
|
|
1963
|
+
return ArchivesResourceWithRawResponse(self._agents.archives)
|
|
1964
|
+
|
|
1965
|
+
@cached_property
|
|
1966
|
+
def passages(self) -> PassagesResourceWithRawResponse:
|
|
1967
|
+
return PassagesResourceWithRawResponse(self._agents.passages)
|
|
1968
|
+
|
|
1969
|
+
@cached_property
|
|
1970
|
+
def identities(self) -> IdentitiesResourceWithRawResponse:
|
|
1971
|
+
return IdentitiesResourceWithRawResponse(self._agents.identities)
|
|
1972
|
+
|
|
1973
|
+
|
|
1974
|
+
class AsyncAgentsResourceWithRawResponse:
|
|
1975
|
+
def __init__(self, agents: AsyncAgentsResource) -> None:
|
|
1976
|
+
self._agents = agents
|
|
1977
|
+
|
|
1978
|
+
self.create = async_to_raw_response_wrapper(
|
|
1979
|
+
agents.create,
|
|
1980
|
+
)
|
|
1981
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
1982
|
+
agents.retrieve,
|
|
1983
|
+
)
|
|
1984
|
+
self.update = async_to_raw_response_wrapper(
|
|
1985
|
+
agents.update,
|
|
1986
|
+
)
|
|
1987
|
+
self.list = async_to_raw_response_wrapper(
|
|
1988
|
+
agents.list,
|
|
1989
|
+
)
|
|
1990
|
+
self.delete = async_to_raw_response_wrapper(
|
|
1991
|
+
agents.delete,
|
|
1992
|
+
)
|
|
1993
|
+
self.export_file = async_to_raw_response_wrapper(
|
|
1994
|
+
agents.export_file,
|
|
1995
|
+
)
|
|
1996
|
+
self.import_file = async_to_raw_response_wrapper(
|
|
1997
|
+
agents.import_file,
|
|
1998
|
+
)
|
|
1999
|
+
|
|
2000
|
+
@cached_property
|
|
2001
|
+
def messages(self) -> AsyncMessagesResourceWithRawResponse:
|
|
2002
|
+
return AsyncMessagesResourceWithRawResponse(self._agents.messages)
|
|
2003
|
+
|
|
2004
|
+
@cached_property
|
|
2005
|
+
def blocks(self) -> AsyncBlocksResourceWithRawResponse:
|
|
2006
|
+
return AsyncBlocksResourceWithRawResponse(self._agents.blocks)
|
|
2007
|
+
|
|
2008
|
+
@cached_property
|
|
2009
|
+
def tools(self) -> AsyncToolsResourceWithRawResponse:
|
|
2010
|
+
return AsyncToolsResourceWithRawResponse(self._agents.tools)
|
|
2011
|
+
|
|
2012
|
+
@cached_property
|
|
2013
|
+
def folders(self) -> AsyncFoldersResourceWithRawResponse:
|
|
2014
|
+
return AsyncFoldersResourceWithRawResponse(self._agents.folders)
|
|
2015
|
+
|
|
2016
|
+
@cached_property
|
|
2017
|
+
def files(self) -> AsyncFilesResourceWithRawResponse:
|
|
2018
|
+
return AsyncFilesResourceWithRawResponse(self._agents.files)
|
|
2019
|
+
|
|
2020
|
+
@cached_property
|
|
2021
|
+
def archives(self) -> AsyncArchivesResourceWithRawResponse:
|
|
2022
|
+
return AsyncArchivesResourceWithRawResponse(self._agents.archives)
|
|
2023
|
+
|
|
2024
|
+
@cached_property
|
|
2025
|
+
def passages(self) -> AsyncPassagesResourceWithRawResponse:
|
|
2026
|
+
return AsyncPassagesResourceWithRawResponse(self._agents.passages)
|
|
2027
|
+
|
|
2028
|
+
@cached_property
|
|
2029
|
+
def identities(self) -> AsyncIdentitiesResourceWithRawResponse:
|
|
2030
|
+
return AsyncIdentitiesResourceWithRawResponse(self._agents.identities)
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
class AgentsResourceWithStreamingResponse:
|
|
2034
|
+
def __init__(self, agents: AgentsResource) -> None:
|
|
2035
|
+
self._agents = agents
|
|
2036
|
+
|
|
2037
|
+
self.create = to_streamed_response_wrapper(
|
|
2038
|
+
agents.create,
|
|
2039
|
+
)
|
|
2040
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
2041
|
+
agents.retrieve,
|
|
2042
|
+
)
|
|
2043
|
+
self.update = to_streamed_response_wrapper(
|
|
2044
|
+
agents.update,
|
|
2045
|
+
)
|
|
2046
|
+
self.list = to_streamed_response_wrapper(
|
|
2047
|
+
agents.list,
|
|
2048
|
+
)
|
|
2049
|
+
self.delete = to_streamed_response_wrapper(
|
|
2050
|
+
agents.delete,
|
|
2051
|
+
)
|
|
2052
|
+
self.export_file = to_streamed_response_wrapper(
|
|
2053
|
+
agents.export_file,
|
|
2054
|
+
)
|
|
2055
|
+
self.import_file = to_streamed_response_wrapper(
|
|
2056
|
+
agents.import_file,
|
|
2057
|
+
)
|
|
2058
|
+
|
|
2059
|
+
@cached_property
|
|
2060
|
+
def messages(self) -> MessagesResourceWithStreamingResponse:
|
|
2061
|
+
return MessagesResourceWithStreamingResponse(self._agents.messages)
|
|
2062
|
+
|
|
2063
|
+
@cached_property
|
|
2064
|
+
def blocks(self) -> BlocksResourceWithStreamingResponse:
|
|
2065
|
+
return BlocksResourceWithStreamingResponse(self._agents.blocks)
|
|
2066
|
+
|
|
2067
|
+
@cached_property
|
|
2068
|
+
def tools(self) -> ToolsResourceWithStreamingResponse:
|
|
2069
|
+
return ToolsResourceWithStreamingResponse(self._agents.tools)
|
|
2070
|
+
|
|
2071
|
+
@cached_property
|
|
2072
|
+
def folders(self) -> FoldersResourceWithStreamingResponse:
|
|
2073
|
+
return FoldersResourceWithStreamingResponse(self._agents.folders)
|
|
2074
|
+
|
|
2075
|
+
@cached_property
|
|
2076
|
+
def files(self) -> FilesResourceWithStreamingResponse:
|
|
2077
|
+
return FilesResourceWithStreamingResponse(self._agents.files)
|
|
2078
|
+
|
|
2079
|
+
@cached_property
|
|
2080
|
+
def archives(self) -> ArchivesResourceWithStreamingResponse:
|
|
2081
|
+
return ArchivesResourceWithStreamingResponse(self._agents.archives)
|
|
2082
|
+
|
|
2083
|
+
@cached_property
|
|
2084
|
+
def passages(self) -> PassagesResourceWithStreamingResponse:
|
|
2085
|
+
return PassagesResourceWithStreamingResponse(self._agents.passages)
|
|
2086
|
+
|
|
2087
|
+
@cached_property
|
|
2088
|
+
def identities(self) -> IdentitiesResourceWithStreamingResponse:
|
|
2089
|
+
return IdentitiesResourceWithStreamingResponse(self._agents.identities)
|
|
2090
|
+
|
|
2091
|
+
|
|
2092
|
+
class AsyncAgentsResourceWithStreamingResponse:
|
|
2093
|
+
def __init__(self, agents: AsyncAgentsResource) -> None:
|
|
2094
|
+
self._agents = agents
|
|
2095
|
+
|
|
2096
|
+
self.create = async_to_streamed_response_wrapper(
|
|
2097
|
+
agents.create,
|
|
2098
|
+
)
|
|
2099
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
2100
|
+
agents.retrieve,
|
|
2101
|
+
)
|
|
2102
|
+
self.update = async_to_streamed_response_wrapper(
|
|
2103
|
+
agents.update,
|
|
2104
|
+
)
|
|
2105
|
+
self.list = async_to_streamed_response_wrapper(
|
|
2106
|
+
agents.list,
|
|
2107
|
+
)
|
|
2108
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
2109
|
+
agents.delete,
|
|
2110
|
+
)
|
|
2111
|
+
self.export_file = async_to_streamed_response_wrapper(
|
|
2112
|
+
agents.export_file,
|
|
2113
|
+
)
|
|
2114
|
+
self.import_file = async_to_streamed_response_wrapper(
|
|
2115
|
+
agents.import_file,
|
|
2116
|
+
)
|
|
2117
|
+
|
|
2118
|
+
@cached_property
|
|
2119
|
+
def messages(self) -> AsyncMessagesResourceWithStreamingResponse:
|
|
2120
|
+
return AsyncMessagesResourceWithStreamingResponse(self._agents.messages)
|
|
2121
|
+
|
|
2122
|
+
@cached_property
|
|
2123
|
+
def blocks(self) -> AsyncBlocksResourceWithStreamingResponse:
|
|
2124
|
+
return AsyncBlocksResourceWithStreamingResponse(self._agents.blocks)
|
|
2125
|
+
|
|
2126
|
+
@cached_property
|
|
2127
|
+
def tools(self) -> AsyncToolsResourceWithStreamingResponse:
|
|
2128
|
+
return AsyncToolsResourceWithStreamingResponse(self._agents.tools)
|
|
2129
|
+
|
|
2130
|
+
@cached_property
|
|
2131
|
+
def folders(self) -> AsyncFoldersResourceWithStreamingResponse:
|
|
2132
|
+
return AsyncFoldersResourceWithStreamingResponse(self._agents.folders)
|
|
2133
|
+
|
|
2134
|
+
@cached_property
|
|
2135
|
+
def files(self) -> AsyncFilesResourceWithStreamingResponse:
|
|
2136
|
+
return AsyncFilesResourceWithStreamingResponse(self._agents.files)
|
|
2137
|
+
|
|
2138
|
+
@cached_property
|
|
2139
|
+
def archives(self) -> AsyncArchivesResourceWithStreamingResponse:
|
|
2140
|
+
return AsyncArchivesResourceWithStreamingResponse(self._agents.archives)
|
|
2141
|
+
|
|
2142
|
+
@cached_property
|
|
2143
|
+
def passages(self) -> AsyncPassagesResourceWithStreamingResponse:
|
|
2144
|
+
return AsyncPassagesResourceWithStreamingResponse(self._agents.passages)
|
|
2145
|
+
|
|
2146
|
+
@cached_property
|
|
2147
|
+
def identities(self) -> AsyncIdentitiesResourceWithStreamingResponse:
|
|
2148
|
+
return AsyncIdentitiesResourceWithStreamingResponse(self._agents.identities)
|