Skip to content

Fix async await error in streaming notebook#108

Open
0xrdan wants to merge 1 commit intoanthropics:masterfrom
0xrdan:fix/issue-73-async-await-error
Open

Fix async await error in streaming notebook#108
0xrdan wants to merge 1 commit intoanthropics:masterfrom
0xrdan:fix/issue-73-async-await-error

Conversation

@0xrdan
Copy link

@0xrdan 0xrdan commented Jan 8, 2026

Replace top-level await with asyncio.run() in cells demonstrating async streaming helpers. Top-level await is not supported in Python 3.13 when running as a standalone script.

Changes:

  • Add import asyncio to async cells
  • Replace await streaming_with_helpers() with asyncio.run(streaming_with_helpers())
  • Replace await streaming_events_demo() with asyncio.run(streaming_events_demo())

Fixes #73

Replace top-level `await` with `asyncio.run()` in cells demonstrating
async streaming helpers. Top-level await is not supported in Python 3.13
when running as a standalone script.

Changes:
- Add `import asyncio` to async cells
- Replace `await streaming_with_helpers()` with `asyncio.run(streaming_with_helpers())`
- Replace `await streaming_events_demo()` with `asyncio.run(streaming_events_demo())`

Fixes anthropics#73

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In [79] in anthropic_api_fundamentals/05_Streaming.ipynb error. Await must be inside async function.

1 participant