3636from .agents .llm_agent import LlmAgent
3737from .agents .run_config import RunConfig
3838from .apps .app import App
39+ from .apps .app import ResumabilityConfig
3940from .artifacts .base_artifact_service import BaseArtifactService
4041from .artifacts .in_memory_artifact_service import InMemoryArtifactService
4142from .auth .credential_service .base_credential_service import BaseCredentialService
@@ -74,6 +75,8 @@ class Runner:
7475 session_service: The session service for the runner.
7576 memory_service: The memory service for the runner.
7677 credential_service: The credential service for the runner.
78+ context_cache_config: The context cache config for the runner.
79+ resumability_config: The resumability config for the application.
7780 """
7881
7982 app_name : str
@@ -90,6 +93,10 @@ class Runner:
9093 """The memory service for the runner."""
9194 credential_service : Optional [BaseCredentialService ] = None
9295 """The credential service for the runner."""
96+ context_cache_config : Optional [ContextCacheConfig ] = None
97+ """The context cache config for the runner."""
98+ resumability_config : Optional [ResumabilityConfig ] = None
99+ """The resumability config for the application."""
93100
94101 def __init__ (
95102 self ,
@@ -110,11 +117,11 @@ def __init__(
110117 `ValueError`. Providing `app` is the recommended way to create a runner.
111118
112119 Args:
120+ app: An optional `App` instance. If provided, `app_name` and `agent`
121+ should not be specified.
113122 app_name: The application name of the runner. Required if `app` is not
114123 provided.
115124 agent: The root agent to run. Required if `app` is not provided.
116- app: An optional `App` instance. If provided, `app_name` and `agent`
117- should not be specified.
118125 plugins: Deprecated. A list of plugins for the runner. Please use the
119126 `app` argument to provide plugins instead.
120127 artifact_service: The artifact service for the runner.
@@ -126,9 +133,13 @@ def __init__(
126133 ValueError: If `app` is provided along with `app_name` or `plugins`, or
127134 if `app` is not provided but either `app_name` or `agent` is missing.
128135 """
129- self .app_name , self .agent , self .context_cache_config , plugins = (
130- self ._validate_runner_params (app , app_name , agent , plugins )
131- )
136+ (
137+ self .app_name ,
138+ self .agent ,
139+ self .context_cache_config ,
140+ self .resumability_config ,
141+ plugins ,
142+ ) = self ._validate_runner_params (app , app_name , agent , plugins )
132143 self .artifact_service = artifact_service
133144 self .session_service = session_service
134145 self .memory_service = memory_service
@@ -142,7 +153,11 @@ def _validate_runner_params(
142153 agent : Optional [BaseAgent ],
143154 plugins : Optional [List [BasePlugin ]],
144155 ) -> tuple [
145- str , BaseAgent , Optional [ContextCacheConfig ], Optional [List [BasePlugin ]]
156+ str ,
157+ BaseAgent ,
158+ Optional [ContextCacheConfig ],
159+ Optional [ResumabilityConfig ],
160+ Optional [List [BasePlugin ]],
146161 ]:
147162 """Validates and extracts runner parameters.
148163
@@ -153,7 +168,8 @@ def _validate_runner_params(
153168 plugins: A list of plugins for the runner.
154169
155170 Returns:
156- A tuple containing (app_name, agent, context_cache_config, plugins).
171+ A tuple containing (app_name, agent, context_cache_config,
172+ resumability_config, plugins).
157173
158174 Raises:
159175 ValueError: If parameters are invalid.
@@ -174,20 +190,22 @@ def _validate_runner_params(
174190 agent = app .root_agent
175191 plugins = app .plugins
176192 context_cache_config = app .context_cache_config
193+ resumability_config = app .resumability_config
177194 elif not app_name or not agent :
178195 raise ValueError (
179196 'Either app or both app_name and agent must be provided.'
180197 )
181198 else :
182199 context_cache_config = None
200+ resumability_config = None
183201
184202 if plugins :
185203 warnings .warn (
186204 'The `plugins` argument is deprecated. Please use the `app` argument'
187205 ' to provide plugins instead.' ,
188206 DeprecationWarning ,
189207 )
190- return app_name , agent , context_cache_config , plugins
208+ return app_name , agent , context_cache_config , resumability_config , plugins
191209
192210 def run (
193211 self ,
@@ -264,6 +282,7 @@ async def run_async(
264282 user_id: The user ID of the session.
265283 session_id: The session ID of the session.
266284 new_message: A new message to append to the session.
285+ state_delta: Optional state changes to apply to the session.
267286 run_config: The run config for the agent.
268287
269288 Yields:
@@ -687,6 +706,7 @@ def _new_invocation_context(
687706 user_content = new_message ,
688707 live_request_queue = live_request_queue ,
689708 run_config = run_config ,
709+ resumability_config = self .resumability_config ,
690710 )
691711
692712 def _new_invocation_context_for_live (
0 commit comments