Skip to main content
This page documents the lower-level streaming helpers in aion-authoring-langgraph. Use these helpers when a LangGraph node needs direct control over emitted messages, cards, artifacts, or reactions. For ordinary reply and post authoring, the higher-level Thread and Message APIs are the intended fluent surface. These helpers are intended for use with streaming requests where Aion Server consumes stream_mode=["values", "messages", "custom", "updates"].

Event Helpers

Functions

emit_artifact(...)

Emits a pre-built a2a.types.Artifact during graph execution. Use the framework-agnostic builders from aion.core.a2a (url_artifact, file_artifact, data_artifact) to construct the artifact before emitting it. Use cases: generated PDFs or images, chunked file streaming, external file references, structured data payloads. Example:

emit_card(...)

Emits a card message during graph execution. Produces a TaskStatusUpdateEvent whose message contains a card file part and extensions=[CardsURI]. When routing is provided, a DataPart with MessageActionPayload is also attached so the distribution delivers the card to the correct channel. Example:

emit_message(...)

Emits a programmatic message during graph execution. Supports full messages and streaming chunks. ephemeral=False (default):
  • AIMessage -> TaskStatusUpdateEvent(working, message=...); persisted in history.
  • AIMessageChunk -> TaskArtifactUpdateEvent(STREAM_DELTA); streamed and not persisted.
ephemeral=True:
  • AIMessage or AIMessageChunk -> TaskArtifactUpdateEvent(EPHEMERAL_MESSAGE).
  • Emitted to client and filtered out by task store.
  • Does not change durable response fallback behavior.
Use cases: progress notifications, thinking indicators, and transient status events. Example:

emit_reaction(...)

Emits a reaction action on an existing provider message. Instructs the distribution to add or remove a reaction. When reacting to the current inbound message, prefer Message.react(...); it derives the context and message identifiers from the runtime context. The ReactionActionPayload must include:
  • context_id: Provider-native conversation or thread identifier — take from context.event.payload.context_id
  • message_id: Provider-native message identifier to react to — take from context.event.payload.message_id
  • reaction_key: Reaction identifier, such as thumbsup or heart
  • operation: "add" or "remove"
  • display_value: Optional human-readable reaction text
Use cases: automated reactions to messages, conditional emoji responses, approval workflows. Example: