letta-nightly 0.6.39.dev20250314104053__py3-none-any.whl → 0.6.40.dev20250314222759__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of letta-nightly might be problematic. Click here for more details.

Files changed (67) hide show
  1. letta/__init__.py +1 -1
  2. letta/agent.py +14 -4
  3. letta/agents/ephemeral_agent.py +2 -1
  4. letta/agents/low_latency_agent.py +8 -0
  5. letta/dynamic_multi_agent.py +274 -0
  6. letta/functions/function_sets/base.py +1 -0
  7. letta/functions/function_sets/extras.py +2 -1
  8. letta/functions/function_sets/multi_agent.py +17 -0
  9. letta/functions/helpers.py +41 -0
  10. letta/functions/mcp_client/__init__.py +0 -0
  11. letta/functions/mcp_client/base_client.py +61 -0
  12. letta/functions/mcp_client/sse_client.py +21 -0
  13. letta/functions/mcp_client/stdio_client.py +103 -0
  14. letta/functions/mcp_client/types.py +48 -0
  15. letta/functions/schema_generator.py +1 -1
  16. letta/helpers/converters.py +67 -0
  17. letta/llm_api/openai.py +1 -1
  18. letta/memory.py +2 -1
  19. letta/orm/__init__.py +2 -0
  20. letta/orm/agent.py +69 -20
  21. letta/orm/custom_columns.py +15 -0
  22. letta/orm/group.py +33 -0
  23. letta/orm/groups_agents.py +13 -0
  24. letta/orm/message.py +7 -4
  25. letta/orm/organization.py +1 -0
  26. letta/orm/sqlalchemy_base.py +3 -3
  27. letta/round_robin_multi_agent.py +152 -0
  28. letta/schemas/agent.py +3 -0
  29. letta/schemas/enums.py +0 -4
  30. letta/schemas/group.py +65 -0
  31. letta/schemas/letta_message.py +167 -106
  32. letta/schemas/letta_message_content.py +192 -0
  33. letta/schemas/message.py +28 -36
  34. letta/schemas/tool.py +1 -1
  35. letta/serialize_schemas/__init__.py +1 -1
  36. letta/serialize_schemas/marshmallow_agent.py +108 -0
  37. letta/serialize_schemas/{agent_environment_variable.py → marshmallow_agent_environment_variable.py} +1 -1
  38. letta/serialize_schemas/marshmallow_base.py +52 -0
  39. letta/serialize_schemas/{block.py → marshmallow_block.py} +1 -1
  40. letta/serialize_schemas/{custom_fields.py → marshmallow_custom_fields.py} +12 -0
  41. letta/serialize_schemas/marshmallow_message.py +42 -0
  42. letta/serialize_schemas/{tag.py → marshmallow_tag.py} +12 -2
  43. letta/serialize_schemas/{tool.py → marshmallow_tool.py} +1 -1
  44. letta/serialize_schemas/pydantic_agent_schema.py +111 -0
  45. letta/server/rest_api/app.py +15 -0
  46. letta/server/rest_api/routers/v1/__init__.py +2 -0
  47. letta/server/rest_api/routers/v1/agents.py +46 -40
  48. letta/server/rest_api/routers/v1/groups.py +233 -0
  49. letta/server/rest_api/routers/v1/tools.py +31 -3
  50. letta/server/rest_api/utils.py +1 -1
  51. letta/server/server.py +272 -22
  52. letta/services/agent_manager.py +65 -28
  53. letta/services/group_manager.py +147 -0
  54. letta/services/helpers/agent_manager_helper.py +151 -1
  55. letta/services/message_manager.py +11 -3
  56. letta/services/passage_manager.py +15 -0
  57. letta/settings.py +5 -0
  58. letta/supervisor_multi_agent.py +103 -0
  59. {letta_nightly-0.6.39.dev20250314104053.dist-info → letta_nightly-0.6.40.dev20250314222759.dist-info}/METADATA +1 -2
  60. {letta_nightly-0.6.39.dev20250314104053.dist-info → letta_nightly-0.6.40.dev20250314222759.dist-info}/RECORD +63 -49
  61. letta/helpers/mcp_helpers.py +0 -108
  62. letta/serialize_schemas/agent.py +0 -80
  63. letta/serialize_schemas/base.py +0 -64
  64. letta/serialize_schemas/message.py +0 -29
  65. {letta_nightly-0.6.39.dev20250314104053.dist-info → letta_nightly-0.6.40.dev20250314222759.dist-info}/LICENSE +0 -0
  66. {letta_nightly-0.6.39.dev20250314104053.dist-info → letta_nightly-0.6.40.dev20250314222759.dist-info}/WHEEL +0 -0
  67. {letta_nightly-0.6.39.dev20250314104053.dist-info → letta_nightly-0.6.40.dev20250314222759.dist-info}/entry_points.txt +0 -0
@@ -1,10 +1,10 @@
1
- letta/__init__.py,sha256=q6k2pwvx7XD4fcSf0faPYn9dD9Yj6778hhgrULdXd6s,918
1
+ letta/__init__.py,sha256=UHqXlWcxu1BBS0f_6UszKphaK2mFq0xvQby9G3WcIFc,918
2
2
  letta/__main__.py,sha256=6Hs2PV7EYc5Tid4g4OtcLXhqVHiNYTGzSBdoOnW2HXA,29
3
- letta/agent.py,sha256=2n0GTPjWnBT9jQib_qulOlq4_hdcLIfgzIB9A2u1LbE,67778
3
+ letta/agent.py,sha256=xBXIgaeiGXDBpgNKX0-2w10iRBBvcLgBK0W85jTiSX8,68141
4
4
  letta/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  letta/agents/base_agent.py,sha256=8IMB7UK4ft-Wi-ZYjX7akqQUhk_cSswRgepqeZyvCMs,1550
6
- letta/agents/ephemeral_agent.py,sha256=XOQ5rj3cn7i7Imr_aFaL8DbH7oAizrHbmUy8QZuz9yk,2704
7
- letta/agents/low_latency_agent.py,sha256=CfldT1b0jZ_iTySES4woyXLOQUsIzCnlEHP8treekN4,13990
6
+ letta/agents/ephemeral_agent.py,sha256=DBMXT50UQoqjkvl_Piwle3Fy7iXopy15oMWwnWzbpvo,2751
7
+ letta/agents/low_latency_agent.py,sha256=kDX9pKomyn9IptnVCcxzBNGZBLWQudrexHSfNsJCGvw,14396
8
8
  letta/benchmark/benchmark.py,sha256=ebvnwfp3yezaXOQyGXkYCDYpsmre-b9hvNtnyx4xkG0,3701
9
9
  letta/benchmark/constants.py,sha256=aXc5gdpMGJT327VuxsT5FngbCK2J41PQYeICBO7g_RE,536
10
10
  letta/cli/cli.py,sha256=zJz78-qDUz-depb7VQWkg87RBKiETQU4h9DI6ukQBa8,16477
@@ -18,23 +18,28 @@ letta/config.py,sha256=JFGY4TWW0Wm5fTbZamOwWqk5G8Nn-TXyhgByGoAqy2c,12375
18
18
  letta/constants.py,sha256=_QI06HD6yLmGFrTqexLkUnUWSsKUiBlM1QtbiLGEq4k,7773
19
19
  letta/data_sources/connectors.py,sha256=R2AssXpqS7wN6VI8AfxvqaZs5S1ZACc4E_FewmR9iZI,7022
20
20
  letta/data_sources/connectors_helper.py,sha256=oQpVlc-BjSz9sTZ7sp4PsJSXJbBKpZPi3Dam03CURTQ,3376
21
+ letta/dynamic_multi_agent.py,sha256=syJ-uODfZR_OHd4Acx19yMvjSJ2jwjyX0SOPaeLsZ38,12056
21
22
  letta/embeddings.py,sha256=zqlfbN3aCgSOlNd9M2NW9zrwx4WwQzketb8oa5BzzE8,10831
22
23
  letta/errors.py,sha256=6fQXg2unP-2fo3R7db0ayKKWlD2XMusOPNi9TgJplCg,5558
23
24
  letta/functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
25
  letta/functions/ast_parsers.py,sha256=CQI0rUoIXcLKAev_GYrXcldRIGN5ZQtk5u4FLoHe5sE,5728
25
- letta/functions/function_sets/base.py,sha256=Rc1fKCExxTR66DmEh4OTCtvHIpC0s28ggx9tFgh_0QQ,6010
26
- letta/functions/function_sets/extras.py,sha256=R1a97EKepEPDxJKsxQPFdXXWQrkVppOvKbEkRc_79tc,4852
27
- letta/functions/function_sets/multi_agent.py,sha256=MmLw42ztpjoZj6bPR6BKq9ttRWa9NMwuod48YQq5Qzw,4024
26
+ letta/functions/function_sets/base.py,sha256=RKc_edeBxP5MXmHEDI_LKP7ktO0XuDGLbqYDAgRbvjQ,6114
27
+ letta/functions/function_sets/extras.py,sha256=mG7jCd2RUsf1w9G8mVcv26twJWpiDhbWI6VvnLZoEOk,4899
28
+ letta/functions/function_sets/multi_agent.py,sha256=QTRvK7G-B_2ShIP7hw6Xw50P5VMMc0IHRIS9qMJJT8s,4660
28
29
  letta/functions/functions.py,sha256=NyWLh7a-f4mXti5vM1oWDwXzfA58VmVVqL03O9vosKY,5672
29
- letta/functions/helpers.py,sha256=Eh-6FLVCv7eJZP_IwP4Ib374oYzfvdkAOtYJX7p1t6c,27495
30
+ letta/functions/helpers.py,sha256=0I-ezZeM3slhAifpdlR5k2Rn6GxExD6xACCKuoYmE8M,29119
30
31
  letta/functions/interface.py,sha256=s_PPp5WDvGH_y9KUpMlORkdC141ITczFk3wsevrrUD8,2866
31
- letta/functions/schema_generator.py,sha256=wbV8tDx5RIkrSP9JNVo3PUuulN-WZie1WWLg69QTOjE,22320
32
+ letta/functions/mcp_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
+ letta/functions/mcp_client/base_client.py,sha256=uHp4XuXFy3avCkc3XYr1IxEPTHZWADqrDk-kR-oFyLY,2144
34
+ letta/functions/mcp_client/sse_client.py,sha256=VElaM87sEMTvam4t3IJgWGhyqs5BL4YVErqVPv2hQug,961
35
+ letta/functions/mcp_client/stdio_client.py,sha256=qy9vHB99oI4pCAQ4KmQUKY0bTboaQI4pnPm9DPQfPvY,4210
36
+ letta/functions/mcp_client/types.py,sha256=nmcnQn2EpxXzXg5_pWPsHZobfxO6OucaUgz1bVvam7o,1411
37
+ letta/functions/schema_generator.py,sha256=4hiDQpHemyfKWME-5X6xJuSiv7g9V_BgAPFegohHBIM,22327
32
38
  letta/helpers/__init__.py,sha256=p0luQ1Oe3Skc6sH4O58aHHA3Qbkyjifpuq0DZ1GAY0U,59
33
39
  letta/helpers/composio_helpers.py,sha256=6CWV483vE3N-keQlblexxBiQHxorMAgQuvbok4adGO4,949
34
- letta/helpers/converters.py,sha256=yM0slUU4YMW6K260JT88xnCxK2jB4RstSmaOezsT_Ik,6679
40
+ letta/helpers/converters.py,sha256=3qHoPDPa7ycPeeE6eLYZ8mad1mA6oGPgY95lDyhb3_A,8971
35
41
  letta/helpers/datetime_helpers.py,sha256=7U5ZJkE0cLki4sG8ukIHZSAoFfQpLWQu2kFekETy6Zg,2633
36
42
  letta/helpers/json_helpers.py,sha256=PWZ5HhSqGXO4e563dM_8M72q7ScirjXQ4Rv1ckohaV8,396
37
- letta/helpers/mcp_helpers.py,sha256=kq2CH4PtnawUuO409_G3Q1ZUB0WSB0fzYb7JDpPUxo4,4196
38
43
  letta/helpers/tool_execution_helper.py,sha256=bskCscuz2nqoUboFcYA7sQGeikdEyqiYnNpO4gLQTdc,7469
39
44
  letta/helpers/tool_rule_solver.py,sha256=z-2Zq_qWykgWanFZYxtxUee4FkMnxqvntXe2tomoH68,6774
40
45
  letta/humans/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -61,7 +66,7 @@ letta/llm_api/llm_api_tools.py,sha256=g6Rm7srSNzJKDEUDIKA-dJ9W9GLynLOSgt_2lHj2Lq
61
66
  letta/llm_api/llm_client.py,sha256=u7nnmtSgwhqNDiaNmv6i0G-I-WgwLH35uxJnXM0C33o,1767
62
67
  letta/llm_api/llm_client_base.py,sha256=754JOj33J2kowxSYdP7hkQ_dx47zZ5qCQXy2w5NiywM,4881
63
68
  letta/llm_api/mistral.py,sha256=fHdfD9ug-rQIk2qn8tRKay1U6w9maF11ryhKi91FfXM,1593
64
- letta/llm_api/openai.py,sha256=UnCh2NYYJWpwUai6P2enFop3K_5JS4-VHuoFoBx7yRs,22398
69
+ letta/llm_api/openai.py,sha256=XyUdtWEeKEsxmryomgKn65157R1TJFEVAhfJJBGILzY,22401
65
70
  letta/local_llm/README.md,sha256=hFJyw5B0TU2jrh9nb0zGZMgdH-Ei1dSRfhvPQG_NSoU,168
66
71
  letta/local_llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
72
  letta/local_llm/chat_completion_proxy.py,sha256=k8_8kIKglMSXnthIdc4TnR3ACJVQsk6MHJY_Y3lM6B0,13845
@@ -101,35 +106,37 @@ letta/local_llm/webui/legacy_settings.py,sha256=BLmd3TSx5StnY3ibjwaxYATPt_Lvq-o1
101
106
  letta/local_llm/webui/settings.py,sha256=gmLHfiOl1u4JmlAZU2d2O8YKF9lafdakyjwR_ftVPh8,552
102
107
  letta/log.py,sha256=FbFwU9KEX7k0FBYhPl7fJ6uQ3NO3-ZbsnM2OpcTFXjo,2217
103
108
  letta/main.py,sha256=_agyaYPJq70OL0goNwO34zENL2KupnTgqlg-HVcNaTY,15379
104
- letta/memory.py,sha256=26cwXeUxlB_UfTMPjKyXs19foNxMe-gecEggOiR5Eiw,3364
109
+ letta/memory.py,sha256=JjKripPdzsCxXCPYBmFP_yRVN_PSqEQW5s8EKK-Mt9M,3411
105
110
  letta/offline_memory_agent.py,sha256=P_rm6GmKAH6lg7-njuv7dK29f7v5-tAQy-rMOwcPfwk,7499
106
111
  letta/openai_backcompat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
107
112
  letta/openai_backcompat/openai_object.py,sha256=GSzeCTwLpLD2fH4X8wVqzwdmoTjKK2I4PnriBY453lc,13505
108
113
  letta/orm/__all__.py,sha256=2gh2MZTkA3Hw67VWVKK3JIStJOqTeLdpCvYSVYNeEDA,692
109
- letta/orm/__init__.py,sha256=QNrBCBcz4Z-xVObkWngCkJTp7LWJfIZQ1IMWUylFPyg,996
110
- letta/orm/agent.py,sha256=LYMAfDfUlLTpOu5hw8mrQ1AKOOkT39BvLMp12IdGrik,7742
114
+ letta/orm/__init__.py,sha256=t9ZXn6Y7Cp1Ia0iZXBhXw9JZ6-ff8bSavKD4uy2mBN8,1079
115
+ letta/orm/agent.py,sha256=X2H_wDIvX7K0uBO5aoXfIH1C3b31FZ8IywWfgmDc0J8,9602
111
116
  letta/orm/agents_tags.py,sha256=dYSnHz4IWBjyOiQ4RJomX3P0QN76JTlEZEw5eJM6Emg,925
112
117
  letta/orm/base.py,sha256=VjvxF9TwKF9Trf8BJkDgf7D6KrWWopOkUiF18J3IElk,3071
113
118
  letta/orm/block.py,sha256=Ci_CO54CDb4vpZkrRircmYjc-Y00Zhs9T14s3Bf_dF4,4134
114
119
  letta/orm/blocks_agents.py,sha256=W0dykl9OchAofSuAYZD5zNmhyMabPr9LTJrz-I3A0m4,983
115
- letta/orm/custom_columns.py,sha256=UW_qhIJGYlPn7TMMeTILYKXibdZ2CKVlhXDX5UmnNxA,2567
120
+ letta/orm/custom_columns.py,sha256=A6FSbwnweFwcnunH38ZIebjI2zWufW_aPz6WK1aF9ps,3007
116
121
  letta/orm/enums.py,sha256=gUmlsCN04RiwtbN1FysjgqDqbR7WiU546iNPjCEzTNk,610
117
122
  letta/orm/errors.py,sha256=Se0Guz-gqi-D36NUWSh7AP9zTVCSph9KgZh_trwng4o,734
118
123
  letta/orm/file.py,sha256=7_p7LxityP3NQZVURQYG0kgcZhEkVuMN0Fj4h9YOe1w,1780
124
+ letta/orm/group.py,sha256=O_Eehn7Ceu0NGc12wtoiss2J1XoGFifVMj0Vwt4y_kU,1462
125
+ letta/orm/groups_agents.py,sha256=1J6ZyXlTjC8CG0fXPuzfcFo_Bg0cpZSyktYRkoFOUt4,483
119
126
  letta/orm/identities_agents.py,sha256=cfIQ6UsbwmjxtGVmFt1ArK2zbKr9k6VWoELuISDnLSc,502
120
127
  letta/orm/identities_blocks.py,sha256=oS0DnDXKzcWtlH2dDFREkNF1JHJ3Kyg8fN9GI8DKtcg,501
121
128
  letta/orm/identity.py,sha256=DQlyqQtszv8AlP0HYftBbewoHbCr-_vQllzEvNuGrxA,2867
122
129
  letta/orm/job.py,sha256=G2P-xUpTapD4lhU2FwMZET1b5QR4ju9WOB3uiTKD_mw,2157
123
130
  letta/orm/job_messages.py,sha256=SgwaYPYwwAC3dBtl9Xye_TWUl9H_-m95S95TTcfPyOg,1245
124
- letta/orm/message.py,sha256=Q3Tx8MqImgmyxiGnfxrgkosZdhWeOiHP9XUOM4Y9KFk,3085
131
+ letta/orm/message.py,sha256=cdQvpTY8HN-Ld5ky2d7CoADcM70xUhzo8vVNlQvzAjc,3466
125
132
  letta/orm/mixins.py,sha256=9c79Kfr-Z1hL-SDYKeoptx_yMTbBwJJBo9nrKEzSDAc,1622
126
- letta/orm/organization.py,sha256=ciF2ffCBMddfOQ9O1gHv_cFMTPUlSQZNDYYXFgH_z1E,3070
133
+ letta/orm/organization.py,sha256=ALFdILLT09Nm_oH1IxPr6eInasA6OBk0X5rDhCBANPw,3189
127
134
  letta/orm/passage.py,sha256=tQi-fZZFBFVz0KZxd0foKPkAOaempgiYOHHK6lJ98gw,3332
128
135
  letta/orm/provider.py,sha256=-qA9tvKTZgaM4D7CoDZZiA7zTgjaaWDV4jZvifQv_MM,805
129
136
  letta/orm/sandbox_config.py,sha256=DyOy_1_zCMlp13elCqPcuuA6OwUove6mrjhcpROTg50,4150
130
137
  letta/orm/source.py,sha256=z89VZUHV9K8Ew9JCYoZqUeRb1WEUKmrn0MMFkppaphE,2117
131
138
  letta/orm/sources_agents.py,sha256=Ik_PokCBrXRd9wXWomeNeb8EtLUwjb9VMZ8LWXqpK5A,473
132
- letta/orm/sqlalchemy_base.py,sha256=IKkMSQ5LLGqP6gNL_Q4pdsYlOd5XM_8YM0vh606Gyc4,22501
139
+ letta/orm/sqlalchemy_base.py,sha256=IaiVDy7q5mZsP2x2ME0IFyI6KYMwMiKb5oHODqfiDNs,22491
133
140
  letta/orm/sqlite_functions.py,sha256=JCScKiRlYCKxy9hChQ8wsk4GMKknZE24MunnG3fM1Gw,4255
134
141
  letta/orm/step.py,sha256=fjm7fLtYLCtFM6Mj6e2boP6P7dHSFG24Nem85VfVqHg,3216
135
142
  letta/orm/tool.py,sha256=x58lmVG5IhXTVt82CnoN-ExuObnQCbeSMx_yOhUMmA4,2515
@@ -163,24 +170,27 @@ letta/prompts/system/memgpt_modified_o1.txt,sha256=objnDgnxpF3-MmU28ZqZ7-TOG8UlH
163
170
  letta/prompts/system/memgpt_offline_memory.txt,sha256=rWEJeF-6aiinjkJM9hgLUYCmlEcC_HekYB1bjEUYq6M,2460
164
171
  letta/prompts/system/memgpt_offline_memory_chat.txt,sha256=ituh7gDuio7nC2UKFB7GpBq6crxb8bYedQfJ0ADoPgg,3949
165
172
  letta/pytest.ini,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
166
- letta/schemas/agent.py,sha256=4pTHrTV_FYyJuujtSglRsJQ2ouF0FRYWNmvObbLeL2g,14123
173
+ letta/round_robin_multi_agent.py,sha256=up9x_9Zb20sPZT-iAkheM5RsrplMAeTdYPkK-18P3y4,6220
174
+ letta/schemas/agent.py,sha256=YjjzBIA4txW5LzQjVoDfXHgNZQh8HCYZ7tOyYVlbU0s,14276
167
175
  letta/schemas/block.py,sha256=rMWflyj982qW86dQK-9saXBHKaLCu3aUG2gQTckG3Ik,4984
168
176
  letta/schemas/embedding_config.py,sha256=ufboqW9ctSBJdhwzJRbrGtTzOTwSKfT0LY0mowpr6fs,3398
169
177
  letta/schemas/embedding_config_overrides.py,sha256=lkTa4y-EQ2RnaEKtKDM0sEAk7EwNa67REw8DGNNtGQY,84
170
- letta/schemas/enums.py,sha256=jfuke35XP_AKfHHBnH1rx1wYjUDWqgDsKnRxdrCpTKA,1213
178
+ letta/schemas/enums.py,sha256=zBNS0iIDtAS9mrDafin4mY33LLPUxq_SoPx6z5BiM_g,1156
171
179
  letta/schemas/environment_variables.py,sha256=VRtzOjdeQdHcSHXisk7oJUQlheruxhSWNS0xqlfGzbs,2429
172
180
  letta/schemas/file.py,sha256=ChN2CWzLI2TT9WLItcfElEH0E8b7kzPylF2OQBr6Beg,1550
181
+ letta/schemas/group.py,sha256=fniDxIkgrYxo8yR1br-ZqhjjhOIaFqG-JMYHWo2J81Y,2141
173
182
  letta/schemas/health.py,sha256=zT6mYovvD17iJRuu2rcaQQzbEEYrkwvAE9TB7iU824c,139
174
183
  letta/schemas/identity.py,sha256=9emyusE65zFSW7IDKDMsGzMwqDbadF0eKjvYNDtpS1s,3220
175
184
  letta/schemas/job.py,sha256=MX9EiLDDIeHm3q52ImOjp7UzXEdYTXAWWobRCAxwV0w,2225
176
185
  letta/schemas/letta_base.py,sha256=DuMqiNFmYwTAsXUHYdX--EWgtFUVzph5ptLZvu7aguI,3988
177
- letta/schemas/letta_message.py,sha256=3AXGiSwXf9m3Ta2A0Z8BlCq80n4fRC3c66V7LkiDUHw,10648
186
+ letta/schemas/letta_message.py,sha256=mMbo6n4iO1cZJXRC7N497agtqcMTvs2o_x0163E8mes,13302
187
+ letta/schemas/letta_message_content.py,sha256=CeIgyOy8HYMh_oGoPYlATp6d3Hp5v7SU3St9HPSbIqo,6402
178
188
  letta/schemas/letta_request.py,sha256=dzy3kwb5j2QLaSV0sDlwISEMt2xxH3IiK-vR9xJV65k,1123
179
189
  letta/schemas/letta_response.py,sha256=pq-SxXQy5yZo1-DiAwV2mMURlUvz1Uu7HHR_tB1hMho,7139
180
190
  letta/schemas/llm_config.py,sha256=bqq4LGE9layPcnnkzd_8d2SB8o1x8XdDzfd2ZkYQwcY,5611
181
191
  letta/schemas/llm_config_overrides.py,sha256=-oRglCTcajF6UAK3RAa0FLWVuKODPI1v403fDIWMAtA,1815
182
192
  letta/schemas/memory.py,sha256=GOYDfPKzbWftUWO9Hv4KW7xAi1EIQmC8zpP7qvEkVHw,10245
183
- letta/schemas/message.py,sha256=73F0UwRpi1DkQi_MOTLYctIgIUkxoeMqLaA-EiKdqX4,39544
193
+ letta/schemas/message.py,sha256=1V9_1OZxVkkKeBx9Y9WcrnHF0ggc2zeV3K-Wix8mYBA,39339
184
194
  letta/schemas/openai/chat_completion_request.py,sha256=3tALmbBV2pv1CcqzNLBxxIPOQ8Z85woucT7FN0fuDic,3402
185
195
  letta/schemas/openai/chat_completion_response.py,sha256=koEb_NTiz5YsAAX81Z0cSqSFX4a6MdD2lhoXtxF_rw4,4100
186
196
  letta/schemas/openai/chat_completions.py,sha256=l0e9sT9boTD5VBU5YtJ0s7qUtCfFGB2K-gQLeEZ2LHU,3599
@@ -193,25 +203,26 @@ letta/schemas/run.py,sha256=SRqPRziINIiPunjOhE_NlbnQYgxTvqmbauni_yfBQRA,2085
193
203
  letta/schemas/sandbox_config.py,sha256=SZCo3FSMz-DIBMKGu0atT4tsVFXGsqMFPaJnjrxpkX4,5993
194
204
  letta/schemas/source.py,sha256=-BQVolcXA2ziCu2ztR6cbTdGUc8G7vGJy7rvpdf1hpg,2880
195
205
  letta/schemas/step.py,sha256=WkcVnruUUOWLKwiWPn2Gfal4EQZPNLqlsd9859xhgsw,2224
196
- letta/schemas/tool.py,sha256=A6HS_nHoxAOVyv4u6NMxzMNsp0PG40kY2uDS8FA06M4,12284
206
+ letta/schemas/tool.py,sha256=PXWxEqzM-kADijlsJzu0ZYtWLnjpq4ZUNX4NzesIWNQ,12291
197
207
  letta/schemas/tool_rule.py,sha256=2YQZba4fXS3u4j8pIk7BDujfq8rnxSVMwJSyaVgApH4,2149
198
208
  letta/schemas/usage.py,sha256=8oYRH-JX0PfjIu2zkT5Uu3UWQ7Unnz_uHiO8hRGI4m0,912
199
209
  letta/schemas/user.py,sha256=V32Tgl6oqB3KznkxUz12y7agkQicjzW7VocSpj78i6Q,1526
200
- letta/serialize_schemas/__init__.py,sha256=mflGEZvM3NuMG9Q6dccEdVk73BUHoX-v7hmfk025Gmc,64
201
- letta/serialize_schemas/agent.py,sha256=BqtIBiMbGnupr6CGCF4Z4wKtkT90ACnxLN0qcRgkieM,3281
202
- letta/serialize_schemas/agent_environment_variable.py,sha256=IDcivP-xB1j6Fn0onSM4T1l4CSlXhOLWNmKHG2psOoU,641
203
- letta/serialize_schemas/base.py,sha256=X5cs1U4P0Vjem4SKNCYBiSAIboThJdM2Oyphu_Nl9Ag,2040
204
- letta/serialize_schemas/block.py,sha256=BeZ2FZO59IWUHiPMSNKlZMi9dH9Gbys0rJpsoCFBjdg,420
205
- letta/serialize_schemas/custom_fields.py,sha256=HPonsK5DIU9EezXmQG0vAq2CWZVucld6Fqm3-VcJBg8,2101
206
- letta/serialize_schemas/message.py,sha256=Tdj_ixjjqM2j29gqxLgrdWpTgh5mR3YF5wTbPTnSsHY,920
207
- letta/serialize_schemas/tag.py,sha256=wbCTERsLqN5_bitTMwIuYjt-yZ4XmAewOwEN6ObtbNM,443
208
- letta/serialize_schemas/tool.py,sha256=x13LlwOvbAwnS7Jf5M1nOQCUnDhm4oTFY_mYJu3aJhM,392
210
+ letta/serialize_schemas/__init__.py,sha256=cosMjvWz7cubC1azbUofzYrcDBTuSgjJImUdsrSs3p0,77
211
+ letta/serialize_schemas/marshmallow_agent.py,sha256=Ks0RQK5LcuxOHIyB7GKdD2yKK0mh06RCxb-k6YE9kcc,4304
212
+ letta/serialize_schemas/marshmallow_agent_environment_variable.py,sha256=9RYJkaNH2UiRoIFzrNklVAGl3uMmu3n6NwzFdviPPVA,653
213
+ letta/serialize_schemas/marshmallow_base.py,sha256=GP0ImCRfJ-BqNKe-T44Feal18pmFQG-p8JllOsSSNRk,1379
214
+ letta/serialize_schemas/marshmallow_block.py,sha256=e6xT1SEOBf5Nh4ed1UJ0O05S8o-BKFcLH6yxmvxw5zE,432
215
+ letta/serialize_schemas/marshmallow_custom_fields.py,sha256=_rXV4eGY4wKqzZQPyk3ohHq4rt_oXa4r9QoHfoE-DbM,2500
216
+ letta/serialize_schemas/marshmallow_message.py,sha256=vkBlIFONzsiREXo507sWl1mjVjCLV97RtB7jyE0N_fw,1336
217
+ letta/serialize_schemas/marshmallow_tag.py,sha256=ssNGdD-z9UafhoTTOcvWRXju__NSx1bPijae_vljMr4,682
218
+ letta/serialize_schemas/marshmallow_tool.py,sha256=98dzHzKcH_HE5n_gCkU683iHvg1M9IGmRZ2BWnh__j4,404
219
+ letta/serialize_schemas/pydantic_agent_schema.py,sha256=4FfF405nyH3lpTpU6r1vkZmP5916FhuEcgaEqpiAMko,2633
209
220
  letta/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
210
221
  letta/server/constants.py,sha256=yAdGbLkzlOU_dLTx0lKDmAnj0ZgRXCEaIcPJWO69eaE,92
211
222
  letta/server/db.py,sha256=cA1MHpMCTTC1MX7VWppJ-cKq1XW93Vws_vTV0-bKmTE,3642
212
223
  letta/server/generate_openapi_schema.sh,sha256=0OtBhkC1g6CobVmNEd_m2B6sTdppjbJLXaM95icejvE,371
213
224
  letta/server/rest_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
214
- letta/server/rest_api/app.py,sha256=_rJ6XzvmACjaZwtuGbTLPcqd40pa9FIUyAUHPJCTvow,12723
225
+ letta/server/rest_api/app.py,sha256=gP558sE9dY4914GYVPuypPwYiGHaVtfeWSsOUZBq67c,13618
215
226
  letta/server/rest_api/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
216
227
  letta/server/rest_api/auth/index.py,sha256=fQBGyVylGSRfEMLQ17cZzrHd5Y1xiVylvPqH5Rl-lXQ,1378
217
228
  letta/server/rest_api/auth_token.py,sha256=725EFEIiNj4dh70hrSd94UysmFD8vcJLrTRfNHkzxDo,774
@@ -221,9 +232,10 @@ letta/server/rest_api/optimistic_json_parser.py,sha256=1z4d9unmxMb0ou7owJ62uUQoN
221
232
  letta/server/rest_api/routers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
222
233
  letta/server/rest_api/routers/openai/chat_completions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
223
234
  letta/server/rest_api/routers/openai/chat_completions/chat_completions.py,sha256=OgjWs4zJaIi5Ps67iCTeOLmLXcW0S5Xccd-TcNa9obQ,5321
224
- letta/server/rest_api/routers/v1/__init__.py,sha256=Zi2th-okqT_RWAjB8MYGHX8CpHt1OSRyO5V8SJEp6UU,1361
225
- letta/server/rest_api/routers/v1/agents.py,sha256=ViQuKsVtqYciLXHkQkC03gz5TtF2CORZg4d6fhH9D0M,29458
235
+ letta/server/rest_api/routers/v1/__init__.py,sha256=AV_uopcsNQIK-paX-9X23dNmLMUDDe_fgLTfeNyjWk8,1456
236
+ letta/server/rest_api/routers/v1/agents.py,sha256=ytRWTFvBW8zQZ0JOStK6QiXMjoNo2QESGZ6nOzW_sOY,29879
226
237
  letta/server/rest_api/routers/v1/blocks.py,sha256=OqX-YHC8e-yi-IoZ8OQJQjZ4QIjJ4xcio0tUlRhv8H0,4168
238
+ letta/server/rest_api/routers/v1/groups.py,sha256=v53Ekx9HmcabvBuUsvxlJyRvUiStgVrzAFoqzwC4cOs,9826
227
239
  letta/server/rest_api/routers/v1/health.py,sha256=MoOjkydhGcJXTiuJrKIB0etVXiRMdTa51S8RQ8-50DQ,399
228
240
  letta/server/rest_api/routers/v1/identities.py,sha256=gRTcOXxbpiTzQzzVA_I1Sc9aUSKhW6YcQcJb__HxOX4,5957
229
241
  letta/server/rest_api/routers/v1/jobs.py,sha256=4oeJfI2odNGubU_g7WSORJhn_usFsbRaD-qm86rve1E,2746
@@ -235,12 +247,12 @@ letta/server/rest_api/routers/v1/sandbox_configs.py,sha256=9hqnnMwJ3wCwO-Bezu3Xl
235
247
  letta/server/rest_api/routers/v1/sources.py,sha256=rpQhaRHyzGUK43LX623L8BBLqL85HJ6fUYPMvI4k3kA,8434
236
248
  letta/server/rest_api/routers/v1/steps.py,sha256=DVVwaxLNbNAgWpr2oQkrNjdS-wi0bP8kVJZUO-hiaf8,3275
237
249
  letta/server/rest_api/routers/v1/tags.py,sha256=coydgvL6-9cuG2Hy5Ea7QY3inhTHlsf69w0tcZenBus,880
238
- letta/server/rest_api/routers/v1/tools.py,sha256=1nBJdYijMVf1RYHgVw01QPnAVsFI5LEYqC5z69AE6YQ,16060
250
+ letta/server/rest_api/routers/v1/tools.py,sha256=pWIlYUksq9QNFSmknB_DdSB5zs77zaHoj-Ha-WxYkO8,17211
239
251
  letta/server/rest_api/routers/v1/users.py,sha256=G5DBHSkPfBgVHN2Wkm-rVYiLQAudwQczIq2Z3YLdbVo,2277
240
252
  letta/server/rest_api/routers/v1/voice.py,sha256=7J0L-Nkz65m0PXcpQI2ATMIZzumDDSUzgtIus7d-tv8,2461
241
253
  letta/server/rest_api/static_files.py,sha256=NG8sN4Z5EJ8JVQdj19tkFa9iQ1kBPTab9f_CUxd_u4Q,3143
242
- letta/server/rest_api/utils.py,sha256=TlVzgtsg0jmaXzvGubtzOE9WSyvRe6_DFoIBK9EDYt8,13820
243
- letta/server/server.py,sha256=CaG1oIS_uAI6MwuNDNZA_l7mfWyDn9ouITzmOLTi0HU,62929
254
+ letta/server/rest_api/utils.py,sha256=aF0u__Q33-aPWAiHi9JA0jKAjqnwbVKzJdD5NgFpnOU,13828
255
+ letta/server/server.py,sha256=Ml4-MklB28x3iAONfp3m2oSbrhVctAvvxUWApeWIWrk,75884
244
256
  letta/server/startup.sh,sha256=eo7zz4HGu5ryOshfbOSGbXpUDDyoaP7fTq4z8269uaw,1939
245
257
  letta/server/static_files/assets/index-048c9598.js,sha256=mR16XppvselwKCcNgONs4L7kZEVa4OEERm4lNZYtLSk,146819
246
258
  letta/server/static_files/assets/index-0e31b727.css,sha256=SBbja96uiQVLDhDOroHgM6NSl7tS4lpJRCREgSS_hA8,7672
@@ -254,15 +266,16 @@ letta/server/ws_api/interface.py,sha256=TWl9vkcMCnLsUtgsuENZ-ku2oMDA-OUTzLh_yNRo
254
266
  letta/server/ws_api/protocol.py,sha256=5mDgpfNZn_kNwHnpt5Dsuw8gdNH298sgxTGed3etzYg,1836
255
267
  letta/server/ws_api/server.py,sha256=cBSzf-V4zT1bL_0i54OTI3cMXhTIIxqjSRF8pYjk7fg,5835
256
268
  letta/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
257
- letta/services/agent_manager.py,sha256=Lb3dr3n-La2-yKsQQPwQDjZIgiQetjaqTsu3QFYusD4,60233
269
+ letta/services/agent_manager.py,sha256=2xLGa_BBil9OwFylC16MN1wz1QrpFhLbue1aNiKEs3A,62613
258
270
  letta/services/block_manager.py,sha256=vfFs7T00WZWKfyKn50QjK5N1T7b2xjuxou7ffjGVf0Y,5838
259
- letta/services/helpers/agent_manager_helper.py,sha256=0xpFUQlLoben1_1sARDFSULOk2_ueWiCtGvl1UMJqTg,11643
271
+ letta/services/group_manager.py,sha256=rzfy7w1yYtUtI0cBlr3mdQjfcWKqKahT1q2v9s6_RBI,6202
272
+ letta/services/helpers/agent_manager_helper.py,sha256=YPlsDrExprwOuaHW6ZDv-j3tkGi6bNYJ2-XcYIzcKLo,18267
260
273
  letta/services/helpers/tool_execution_helper.py,sha256=lLoebs1kZKjw62y1PxHbIDkHq_heJN2ZT0gKje-R8oo,6941
261
274
  letta/services/identity_manager.py,sha256=DJzvq5TqzgmVdnH401YAJUycXTE0tNN70KRZTwu6ko8,8505
262
275
  letta/services/job_manager.py,sha256=ejcv_nMljByimiWJjvj7aqUFQktL1kK-vx_cra2L2cs,16317
263
- letta/services/message_manager.py,sha256=ZcHn3xQC86LY0_6mecux9WyxPQqMDAhMRjXIjAFLVdc,13079
276
+ letta/services/message_manager.py,sha256=75JGDC0v3SKdxhr85nAxbNza0aI1fvCxXJkoKdwB_nM,13499
264
277
  letta/services/organization_manager.py,sha256=dhQ3cFPXWNYLfMjdahr2HsOAMJ1JtCEWj1G8Nei5MQc,3388
265
- letta/services/passage_manager.py,sha256=mwShFO_xRaTi82fvANb_ngO0TmGaZPA9FPu8KuZ6Gd8,8643
278
+ letta/services/passage_manager.py,sha256=GeEsQZx3uBe4E509LaZtwKVjIeIw4Lra9jOqFgbk1yg,9102
266
279
  letta/services/per_agent_lock_manager.py,sha256=porM0cKKANQ1FvcGXOO_qM7ARk5Fgi1HVEAhXsAg9-4,546
267
280
  letta/services/provider_manager.py,sha256=QOKMSZOM6eAWa2-nANWQc1frKBh8N3gqDq0V87fnSuc,3748
268
281
  letta/services/sandbox_config_manager.py,sha256=ATgZNWNpkdIQDUPy4ABsguHQba2PZf51-c4Ji60MzLE,13361
@@ -274,14 +287,15 @@ letta/services/summarizer/summarizer.py,sha256=qPcR7VsHsgUsUtxmKx_73l3XdDhFvDzZ8
274
287
  letta/services/tool_execution_sandbox.py,sha256=6AB3rFS34PzoyE9dxtUmuaUUWvKrwdE083NuBRa1eC0,22969
275
288
  letta/services/tool_manager.py,sha256=rXOdB2quTWE9EGjkg9Q4EY6-hAwX2R9gGBCXFs8hR4w,9862
276
289
  letta/services/user_manager.py,sha256=ScHbdJK9kNF8QXjsd3ZWGEL87n_Uyp3YwfKetOJmpHs,4304
277
- letta/settings.py,sha256=wBgZgIFQaoUOyeTRl-vD61gY2M1Q89FHP0X1IS0yz50,6885
290
+ letta/settings.py,sha256=2uvCG4UEJt0hss--f0HC2bhbsu4uqOBSaHJWBRVxKhw,7011
278
291
  letta/streaming_interface.py,sha256=1vuAckIxo1p1UsXtDzE8LTUve5RoTZRdXUe-WBIYDWU,15818
279
292
  letta/streaming_utils.py,sha256=jLqFTVhUL76FeOuYk8TaRQHmPTf3HSRc2EoJwxJNK6U,11946
293
+ letta/supervisor_multi_agent.py,sha256=dw6XPAxZcyjAXEVYkMIxJFhZdR2m2_rq-fYev5hZE50,3936
280
294
  letta/system.py,sha256=dnOrS2FlRMwijQnOvfrky0Lg8wEw-FUq2zzfAJOUSKA,8477
281
295
  letta/tracing.py,sha256=h_-c2lIKHmA7yCLOvgaHijMabmRC__FAl2rZtVKufUM,8017
282
296
  letta/utils.py,sha256=AdHrQ2OQ3V4XhJ1LtYwbLUO71j2IJY37cIUxXPgaaRY,32125
283
- letta_nightly-0.6.39.dev20250314104053.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
284
- letta_nightly-0.6.39.dev20250314104053.dist-info/METADATA,sha256=MhcDCXAVIvAL9buyymG2DWWtWwzy1E8yDq5LZfqHjQg,22928
285
- letta_nightly-0.6.39.dev20250314104053.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
286
- letta_nightly-0.6.39.dev20250314104053.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
287
- letta_nightly-0.6.39.dev20250314104053.dist-info/RECORD,,
297
+ letta_nightly-0.6.40.dev20250314222759.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
298
+ letta_nightly-0.6.40.dev20250314222759.dist-info/METADATA,sha256=_O99vV3C3JQYXICthAEXivxmz4g0rYe2ByP1bNOXu6Y,22886
299
+ letta_nightly-0.6.40.dev20250314222759.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
300
+ letta_nightly-0.6.40.dev20250314222759.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
301
+ letta_nightly-0.6.40.dev20250314222759.dist-info/RECORD,,
@@ -1,108 +0,0 @@
1
- import asyncio
2
- from enum import Enum
3
- from typing import List, Optional, Tuple
4
-
5
- from mcp import ClientSession, StdioServerParameters, Tool
6
- from mcp.client.sse import sse_client
7
- from mcp.client.stdio import stdio_client
8
- from pydantic import BaseModel, Field
9
-
10
- from letta.log import get_logger
11
-
12
- logger = get_logger(__name__)
13
-
14
-
15
- class MCPTool(Tool):
16
- """A simple wrapper around MCP's tool definition (to avoid conflict with our own)"""
17
-
18
-
19
- class MCPServerType(str, Enum):
20
- SSE = "sse"
21
- LOCAL = "local"
22
-
23
-
24
- class BaseServerConfig(BaseModel):
25
- server_name: str = Field(..., description="The name of the server")
26
- type: MCPServerType
27
-
28
-
29
- class SSEServerConfig(BaseServerConfig):
30
- type: MCPServerType = MCPServerType.SSE
31
- server_url: str = Field(..., description="The URL of the server (MCP SSE client will connect to this URL)")
32
-
33
-
34
- class LocalServerConfig(BaseServerConfig):
35
- type: MCPServerType = MCPServerType.LOCAL
36
- command: str = Field(..., description="The command to run (MCP 'local' client will run this command)")
37
- args: List[str] = Field(..., description="The arguments to pass to the command")
38
-
39
-
40
- class BaseMCPClient:
41
- def __init__(self):
42
- self.session: Optional[ClientSession] = None
43
- self.stdio = None
44
- self.write = None
45
- self.initialized = False
46
- self.loop = asyncio.new_event_loop()
47
- self.cleanup_funcs = []
48
-
49
- def connect_to_server(self, server_config: BaseServerConfig):
50
- asyncio.set_event_loop(self.loop)
51
- self._initialize_connection(server_config)
52
- self.loop.run_until_complete(self.session.initialize())
53
- self.initialized = True
54
-
55
- def _initialize_connection(self, server_config: BaseServerConfig):
56
- raise NotImplementedError("Subclasses must implement _initialize_connection")
57
-
58
- def list_tools(self) -> List[Tool]:
59
- self._check_initialized()
60
- response = self.loop.run_until_complete(self.session.list_tools())
61
- return response.tools
62
-
63
- def execute_tool(self, tool_name: str, tool_args: dict) -> Tuple[str, bool]:
64
- self._check_initialized()
65
- result = self.loop.run_until_complete(self.session.call_tool(tool_name, tool_args))
66
- return str(result.content), result.isError
67
-
68
- def _check_initialized(self):
69
- if not self.initialized:
70
- logger.error("MCPClient has not been initialized")
71
- raise RuntimeError("MCPClient has not been initialized")
72
-
73
- def cleanup(self):
74
- try:
75
- for cleanup_func in self.cleanup_funcs:
76
- cleanup_func()
77
- self.initialized = False
78
- if not self.loop.is_closed():
79
- self.loop.close()
80
- except Exception as e:
81
- logger.warning(e)
82
- finally:
83
- logger.info("Cleaned up MCP clients on shutdown.")
84
-
85
-
86
- class LocalMCPClient(BaseMCPClient):
87
- def _initialize_connection(self, server_config: LocalServerConfig):
88
- server_params = StdioServerParameters(command=server_config.command, args=server_config.args)
89
- stdio_cm = stdio_client(server_params)
90
- stdio_transport = self.loop.run_until_complete(stdio_cm.__aenter__())
91
- self.stdio, self.write = stdio_transport
92
- self.cleanup_funcs.append(lambda: self.loop.run_until_complete(stdio_cm.__aexit__(None, None, None)))
93
-
94
- session_cm = ClientSession(self.stdio, self.write)
95
- self.session = self.loop.run_until_complete(session_cm.__aenter__())
96
- self.cleanup_funcs.append(lambda: self.loop.run_until_complete(session_cm.__aexit__(None, None, None)))
97
-
98
-
99
- class SSEMCPClient(BaseMCPClient):
100
- def _initialize_connection(self, server_config: SSEServerConfig):
101
- sse_cm = sse_client(url=server_config.server_url)
102
- sse_transport = self.loop.run_until_complete(sse_cm.__aenter__())
103
- self.stdio, self.write = sse_transport
104
- self.cleanup_funcs.append(lambda: self.loop.run_until_complete(sse_cm.__aexit__(None, None, None)))
105
-
106
- session_cm = ClientSession(self.stdio, self.write)
107
- self.session = self.loop.run_until_complete(session_cm.__aenter__())
108
- self.cleanup_funcs.append(lambda: self.loop.run_until_complete(session_cm.__aexit__(None, None, None)))
@@ -1,80 +0,0 @@
1
- from typing import Dict
2
-
3
- from marshmallow import fields, post_dump
4
-
5
- from letta.orm import Agent
6
- from letta.schemas.agent import AgentState as PydanticAgentState
7
- from letta.schemas.user import User
8
- from letta.serialize_schemas.agent_environment_variable import SerializedAgentEnvironmentVariableSchema
9
- from letta.serialize_schemas.base import BaseSchema
10
- from letta.serialize_schemas.block import SerializedBlockSchema
11
- from letta.serialize_schemas.custom_fields import EmbeddingConfigField, LLMConfigField, ToolRulesField
12
- from letta.serialize_schemas.message import SerializedMessageSchema
13
- from letta.serialize_schemas.tag import SerializedAgentTagSchema
14
- from letta.serialize_schemas.tool import SerializedToolSchema
15
- from letta.server.db import SessionLocal
16
-
17
-
18
- class SerializedAgentSchema(BaseSchema):
19
- """
20
- Marshmallow schema for serializing/deserializing Agent objects.
21
- Excludes relational fields.
22
- """
23
-
24
- __pydantic_model__ = PydanticAgentState
25
-
26
- llm_config = LLMConfigField()
27
- embedding_config = EmbeddingConfigField()
28
- tool_rules = ToolRulesField()
29
-
30
- messages = fields.List(fields.Nested(SerializedMessageSchema))
31
- core_memory = fields.List(fields.Nested(SerializedBlockSchema))
32
- tools = fields.List(fields.Nested(SerializedToolSchema))
33
- tool_exec_environment_variables = fields.List(fields.Nested(SerializedAgentEnvironmentVariableSchema))
34
- tags = fields.List(fields.Nested(SerializedAgentTagSchema))
35
-
36
- def __init__(self, *args, session: SessionLocal, actor: User, **kwargs):
37
- super().__init__(*args, actor=actor, **kwargs)
38
- self.session = session
39
-
40
- # Propagate session and actor to nested schemas automatically
41
- for field in self.fields.values():
42
- if isinstance(field, fields.List) and isinstance(field.inner, fields.Nested):
43
- field.inner.schema.session = session
44
- field.inner.schema.actor = actor
45
- elif isinstance(field, fields.Nested):
46
- field.schema.session = session
47
- field.schema.actor = actor
48
-
49
- @post_dump
50
- def sanitize_ids(self, data: Dict, **kwargs):
51
- data = super().sanitize_ids(data, **kwargs)
52
-
53
- # Remap IDs of messages
54
- # Need to do this in post, so we can correctly map the in-context message IDs
55
- # TODO: Remap message_ids to reference objects, not just be a list
56
- id_remapping = dict()
57
- for message in data.get("messages"):
58
- message_id = message.get("id")
59
- if message_id not in id_remapping:
60
- id_remapping[message_id] = SerializedMessageSchema.__pydantic_model__.generate_id()
61
- message["id"] = id_remapping[message_id]
62
- else:
63
- raise ValueError(f"Duplicate message IDs in agent.messages: {message_id}")
64
-
65
- # Remap in context message ids
66
- data["message_ids"] = [id_remapping[message_id] for message_id in data.get("message_ids")]
67
-
68
- return data
69
-
70
- class Meta(BaseSchema.Meta):
71
- model = Agent
72
- # TODO: Serialize these as well...
73
- exclude = BaseSchema.Meta.exclude + (
74
- "project_id",
75
- "template_id",
76
- "base_template_id",
77
- "sources",
78
- "source_passages",
79
- "agent_passages",
80
- )
@@ -1,64 +0,0 @@
1
- from typing import Dict, Optional
2
-
3
- from marshmallow import post_dump, pre_load
4
- from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
5
- from sqlalchemy.inspection import inspect
6
-
7
- from letta.schemas.user import User
8
-
9
-
10
- class BaseSchema(SQLAlchemyAutoSchema):
11
- """
12
- Base schema for all SQLAlchemy models.
13
- This ensures all schemas share the same session.
14
- """
15
-
16
- __pydantic_model__ = None
17
- sensitive_ids = {"_created_by_id", "_last_updated_by_id"}
18
- sensitive_relationships = {"organization"}
19
- id_scramble_placeholder = "xxx"
20
-
21
- def __init__(self, *args, actor: Optional[User] = None, **kwargs):
22
- super().__init__(*args, **kwargs)
23
- self.actor = actor
24
-
25
- def generate_id(self) -> Optional[str]:
26
- if self.__pydantic_model__:
27
- return self.__pydantic_model__.generate_id()
28
-
29
- return None
30
-
31
- @post_dump
32
- def sanitize_ids(self, data: Dict, **kwargs) -> Dict:
33
- if self.Meta.model:
34
- mapper = inspect(self.Meta.model)
35
- if "id" in mapper.columns:
36
- generated_id = self.generate_id()
37
- if generated_id:
38
- data["id"] = generated_id
39
-
40
- for sensitive_id in BaseSchema.sensitive_ids.union(BaseSchema.sensitive_relationships):
41
- if sensitive_id in data:
42
- data[sensitive_id] = BaseSchema.id_scramble_placeholder
43
-
44
- return data
45
-
46
- @pre_load
47
- def regenerate_ids(self, data: Dict, **kwargs) -> Dict:
48
- if self.Meta.model:
49
- mapper = inspect(self.Meta.model)
50
- for sensitive_id in BaseSchema.sensitive_ids:
51
- if sensitive_id in mapper.columns:
52
- data[sensitive_id] = self.actor.id
53
-
54
- for relationship in BaseSchema.sensitive_relationships:
55
- if relationship in mapper.relationships:
56
- data[relationship] = self.actor.organization_id
57
-
58
- return data
59
-
60
- class Meta:
61
- model = None
62
- include_relationships = True
63
- load_instance = True
64
- exclude = ()
@@ -1,29 +0,0 @@
1
- from typing import Dict
2
-
3
- from marshmallow import post_dump
4
-
5
- from letta.orm.message import Message
6
- from letta.schemas.message import Message as PydanticMessage
7
- from letta.serialize_schemas.base import BaseSchema
8
- from letta.serialize_schemas.custom_fields import ToolCallField
9
-
10
-
11
- class SerializedMessageSchema(BaseSchema):
12
- """
13
- Marshmallow schema for serializing/deserializing Message objects.
14
- """
15
-
16
- __pydantic_model__ = PydanticMessage
17
-
18
- tool_calls = ToolCallField()
19
-
20
- @post_dump
21
- def sanitize_ids(self, data: Dict, **kwargs):
22
- # We don't want to remap here
23
- # Because of the way that message_ids is just a JSON field on agents
24
- # We need to wait for the agent dumps, and then keep track of all the message IDs we remapped
25
- return data
26
-
27
- class Meta(BaseSchema.Meta):
28
- model = Message
29
- exclude = BaseSchema.Meta.exclude + ("step", "job_message", "agent")