Skip to content

Commit 4451d91

Browse files
committed
fix: Address PR comments
1 parent 24b2520 commit 4451d91

File tree

2 files changed

+7
-31
lines changed

2 files changed

+7
-31
lines changed

tests/strands/agent/test_agent.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2091,7 +2091,10 @@ def shell(command: str):
20912091
)
20922092

20932093
agent = Agent(tools=[shell], model=model)
2094-
agent("Test")
2094+
result = agent("Test")
2095+
2096+
# Ensure the stop_reason is
2097+
assert result.stop_reason == "end_turn"
20952098

20962099
# Assert that there exists a message with a toolResponse
20972100
assert agent.messages[-2] == {
@@ -2106,3 +2109,6 @@ def shell(command: str):
21062109
],
21072110
"role": "user",
21082111
}
2112+
2113+
# And that it continued to the LLM call
2114+
assert agent.messages[-1] == {"content": [{"text": "I invoked a tool!"}], "role": "assistant"}

tests/strands/event_loop/test_event_loop.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -400,36 +400,6 @@ async def test_event_loop_cycle_tool_result_error(
400400
await alist(stream)
401401

402402

403-
@pytest.mark.asyncio
404-
async def test_event_loop_with_tool_result_valid(
405-
agent,
406-
model,
407-
tool_stream,
408-
mock_tracer,
409-
agenerator,
410-
alist,
411-
):
412-
# Setup
413-
414-
# Set up model to return tool use and then text response
415-
model.stream.side_effect = [
416-
agenerator(tool_stream),
417-
agenerator(
418-
[
419-
{"contentBlockDelta": {"delta": {"text": "test text"}}},
420-
{"contentBlockStop": {}},
421-
]
422-
),
423-
]
424-
425-
# Call event_loop_cycle which should execute a tool
426-
stream = strands.event_loop.event_loop.event_loop_cycle(
427-
agent=agent,
428-
invocation_state={},
429-
)
430-
await alist(stream)
431-
432-
433403
@pytest.mark.asyncio
434404
async def test_event_loop_cycle_tool_result_no_tool_handler(
435405
agent,

0 commit comments

Comments
 (0)