Skip to content

Commit dad76cf

Browse files
fix(runner): change agent to optional to compatible with app argument (#323)
1 parent a88b97c commit dad76cf

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

veadk/runner.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,9 @@ class Runner(ADKRunner):
303303

304304
def __init__(
305305
self,
306-
agent: BaseAgent | Agent,
306+
agent: BaseAgent | Agent | None = None,
307307
short_term_memory: ShortTermMemory | None = None,
308-
app_name: str = "veadk_default_app",
308+
app_name: str | None = None,
309309
user_id: str = "veadk_default_user",
310310
upload_inline_data_to_tos: bool = False,
311311
run_processor: "BaseRunProcessor | None" = None,
@@ -324,15 +324,15 @@ def __init__(
324324
agent (google.adk.agents.base_agent.BaseAgent | veadk.agent.Agent):
325325
The agent instance used to run interactions.
326326
short_term_memory (ShortTermMemory | None): Optional short-term memory; if
327-
not provided and no external ``session_service`` is supplied, an in-memory
327+
not provided and no external `session_service` is supplied, an in-memory
328328
session service will be created.
329-
app_name (str): Application name. Defaults to ``"veadk_default_app"``.
330-
user_id (str): Default user ID. Defaults to ``"veadk_default_user"``.
331-
upload_inline_data_to_tos (bool): Whether to enable inline media upload. Defaults to ``False``.
329+
app_name (str): Application name. Defaults to `veadk_default_app`.
330+
user_id (str): Default user ID. Defaults to `veadk_default_user`.
331+
upload_inline_data_to_tos (bool): Whether to enable inline media upload. Defaults to `False`.
332332
run_processor (BaseRunProcessor | None): Optional run processor for intercepting agent execution.
333333
If not provided, will try to get from agent. If agent doesn't have one, uses NoOpRunProcessor.
334-
*args: Positional args passed through to ``ADKRunner``.
335-
**kwargs: Keyword args passed through to ``ADKRunner``; may include
334+
*args: Positional args passed through to `ADKRunner`.
335+
**kwargs: Keyword args passed through to `ADKRunner`; may include
336336
``session_service`` and ``memory_service`` to override defaults.
337337
338338
Returns:
@@ -393,6 +393,10 @@ def __init__(
393393
else:
394394
logger.info("No long term memory provided.")
395395

396+
# For forward compatibility, we pass app_name to ADKRunner.
397+
if not kwargs.get("app") and not app_name:
398+
app_name = "veadk_default_app"
399+
396400
super().__init__(
397401
agent=agent,
398402
session_service=session_service,

0 commit comments

Comments
 (0)