Documentation preview: These docs are a work in progress and have not been formally released yet. We update them iteratively as internal Aion development progresses.
Low-level streaming helpers for emitting events from Google ADK agents.
The streaming helpers are the low-level alternative to using Thread
and Message. They let you emit messages, cards, artifacts, and
reactions directly when you already have access to the ADK event emitter.Most agents should use Thread and Message instead. Reach for these functions when you
are outside an invocation method that provides a Thread, or when you need fine-grained control
over routing.
from aion.adk.authoring import ( emit_message, emit_card, emit_artifact, emit_reaction,)
All four functions require an EventEmitter — the callable that pushes ADK events into the current
invocation stream. Retrieve it with get_adk_emitter():
from aion.adk.authoring.invocation import get_adk_emitteremitter = get_adk_emitter()
get_adk_emitter() returns None when called outside an active invocation context. Always guard
before using it.
Emit a pre-built A2A artifact during agent execution. The function saves the artifact via
ctx.artifact_service and then emits an ADK event with EventActions(artifact_delta=...).
Parameter
Type
Description
emitter
EventEmitter
ADK event emitter from the current invocation
ctx
AionInvocationContext
ADK invocation context providing artifact_service
artifact
a2a.types.Artifact
Pre-built artifact to emit
routing
MessageActionPayload | None
Optional delivery routing target
metadata
dict | None
Optional metadata merged into A2A Artifact.metadata. Keys must not start with aion: (reserved)
emit_artifact does not support multi-part artifacts. If the artifact contains more than one
part, the call is a no-op and a warning is logged. Build single-part artifacts when using this
function.