letta-nightly 0.6.0.dev20241204054116__tar.gz → 0.6.0.dev20241204213946__tar.gz
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.
Potentially problematic release.
This version of letta-nightly might be problematic. Click here for more details.
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/PKG-INFO +1 -1
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/agent.py +2 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/agent.py +2 -2
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/sandbox_config.py +5 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/server.py +46 -3
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/services/tool_execution_sandbox.py +137 -31
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/pyproject.toml +1 -1
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/LICENSE +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/README.md +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/__main__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/agent_store/chroma.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/agent_store/db.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/agent_store/lancedb.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/agent_store/milvus.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/agent_store/qdrant.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/agent_store/storage.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/benchmark/benchmark.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/benchmark/constants.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/cli/cli.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/cli/cli_config.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/cli/cli_load.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/client/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/client/client.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/client/streaming.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/client/utils.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/config.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/constants.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/credentials.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/data_sources/connectors.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/data_sources/connectors_helper.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/embeddings.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/errors.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/functions/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/functions/function_sets/base.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/functions/function_sets/extras.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/functions/functions.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/functions/helpers.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/functions/schema_generator.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/helpers/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/helpers/tool_rule_solver.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/humans/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/humans/examples/basic.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/humans/examples/cs_phd.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/interface.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/llm_api/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/llm_api/anthropic.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/llm_api/azure_openai.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/llm_api/azure_openai_constants.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/llm_api/cohere.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/llm_api/google_ai.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/llm_api/helpers.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/llm_api/llm_api_tools.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/llm_api/mistral.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/llm_api/openai.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/README.md +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/chat_completion_proxy.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/constants.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/function_parser.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/grammars/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/grammars/gbnf_grammar_generator.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/grammars/json.gbnf +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/json_parser.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/koboldcpp/api.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/koboldcpp/settings.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/llamacpp/api.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/llamacpp/settings.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/llm_chat_completion_wrappers/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/llm_chat_completion_wrappers/airoboros.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/llm_chat_completion_wrappers/chatml.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/llm_chat_completion_wrappers/dolphin.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/llm_chat_completion_wrappers/llama3.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/llm_chat_completion_wrappers/wrapper_base.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/llm_chat_completion_wrappers/zephyr.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/lmstudio/api.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/lmstudio/settings.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/ollama/api.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/ollama/settings.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/settings/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/settings/deterministic_mirostat.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/settings/settings.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/settings/simple.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/utils.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/vllm/api.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/webui/api.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/webui/legacy_api.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/webui/legacy_settings.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/local_llm/webui/settings.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/log.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/main.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/memory.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/metadata.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/o1_agent.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/openai_backcompat/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/openai_backcompat/openai_object.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/__all__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/agents_tags.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/base.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/block.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/blocks_agents.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/enums.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/errors.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/file.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/mixins.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/organization.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/sandbox_config.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/source.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/sqlalchemy_base.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/tool.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/orm/user.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/persistence_manager.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/personas/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/personas/examples/anna_pa.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/personas/examples/google_search_persona.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/personas/examples/memgpt_doc.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/personas/examples/memgpt_starter.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/personas/examples/o1_persona.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/personas/examples/sam.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/personas/examples/sam_pov.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/personas/examples/sam_simple_pov_gpt35.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/personas/examples/sqldb/test.db +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/prompts/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/prompts/gpt_summarize.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/prompts/gpt_system.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/prompts/system/memgpt_base.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/prompts/system/memgpt_chat.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/prompts/system/memgpt_chat_compressed.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/prompts/system/memgpt_chat_fstring.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/prompts/system/memgpt_doc.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/prompts/system/memgpt_gpt35_extralong.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/prompts/system/memgpt_intuitive_knowledge.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/prompts/system/memgpt_modified_chat.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/prompts/system/memgpt_modified_o1.txt +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/providers.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/pytest.ini +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/agents_tags.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/api_key.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/block.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/blocks_agents.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/embedding_config.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/enums.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/file.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/health.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/job.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/letta_base.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/letta_message.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/letta_request.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/letta_response.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/llm_config.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/memory.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/message.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/openai/chat_completion_request.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/openai/chat_completion_response.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/openai/chat_completions.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/openai/embedding_response.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/openai/openai.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/organization.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/passage.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/source.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/tool.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/tool_rule.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/usage.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/schemas/user.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/constants.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/generate_openapi_schema.sh +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/app.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/auth/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/auth/index.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/auth_token.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/interface.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/openai/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/openai/assistants/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/openai/assistants/assistants.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/openai/assistants/schemas.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/openai/assistants/threads.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/openai/chat_completions/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/v1/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/v1/agents.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/v1/blocks.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/v1/health.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/v1/jobs.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/v1/llms.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/v1/organizations.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/v1/sandbox_configs.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/v1/sources.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/v1/tools.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/routers/v1/users.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/static_files.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/rest_api/utils.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/startup.sh +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/static_files/assets/index-3ab03d5b.css +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/static_files/assets/index-9fa459a2.js +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/static_files/favicon.ico +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/static_files/index.html +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/static_files/memgpt_logo_transparent.png +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/utils.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/ws_api/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/ws_api/example_client.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/ws_api/interface.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/ws_api/protocol.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/server/ws_api/server.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/services/__init__.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/services/agents_tags_manager.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/services/block_manager.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/services/blocks_agents_manager.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/services/organization_manager.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/services/per_agent_lock_manager.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/services/sandbox_config_manager.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/services/source_manager.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/services/tool_manager.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/services/tool_sandbox_env/.gitkeep +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/services/user_manager.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/settings.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/streaming_interface.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/streaming_utils.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/system.py +0 -0
- {letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/utils.py +0 -0
{letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/agent.py
RENAMED
|
@@ -350,6 +350,8 @@ class Agent(BaseAgent):
|
|
|
350
350
|
init_messages_objs = []
|
|
351
351
|
for msg in init_messages:
|
|
352
352
|
init_messages_objs.append(msg)
|
|
353
|
+
for msg in init_messages_objs:
|
|
354
|
+
assert isinstance(msg, Message), f"Message object is not of type Message: {type(msg)}"
|
|
353
355
|
assert all([isinstance(msg, Message) for msg in init_messages_objs]), (init_messages_objs, init_messages)
|
|
354
356
|
|
|
355
357
|
# Put the messages inside the message buffer
|
|
@@ -9,7 +9,7 @@ from letta.schemas.embedding_config import EmbeddingConfig
|
|
|
9
9
|
from letta.schemas.letta_base import LettaBase
|
|
10
10
|
from letta.schemas.llm_config import LLMConfig
|
|
11
11
|
from letta.schemas.memory import Memory
|
|
12
|
-
from letta.schemas.message import Message
|
|
12
|
+
from letta.schemas.message import Message, MessageCreate
|
|
13
13
|
from letta.schemas.openai.chat_completion_response import UsageStatistics
|
|
14
14
|
from letta.schemas.source import Source
|
|
15
15
|
from letta.schemas.tool import Tool
|
|
@@ -124,7 +124,7 @@ class CreateAgent(BaseAgent): #
|
|
|
124
124
|
embedding_config: Optional[EmbeddingConfig] = Field(None, description="The embedding configuration used by the agent.")
|
|
125
125
|
# Note: if this is None, then we'll populate with the standard "more human than human" initial message sequence
|
|
126
126
|
# If the client wants to make this empty, then the client can set the arg to an empty list
|
|
127
|
-
initial_message_sequence: Optional[List[
|
|
127
|
+
initial_message_sequence: Optional[List[MessageCreate]] = Field(
|
|
128
128
|
None, description="The initial set of messages to put in the agent's in-context memory."
|
|
129
129
|
)
|
|
130
130
|
|
|
@@ -24,6 +24,11 @@ class SandboxRunResult(BaseModel):
|
|
|
24
24
|
|
|
25
25
|
class LocalSandboxConfig(BaseModel):
|
|
26
26
|
sandbox_dir: str = Field(..., description="Directory for the sandbox environment.")
|
|
27
|
+
use_venv: bool = Field(False, description="Whether or not to use the venv, or run directly in the same run loop.")
|
|
28
|
+
venv_name: str = Field(
|
|
29
|
+
"venv",
|
|
30
|
+
description="The name for the venv in the sandbox directory. We first search for an existing venv with this name, otherwise, we make it from the requirements.txt.",
|
|
31
|
+
)
|
|
27
32
|
|
|
28
33
|
@property
|
|
29
34
|
def type(self) -> "SandboxType":
|
|
@@ -372,6 +372,22 @@ class SyncServer(Server):
|
|
|
372
372
|
}
|
|
373
373
|
)
|
|
374
374
|
|
|
375
|
+
def initialize_agent(self, agent_id, interface: Union[AgentInterface, None] = None, initial_message_sequence=None) -> Agent:
|
|
376
|
+
"""Initialize an agent from the database"""
|
|
377
|
+
agent_state = self.get_agent(agent_id=agent_id)
|
|
378
|
+
actor = self.user_manager.get_user_by_id(user_id=agent_state.user_id)
|
|
379
|
+
|
|
380
|
+
interface = interface or self.default_interface_factory()
|
|
381
|
+
if agent_state.agent_type == AgentType.memgpt_agent:
|
|
382
|
+
agent = Agent(agent_state=agent_state, interface=interface, user=actor, initial_message_sequence=initial_message_sequence)
|
|
383
|
+
else:
|
|
384
|
+
assert initial_message_sequence is None, f"Initial message sequence is not supported for O1Agents"
|
|
385
|
+
agent = O1Agent(agent_state=agent_state, interface=interface, user=actor)
|
|
386
|
+
|
|
387
|
+
# Persist to agent
|
|
388
|
+
save_agent(agent, self.ms)
|
|
389
|
+
return agent
|
|
390
|
+
|
|
375
391
|
def load_agent(self, agent_id: str, interface: Union[AgentInterface, None] = None) -> Agent:
|
|
376
392
|
"""Updated method to load agents from persisted storage"""
|
|
377
393
|
agent_lock = self.per_agent_lock_manager.get_lock(agent_id)
|
|
@@ -385,6 +401,9 @@ class SyncServer(Server):
|
|
|
385
401
|
else:
|
|
386
402
|
agent = O1Agent(agent_state=agent_state, interface=interface, user=actor)
|
|
387
403
|
|
|
404
|
+
# Rebuild the system prompt - may be linked to new blocks now
|
|
405
|
+
agent.rebuild_system_prompt()
|
|
406
|
+
|
|
388
407
|
# Persist to agent
|
|
389
408
|
save_agent(agent, self.ms)
|
|
390
409
|
return agent
|
|
@@ -802,8 +821,6 @@ class SyncServer(Server):
|
|
|
802
821
|
if not user:
|
|
803
822
|
raise ValueError(f"cannot find user with associated client id: {user_id}")
|
|
804
823
|
|
|
805
|
-
# TODO: create the message objects (NOTE: do this after we migrate to `CreateMessage`)
|
|
806
|
-
|
|
807
824
|
# created and persist the agent state in the DB
|
|
808
825
|
agent_state = PersistedAgentState(
|
|
809
826
|
name=request.name,
|
|
@@ -822,6 +839,31 @@ class SyncServer(Server):
|
|
|
822
839
|
# this saves the agent ID and state into the DB
|
|
823
840
|
self.ms.create_agent(agent_state)
|
|
824
841
|
|
|
842
|
+
# create the agent object
|
|
843
|
+
if request.initial_message_sequence:
|
|
844
|
+
# init_messages = [Message(user_id=user_id, agent_id=agent_state.id, role=message.role, text=message.text) for message in request.initial_message_sequence]
|
|
845
|
+
init_messages = []
|
|
846
|
+
for message in request.initial_message_sequence:
|
|
847
|
+
|
|
848
|
+
if message.role == MessageRole.user:
|
|
849
|
+
packed_message = system.package_user_message(
|
|
850
|
+
user_message=message.text,
|
|
851
|
+
)
|
|
852
|
+
elif message.role == MessageRole.system:
|
|
853
|
+
packed_message = system.package_system_message(
|
|
854
|
+
system_message=message.text,
|
|
855
|
+
)
|
|
856
|
+
else:
|
|
857
|
+
raise ValueError(f"Invalid message role: {message.role}")
|
|
858
|
+
|
|
859
|
+
init_messages.append(Message(role=message.role, text=packed_message, user_id=user_id, agent_id=agent_state.id))
|
|
860
|
+
# init_messages = [Message.dict_to_message(user_id=user_id, agent_id=agent_state.id, openai_message_dict=message.model_dump()) for message in request.initial_message_sequence]
|
|
861
|
+
else:
|
|
862
|
+
init_messages = None
|
|
863
|
+
|
|
864
|
+
# initialize the agent (generates initial message list with system prompt)
|
|
865
|
+
self.initialize_agent(agent_id=agent_state.id, interface=interface, initial_message_sequence=init_messages)
|
|
866
|
+
|
|
825
867
|
# Note: mappings (e.g. tags, blocks) are created after the agent is persisted
|
|
826
868
|
# TODO: add source mappings here as well
|
|
827
869
|
|
|
@@ -1876,7 +1918,8 @@ class SyncServer(Server):
|
|
|
1876
1918
|
apps = self.composio_client.apps.get()
|
|
1877
1919
|
apps_with_actions = []
|
|
1878
1920
|
for app in apps:
|
|
1879
|
-
|
|
1921
|
+
# A bit of hacky logic until composio patches this
|
|
1922
|
+
if app.meta["actionsCount"] > 0 and not app.name.lower().endswith("_beta"):
|
|
1880
1923
|
apps_with_actions.append(app)
|
|
1881
1924
|
|
|
1882
1925
|
return apps_with_actions
|
|
@@ -4,9 +4,12 @@ import io
|
|
|
4
4
|
import os
|
|
5
5
|
import pickle
|
|
6
6
|
import runpy
|
|
7
|
+
import subprocess
|
|
7
8
|
import sys
|
|
8
9
|
import tempfile
|
|
9
|
-
|
|
10
|
+
import uuid
|
|
11
|
+
import venv
|
|
12
|
+
from typing import Any, Dict, Optional, TextIO
|
|
10
13
|
|
|
11
14
|
from letta.log import get_logger
|
|
12
15
|
from letta.schemas.agent import AgentState
|
|
@@ -24,6 +27,11 @@ class ToolExecutionSandbox:
|
|
|
24
27
|
METADATA_CONFIG_STATE_KEY = "config_state"
|
|
25
28
|
REQUIREMENT_TXT_NAME = "requirements.txt"
|
|
26
29
|
|
|
30
|
+
# For generating long, random marker hashes
|
|
31
|
+
NAMESPACE = uuid.NAMESPACE_DNS
|
|
32
|
+
LOCAL_SANDBOX_RESULT_START_MARKER = str(uuid.uuid5(NAMESPACE, "local-sandbox-result-start-marker"))
|
|
33
|
+
LOCAL_SANDBOX_RESULT_END_MARKER = str(uuid.uuid5(NAMESPACE, "local-sandbox-result-end-marker"))
|
|
34
|
+
|
|
27
35
|
# This is the variable name in the auto-generated code that contains the function results
|
|
28
36
|
# We make this a long random string to avoid collisions with any variables in the user's code
|
|
29
37
|
LOCAL_SANDBOX_RESULT_VAR_NAME = "result_ZQqiequkcFwRwwGQMqkt"
|
|
@@ -65,12 +73,10 @@ class ToolExecutionSandbox:
|
|
|
65
73
|
"""
|
|
66
74
|
if tool_settings.e2b_api_key:
|
|
67
75
|
logger.debug(f"Using e2b sandbox to execute {self.tool_name}")
|
|
68
|
-
|
|
69
|
-
result = self.run_e2b_sandbox(code=code)
|
|
76
|
+
result = self.run_e2b_sandbox(agent_state=agent_state)
|
|
70
77
|
else:
|
|
71
78
|
logger.debug(f"Using local sandbox to execute {self.tool_name}")
|
|
72
|
-
|
|
73
|
-
result = self.run_local_dir_sandbox(code=code)
|
|
79
|
+
result = self.run_local_dir_sandbox(agent_state=agent_state)
|
|
74
80
|
|
|
75
81
|
# Log out any stdout from the tool run
|
|
76
82
|
logger.debug(f"Executed tool '{self.tool_name}', logging stdout from tool run: \n")
|
|
@@ -94,12 +100,14 @@ class ToolExecutionSandbox:
|
|
|
94
100
|
os.environ.clear()
|
|
95
101
|
os.environ.update(original_env) # Restore original environment variables
|
|
96
102
|
|
|
97
|
-
def run_local_dir_sandbox(self,
|
|
103
|
+
def run_local_dir_sandbox(self, agent_state: AgentState) -> Optional[SandboxRunResult]:
|
|
98
104
|
sbx_config = self.sandbox_config_manager.get_or_create_default_sandbox_config(sandbox_type=SandboxType.LOCAL, actor=self.user)
|
|
99
105
|
local_configs = sbx_config.get_local_config()
|
|
100
106
|
|
|
101
107
|
# Get environment variables for the sandbox
|
|
102
108
|
env_vars = self.sandbox_config_manager.get_sandbox_env_vars_as_dict(sandbox_config_id=sbx_config.id, actor=self.user, limit=100)
|
|
109
|
+
env = os.environ.copy()
|
|
110
|
+
env.update(env_vars)
|
|
103
111
|
|
|
104
112
|
# Safety checks
|
|
105
113
|
if not os.path.isdir(local_configs.sandbox_dir):
|
|
@@ -107,6 +115,12 @@ class ToolExecutionSandbox:
|
|
|
107
115
|
|
|
108
116
|
# Write the code to a temp file in the sandbox_dir
|
|
109
117
|
with tempfile.NamedTemporaryFile(mode="w", dir=local_configs.sandbox_dir, suffix=".py", delete=False) as temp_file:
|
|
118
|
+
if local_configs.use_venv:
|
|
119
|
+
# If using venv, we need to wrap with special string markers to separate out the output and the stdout (since it is all in stdout)
|
|
120
|
+
code = self.generate_execution_script(agent_state=agent_state, wrap_print_with_markers=True)
|
|
121
|
+
else:
|
|
122
|
+
code = self.generate_execution_script(agent_state=agent_state)
|
|
123
|
+
|
|
110
124
|
temp_file.write(code)
|
|
111
125
|
temp_file.flush()
|
|
112
126
|
temp_file_path = temp_file.name
|
|
@@ -114,39 +128,122 @@ class ToolExecutionSandbox:
|
|
|
114
128
|
# Save the old stdout
|
|
115
129
|
old_stdout = sys.stdout
|
|
116
130
|
try:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
# Execute the temp file
|
|
122
|
-
with self.temporary_env_vars(env_vars):
|
|
123
|
-
result = runpy.run_path(temp_file_path, init_globals=env_vars)
|
|
124
|
-
|
|
125
|
-
# Fetch the result
|
|
126
|
-
func_result = result.get(self.LOCAL_SANDBOX_RESULT_VAR_NAME)
|
|
127
|
-
func_return, agent_state = self.parse_best_effort(func_result)
|
|
128
|
-
|
|
129
|
-
# Restore stdout and collect captured output
|
|
130
|
-
sys.stdout = old_stdout
|
|
131
|
-
stdout_output = captured_stdout.getvalue()
|
|
132
|
-
|
|
133
|
-
return SandboxRunResult(
|
|
134
|
-
func_return=func_return,
|
|
135
|
-
agent_state=agent_state,
|
|
136
|
-
stdout=[stdout_output],
|
|
137
|
-
sandbox_config_fingerprint=sbx_config.fingerprint(),
|
|
138
|
-
)
|
|
131
|
+
if local_configs.use_venv:
|
|
132
|
+
return self.run_local_dir_sandbox_venv(sbx_config, env, temp_file_path)
|
|
133
|
+
else:
|
|
134
|
+
return self.run_local_dir_sandbox_runpy(sbx_config, env_vars, temp_file_path, old_stdout)
|
|
139
135
|
except Exception as e:
|
|
140
136
|
logger.error(f"Executing tool {self.tool_name} has an unexpected error: {e}")
|
|
137
|
+
logger.error(f"Logging out tool {self.tool_name} auto-generated code for debugging: \n\n{code}")
|
|
141
138
|
raise e
|
|
142
139
|
finally:
|
|
143
140
|
# Clean up the temp file and restore stdout
|
|
144
141
|
sys.stdout = old_stdout
|
|
145
142
|
os.remove(temp_file_path)
|
|
146
143
|
|
|
144
|
+
def run_local_dir_sandbox_venv(self, sbx_config: SandboxConfig, env: Dict[str, str], temp_file_path: str) -> SandboxRunResult:
|
|
145
|
+
local_configs = sbx_config.get_local_config()
|
|
146
|
+
venv_path = os.path.join(local_configs.sandbox_dir, local_configs.venv_name)
|
|
147
|
+
|
|
148
|
+
# Safety checks for the venv
|
|
149
|
+
# Verify that the venv path exists and is a directory
|
|
150
|
+
if not os.path.isdir(venv_path):
|
|
151
|
+
logger.warning(f"Virtual environment directory does not exist at: {venv_path}, creating one now...")
|
|
152
|
+
self.create_venv_for_local_sandbox(sandbox_dir_path=local_configs.sandbox_dir, venv_path=venv_path, env=env)
|
|
153
|
+
|
|
154
|
+
# Ensure the python interpreter exists in the virtual environment
|
|
155
|
+
python_executable = os.path.join(venv_path, "bin", "python3")
|
|
156
|
+
if not os.path.isfile(python_executable):
|
|
157
|
+
raise FileNotFoundError(f"Python executable not found in virtual environment: {python_executable}")
|
|
158
|
+
|
|
159
|
+
# Set up env for venv
|
|
160
|
+
env["VIRTUAL_ENV"] = venv_path
|
|
161
|
+
env["PATH"] = os.path.join(venv_path, "bin") + ":" + env["PATH"]
|
|
162
|
+
|
|
163
|
+
# Execute the code in a restricted subprocess
|
|
164
|
+
try:
|
|
165
|
+
result = subprocess.run(
|
|
166
|
+
[os.path.join(venv_path, "bin", "python3"), temp_file_path],
|
|
167
|
+
env=env,
|
|
168
|
+
cwd=local_configs.sandbox_dir, # Restrict execution to sandbox_dir
|
|
169
|
+
timeout=60,
|
|
170
|
+
capture_output=True,
|
|
171
|
+
text=True,
|
|
172
|
+
)
|
|
173
|
+
if result.stderr:
|
|
174
|
+
logger.error(f"Sandbox execution error: {result.stderr}")
|
|
175
|
+
raise RuntimeError(f"Sandbox execution error: {result.stderr}")
|
|
176
|
+
|
|
177
|
+
func_result, stdout = self.parse_out_function_results_markers(result.stdout)
|
|
178
|
+
func_return, agent_state = self.parse_best_effort(func_result)
|
|
179
|
+
return SandboxRunResult(
|
|
180
|
+
func_return=func_return, agent_state=agent_state, stdout=[stdout], sandbox_config_fingerprint=sbx_config.fingerprint()
|
|
181
|
+
)
|
|
182
|
+
except subprocess.TimeoutExpired:
|
|
183
|
+
raise TimeoutError(f"Executing tool {self.tool_name} has timed out.")
|
|
184
|
+
except subprocess.CalledProcessError as e:
|
|
185
|
+
raise RuntimeError(f"Executing tool {self.tool_name} has process error: {e}")
|
|
186
|
+
except Exception as e:
|
|
187
|
+
raise RuntimeError(f"Executing tool {self.tool_name} has an unexpected error: {e}")
|
|
188
|
+
|
|
189
|
+
def run_local_dir_sandbox_runpy(
|
|
190
|
+
self, sbx_config: SandboxConfig, env_vars: Dict[str, str], temp_file_path: str, old_stdout: TextIO
|
|
191
|
+
) -> SandboxRunResult:
|
|
192
|
+
# Redirect stdout to capture script output
|
|
193
|
+
captured_stdout = io.StringIO()
|
|
194
|
+
sys.stdout = captured_stdout
|
|
195
|
+
|
|
196
|
+
# Execute the temp file
|
|
197
|
+
with self.temporary_env_vars(env_vars):
|
|
198
|
+
result = runpy.run_path(temp_file_path, init_globals=env_vars)
|
|
199
|
+
|
|
200
|
+
# Fetch the result
|
|
201
|
+
func_result = result.get(self.LOCAL_SANDBOX_RESULT_VAR_NAME)
|
|
202
|
+
func_return, agent_state = self.parse_best_effort(func_result)
|
|
203
|
+
|
|
204
|
+
# Restore stdout and collect captured output
|
|
205
|
+
sys.stdout = old_stdout
|
|
206
|
+
stdout_output = captured_stdout.getvalue()
|
|
207
|
+
|
|
208
|
+
return SandboxRunResult(
|
|
209
|
+
func_return=func_return,
|
|
210
|
+
agent_state=agent_state,
|
|
211
|
+
stdout=[stdout_output],
|
|
212
|
+
sandbox_config_fingerprint=sbx_config.fingerprint(),
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
def parse_out_function_results_markers(self, text: str):
|
|
216
|
+
marker_len = len(self.LOCAL_SANDBOX_RESULT_START_MARKER)
|
|
217
|
+
start_index = text.index(self.LOCAL_SANDBOX_RESULT_START_MARKER) + marker_len
|
|
218
|
+
end_index = text.index(self.LOCAL_SANDBOX_RESULT_END_MARKER)
|
|
219
|
+
return text[start_index:end_index], text[: start_index - marker_len] + text[end_index + +marker_len :]
|
|
220
|
+
|
|
221
|
+
def create_venv_for_local_sandbox(self, sandbox_dir_path: str, venv_path: str, env: Dict[str, str]):
|
|
222
|
+
# Step 1: Create the virtual environment
|
|
223
|
+
venv.create(venv_path, with_pip=True)
|
|
224
|
+
|
|
225
|
+
pip_path = os.path.join(venv_path, "bin", "pip")
|
|
226
|
+
try:
|
|
227
|
+
# Step 2: Upgrade pip
|
|
228
|
+
logger.info("Upgrading pip in the virtual environment...")
|
|
229
|
+
subprocess.run([pip_path, "install", "--upgrade", "pip"], env=env, check=True)
|
|
230
|
+
|
|
231
|
+
# Step 3: Install packages from requirements.txt if provided
|
|
232
|
+
requirements_txt_path = os.path.join(sandbox_dir_path, self.REQUIREMENT_TXT_NAME)
|
|
233
|
+
if os.path.isfile(requirements_txt_path):
|
|
234
|
+
logger.info(f"Installing packages from requirements file: {requirements_txt_path}")
|
|
235
|
+
subprocess.run([pip_path, "install", "-r", requirements_txt_path], env=env, check=True)
|
|
236
|
+
logger.info("Successfully installed packages from requirements.txt")
|
|
237
|
+
else:
|
|
238
|
+
logger.warning("No requirements.txt file provided or the file does not exist. Skipping package installation.")
|
|
239
|
+
|
|
240
|
+
except subprocess.CalledProcessError as e:
|
|
241
|
+
logger.error(f"Error while setting up the virtual environment: {e}")
|
|
242
|
+
raise RuntimeError(f"Failed to set up the virtual environment: {e}")
|
|
243
|
+
|
|
147
244
|
# e2b sandbox specific functions
|
|
148
245
|
|
|
149
|
-
def run_e2b_sandbox(self,
|
|
246
|
+
def run_e2b_sandbox(self, agent_state: AgentState) -> Optional[SandboxRunResult]:
|
|
150
247
|
sbx_config = self.sandbox_config_manager.get_or_create_default_sandbox_config(sandbox_type=SandboxType.E2B, actor=self.user)
|
|
151
248
|
sbx = self.get_running_e2b_sandbox_with_same_state(sbx_config)
|
|
152
249
|
if not sbx or self.force_recreate:
|
|
@@ -158,6 +255,7 @@ class ToolExecutionSandbox:
|
|
|
158
255
|
# Get environment variables for the sandbox
|
|
159
256
|
# TODO: We set limit to 100 here, but maybe we want it uncapped? Realistically this should be fine.
|
|
160
257
|
env_vars = self.sandbox_config_manager.get_sandbox_env_vars_as_dict(sandbox_config_id=sbx_config.id, actor=self.user, limit=100)
|
|
258
|
+
code = self.generate_execution_script(agent_state=agent_state)
|
|
161
259
|
execution = sbx.run_code(code, envs=env_vars)
|
|
162
260
|
if execution.error is not None:
|
|
163
261
|
logger.error(f"Executing tool {self.tool_name} failed with {execution.error}")
|
|
@@ -236,13 +334,14 @@ class ToolExecutionSandbox:
|
|
|
236
334
|
args.append(arg.arg)
|
|
237
335
|
return args
|
|
238
336
|
|
|
239
|
-
def generate_execution_script(self, agent_state: AgentState) -> str:
|
|
337
|
+
def generate_execution_script(self, agent_state: AgentState, wrap_print_with_markers: bool = False) -> str:
|
|
240
338
|
"""
|
|
241
339
|
Generate code to run inside of execution sandbox.
|
|
242
340
|
Passes into a serialized agent state into the code, to be accessed by the tool.
|
|
243
341
|
|
|
244
342
|
Args:
|
|
245
343
|
agent_state (AgentState): The agent state
|
|
344
|
+
wrap_print_with_markers (bool): If true, we wrap the final statement with a `print` and wrap with special markers
|
|
246
345
|
|
|
247
346
|
Returns:
|
|
248
347
|
code (str): The generated code strong
|
|
@@ -286,7 +385,14 @@ class ToolExecutionSandbox:
|
|
|
286
385
|
code += (
|
|
287
386
|
f"{self.LOCAL_SANDBOX_RESULT_VAR_NAME} = base64.b64encode(pickle.dumps({self.LOCAL_SANDBOX_RESULT_VAR_NAME})).decode('utf-8')\n"
|
|
288
387
|
)
|
|
289
|
-
|
|
388
|
+
|
|
389
|
+
if wrap_print_with_markers:
|
|
390
|
+
code += f"sys.stdout.write('{self.LOCAL_SANDBOX_RESULT_START_MARKER}')\n"
|
|
391
|
+
code += f"sys.stdout.write(str({self.LOCAL_SANDBOX_RESULT_VAR_NAME}))\n"
|
|
392
|
+
code += f"sys.stdout.write('{self.LOCAL_SANDBOX_RESULT_END_MARKER}')\n"
|
|
393
|
+
else:
|
|
394
|
+
code += f"{self.LOCAL_SANDBOX_RESULT_VAR_NAME}\n"
|
|
395
|
+
|
|
290
396
|
return code
|
|
291
397
|
|
|
292
398
|
def _convert_param_to_value(self, param_type: str, raw_value: str) -> str:
|
|
File without changes
|
|
File without changes
|
{letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/__init__.py
RENAMED
|
File without changes
|
{letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/__main__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/cli/cli.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/config.py
RENAMED
|
File without changes
|
{letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/constants.py
RENAMED
|
File without changes
|
{letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/credentials.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/embeddings.py
RENAMED
|
File without changes
|
{letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/errors.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/interface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/log.py
RENAMED
|
File without changes
|
{letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/main.py
RENAMED
|
File without changes
|
{letta_nightly-0.6.0.dev20241204054116 → letta_nightly-0.6.0.dev20241204213946}/letta/memory.py
RENAMED
|
File without changes
|