@@ -188,7 +188,7 @@ def run(
188188 user_id : str ,
189189 session_id : str ,
190190 new_message : types .Content ,
191- run_config : RunConfig = RunConfig () ,
191+ run_config : Optional [ RunConfig ] = None ,
192192 ) -> Generator [Event , None , None ]:
193193 """Runs the agent.
194194
@@ -205,6 +205,7 @@ def run(
205205 Yields:
206206 The events generated by the agent.
207207 """
208+ run_config = run_config or RunConfig ()
208209 event_queue = queue .Queue ()
209210
210211 async def _invoke_run_async ():
@@ -248,7 +249,7 @@ async def run_async(
248249 session_id : str ,
249250 new_message : types .Content ,
250251 state_delta : Optional [dict [str , Any ]] = None ,
251- run_config : RunConfig = RunConfig () ,
252+ run_config : Optional [ RunConfig ] = None ,
252253 ) -> AsyncGenerator [Event , None ]:
253254 """Main entry method to run the agent in this runner.
254255
@@ -261,6 +262,7 @@ async def run_async(
261262 Yields:
262263 The events generated by the agent.
263264 """
265+ run_config = run_config or RunConfig ()
264266
265267 async def _run_with_trace (
266268 new_message : types .Content ,
@@ -426,7 +428,7 @@ async def run_live(
426428 user_id : Optional [str ] = None ,
427429 session_id : Optional [str ] = None ,
428430 live_request_queue : LiveRequestQueue ,
429- run_config : RunConfig = RunConfig () ,
431+ run_config : Optional [ RunConfig ] = None ,
430432 session : Optional [Session ] = None ,
431433 ) -> AsyncGenerator [Event , None ]:
432434 """Runs the agent in live mode (experimental feature).
@@ -452,6 +454,7 @@ async def run_live(
452454 .. NOTE::
453455 Either `session` or both `user_id` and `session_id` must be provided.
454456 """
457+ run_config = run_config or RunConfig ()
455458 if session is None and (user_id is None or session_id is None ):
456459 raise ValueError (
457460 'Either session or user_id and session_id must be provided.'
@@ -601,7 +604,7 @@ def _new_invocation_context(
601604 * ,
602605 new_message : Optional [types .Content ] = None ,
603606 live_request_queue : Optional [LiveRequestQueue ] = None ,
604- run_config : RunConfig = RunConfig () ,
607+ run_config : Optional [ RunConfig ] = None ,
605608 ) -> InvocationContext :
606609 """Creates a new invocation context.
607610
@@ -614,6 +617,7 @@ def _new_invocation_context(
614617 Returns:
615618 The new invocation context.
616619 """
620+ run_config = run_config or RunConfig ()
617621 invocation_id = new_invocation_context_id ()
618622
619623 if run_config .support_cfc and isinstance (self .agent , LlmAgent ):
@@ -645,9 +649,10 @@ def _new_invocation_context_for_live(
645649 session : Session ,
646650 * ,
647651 live_request_queue : Optional [LiveRequestQueue ] = None ,
648- run_config : RunConfig = RunConfig () ,
652+ run_config : Optional [ RunConfig ] = None ,
649653 ) -> InvocationContext :
650654 """Creates a new invocation context for live multi-agent."""
655+ run_config = run_config or RunConfig ()
651656
652657 # For live multi-agent, we need model's text transcription as context for
653658 # next agent.
0 commit comments