Runner executes an agent and connects it to sessions, tools, and tracing. VeADK adds the convenient run() entry point on top of Google ADK’s event execution interface. Use run_async() when you need to process individual events
Minimal run
Complete installation and model configuration. Save asapp.py and run python app.py; the terminal should print the model’s text response
app.py
run() is asynchronous: call it with await or asyncio.run(). Sessions use process memory by default. Reusing the application, user, and session identifiers continues a conversation; in-memory sessions disappear when the process exits
Assign an explicit
session_id to each conversation instead of relying on the default temporary value to generate independent sessions. run() returns the last retained text part and may return an empty string. Use run_async() for multipart output, tool events, and complete structured resultsMulti-tenant isolation
app_name, user_id, and session_id locate data; they do not authenticate users or authorize access. Obtain user identifiers from verified request identities instead of trusting arbitrary client-provided user_id values
Streaming events
run_async() returns an asynchronous event stream. Unlike run(), it requires an existing session. This example requests streaming with StreamingMode.SSE but prints only complete responses to avoid displaying both partial chunks and the same complete text
stream.py
stream.py and run python stream.py. If tools are configured, the terminal also displays tool call and result names. Incremental output depends on model and runtime support; consuming events does not mean every runtime returns individual tokens
To display text incrementally, use partial=True events to update the current response and replace it with the complete text when that event arrives. Do not append both forms to the same output
Parsing events
part.text contains text, part.thought marks reasoning content, and part.function_call and part.function_response represent tool calls and results. Handle each content type separately when displaying results. Avoid printing complete tool arguments that may contain credentials or sensitive data
Parameters and behavior
Runner constructor
ADK’s
session_service, memory_service, and credential_service can be supplied as keyword arguments. Explicit services take precedence over agent configuration. When supplying a session service, create sessions through that service and use run_async() so creation and reads use the same backend. See the Runner reference for other ADK parameters
run parameters
VeADK
run() returns an empty string when the model-call limit is reached. To distinguish this from a response without text or other failures, consume run_async() events and handle execution errors