Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix: docker tests - local sandbox call and agent listing tests (#1888)

Andy Li4a2bf46f0169
diff --git a/letta/services/tool_executor/tool_execution_sandbox.py b/letta/services/tool_executor/tool_execution_sandbox.py
index 1bc51feb9..2588caf74 100644
--- a/letta/services/tool_executor/tool_execution_sandbox.py
+++ b/letta/services/tool_executor/tool_execution_sandbox.py
@@ -204,12 +204,7 @@ class ToolExecutionSandbox:
try:
log_event(name="start subprocess")
result = subprocess.run(
- [python_executable, temp_file_path],
- env=env,
- cwd=sandbox_dir,
- timeout=60,
- capture_output=True,
- text=True,
+ [python_executable, temp_file_path], env=env, cwd=sandbox_dir, timeout=60, capture_output=True, text=True, check=True
)
log_event(name="finish subprocess")
func_result, stdout = self.parse_out_function_results_markers(result.stdout)
diff --git a/tests/test_client.py b/tests/test_client.py
index 280e50c7a..4ae4828dd 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -505,9 +505,8 @@ def test_function_always_error(client: Letta):
assert response_message, "ToolReturnMessage message not found in response"
assert response_message.status == "error"
- assert (
- response_message.tool_return == "Error executing function testing_method: ZeroDivisionError: division by zero"
- ), response_message.tool_return
+ assert "Error executing function testing_method" in response_message.tool_return, response_message.tool_return
+ assert "ZeroDivisionError: division by zero" in response_message.stderr[0]
client.agents.delete(agent_id=agent.id)
@@ -642,9 +641,9 @@ def test_agent_listing(client: Letta, agent, search_agent_one, search_agent_two)
assert len(all_ids) == 2
assert all_ids == {search_agent_one.id, search_agent_two.id}
- # Test listing without any filters
+ # Test listing without any filters; make less flakey by checking we have at least 3 agents in case created elsewhere
all_agents = client.agents.list()
- assert len(all_agents) == 3
+ assert len(all_agents) >= 3
assert all(agent.id in {a.id for a in all_agents} for agent in [search_agent_one, search_agent_two, agent])