Skip to content

Conversation

SeeYangZhi
Copy link
Contributor

@SeeYangZhi SeeYangZhi commented Aug 19, 2025

Introduces an optional 'context' argument to the run_demo_loop function and passes it to Runner.run and Runner.run_streamed. This allows additional context information to be provided during agent execution for enhanced flexibility.

Introduces an optional 'context' argument to the run_demo_loop function and passes it to Runner.run and Runner.run_streamed. This allows additional context information to be provided during agent execution for enhanced flexibility.
@@ -11,7 +11,7 @@
from .stream_events import AgentUpdatedStreamEvent, RawResponsesStreamEvent, RunItemStreamEvent


async def run_demo_loop(agent: Agent[Any], *, stream: bool = True) -> None:
async def run_demo_loop(agent: Agent[Any], *, stream: bool = True, context: Any = None) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having this additional argument is fine, but we would like to avoid Any type here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay thanks, I have updated it to be TContext | None

Changed the type annotation for the context parameter in run_demo_loop from Any to TContext | None for improved type safety and clarity.
@SeeYangZhi SeeYangZhi requested a review from seratch August 19, 2025 09:29
@seratch seratch merged commit f903ad0 into openai:main Aug 19, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature:core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants