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: v1 sdk tests directly subscripting from list endpoints (#6054)

jnjpnga66a8187cd99
diff --git a/tests/integration_test_send_message_v2.py b/tests/integration_test_send_message_v2.py
index 8a65ddf2c..2d0dc0997 100644
--- a/tests/integration_test_send_message_v2.py
+++ b/tests/integration_test_send_message_v2.py
@@ -526,6 +526,7 @@ async def test_greeting(
assert run.status == JobStatus.completed
[email protected](reason="Skipping parallel tool calling test until it is fixed")
@pytest.mark.parametrize(
"llm_config",
TESTED_LLM_CONFIGS,
diff --git a/tests/sdk_v1/integration/integration_test_send_message.py b/tests/sdk_v1/integration/integration_test_send_message.py
index 7aa609436..13a887c2d 100644
--- a/tests/sdk_v1/integration/integration_test_send_message.py
+++ b/tests/sdk_v1/integration/integration_test_send_message.py
@@ -889,7 +889,7 @@ def agent_state(client: Letta) -> AgentState:
client.tools.upsert_base_tools()
dice_tool = client.tools.upsert_from_function(func=roll_dice)
- send_message_tool = client.tools.list(name="send_message")[0]
+ send_message_tool = client.tools.list(name="send_message").items[0]
agent_state_instance = client.agents.create(
name="supervisor",
include_base_tools=False,
@@ -1497,7 +1497,7 @@ def test_background_token_streaming_greeting_with_assistant_message(
run_id = messages[0].run_id
assert run_id is not None
- runs = client.runs.list(agent_ids=[agent_state.id], background=True)
+ runs = client.runs.list(agent_ids=[agent_state.id], background=True).items
assert len(runs) > 0
assert runs[0].id == run_id
diff --git a/tests/sdk_v1/integration/integration_test_send_message_v2.py b/tests/sdk_v1/integration/integration_test_send_message_v2.py
index 20056594b..03a38e930 100644
--- a/tests/sdk_v1/integration/integration_test_send_message_v2.py
+++ b/tests/sdk_v1/integration/integration_test_send_message_v2.py
@@ -579,7 +579,7 @@ async def test_greeting(
# If run_id is not in messages (e.g., due to early cancellation), get the most recent run
if run_id is None:
runs = await client.runs.list(agent_ids=[agent_state.id])
- run_id = runs[0].id if runs else None
+ run_id = runs.items[0].id if runs.items else None
assert_greeting_response(
messages, streaming=("stream" in send_type), token_streaming=(send_type == "stream_tokens"), llm_config=llm_config
@@ -850,7 +850,7 @@ async def test_tool_call(
# If run_id is not in messages (e.g., due to early cancellation), get the most recent run
if run_id is None:
runs = await client.runs.list(agent_ids=[agent_state.id])
- run_id = runs[0].id if runs else None
+ run_id = runs.items[0].id if runs.items else None
assert_tool_call_response(
messages, streaming=("stream" in send_type), llm_config=llm_config, with_cancellation=(cancellation == "with_cancellation")