aion.langgraph today.
Use these helpers when you need direct control over emitted
TaskStatusUpdateEvent or TaskArtifactUpdateEvent objects. For ordinary
reply and post authoring, the higher-level Thread and Message APIs
described elsewhere in this section are the intended fluent surface.
These helpers still participate in the same request-scoped response
accumulator. They do not replace the standard precedence of response buffer,
a2a_outbox, and framework-native fallback.
These helpers are intended for use with streaming requests where Aion Server
consumes stream_mode=["values", "messages", "custom", "updates"].
Event Helpers
| Helper | Emitted A2A Event | Behavior |
|---|---|---|
emit_file_artifact | TaskArtifactUpdateEvent | Emits a file artifact with a file part. |
emit_data_artifact | TaskArtifactUpdateEvent | Emits a structured artifact with a data part. |
emit_message | TaskStatusUpdateEvent or TaskArtifactUpdateEvent | Emits message or stream updates. |
emit_task_update | TaskStatusUpdateEvent | Emits one combined task update. |
emit_reaction | A2A ReactionActionPayload | Emits a reaction on an existing provider message. |
Functions
emit_file_artifact(...)
Artifact with a file part.
| Parameter | Description |
|---|---|
writer | LangGraph StreamWriter from node signature |
url | File URL for remote files; mutually exclusive with data |
data | File content as bytes; mutually exclusive with url |
mime_type | MIME type such as application/pdf or image/png |
name | Artifact name (default: file) |
artifact_id | Explicit artifact ID; auto-generated if not provided |
append | Set true to append to a previously sent artifact |
is_last_chunk | Set false if more chunks are coming |
emit_data_artifact(...)
emit_data_artifact(writer, data, name=None, artifact_id=None, append=False, is_last_chunk=True)
Emits a structured data artifact. data must be JSON-serializable.
| Parameter | Description |
|---|---|
writer | LangGraph StreamWriter from node signature |
data | Dictionary or any JSON-serializable value |
name | Artifact name (default: data) |
artifact_id | Explicit artifact ID; auto-generated if not provided |
append | Set true to append to a previously sent artifact |
is_last_chunk | Set false if more chunks are coming |
emit_message(...)
emit_message(writer, message, ephemeral=False, routing=None)
Emits a programmatic message during graph execution. Supports full messages and
streaming chunks.
| Parameter | Description |
|---|---|
writer | LangGraph StreamWriter from node signature |
message | LangChain AIMessage or AIMessageChunk |
ephemeral | If true, event is sent to client but not persisted in task history |
routing | Optional MessageActionPayload for explicit delivery routing; if not provided, uses default reply target |
ephemeral=False (default):
AIMessage->TaskStatusUpdateEvent(working, message=...); persisted in history.AIMessageChunk->TaskArtifactUpdateEvent(STREAM_DELTA); streamed and not persisted.
ephemeral=True:
AIMessageorAIMessageChunk->TaskArtifactUpdateEvent(EPHEMERAL_MESSAGE).- Emitted to client and filtered out by task store.
- Does not change durable response fallback behavior.
emit_task_update(...)
emit_task_update(writer, message=None, metadata=None)
Emits one combined task update containing message and or metadata.
Only AIMessage is accepted for message. For chunk streaming, use
emit_message().
| Parameter | Description |
|---|---|
writer | LangGraph StreamWriter from node signature |
message | Optional full message (AIMessage only) |
metadata | Optional metadata dictionary to merge into task metadata |
message or metadata must be provided. Keys with the
aion: prefix in metadata are ignored.
Use cases: step completion updates with metadata, progress plus message in one
event.
Example:
emit_reaction(...)
emit_reaction(writer, payload)
Emits a reaction action on an existing provider message. Instructs the distribution to add or remove a reaction.
| Parameter | Description |
|---|---|
writer | LangGraph StreamWriter from node signature |
payload | ReactionActionPayload with reaction details |
ReactionActionPayload must include:
context_id: Message context/thread identifiermessage_id: Message identifier to react toreaction_key: Reaction identifier (e.g.,thumbsup,heart)operation:"add"or"remove"display_value: Optional human-readable reaction text