8000 feat: add toolset cleanup logic to run_cli · linuxem/adk-python@a134ba6 · GitHub
[go: up one dir, main page]

Skip to content

Commit a134ba6

Browse files
seanzhougooglecopybara-github
authored andcommitted
feat: add toolset cleanup logic to run_cli
PiperOrigin-RevId: 762638389
1 parent 7067c03 commit a134ba6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/google/adk/cli/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ async def run_interactively(
9696
if event.content and event.content.parts:
9797
if text := ''.join(part.text or '' for part in event.content.parts):
9898
click.echo(f'[{event.author}]: {text}')
99+
await runner.close()
99100

100101

101102
async def run_cli(
@@ -145,7 +146,7 @@ async def run_cli(
145146
input_path=input_file,
146147
)
147148
elif saved_session_file:
148-
with open(saved_session_file, 'r') as f:
149+
with open(saved_session_file, 'r', encoding='utf-8') as f:
149150
loaded_session = Session.model_validate_json(f.read())
150151

151152
if loaded_session:
@@ -184,7 +185,7 @@ async def run_cli(
184185
user_id=session.user_id,
185186
session_id=session.id,
186187
)
187-
with open(session_path, 'w') as f:
188+
with open(session_path, 'w', encoding='utf-8') as f:
188189
f.write(session.model_dump_json(indent=2, exclude_none=True))
189190

190191
print('Session saved to', session_path)

0 commit comments

Comments
 (0)
0