1919import logging
2020from pathlib import Path
2121import queue
22+ import sys
2223from typing import Any
2324from typing import AsyncGenerator
2425from typing import Callable
@@ -985,16 +986,16 @@ async def run_debug(
985986 over session management, event streaming, and error handling.
986987
987988 Args:
988- user_messages: Message(s) to send to the agent. Can be:
989- - Single string: "What is 2+2?"
990- - List of strings: ["Hello!", "What's my name?"]
989+ user_messages: Message(s) to send to the agent. Can be: - Single string:
990+ "What is 2+2?" - List of strings: ["Hello!", "What's my name?"]
991991 user_id: User identifier. Defaults to "debug_user_id".
992- session_id: Session identifier for conversation persistence.
993- Defaults to "debug_session_id". Reuse the same ID to continue a conversation.
992+ session_id: Session identifier for conversation persistence. Defaults to
993+ "debug_session_id". Reuse the same ID to continue a conversation.
994994 run_config: Optional configuration for the agent execution.
995- quiet: If True, suppresses console output. Defaults to False (output shown).
996- verbose: If True, shows detailed tool calls and responses. Defaults to False
997- for cleaner output showing only final agent responses.
995+ quiet: If True, suppresses console output. Defaults to False (output
996+ shown).
997+ verbose: If True, shows detailed tool calls and responses. Defaults to
998+ False for cleaner output showing only final agent responses.
998999
9991000 Returns:
10001001 list[Event]: All events from all messages.
@@ -1011,7 +1012,8 @@ async def run_debug(
10111012 >>> await runner.run_debug(["Hello!", "What's my name?"])
10121013
10131014 Continue a debug session:
1014- >>> await runner.run_debug("What did we discuss?") # Continues default session
1015+ >>> await runner.run_debug("What did we discuss?") # Continues default
1016+ session
10151017
10161018 Separate debug sessions:
10171019 >>> await runner.run_debug("Hi", user_id="alice", session_id="debug1")
@@ -1353,7 +1355,12 @@ async def close(self):
13531355
13541356 logger .info ('Runner closed.' )
13551357
1356- async def __aenter__ (self ):
1358+ if sys .version_info < (3 , 11 ):
1359+ Self = 'Runner' # pylint: disable=invalid-name
1360+ else :
1361+ from typing import Self # pylint: disable=g-import-not-at-top
1362+
1363+ async def __aenter__ (self ) -> Self :
13571364 """Async context manager entry."""
13581365 return self
13591366
0 commit comments