Skip to content

async model stream interface #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Jul 3, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
01f7d1b
async models
pgrayy Jun 27, 2025
0fd2671
Merge branch 'main' of https://github.com/strands-agents/sdk-python i…
pgrayy Jun 30, 2025
ab2c088
lint
pgrayy Jun 30, 2025
3fd243e
tests
pgrayy Jun 30, 2025
d9deb93
agent - asyncio.run stream_async in call
pgrayy Jun 30, 2025
b864b65
tests - agenerator helper
pgrayy Jun 30, 2025
bd2adff
tests - agent - stream async result
pgrayy Jun 30, 2025
7ea90e9
lint
pgrayy Jun 30, 2025
3462e1d
agent - stream async - result
pgrayy Jun 30, 2025
8063c08
typing
pgrayy Jun 30, 2025
f8e58a1
tests - anext
pgrayy Jun 30, 2025
5bb0620
tests - alist
pgrayy Jun 30, 2025
760fcfb
lint
pgrayy Jun 30, 2025
61bb44d
tests - async utilities - scope session
pgrayy Jun 30, 2025
e47567f
tests integ - conftest
pgrayy Jun 30, 2025
90aaa47
Merge branch 'main' of https://github.com/strands-agents/sdk-python i…
pgrayy Jul 1, 2025
ccc44d9
lint
pgrayy Jul 1, 2025
e8c7bda
tests - async mock model provider
pgrayy Jul 1, 2025
17b24b3
lint
pgrayy Jul 1, 2025
6f46740
Merge branch 'main' of https://github.com/strands-agents/sdk-python i…
pgrayy Jul 2, 2025
1c667d9
async invoke and structured output
pgrayy Jul 2, 2025
21f80cc
thread asyncio run
pgrayy Jul 2, 2025
885f98d
test async threading
pgrayy Jul 2, 2025
773bef1
lint
pgrayy Jul 2, 2025
eb1ffd5
move invoke_async up for clarity
pgrayy Jul 2, 2025
2ce4581
Merge branch 'main' of https://github.com/strands-agents/sdk-python i…
pgrayy Jul 3, 2025
3a58ef4
lint
pgrayy Jul 3, 2025
780b13e
tests
pgrayy Jul 3, 2025
5761545
Merge branch 'main' of https://github.com/strands-agents/sdk-python i…
pgrayy Jul 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tests - anext
  • Loading branch information
pgrayy committed Jun 30, 2025
commit f8e58a13d15c7b14ed189a2fa55dd1c6edf1a35e
4 changes: 2 additions & 2 deletions tests/strands/models/test_anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ async def test_stream_bad_request_overflow_error(overflow_message, anthropic_cli
)

with pytest.raises(ContextWindowOverflowException):
[_ async for _ in model.stream({})]
await anext(model.stream({}))


@pytest.mark.asyncio
Expand All @@ -701,7 +701,7 @@ async def test_stream_bad_request_error(anthropic_client, model):
)

with pytest.raises(anthropic.BadRequestError, match="bad"):
[_ async for _ in model.stream({})]
await anext(model.stream({}))


@pytest.mark.asyncio
Expand Down
4 changes: 2 additions & 2 deletions tests/strands/models/test_mistral.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ async def test_structured_output_no_tool_calls(mistral_client, model, test_outpu

with pytest.raises(ValueError, match="No tool calls found in response"):
stream = model.structured_output(test_output_model_cls, prompt)
[_ async for _ in stream]
await anext(stream)


@pytest.mark.asyncio
Expand All @@ -498,4 +498,4 @@ async def test_structured_output_invalid_json(mistral_client, model, test_output

with pytest.raises(ValueError, match="Failed to parse tool call arguments into model"):
stream = model.structured_output(test_output_model_cls, prompt)
[_ async for _ in stream]
await anext(stream)