File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -640,6 +640,7 @@ async def run(
640640 model_responses .append (turn_result .model_response )
641641 original_input = turn_result .original_input
642642 generated_items = turn_result .generated_items
643+ context_wrapper .run_items = generated_items
643644
644645 if server_conversation_tracker is not None :
645646 server_conversation_tracker .track_server_items (turn_result .model_response )
@@ -1080,6 +1081,7 @@ async def _start_streaming(
10801081 ]
10811082 streamed_result .input = turn_result .original_input
10821083 streamed_result .new_items = turn_result .generated_items
1084+ context_wrapper .run_items = turn_result .generated_items
10831085
10841086 if server_conversation_tracker is not None :
10851087 server_conversation_tracker .track_server_items (turn_result .model_response )
Original file line number Diff line number Diff line change 11from dataclasses import dataclass , field
2- from typing import Any , Generic
2+ from typing import Any , Generic , TYPE_CHECKING
33
4- from typing_extensions import TypeVar
54
5+ from typing_extensions import TypeVar
66from .usage import Usage
77
8+ if TYPE_CHECKING :
9+ from .items import RunItem
10+
811TContext = TypeVar ("TContext" , default = Any )
912
1013
14+
1115@dataclass
1216class RunContextWrapper (Generic [TContext ]):
13- """This wraps the context object that you passed to `Runner.run()`. It also contains
17+ """
18+ This wraps the context object that you passed to `Runner.run()`. It also contains
1419 information about the usage of the agent run so far.
1520
1621 NOTE: Contexts are not passed to the LLM. They're a way to pass dependencies and data to code
@@ -24,3 +29,6 @@ class RunContextWrapper(Generic[TContext]):
2429 """The usage of the agent run so far. For streamed responses, the usage will be stale until the
2530 last chunk of the stream is processed.
2631 """
32+
33+ run_items : list ["RunItem" ] = field (default_factory = list )
34+ """The items generated by the agent so far."""
You can’t perform that action at this time.
0 commit comments