letta-nightly 0.6.17.dev20250129174639__py3-none-any.whl → 0.6.19.dev20250130002201__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.

letta/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.6.17"
1
+ __version__ = "0.6.19"
2
2
 
3
3
 
4
4
  # import clients
letta/agent.py CHANGED
@@ -235,6 +235,7 @@ class Agent(BaseAgent):
235
235
  # TODO: This is only temporary, can remove after we publish a pip package with this object
236
236
  agent_state_copy = self.agent_state.__deepcopy__()
237
237
  agent_state_copy.tools = []
238
+ agent_state_copy.tool_rules = []
238
239
 
239
240
  sandbox_run_result = ToolExecutionSandbox(function_name, function_args, self.user).run(agent_state=agent_state_copy)
240
241
  function_response, updated_agent_state = sandbox_run_result.func_return, sandbox_run_result.agent_state
letta/constants.py CHANGED
@@ -150,6 +150,7 @@ CORE_MEMORY_BLOCK_CHAR_LIMIT: int = 5000
150
150
 
151
151
  # Function return limits
152
152
  FUNCTION_RETURN_CHAR_LIMIT = 6000 # ~300 words
153
+ BASE_FUNCTION_RETURN_CHAR_LIMIT = 1000000 # very high (we rely on implementation)
153
154
 
154
155
  MAX_PAUSE_HEARTBEATS = 360 # in min
155
156
 
@@ -22,7 +22,12 @@ def send_message_to_agent_and_wait_for_reply(self: "Agent", message: str, other_
22
22
  Returns:
23
23
  str: The response from the target agent.
24
24
  """
25
- messages = [MessageCreate(role=MessageRole.user, content=message, name=self.agent_state.name)]
25
+ message = (
26
+ f"[Incoming message from agent with ID '{self.agent_state.id}' - to reply to this message, "
27
+ f"make sure to use the 'send_message' at the end, and the system will notify the sender of your response] "
28
+ f"{message}"
29
+ )
30
+ messages = [MessageCreate(role=MessageRole.system, content=message, name=self.agent_state.name)]
26
31
  return execute_send_message_to_agent(
27
32
  sender_agent=self,
28
33
  messages=messages,
@@ -78,9 +83,15 @@ def send_message_to_agents_matching_all_tags(self: "Agent", message: str, tags:
78
83
 
79
84
  server = get_letta_server()
80
85
 
86
+ message = (
87
+ f"[Incoming message from agent with ID '{self.agent_state.id}' - to reply to this message, "
88
+ f"make sure to use the 'send_message' at the end, and the system will notify the sender of your response] "
89
+ f"{message}"
90
+ )
91
+
81
92
  # Retrieve agents that match ALL specified tags
82
93
  matching_agents = server.agent_manager.list_agents(actor=self.user, tags=tags, match_all_tags=True, limit=100)
83
- messages = [MessageCreate(role=MessageRole.user, content=message, name=self.agent_state.name)]
94
+ messages = [MessageCreate(role=MessageRole.system, content=message, name=self.agent_state.name)]
84
95
 
85
96
  async def send_messages_to_all_agents():
86
97
  tasks = [
@@ -249,24 +249,31 @@ def generate_import_code(module_attr_map: Optional[dict]):
249
249
 
250
250
 
251
251
  def parse_letta_response_for_assistant_message(
252
+ target_agent_id: str,
252
253
  letta_response: LettaResponse,
253
254
  assistant_message_tool_name: str = DEFAULT_MESSAGE_TOOL,
254
255
  assistant_message_tool_kwarg: str = DEFAULT_MESSAGE_TOOL_KWARG,
255
256
  ) -> Optional[str]:
256
- reasoning_message = ""
257
+ messages = []
258
+ # This is not ideal, but we would like to return something rather than nothing
259
+ fallback_reasoning = []
257
260
  for m in letta_response.messages:
258
261
  if isinstance(m, AssistantMessage):
259
- return m.content
262
+ messages.append(m.content)
260
263
  elif isinstance(m, ToolCallMessage) and m.tool_call.name == assistant_message_tool_name:
261
264
  try:
262
- return json.loads(m.tool_call.arguments)[assistant_message_tool_kwarg]
265
+ messages.append(json.loads(m.tool_call.arguments)[assistant_message_tool_kwarg])
263
266
  except Exception: # TODO: Make this more specific
264
267
  continue
265
268
  elif isinstance(m, ReasoningMessage):
266
- # This is not ideal, but we would like to return something rather than nothing
267
- reasoning_message += f"{m.reasoning}\n"
269
+ fallback_reasoning.append(m.reasoning)
268
270
 
269
- return None
271
+ if messages:
272
+ messages_str = "\n".join(messages)
273
+ return f"Agent {target_agent_id} said: '{messages_str}'"
274
+ else:
275
+ messages_str = "\n".join(fallback_reasoning)
276
+ return f"Agent {target_agent_id}'s inner thoughts: '{messages_str}'"
270
277
 
271
278
 
272
279
  def execute_send_message_to_agent(
@@ -364,17 +371,19 @@ async def async_send_message_with_retries(
364
371
 
365
372
  # Extract assistant message
366
373
  assistant_message = parse_letta_response_for_assistant_message(
374
+ target_agent_id,
367
375
  response,
368
376
  assistant_message_tool_name=DEFAULT_MESSAGE_TOOL,
369
377
  assistant_message_tool_kwarg=DEFAULT_MESSAGE_TOOL_KWARG,
370
378
  )
371
379
  if assistant_message:
372
- msg = f"Agent {target_agent_id} said '{assistant_message}'"
373
- sender_agent.logger.info(f"{logging_prefix} - {msg}")
374
- return msg
380
+ sender_agent.logger.info(f"{logging_prefix} - {assistant_message}")
381
+ return assistant_message
375
382
  else:
376
383
  msg = f"(No response from agent {target_agent_id})"
377
384
  sender_agent.logger.info(f"{logging_prefix} - {msg}")
385
+ sender_agent.logger.info(f"{logging_prefix} - raw response: {response.model_dump_json(indent=4)}")
386
+ sender_agent.logger.info(f"{logging_prefix} - parsed assistant message: {assistant_message}")
378
387
  return msg
379
388
  except asyncio.TimeoutError:
380
389
  error_msg = f"(Timeout on attempt {attempt}/{max_retries} for agent {target_agent_id})"
@@ -84,11 +84,11 @@ class ToolRulesColumn(TypeDecorator):
84
84
  def deserialize_tool_rule(data: dict) -> Union[ChildToolRule, InitToolRule, TerminalToolRule, ConditionalToolRule]:
85
85
  """Deserialize a dictionary to the appropriate ToolRule subclass based on the 'type'."""
86
86
  rule_type = ToolRuleType(data.get("type")) # Remove 'type' field if it exists since it is a class var
87
- if rule_type == ToolRuleType.run_first:
87
+ if rule_type == ToolRuleType.run_first or rule_type == "InitToolRule":
88
88
  return InitToolRule(**data)
89
- elif rule_type == ToolRuleType.exit_loop:
89
+ elif rule_type == ToolRuleType.exit_loop or rule_type == "TerminalToolRule":
90
90
  return TerminalToolRule(**data)
91
- elif rule_type == ToolRuleType.constrain_child_tools:
91
+ elif rule_type == ToolRuleType.constrain_child_tools or rule_type == "ToolRule":
92
92
  rule = ChildToolRule(**data)
93
93
  return rule
94
94
  elif rule_type == ToolRuleType.conditional:
letta/schemas/enums.py CHANGED
@@ -46,9 +46,13 @@ class ToolRuleType(str, Enum):
46
46
 
47
47
  # note: some of these should be renamed when we do the data migration
48
48
 
49
- run_first = "InitToolRule"
50
- exit_loop = "TerminalToolRule" # reasoning loop should exit
51
- continue_loop = "continue_loop" # reasoning loop should continue
49
+ run_first = "run_first"
50
+ exit_loop = "exit_loop" # reasoning loop should exit
51
+ continue_loop = "continue_loop"
52
52
  conditional = "conditional"
53
- constrain_child_tools = "ToolRule"
53
+ constrain_child_tools = "constrain_child_tools"
54
54
  require_parent_tools = "require_parent_tools"
55
+ # Deprecated
56
+ InitToolRule = "InitToolRule"
57
+ TerminalToolRule = "TerminalToolRule"
58
+ ToolRule = "ToolRule"
@@ -9,7 +9,7 @@ from letta.schemas.letta_base import LettaBase
9
9
  class BaseToolRule(LettaBase):
10
10
  __id_prefix__ = "tool_rule"
11
11
  tool_name: str = Field(..., description="The name of the tool. Must exist in the database for the user's organization.")
12
- type: ToolRuleType
12
+ type: ToolRuleType = Field(..., description="The type of the message.")
13
13
 
14
14
 
15
15
  class ChildToolRule(BaseToolRule):
@@ -2,7 +2,7 @@ import importlib
2
2
  import warnings
3
3
  from typing import List, Optional
4
4
 
5
- from letta.constants import BASE_MEMORY_TOOLS, BASE_TOOLS, MULTI_AGENT_TOOLS
5
+ from letta.constants import BASE_FUNCTION_RETURN_CHAR_LIMIT, BASE_MEMORY_TOOLS, BASE_TOOLS, MULTI_AGENT_TOOLS
6
6
  from letta.functions.functions import derive_openai_json_schema, load_function_set
7
7
  from letta.log import get_logger
8
8
  from letta.orm.enums import ToolType
@@ -200,6 +200,7 @@ class ToolManager:
200
200
  tags=tags,
201
201
  source_type="python",
202
202
  tool_type=tool_type,
203
+ return_char_limit=BASE_FUNCTION_RETURN_CHAR_LIMIT,
203
204
  ),
204
205
  actor=actor,
205
206
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: letta-nightly
3
- Version: 0.6.17.dev20250129174639
3
+ Version: 0.6.19.dev20250130002201
4
4
  Summary: Create LLM agents with long-term memory and custom tools
5
5
  License: Apache License
6
6
  Author: Letta Team
@@ -1,6 +1,6 @@
1
- letta/__init__.py,sha256=45zX5RUC_aJSVvqltsKJXMJfygW8OOpzVbqb9unbegU,919
1
+ letta/__init__.py,sha256=mpGFNaHH0eZV-lM9FibGipWc-jltrJW033d7eqp66Dw,919
2
2
  letta/__main__.py,sha256=6Hs2PV7EYc5Tid4g4OtcLXhqVHiNYTGzSBdoOnW2HXA,29
3
- letta/agent.py,sha256=VzVh9ZpRElA1n0pGqMkb70FXatOn_Yk1Zaa-aWIpUZE,56526
3
+ letta/agent.py,sha256=3-YDxRLMKPrXnmvZ1qstG2MmH9FU9cUQ0cDYZbFQ9eM,56575
4
4
  letta/benchmark/benchmark.py,sha256=ebvnwfp3yezaXOQyGXkYCDYpsmre-b9hvNtnyx4xkG0,3701
5
5
  letta/benchmark/constants.py,sha256=aXc5gdpMGJT327VuxsT5FngbCK2J41PQYeICBO7g_RE,536
6
6
  letta/chat_only_agent.py,sha256=71Lf-df8y3nsE9IFKpEigaZaWHoWnXnhVChkp1L-83I,4760
@@ -12,7 +12,7 @@ letta/client/client.py,sha256=-h6V_PUunYouEmw_TI0BalEvQcQ9uIOfLBnDMrDSYQQ,138785
12
12
  letta/client/streaming.py,sha256=DzE86XJTg_0j9eC45Hrpy9vPt-Wfo1F-sIv_B7iNV6I,5509
13
13
  letta/client/utils.py,sha256=VCGV-op5ZSmurd4yw7Vhf93XDQ0BkyBT8qsuV7EqfiU,2859
14
14
  letta/config.py,sha256=JFGY4TWW0Wm5fTbZamOwWqk5G8Nn-TXyhgByGoAqy2c,12375
15
- letta/constants.py,sha256=FHCoIheWu7DQwKjn_x6JbMUCgv99AzNAXylVsKYeCfs,7159
15
+ letta/constants.py,sha256=SafL4BPMDzzVhp-Y6Uu51NaZAzOuUAoJhbKYpzbQZoQ,7242
16
16
  letta/data_sources/connectors.py,sha256=R2AssXpqS7wN6VI8AfxvqaZs5S1ZACc4E_FewmR9iZI,7022
17
17
  letta/data_sources/connectors_helper.py,sha256=2TQjCt74fCgT5sw1AP8PalDEk06jPBbhrPG4HVr-WLs,3371
18
18
  letta/embeddings.py,sha256=VgqbUqYL6oTuLOKGOd_8swTRMYIpRTIWJbBthjT8eR8,8838
@@ -21,9 +21,9 @@ letta/functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  letta/functions/ast_parsers.py,sha256=MEFfGxpflUsw34JiY9zdunkpbczAYxte8t4rDPOmXfQ,3620
22
22
  letta/functions/function_sets/base.py,sha256=bOiitkhzqYKwZBiRYrx29AlordiA5IrXw25eVSRK8BY,5984
23
23
  letta/functions/function_sets/extras.py,sha256=Z9yEdBpQFtTjpxkgbtkWMA8GtDWC6ai2bdsRpnv0H_w,4837
24
- letta/functions/function_sets/multi_agent.py,sha256=QPtAW70V93W6BL1CfPD9xI2eE8Y0aIwdVU2V0CkJ_9I,4832
24
+ letta/functions/function_sets/multi_agent.py,sha256=2tu7A_eMwkfXldZWpfwwnq0OXPFTjROo-NjXvuhxOhc,5357
25
25
  letta/functions/functions.py,sha256=NyWLh7a-f4mXti5vM1oWDwXzfA58VmVVqL03O9vosKY,5672
26
- letta/functions/helpers.py,sha256=7T02M73oWwUn3rAAFEIPnNLbewqJ0MB81gF4ok9py00,19300
26
+ letta/functions/helpers.py,sha256=9mNkjzxDo72Xe7Cg5tgbHUT4VyfHc4dygLUONhmVroo,19815
27
27
  letta/functions/schema_generator.py,sha256=qosgp3p27QRTqOCPLrSkCGVdyQsyTTZunXQ_g-YaTkw,20138
28
28
  letta/helpers/__init__.py,sha256=p0luQ1Oe3Skc6sH4O58aHHA3Qbkyjifpuq0DZ1GAY0U,59
29
29
  letta/helpers/tool_rule_solver.py,sha256=VnJfqb5L1Lcipc_tBVGj0om60GKQkMkNLgg6X9VZl2c,6210
@@ -92,7 +92,7 @@ letta/orm/agents_tags.py,sha256=dYSnHz4IWBjyOiQ4RJomX3P0QN76JTlEZEw5eJM6Emg,925
92
92
  letta/orm/base.py,sha256=VjvxF9TwKF9Trf8BJkDgf7D6KrWWopOkUiF18J3IElk,3071
93
93
  letta/orm/block.py,sha256=EjH8lXexHtFIHJ8G-RjNo2oAH834x0Hbn4CER9S4U74,3880
94
94
  letta/orm/blocks_agents.py,sha256=W0dykl9OchAofSuAYZD5zNmhyMabPr9LTJrz-I3A0m4,983
95
- letta/orm/custom_columns.py,sha256=EML5AE5FQ4ugI8MGj4yqfmwBrw7YAcp4_dO6i9oQs6I,5192
95
+ letta/orm/custom_columns.py,sha256=grgUo4kIAd-xsFsWSsOzv3Bw51SA8XZHEJJstLcRI1I,5285
96
96
  letta/orm/enums.py,sha256=HzX3eXhBH-PnpxhBWtWbkV4J6wrStlJaX_OVdZgAdLU,428
97
97
  letta/orm/errors.py,sha256=Se0Guz-gqi-D36NUWSh7AP9zTVCSph9KgZh_trwng4o,734
98
98
  letta/orm/file.py,sha256=7_p7LxityP3NQZVURQYG0kgcZhEkVuMN0Fj4h9YOe1w,1780
@@ -143,7 +143,7 @@ letta/schemas/agent.py,sha256=VmzzaRb4HA20fahzUxU2JOdcIxt2ywLFdTRjbR6Ogyk,11783
143
143
  letta/schemas/block.py,sha256=FYYmRWjH4d4QHMUx_nmIXjv_qJna_l-Ip_4i51wDBPA,5942
144
144
  letta/schemas/embedding_config.py,sha256=RkLbUorFkMWr1tPkn6c2aHrnICjWTbhPY86tIncwXyA,3373
145
145
  letta/schemas/embedding_config_overrides.py,sha256=lkTa4y-EQ2RnaEKtKDM0sEAk7EwNa67REw8DGNNtGQY,84
146
- letta/schemas/enums.py,sha256=UUkeGQNw-9vButo1AXVZLKggLo8QsfO8Zm_fM5pD_zA,1125
146
+ letta/schemas/enums.py,sha256=jfuke35XP_AKfHHBnH1rx1wYjUDWqgDsKnRxdrCpTKA,1213
147
147
  letta/schemas/environment_variables.py,sha256=VRtzOjdeQdHcSHXisk7oJUQlheruxhSWNS0xqlfGzbs,2429
148
148
  letta/schemas/file.py,sha256=ChN2CWzLI2TT9WLItcfElEH0E8b7kzPylF2OQBr6Beg,1550
149
149
  letta/schemas/health.py,sha256=zT6mYovvD17iJRuu2rcaQQzbEEYrkwvAE9TB7iU824c,139
@@ -169,7 +169,7 @@ letta/schemas/sandbox_config.py,sha256=v32V5T73X-VxhDk0g_1RGniK985KMvg2xyLVi1dvM
169
169
  letta/schemas/source.py,sha256=-BQVolcXA2ziCu2ztR6cbTdGUc8G7vGJy7rvpdf1hpg,2880
170
170
  letta/schemas/step.py,sha256=cCmDChQMndy7aMJGH0Z19VbzJkAeFTYuA0cJpzjW2g0,1928
171
171
  letta/schemas/tool.py,sha256=uv3WxTt9SzaoXzwTLNHT2wegWTcaBFQBnBvNJrxeYvs,11022
172
- letta/schemas/tool_rule.py,sha256=LJwi1T474-3zbFGiW7_fegyfduC3F2u7cdlBsV0U_IU,1679
172
+ letta/schemas/tool_rule.py,sha256=SaMHAO5-hlhceQJjz2mDpb7rAN0eDm5yIItDEE7op8o,1732
173
173
  letta/schemas/usage.py,sha256=8oYRH-JX0PfjIu2zkT5Uu3UWQ7Unnz_uHiO8hRGI4m0,912
174
174
  letta/schemas/user.py,sha256=V32Tgl6oqB3KznkxUz12y7agkQicjzW7VocSpj78i6Q,1526
175
175
  letta/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -229,15 +229,15 @@ letta/services/sandbox_config_manager.py,sha256=eWDNTscRG9Gt_Ixho3-daOOno_9Kcebx
229
229
  letta/services/source_manager.py,sha256=0JLKIv405oS5wc6bY5k2bxxZpS9O-VwUGHVdGPbJ3e4,7676
230
230
  letta/services/step_manager.py,sha256=RngrVs2Sd_oDZv_UoQ1ToLY0RnH-6wS1DqIBPRm-Imc,2961
231
231
  letta/services/tool_execution_sandbox.py,sha256=Tjufm58V9XzeYr8oF6g5b3OV5zZ7oPWUTqcC8GsBi9k,23162
232
- letta/services/tool_manager.py,sha256=dSjzjafWGrN2ksCtIMB1bwKwBDzxogyHnfe2bx3-C-4,9069
232
+ letta/services/tool_manager.py,sha256=0zc7bFxGvl_wjs7CC4cyeUWFZAUQK_yVKsUjhrW3Vao,9181
233
233
  letta/services/user_manager.py,sha256=1U8BQ_-MBkEW2wnSFV_OsTwBmRAZLN8uHLFjnDjK3hA,4308
234
234
  letta/settings.py,sha256=sHJEaLPtEnWNZDew69F9tC8YTrkBh5BWXXtzOtAneFY,6071
235
235
  letta/streaming_interface.py,sha256=lo2VAQRUJOdWTijwnXuKOC9uejqr2siUAEmZiQUXkj8,15710
236
236
  letta/streaming_utils.py,sha256=jLqFTVhUL76FeOuYk8TaRQHmPTf3HSRc2EoJwxJNK6U,11946
237
237
  letta/system.py,sha256=3jevN1QOScahsuEW-cavI3GsmiNDTkWryEukb1WTRTo,7752
238
238
  letta/utils.py,sha256=lgBDWKmrQrmJGPxcgamFC2aJyi6I0dX7bzLBt3YC6j0,34051
239
- letta_nightly-0.6.17.dev20250129174639.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
240
- letta_nightly-0.6.17.dev20250129174639.dist-info/METADATA,sha256=tgyuWyEUF9fknxPR4_UDvj-vfT9yORcFe47L17LOpJk,22156
241
- letta_nightly-0.6.17.dev20250129174639.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
242
- letta_nightly-0.6.17.dev20250129174639.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
243
- letta_nightly-0.6.17.dev20250129174639.dist-info/RECORD,,
239
+ letta_nightly-0.6.19.dev20250130002201.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
240
+ letta_nightly-0.6.19.dev20250130002201.dist-info/METADATA,sha256=1G2Tnv3N7ZHoTuUg8QT66ohRrENAtnVpcN5WDOxYnSs,22156
241
+ letta_nightly-0.6.19.dev20250130002201.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
242
+ letta_nightly-0.6.19.dev20250130002201.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
243
+ letta_nightly-0.6.19.dev20250130002201.dist-info/RECORD,,