Skip to content

Commit 8ddddc0

Browse files
DeanChensjcopybara-github
authored andcommitted
chore: Use factory method to create invocation context in the runner
Co-authored-by: Shangjie Chen <deanchen@google.com> PiperOrigin-RevId: 876474267
1 parent dff4c44 commit 8ddddc0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/google/adk/runners.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,10 @@ def _find_user_message_for_invocation(
13811381
return event.content
13821382
return None
13831383

1384+
def _create_invocation_context(self, **kwargs) -> InvocationContext:
1385+
"""Creates an InvocationContext instance."""
1386+
return InvocationContext(**kwargs)
1387+
13841388
def _new_invocation_context(
13851389
self,
13861390
session: Session,
@@ -1415,7 +1419,7 @@ def _new_invocation_context(
14151419
if not isinstance(self.agent.code_executor, BuiltInCodeExecutor):
14161420
self.agent.code_executor = BuiltInCodeExecutor()
14171421

1418-
return InvocationContext(
1422+
return self._create_invocation_context(
14191423
artifact_service=self.artifact_service,
14201424
session_service=self.session_service,
14211425
memory_service=self.memory_service,

0 commit comments

Comments
 (0)