Introduces two major capabilities: - Workflow runtime: graph-based execution engine for composing deterministic execution flows for agentic apps, with support for routing, fan-out/fan-in, loops, retry, state management, dynamic nodes, human-in-the-loop, and nested workflows - Task API: structured agent-to-agent delegation with multi-turn task mode, single-turn controlled output, mixed delegation patterns, human-in-the-loop, and task agents as workflow nodes Co-Authored-By: Bo Yang <ybo@google.com> Co-Authored-By: George Weale <gweale@google.com> Co-Authored-By: Sean Zhou <seanzhougoogle@google.com> Co-Authored-By: Shangjie Chen <deanchen@google.com> Co-Authored-By: Swapnil Agarwal <swapnilag@google.com> Co-Authored-By: Wei Sun <weisun@google.com> Co-Authored-By: Xuan Yang <xygoogle@google.com> Co-Authored-By: Yifan Wang <wanyif@google.com> Change-Id: I35932c50cfe29ff68559e3781713dbb5eb7b3382
ADK Workflow Message Sample
Overview
This sample demonstrates different ways to send a message to a user using Event(message=...) within an ADK Workflows node. It covers:
- String Messages: Standard string text replies.
- Multi-modal Messages: Returning mixed modality inputs, such as a string combined with an inline image.
- Multiple Messages: Emitting multiple full messages from the same node with a delay between them.
Sample Inputs
This workflow executes sequentially and successfully without any expected user input. Since it has only one Workflow node chain that automatically progresses from START, you can just type anything (e.g. start) to kick it off.
Graph
[ START ]
|
v
[ send_string ]
|
v
[ send_multimodal ]
|
v
[ multiple_messages ]
|
v
(Workflow Ends)
How To
To send messages in an ADK node, yield an Event object with the message argument:
-
Send a simple string:
yield Event(message="Hello world!") -
Send text with an image (multi-modal):
from google.genai import types yield Event( message=[ types.Part.from_text(text="Look at this image:"), types.Part.from_bytes(data=image_bytes, mime_type="image/png"), ] ) -
Send multiple messages: To send multiple distinct messages from a single node, yield multiple
Eventobjects sequentially.Note
: When yielding multiple messages with delays (
await asyncio.sleep(...)), your node function must be an asynchronous generator (async def). This allows ADK to yield each message to the client immediately without blocking.import asyncio async def multiple_messages(node_input: Any = None): yield Event(message="Processing step 1...") await asyncio.sleep(1.0) yield Event(message="Processing step 2...") await asyncio.sleep(1.0) yield Event(message="Done processing.")