Skip to content

Commit 9117215

Browse files
committed
Update test_agent.py
1 parent 12dfcc6 commit 9117215

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

examples/tutorials/00_sync/010_multiturn/tests/test_agent.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@ def test_send_message(self, test_agent):
5757
# Validate that "tennis" appears in the response because that is what our model does
5858
assert "tennis" in response.content.lower()
5959

60+
states = test_agent.client.states.list(task_id=test_agent.task_id)
61+
assert len(states) == 1
62+
63+
state = states[0]
64+
assert state.state is not None
65+
assert state.state.get("system_prompt") == "You are a helpful assistant that can answer questions."
66+
6067
# Verify conversation history
61-
message_history = test_agent.get_conversation_history()
68+
message_history = test_agent.client.messages.list(task_id=test_agent.task_id)
6269
assert len(message_history) == (i + 1) * 2 # user + agent messages
6370

6471

@@ -88,9 +95,11 @@ def test_stream_message(self, test_agent):
8895
# Validate that "tennis" appears in the response because that is what our model does
8996
assert "tennis" in aggregated_content.lower()
9097

91-
# Verify conversation history (only user messages tracked with streaming)
92-
message_history = test_agent.get_conversation_history()
93-
assert len(message_history) == (i + 1), f"Expected {(i + 1)} user messages, got {len(message_history)}"
98+
states = test_agent.client.states.list(task_id=test_agent.task_id)
99+
assert len(states) == 1
100+
101+
message_history = test_agent.client.messages.list(task_id=test_agent.task_id)
102+
assert len(message_history) == (i + 1) * 2 # user + agent messages
94103

95104

96105
if __name__ == "__main__":

0 commit comments

Comments
 (0)