letta-nightly 0.5.4.dev20241201104110__tar.gz → 0.5.4.dev20241203104336__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.

Files changed (226) hide show
  1. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/PKG-INFO +6 -6
  2. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/README.md +5 -5
  3. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/cli/cli.py +2 -1
  4. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/functions/functions.py +0 -46
  5. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/utils.py +7 -3
  6. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/metadata.py +4 -5
  7. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/tool.py +12 -0
  8. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/app.py +4 -3
  9. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/v1/agents.py +24 -30
  10. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/v1/sandbox_configs.py +19 -0
  11. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/v1/tools.py +74 -1
  12. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/server.py +146 -12
  13. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/services/per_agent_lock_manager.py +3 -3
  14. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/services/tool_execution_sandbox.py +30 -16
  15. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/utils.py +0 -7
  16. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/pyproject.toml +3 -3
  17. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/LICENSE +0 -0
  18. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/__init__.py +0 -0
  19. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/__main__.py +0 -0
  20. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/agent.py +0 -0
  21. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/agent_store/chroma.py +0 -0
  22. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/agent_store/db.py +0 -0
  23. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/agent_store/lancedb.py +0 -0
  24. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/agent_store/milvus.py +0 -0
  25. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/agent_store/qdrant.py +0 -0
  26. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/agent_store/storage.py +0 -0
  27. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/benchmark/benchmark.py +0 -0
  28. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/benchmark/constants.py +0 -0
  29. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/cli/cli_config.py +0 -0
  30. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/cli/cli_load.py +0 -0
  31. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/client/__init__.py +0 -0
  32. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/client/client.py +0 -0
  33. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/client/streaming.py +0 -0
  34. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/client/utils.py +0 -0
  35. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/config.py +0 -0
  36. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/constants.py +0 -0
  37. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/credentials.py +0 -0
  38. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/data_sources/connectors.py +0 -0
  39. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/data_sources/connectors_helper.py +0 -0
  40. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/embeddings.py +0 -0
  41. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/errors.py +0 -0
  42. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/functions/__init__.py +0 -0
  43. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/functions/function_sets/base.py +0 -0
  44. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/functions/function_sets/extras.py +0 -0
  45. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/functions/helpers.py +0 -0
  46. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/functions/schema_generator.py +0 -0
  47. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/helpers/__init__.py +0 -0
  48. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/helpers/tool_rule_solver.py +0 -0
  49. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/humans/__init__.py +0 -0
  50. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/humans/examples/basic.txt +0 -0
  51. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/humans/examples/cs_phd.txt +0 -0
  52. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/interface.py +0 -0
  53. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/llm_api/__init__.py +0 -0
  54. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/llm_api/anthropic.py +0 -0
  55. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/llm_api/azure_openai.py +0 -0
  56. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/llm_api/azure_openai_constants.py +0 -0
  57. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/llm_api/cohere.py +0 -0
  58. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/llm_api/google_ai.py +0 -0
  59. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/llm_api/helpers.py +0 -0
  60. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/llm_api/llm_api_tools.py +0 -0
  61. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/llm_api/mistral.py +0 -0
  62. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/llm_api/openai.py +0 -0
  63. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/README.md +0 -0
  64. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/__init__.py +0 -0
  65. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/chat_completion_proxy.py +0 -0
  66. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/constants.py +0 -0
  67. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/function_parser.py +0 -0
  68. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/grammars/__init__.py +0 -0
  69. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/grammars/gbnf_grammar_generator.py +0 -0
  70. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/grammars/json.gbnf +0 -0
  71. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf +0 -0
  72. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/json_parser.py +0 -0
  73. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/koboldcpp/api.py +0 -0
  74. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/koboldcpp/settings.py +0 -0
  75. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/llamacpp/api.py +0 -0
  76. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/llamacpp/settings.py +0 -0
  77. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/llm_chat_completion_wrappers/__init__.py +0 -0
  78. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/llm_chat_completion_wrappers/airoboros.py +0 -0
  79. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/llm_chat_completion_wrappers/chatml.py +0 -0
  80. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py +0 -0
  81. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/llm_chat_completion_wrappers/dolphin.py +0 -0
  82. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/llm_chat_completion_wrappers/llama3.py +0 -0
  83. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py +0 -0
  84. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/llm_chat_completion_wrappers/wrapper_base.py +0 -0
  85. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/llm_chat_completion_wrappers/zephyr.py +0 -0
  86. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/lmstudio/api.py +0 -0
  87. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/lmstudio/settings.py +0 -0
  88. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/ollama/api.py +0 -0
  89. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/ollama/settings.py +0 -0
  90. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/settings/__init__.py +0 -0
  91. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/settings/deterministic_mirostat.py +0 -0
  92. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/settings/settings.py +0 -0
  93. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/settings/simple.py +0 -0
  94. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/vllm/api.py +0 -0
  95. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/webui/api.py +0 -0
  96. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/webui/legacy_api.py +0 -0
  97. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/webui/legacy_settings.py +0 -0
  98. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/local_llm/webui/settings.py +0 -0
  99. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/log.py +0 -0
  100. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/main.py +0 -0
  101. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/memory.py +0 -0
  102. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/o1_agent.py +0 -0
  103. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/openai_backcompat/__init__.py +0 -0
  104. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/openai_backcompat/openai_object.py +0 -0
  105. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/__all__.py +0 -0
  106. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/__init__.py +0 -0
  107. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/agents_tags.py +0 -0
  108. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/base.py +0 -0
  109. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/block.py +0 -0
  110. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/blocks_agents.py +0 -0
  111. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/enums.py +0 -0
  112. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/errors.py +0 -0
  113. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/file.py +0 -0
  114. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/mixins.py +0 -0
  115. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/organization.py +0 -0
  116. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/sandbox_config.py +0 -0
  117. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/source.py +0 -0
  118. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/sqlalchemy_base.py +0 -0
  119. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/tool.py +0 -0
  120. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/orm/user.py +0 -0
  121. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/persistence_manager.py +0 -0
  122. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/personas/__init__.py +0 -0
  123. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/personas/examples/anna_pa.txt +0 -0
  124. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/personas/examples/google_search_persona.txt +0 -0
  125. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/personas/examples/memgpt_doc.txt +0 -0
  126. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/personas/examples/memgpt_starter.txt +0 -0
  127. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/personas/examples/o1_persona.txt +0 -0
  128. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/personas/examples/sam.txt +0 -0
  129. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/personas/examples/sam_pov.txt +0 -0
  130. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/personas/examples/sam_simple_pov_gpt35.txt +0 -0
  131. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/personas/examples/sqldb/test.db +0 -0
  132. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/prompts/__init__.py +0 -0
  133. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/prompts/gpt_summarize.py +0 -0
  134. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/prompts/gpt_system.py +0 -0
  135. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/prompts/system/memgpt_base.txt +0 -0
  136. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/prompts/system/memgpt_chat.txt +0 -0
  137. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/prompts/system/memgpt_chat_compressed.txt +0 -0
  138. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/prompts/system/memgpt_chat_fstring.txt +0 -0
  139. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/prompts/system/memgpt_doc.txt +0 -0
  140. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/prompts/system/memgpt_gpt35_extralong.txt +0 -0
  141. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/prompts/system/memgpt_intuitive_knowledge.txt +0 -0
  142. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/prompts/system/memgpt_modified_chat.txt +0 -0
  143. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/prompts/system/memgpt_modified_o1.txt +0 -0
  144. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/providers.py +0 -0
  145. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/pytest.ini +0 -0
  146. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/agent.py +0 -0
  147. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/agents_tags.py +0 -0
  148. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/api_key.py +0 -0
  149. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/block.py +0 -0
  150. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/blocks_agents.py +0 -0
  151. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/embedding_config.py +0 -0
  152. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/enums.py +0 -0
  153. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/file.py +0 -0
  154. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/health.py +0 -0
  155. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/job.py +0 -0
  156. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/letta_base.py +0 -0
  157. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/letta_message.py +0 -0
  158. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/letta_request.py +0 -0
  159. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/letta_response.py +0 -0
  160. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/llm_config.py +0 -0
  161. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/memory.py +0 -0
  162. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/message.py +0 -0
  163. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/openai/chat_completion_request.py +0 -0
  164. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/openai/chat_completion_response.py +0 -0
  165. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/openai/chat_completions.py +0 -0
  166. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/openai/embedding_response.py +0 -0
  167. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/openai/openai.py +0 -0
  168. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/organization.py +0 -0
  169. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/passage.py +0 -0
  170. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/sandbox_config.py +0 -0
  171. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/source.py +0 -0
  172. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/tool_rule.py +0 -0
  173. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/usage.py +0 -0
  174. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/schemas/user.py +0 -0
  175. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/__init__.py +0 -0
  176. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/constants.py +0 -0
  177. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/generate_openapi_schema.sh +0 -0
  178. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/__init__.py +0 -0
  179. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/auth/__init__.py +0 -0
  180. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/auth/index.py +0 -0
  181. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/auth_token.py +0 -0
  182. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/interface.py +0 -0
  183. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/__init__.py +0 -0
  184. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/openai/__init__.py +0 -0
  185. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/openai/assistants/__init__.py +0 -0
  186. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/openai/assistants/assistants.py +0 -0
  187. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/openai/assistants/schemas.py +0 -0
  188. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/openai/assistants/threads.py +0 -0
  189. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/openai/chat_completions/__init__.py +0 -0
  190. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py +0 -0
  191. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/v1/__init__.py +0 -0
  192. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/v1/blocks.py +0 -0
  193. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/v1/health.py +0 -0
  194. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/v1/jobs.py +0 -0
  195. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/v1/llms.py +0 -0
  196. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/v1/organizations.py +0 -0
  197. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/v1/sources.py +0 -0
  198. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/routers/v1/users.py +0 -0
  199. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/static_files.py +0 -0
  200. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/rest_api/utils.py +0 -0
  201. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/startup.sh +0 -0
  202. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/static_files/assets/index-3ab03d5b.css +0 -0
  203. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/static_files/assets/index-9fa459a2.js +0 -0
  204. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/static_files/favicon.ico +0 -0
  205. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/static_files/index.html +0 -0
  206. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/static_files/memgpt_logo_transparent.png +0 -0
  207. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/utils.py +0 -0
  208. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/ws_api/__init__.py +0 -0
  209. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/ws_api/example_client.py +0 -0
  210. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/ws_api/interface.py +0 -0
  211. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/ws_api/protocol.py +0 -0
  212. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/server/ws_api/server.py +0 -0
  213. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/services/__init__.py +0 -0
  214. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/services/agents_tags_manager.py +0 -0
  215. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/services/block_manager.py +0 -0
  216. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/services/blocks_agents_manager.py +0 -0
  217. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/services/organization_manager.py +0 -0
  218. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/services/sandbox_config_manager.py +0 -0
  219. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/services/source_manager.py +0 -0
  220. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/services/tool_manager.py +0 -0
  221. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/services/tool_sandbox_env/.gitkeep +0 -0
  222. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/services/user_manager.py +0 -0
  223. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/settings.py +0 -0
  224. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/streaming_interface.py +0 -0
  225. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/streaming_utils.py +0 -0
  226. {letta_nightly-0.5.4.dev20241201104110 → letta_nightly-0.5.4.dev20241203104336}/letta/system.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: letta-nightly
3
- Version: 0.5.4.dev20241201104110
3
+ Version: 0.5.4.dev20241203104336
4
4
  Summary: Create LLM agents with long-term memory and custom tools
5
5
  License: Apache License
6
6
  Author: Letta Team
@@ -129,24 +129,24 @@ The two main ways to install Letta are through **pypi** (`pip`) or via **Docker*
129
129
 
130
130
  ### Step 1 - Install Letta using `pip`
131
131
  ```sh
132
- $ pip install -U letta
132
+ pip install -U letta
133
133
  ```
134
134
 
135
135
  ### Step 2 - Set your environment variables for your chosen LLM / embedding providers
136
136
  ```sh
137
- $ export OPENAI_API_KEY=sk-...
137
+ export OPENAI_API_KEY=sk-...
138
138
  ```
139
139
 
140
140
  For Ollama (see our full [documentation](https://docs.letta.com/install) for examples of how to set up various providers):
141
141
  ```sh
142
- $ export OLLAMA_BASE_URL=http://localhost:11434
142
+ export OLLAMA_BASE_URL=http://localhost:11434
143
143
  ```
144
144
 
145
145
  ### Step 3 - Run the Letta CLI
146
146
 
147
147
  You can create agents and chat with them via the Letta CLI tool (`letta run`):
148
148
  ```sh
149
- $ letta run
149
+ letta run
150
150
  ```
151
151
  ```
152
152
  🧬 Creating new agent...
@@ -179,7 +179,7 @@ Hit enter to begin (will request first Letta message)
179
179
 
180
180
  You can start the Letta API server with `letta server` (see the full API reference [here](https://docs.letta.com/api-reference)):
181
181
  ```sh
182
- $ letta server
182
+ letta server
183
183
  ```
184
184
  ```
185
185
  Initializing database...
@@ -44,24 +44,24 @@ The two main ways to install Letta are through **pypi** (`pip`) or via **Docker*
44
44
 
45
45
  ### Step 1 - Install Letta using `pip`
46
46
  ```sh
47
- $ pip install -U letta
47
+ pip install -U letta
48
48
  ```
49
49
 
50
50
  ### Step 2 - Set your environment variables for your chosen LLM / embedding providers
51
51
  ```sh
52
- $ export OPENAI_API_KEY=sk-...
52
+ export OPENAI_API_KEY=sk-...
53
53
  ```
54
54
 
55
55
  For Ollama (see our full [documentation](https://docs.letta.com/install) for examples of how to set up various providers):
56
56
  ```sh
57
- $ export OLLAMA_BASE_URL=http://localhost:11434
57
+ export OLLAMA_BASE_URL=http://localhost:11434
58
58
  ```
59
59
 
60
60
  ### Step 3 - Run the Letta CLI
61
61
 
62
62
  You can create agents and chat with them via the Letta CLI tool (`letta run`):
63
63
  ```sh
64
- $ letta run
64
+ letta run
65
65
  ```
66
66
  ```
67
67
  🧬 Creating new agent...
@@ -94,7 +94,7 @@ Hit enter to begin (will request first Letta message)
94
94
 
95
95
  You can start the Letta API server with `letta server` (see the full API reference [here](https://docs.letta.com/api-reference)):
96
96
  ```sh
97
- $ letta server
97
+ letta server
98
98
  ```
99
99
  ```
100
100
  Initializing database...
@@ -220,7 +220,8 @@ def run(
220
220
 
221
221
  # create agent
222
222
  tools = [server.tool_manager.get_tool_by_name(tool_name=tool_name, actor=client.user) for tool_name in agent_state.tool_names]
223
- letta_agent = Agent(agent_state=agent_state, interface=interface(), tools=tools, user=client.user)
223
+ agent_state.tools = tools
224
+ letta_agent = Agent(agent_state=agent_state, interface=interface(), user=client.user)
224
225
 
225
226
  else: # create new agent
226
227
  # create new agent config: override defaults with args if provided
@@ -1,11 +1,8 @@
1
- import importlib
2
1
  import inspect
3
- import os
4
2
  from textwrap import dedent # remove indentation
5
3
  from types import ModuleType
6
4
  from typing import Dict, List, Optional
7
5
 
8
- from letta.constants import CLI_WARNING_PREFIX
9
6
  from letta.errors import LettaToolCreateError
10
7
  from letta.functions.schema_generator import generate_schema
11
8
 
@@ -90,46 +87,3 @@ def load_function_set(module: ModuleType) -> dict:
90
87
  if len(function_dict) == 0:
91
88
  raise ValueError(f"No functions found in module {module}")
92
89
  return function_dict
93
-
94
-
95
- def validate_function(module_name, module_full_path):
96
- try:
97
- file = os.path.basename(module_full_path)
98
- spec = importlib.util.spec_from_file_location(module_name, module_full_path)
99
- module = importlib.util.module_from_spec(spec)
100
- spec.loader.exec_module(module)
101
- except ModuleNotFoundError as e:
102
- # Handle missing module imports
103
- missing_package = str(e).split("'")[1] # Extract the name of the missing package
104
- print(f"{CLI_WARNING_PREFIX}skipped loading python file '{module_full_path}'!")
105
- return (
106
- False,
107
- f"'{file}' imports '{missing_package}', but '{missing_package}' is not installed locally - install python package '{missing_package}' to link functions from '{file}' to Letta.",
108
- )
109
- except SyntaxError as e:
110
- # Handle syntax errors in the module
111
- return False, f"{CLI_WARNING_PREFIX}skipped loading python file '{file}' due to a syntax error: {e}"
112
- except Exception as e:
113
- # Handle other general exceptions
114
- return False, f"{CLI_WARNING_PREFIX}skipped loading python file '{file}': {e}"
115
-
116
- return True, None
117
-
118
-
119
- def load_function_file(filepath: str) -> dict:
120
- file = os.path.basename(filepath)
121
- module_name = file[:-3] # Remove '.py' from filename
122
- try:
123
- spec = importlib.util.spec_from_file_location(module_name, filepath)
124
- module = importlib.util.module_from_spec(spec)
125
- spec.loader.exec_module(module)
126
- except ModuleNotFoundError as e:
127
- # Handle missing module imports
128
- missing_package = str(e).split("'")[1] # Extract the name of the missing package
129
- print(f"{CLI_WARNING_PREFIX}skipped loading python file '{filepath}'!")
130
- print(
131
- f"'{file}' imports '{missing_package}', but '{missing_package}' is not installed locally - install python package '{missing_package}' to link functions from '{file}' to Letta."
132
- )
133
- # load all functions in the module
134
- function_dict = load_function_set(module)
135
- return function_dict
@@ -88,7 +88,9 @@ def num_tokens_from_functions(functions: List[dict], model: str = "gpt-4"):
88
88
  try:
89
89
  encoding = tiktoken.encoding_for_model(model)
90
90
  except KeyError:
91
- warnings.warn("Warning: model not found. Using cl100k_base encoding.")
91
+ from letta.utils import printd
92
+
93
+ printd(f"Warning: model not found. Using cl100k_base encoding.")
92
94
  encoding = tiktoken.get_encoding("cl100k_base")
93
95
 
94
96
  num_tokens = 0
@@ -215,8 +217,10 @@ def num_tokens_from_messages(messages: List[dict], model: str = "gpt-4") -> int:
215
217
  # print("Warning: gpt-4 may update over time. Returning num tokens assuming gpt-4-0613.")
216
218
  return num_tokens_from_messages(messages, model="gpt-4-0613")
217
219
  else:
218
- warnings.warn(
219
- f"""num_tokens_from_messages() is not implemented for model {model}. See https://github.com/openai/openai-python/blob/main/chatml.md for information on how messages are converted to tokens."""
220
+ from letta.utils import printd
221
+
222
+ printd(
223
+ f"num_tokens_from_messages() is not implemented for model {model}. See https://github.com/openai/openai-python/blob/main/chatml.md for information on how messages are converted to tokens."
220
224
  )
221
225
  return num_tokens_from_messages(messages, model="gpt-4-0613")
222
226
  # raise NotImplementedError(
@@ -2,7 +2,6 @@
2
2
 
3
3
  import os
4
4
  import secrets
5
- import warnings
6
5
  from typing import List, Optional, Union
7
6
 
8
7
  from sqlalchemy import JSON, Column, DateTime, Index, String, TypeDecorator
@@ -359,8 +358,8 @@ class MetadataStore:
359
358
  # warnings.warn(f"Agent {agent.id} has no _internal_memory field")
360
359
  if "tags" in fields:
361
360
  del fields["tags"]
362
- else:
363
- warnings.warn(f"Agent {agent.id} has no tags field")
361
+ # else:
362
+ # warnings.warn(f"Agent {agent.id} has no tags field")
364
363
  session.add(AgentModel(**fields))
365
364
  session.commit()
366
365
 
@@ -376,8 +375,8 @@ class MetadataStore:
376
375
  # warnings.warn(f"Agent {agent.id} has no _internal_memory field")
377
376
  if "tags" in fields:
378
377
  del fields["tags"]
379
- else:
380
- warnings.warn(f"Agent {agent.id} has no tags field")
378
+ # else:
379
+ # warnings.warn(f"Agent {agent.id} has no tags field")
381
380
  session.query(AgentModel).filter(AgentModel.id == agent.id).update(fields)
382
381
  session.commit()
383
382
 
@@ -201,3 +201,15 @@ class ToolUpdate(LettaBase):
201
201
  class Config:
202
202
  extra = "ignore" # Allows extra fields without validation errors
203
203
  # TODO: Remove this, and clean usage of ToolUpdate everywhere else
204
+
205
+
206
+ class ToolRun(LettaBase):
207
+ id: str = Field(..., description="The ID of the tool to run.")
208
+ args: str = Field(..., description="The arguments to pass to the tool (as stringified JSON).")
209
+
210
+
211
+ class ToolRunFromSource(LettaBase):
212
+ args: str = Field(..., description="The arguments to pass to the tool (as stringified JSON).")
213
+ name: Optional[str] = Field(..., description="The name of the tool to run.")
214
+ source_code: str = Field(None, description="The source code of the function.")
215
+ source_type: Optional[str] = Field(None, description="The type of the source code.")
@@ -1,5 +1,6 @@
1
1
  import json
2
2
  import logging
3
+ import os
3
4
  import sys
4
5
  from pathlib import Path
5
6
  from typing import Optional
@@ -103,7 +104,7 @@ def generate_password():
103
104
  return secrets.token_urlsafe(16)
104
105
 
105
106
 
106
- random_password = generate_password()
107
+ random_password = os.getenv("LETTA_SERVER_PASSWORD") or generate_password()
107
108
 
108
109
 
109
110
  class CheckPasswordMiddleware(BaseHTTPMiddleware):
@@ -132,11 +133,11 @@ def create_application() -> "FastAPI":
132
133
  debug=True,
133
134
  )
134
135
 
135
- if "--ade" in sys.argv:
136
+ if (os.getenv("LETTA_SERVER_ADE") == "true") or "--ade" in sys.argv:
136
137
  settings.cors_origins.append("https://app.letta.com")
137
138
  print(f"▶ View using ADE at: https://app.letta.com/development-servers/local/dashboard")
138
139
 
139
- if "--secure" in sys.argv:
140
+ if (os.getenv("LETTA_SERVER_SECURE") == "true") or "--secure" in sys.argv:
140
141
  print(f"▶ Using secure mode with password: {random_password}")
141
142
  app.add_middleware(CheckPasswordMiddleware)
142
143
 
@@ -448,21 +448,18 @@ async def send_message(
448
448
  This endpoint accepts a message from a user and processes it through the agent.
449
449
  """
450
450
  actor = server.get_user_or_default(user_id=user_id)
451
-
452
- agent_lock = server.per_agent_lock_manager.get_lock(agent_id)
453
- async with agent_lock:
454
- result = await send_message_to_agent(
455
- server=server,
456
- agent_id=agent_id,
457
- user_id=actor.id,
458
- messages=request.messages,
459
- stream_steps=False,
460
- stream_tokens=False,
461
- # Support for AssistantMessage
462
- assistant_message_tool_name=request.assistant_message_tool_name,
463
- assistant_message_tool_kwarg=request.assistant_message_tool_kwarg,
464
- )
465
- return result
451
+ result = await send_message_to_agent(
452
+ server=server,
453
+ agent_id=agent_id,
454
+ user_id=actor.id,
455
+ messages=request.messages,
456
+ stream_steps=False,
457
+ stream_tokens=False,
458
+ # Support for AssistantMessage
459
+ assistant_message_tool_name=request.assistant_message_tool_name,
460
+ assistant_message_tool_kwarg=request.assistant_message_tool_kwarg,
461
+ )
462
+ return result
466
463
 
467
464
 
468
465
  @router.post(
@@ -490,21 +487,18 @@ async def send_message_streaming(
490
487
  It will stream the steps of the response always, and stream the tokens if 'stream_tokens' is set to True.
491
488
  """
492
489
  actor = server.get_user_or_default(user_id=user_id)
493
-
494
- agent_lock = server.per_agent_lock_manager.get_lock(agent_id)
495
- async with agent_lock:
496
- result = await send_message_to_agent(
497
- server=server,
498
- agent_id=agent_id,
499
- user_id=actor.id,
500
- messages=request.messages,
501
- stream_steps=True,
502
- stream_tokens=request.stream_tokens,
503
- # Support for AssistantMessage
504
- assistant_message_tool_name=request.assistant_message_tool_name,
505
- assistant_message_tool_kwarg=request.assistant_message_tool_kwarg,
506
- )
507
- return result
490
+ result = await send_message_to_agent(
491
+ server=server,
492
+ agent_id=agent_id,
493
+ user_id=actor.id,
494
+ messages=request.messages,
495
+ stream_steps=True,
496
+ stream_tokens=request.stream_tokens,
497
+ # Support for AssistantMessage
498
+ assistant_message_tool_name=request.assistant_message_tool_name,
499
+ assistant_message_tool_kwarg=request.assistant_message_tool_kwarg,
500
+ )
501
+ return result
508
502
 
509
503
 
510
504
  # TODO: move this into server.py?
@@ -8,6 +8,7 @@ from letta.schemas.sandbox_config import SandboxEnvironmentVariable as PydanticE
8
8
  from letta.schemas.sandbox_config import (
9
9
  SandboxEnvironmentVariableCreate,
10
10
  SandboxEnvironmentVariableUpdate,
11
+ SandboxType,
11
12
  )
12
13
  from letta.server.rest_api.utils import get_letta_server, get_user_id
13
14
  from letta.server.server import SyncServer
@@ -29,6 +30,24 @@ def create_sandbox_config(
29
30
  return server.sandbox_config_manager.create_or_update_sandbox_config(config_create, actor)
30
31
 
31
32
 
33
+ @router.post("/e2b/default", response_model=PydanticSandboxConfig)
34
+ def create_default_e2b_sandbox_config(
35
+ server: SyncServer = Depends(get_letta_server),
36
+ user_id: str = Depends(get_user_id),
37
+ ):
38
+ actor = server.get_user_or_default(user_id=user_id)
39
+ return server.sandbox_config_manager.get_or_create_default_sandbox_config(sandbox_type=SandboxType.E2B, actor=actor)
40
+
41
+
42
+ @router.post("/local/default", response_model=PydanticSandboxConfig)
43
+ def create_default_local_sandbox_config(
44
+ server: SyncServer = Depends(get_letta_server),
45
+ user_id: str = Depends(get_user_id),
46
+ ):
47
+ actor = server.get_user_or_default(user_id=user_id)
48
+ return server.sandbox_config_manager.get_or_create_default_sandbox_config(sandbox_type=SandboxType.LOCAL, actor=actor)
49
+
50
+
32
51
  @router.patch("/{sandbox_config_id}", response_model=PydanticSandboxConfig)
33
52
  def update_sandbox_config(
34
53
  sandbox_config_id: str,
@@ -1,10 +1,12 @@
1
1
  from typing import List, Optional
2
2
 
3
+ from composio.client.collections import ActionModel, AppModel
3
4
  from fastapi import APIRouter, Body, Depends, Header, HTTPException
4
5
 
5
6
  from letta.errors import LettaToolCreateError
6
7
  from letta.orm.errors import UniqueConstraintViolationError
7
- from letta.schemas.tool import Tool, ToolCreate, ToolUpdate
8
+ from letta.schemas.letta_message import FunctionReturn
9
+ from letta.schemas.tool import Tool, ToolCreate, ToolRunFromSource, ToolUpdate
8
10
  from letta.server.rest_api.utils import get_letta_server
9
11
  from letta.server.server import SyncServer
10
12
 
@@ -156,3 +158,74 @@ def add_base_tools(
156
158
  """
157
159
  actor = server.get_user_or_default(user_id=user_id)
158
160
  return server.tool_manager.add_base_tools(actor=actor)
161
+
162
+
163
+ # NOTE: can re-enable if needed
164
+ # @router.post("/{tool_id}/run", response_model=FunctionReturn, operation_id="run_tool")
165
+ # def run_tool(
166
+ # server: SyncServer = Depends(get_letta_server),
167
+ # request: ToolRun = Body(...),
168
+ # user_id: Optional[str] = Header(None, alias="user_id"), # Extract user_id from header, default to None if not present
169
+ # ):
170
+ # """
171
+ # Run an existing tool on provided arguments
172
+ # """
173
+ # actor = server.get_user_or_default(user_id=user_id)
174
+
175
+ # return server.run_tool(tool_id=request.tool_id, tool_args=request.tool_args, user_id=actor.id)
176
+
177
+
178
+ @router.post("/run", response_model=FunctionReturn, operation_id="run_tool_from_source")
179
+ def run_tool_from_source(
180
+ server: SyncServer = Depends(get_letta_server),
181
+ request: ToolRunFromSource = Body(...),
182
+ user_id: Optional[str] = Header(None, alias="user_id"), # Extract user_id from header, default to None if not present
183
+ ):
184
+ """
185
+ Attempt to build a tool from source, then run it on the provided arguments
186
+ """
187
+ actor = server.get_user_or_default(user_id=user_id)
188
+
189
+ return server.run_tool_from_source(
190
+ tool_source=request.source_code,
191
+ tool_source_type=request.source_type,
192
+ tool_args=request.args,
193
+ tool_name=request.name,
194
+ user_id=actor.id,
195
+ )
196
+
197
+
198
+ # Specific routes for Composio
199
+
200
+
201
+ @router.get("/composio/apps", response_model=List[AppModel], operation_id="list_composio_apps")
202
+ def list_composio_apps(server: SyncServer = Depends(get_letta_server)):
203
+ """
204
+ Get a list of all Composio apps
205
+ """
206
+ return server.get_composio_apps()
207
+
208
+
209
+ @router.get("/composio/apps/{composio_app_name}/actions", response_model=List[ActionModel], operation_id="list_composio_actions_by_app")
210
+ def list_composio_actions_by_app(
211
+ composio_app_name: str,
212
+ server: SyncServer = Depends(get_letta_server),
213
+ ):
214
+ """
215
+ Get a list of all Composio actions for a specific app
216
+ """
217
+ return server.get_composio_actions_from_app_name(composio_app_name=composio_app_name)
218
+
219
+
220
+ @router.post("/composio/{composio_action_name}", response_model=Tool, operation_id="add_composio_tool")
221
+ def add_composio_tool(
222
+ composio_action_name: str,
223
+ server: SyncServer = Depends(get_letta_server),
224
+ user_id: Optional[str] = Header(None, alias="user_id"),
225
+ ):
226
+ """
227
+ Add a new Composio tool by action name (Composio refers to each tool as an `Action`)
228
+ """
229
+ actor = server.get_user_or_default(user_id=user_id)
230
+ tool_create = ToolCreate.from_composio(action=composio_action_name)
231
+ return server.tool_manager.create_or_update_tool(pydantic_tool=Tool(**tool_create.model_dump()), actor=actor)
@@ -1,4 +1,5 @@
1
1
  # inspecting tools
2
+ import json
2
3
  import os
3
4
  import traceback
4
5
  import warnings
@@ -7,6 +8,8 @@ from asyncio import Lock
7
8
  from datetime import datetime
8
9
  from typing import Callable, Dict, List, Optional, Tuple, Union
9
10
 
11
+ from composio.client import Composio
12
+ from composio.client.collections import ActionModel, AppModel
10
13
  from fastapi import HTTPException
11
14
 
12
15
  import letta.constants as constants
@@ -54,7 +57,7 @@ from letta.schemas.embedding_config import EmbeddingConfig
54
57
  # openai schemas
55
58
  from letta.schemas.enums import JobStatus
56
59
  from letta.schemas.job import Job
57
- from letta.schemas.letta_message import LettaMessage
60
+ from letta.schemas.letta_message import FunctionReturn, LettaMessage
58
61
  from letta.schemas.llm_config import LLMConfig
59
62
  from letta.schemas.memory import (
60
63
  ArchivalMemorySummary,
@@ -76,9 +79,10 @@ from letta.services.organization_manager import OrganizationManager
76
79
  from letta.services.per_agent_lock_manager import PerAgentLockManager
77
80
  from letta.services.sandbox_config_manager import SandboxConfigManager
78
81
  from letta.services.source_manager import SourceManager
82
+ from letta.services.tool_execution_sandbox import ToolExecutionSandbox
79
83
  from letta.services.tool_manager import ToolManager
80
84
  from letta.services.user_manager import UserManager
81
- from letta.utils import create_random_username, json_dumps, json_loads
85
+ from letta.utils import create_random_username, get_utc_time, json_dumps, json_loads
82
86
 
83
87
  logger = get_logger(__name__)
84
88
 
@@ -227,6 +231,11 @@ class SyncServer(Server):
227
231
  # Locks
228
232
  self.send_message_lock = Lock()
229
233
 
234
+ # Composio
235
+ self.composio_client = None
236
+ if tool_settings.composio_api_key:
237
+ self.composio_client = Composio(api_key=tool_settings.composio_api_key)
238
+
230
239
  # Initialize the metadata store
231
240
  config = LettaConfig.load()
232
241
  if settings.letta_pg_uri_no_default:
@@ -365,14 +374,20 @@ class SyncServer(Server):
365
374
 
366
375
  def load_agent(self, agent_id: str, interface: Union[AgentInterface, None] = None) -> Agent:
367
376
  """Updated method to load agents from persisted storage"""
368
- agent_state = self.get_agent(agent_id=agent_id)
369
- actor = self.user_manager.get_user_by_id(user_id=agent_state.user_id)
377
+ agent_lock = self.per_agent_lock_manager.get_lock(agent_id)
378
+ with agent_lock:
379
+ agent_state = self.get_agent(agent_id=agent_id)
380
+ actor = self.user_manager.get_user_by_id(user_id=agent_state.user_id)
381
+
382
+ interface = interface or self.default_interface_factory()
383
+ if agent_state.agent_type == AgentType.memgpt_agent:
384
+ agent = Agent(agent_state=agent_state, interface=interface, user=actor)
385
+ else:
386
+ agent = O1Agent(agent_state=agent_state, interface=interface, user=actor)
370
387
 
371
- interface = interface or self.default_interface_factory()
372
- if agent_state.agent_type == AgentType.memgpt_agent:
373
- return Agent(agent_state=agent_state, interface=interface, user=actor)
374
- else:
375
- return O1Agent(agent_state=agent_state, interface=interface, user=actor)
388
+ # Persist to agent
389
+ save_agent(agent, self.ms)
390
+ return agent
376
391
 
377
392
  def _step(
378
393
  self,
@@ -1715,7 +1730,7 @@ class SyncServer(Server):
1715
1730
  self.blocks_agents_manager.add_block_to_agent(agent_id, block_id, block_label=block.label)
1716
1731
 
1717
1732
  # get agent memory
1718
- memory = self.load_agent(agent_id=agent_id).agent_state.memory
1733
+ memory = self.get_agent(agent_id=agent_id).memory
1719
1734
  return memory
1720
1735
 
1721
1736
  def unlink_block_from_agent_memory(self, user_id: str, agent_id: str, block_label: str, delete_if_no_ref: bool = True) -> Memory:
@@ -1723,7 +1738,7 @@ class SyncServer(Server):
1723
1738
  self.blocks_agents_manager.remove_block_with_label_from_agent(agent_id=agent_id, block_label=block_label)
1724
1739
 
1725
1740
  # get agent memory
1726
- memory = self.load_agent(agent_id=agent_id).agent_state.memory
1741
+ memory = self.get_agent(agent_id=agent_id).memory
1727
1742
  return memory
1728
1743
 
1729
1744
  def update_agent_memory_limit(self, user_id: str, agent_id: str, block_label: str, limit: int) -> Memory:
@@ -1733,7 +1748,7 @@ class SyncServer(Server):
1733
1748
  block_id=block.id, block_update=BlockUpdate(limit=limit), actor=self.user_manager.get_user_by_id(user_id=user_id)
1734
1749
  )
1735
1750
  # get agent memory
1736
- memory = self.load_agent(agent_id=agent_id).agent_state.memory
1751
+ memory = self.get_agent(agent_id=agent_id).memory
1737
1752
  return memory
1738
1753
 
1739
1754
  def upate_block(self, user_id: str, block_id: str, block_update: BlockUpdate) -> Block:
@@ -1750,3 +1765,122 @@ class SyncServer(Server):
1750
1765
  if block.label == label:
1751
1766
  return block
1752
1767
  return None
1768
+
1769
+ # def run_tool(self, tool_id: str, tool_args: str, user_id: str) -> FunctionReturn:
1770
+ # """Run a tool using the sandbox and return the result"""
1771
+
1772
+ # try:
1773
+ # tool_args_dict = json.loads(tool_args)
1774
+ # except json.JSONDecodeError:
1775
+ # raise ValueError("Invalid JSON string for tool_args")
1776
+
1777
+ # # Get the tool by ID
1778
+ # user = self.user_manager.get_user_by_id(user_id=user_id)
1779
+ # tool = self.tool_manager.get_tool_by_id(tool_id=tool_id, actor=user)
1780
+ # if tool.name is None:
1781
+ # raise ValueError(f"Tool with id {tool_id} does not have a name")
1782
+
1783
+ # # TODO eventually allow using agent state in tools
1784
+ # agent_state = None
1785
+
1786
+ # try:
1787
+ # sandbox_run_result = ToolExecutionSandbox(tool.name, tool_args_dict, user_id).run(agent_state=agent_state)
1788
+ # if sandbox_run_result is None:
1789
+ # raise ValueError(f"Tool with id {tool_id} returned execution with None")
1790
+ # function_response = str(sandbox_run_result.func_return)
1791
+
1792
+ # return FunctionReturn(
1793
+ # id="null",
1794
+ # function_call_id="null",
1795
+ # date=get_utc_time(),
1796
+ # status="success",
1797
+ # function_return=function_response,
1798
+ # )
1799
+ # except Exception as e:
1800
+ # # same as agent.py
1801
+ # from letta.constants import MAX_ERROR_MESSAGE_CHAR_LIMIT
1802
+
1803
+ # error_msg = f"Error executing tool {tool.name}: {e}"
1804
+ # if len(error_msg) > MAX_ERROR_MESSAGE_CHAR_LIMIT:
1805
+ # error_msg = error_msg[:MAX_ERROR_MESSAGE_CHAR_LIMIT]
1806
+
1807
+ # return FunctionReturn(
1808
+ # id="null",
1809
+ # function_call_id="null",
1810
+ # date=get_utc_time(),
1811
+ # status="error",
1812
+ # function_return=error_msg,
1813
+ # )
1814
+
1815
+ def run_tool_from_source(
1816
+ self,
1817
+ user_id: str,
1818
+ tool_args: str,
1819
+ tool_source: str,
1820
+ tool_source_type: Optional[str] = None,
1821
+ tool_name: Optional[str] = None,
1822
+ ) -> FunctionReturn:
1823
+ """Run a tool from source code"""
1824
+
1825
+ try:
1826
+ tool_args_dict = json.loads(tool_args)
1827
+ except json.JSONDecodeError:
1828
+ raise ValueError("Invalid JSON string for tool_args")
1829
+
1830
+ if tool_source_type is not None and tool_source_type != "python":
1831
+ raise ValueError("Only Python source code is supported at this time")
1832
+
1833
+ # NOTE: we're creating a floating Tool object and NOT persiting to DB
1834
+ tool = Tool(
1835
+ name=tool_name,
1836
+ source_code=tool_source,
1837
+ )
1838
+ assert tool.name is not None, "Failed to create tool object"
1839
+
1840
+ # TODO eventually allow using agent state in tools
1841
+ agent_state = None
1842
+
1843
+ # Next, attempt to run the tool with the sandbox
1844
+ try:
1845
+ sandbox_run_result = ToolExecutionSandbox(tool.name, tool_args_dict, user_id, tool_object=tool).run(agent_state=agent_state)
1846
+ if sandbox_run_result is None:
1847
+ raise ValueError(f"Tool with id {tool.id} returned execution with None")
1848
+ function_response = str(sandbox_run_result.func_return)
1849
+
1850
+ return FunctionReturn(
1851
+ id="null",
1852
+ function_call_id="null",
1853
+ date=get_utc_time(),
1854
+ status="success",
1855
+ function_return=function_response,
1856
+ )
1857
+ except Exception as e:
1858
+ # same as agent.py
1859
+ from letta.constants import MAX_ERROR_MESSAGE_CHAR_LIMIT
1860
+
1861
+ error_msg = f"Error executing tool {tool.name}: {e}"
1862
+ if len(error_msg) > MAX_ERROR_MESSAGE_CHAR_LIMIT:
1863
+ error_msg = error_msg[:MAX_ERROR_MESSAGE_CHAR_LIMIT]
1864
+
1865
+ return FunctionReturn(
1866
+ id="null",
1867
+ function_call_id="null",
1868
+ date=get_utc_time(),
1869
+ status="error",
1870
+ function_return=error_msg,
1871
+ )
1872
+
1873
+ # Composio wrappers
1874
+ def get_composio_apps(self) -> List["AppModel"]:
1875
+ """Get a list of all Composio apps with actions"""
1876
+ apps = self.composio_client.apps.get()
1877
+ apps_with_actions = []
1878
+ for app in apps:
1879
+ if app.meta["actionsCount"] > 0:
1880
+ apps_with_actions.append(app)
1881
+
1882
+ return apps_with_actions
1883
+
1884
+ def get_composio_actions_from_app_name(self, composio_app_name: str) -> List["ActionModel"]:
1885
+ actions = self.composio_client.actions.get(apps=[composio_app_name])
1886
+ return actions