Skip to content

Conversation

TheDev05
Copy link
Contributor

Wrapped the tutorial code in async def main() with asyncio.run() since top-level await is not valid in Python scripts.
This makes the tutorial fully copy-paste runnable as intended and prevents SyntaxError: 'await' outside async function.

Problem

The MCP client code was using await outside of an async function, causing a SyntaxError: 'await' outside async function when trying to run the script. Without proper async function wrapping, the code would throw this error and not be executable.

Changes

wrap async/await code in proper async function

  • Add asyncio import for async execution
  • Wrap main code in async def main() function
  • Add asyncio.run(main()) to execute async code
  • Makes code copy-paste ready and immediately runnable

Wrapped the tutorial code in async def main() with asyncio.run() since top-level await is not valid in Python scripts.
This makes the tutorial fully copy-paste runnable as intended and prevents SyntaxError: 'await' outside async function.
Copy link

vercel bot commented Aug 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
langgraph-docs-preview Ready Ready Preview Comment Aug 20, 2025 1:34pm

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.

1 participant