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
| Helper | Emitted A2A Event | Behavior |
|---|---|---|
emit_artifact | TaskArtifactUpdateEvent | Emits a pre-built artifact, including file and data artifacts. |
emit_card | TaskStatusUpdateEvent | Emits a card message with optional routing. |
emit_message | TaskStatusUpdateEvent or TaskArtifactUpdateEvent | Emits full messages, stream chunks, or ephemeral messages. |
emit_reaction | A2A ReactionActionPayload | Emits a reaction on an existing provider message. |
Functions
emit_artifact(...)
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.
| Parameter | Description |
|---|---|
writer | LangGraph StreamWriter from node signature |
artifact | Pre-built a2a.types.Artifact to emit |
routing | Optional MessageActionPayload delivery routing target |
append | Set true to append to a previously sent artifact |
is_last_chunk | Set false if more chunks are coming |
metadata | Optional user-defined metadata merged into Artifact.metadata; keys starting with aion: are reserved |
emit_card(...)
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.
| Parameter | Description |
|---|---|
writer | LangGraph StreamWriter from node signature |
card | Card instance, either inline JSX, remote URL, or builder-created JSX |
routing | Optional MessageActionPayload delivery routing target |
metadata | Optional user-defined metadata forwarded to A2A Message.metadata |
emit_message(...)
| 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 |
metadata | Optional user-defined metadata forwarded to A2A Message.metadata; keys starting with aion: are reserved |
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_reaction(...)
Message.react(...); it
derives the context and message identifiers from the runtime context.
| Parameter | Description |
|---|---|
writer | LangGraph StreamWriter from node signature |
payload | ReactionActionPayload with reaction details |
ReactionActionPayload must include:
context_id: Provider-native conversation or thread identifier — take fromcontext.event.payload.context_idmessage_id: Provider-native message identifier to react to — take fromcontext.event.payload.message_idreaction_key: Reaction identifier, such asthumbsuporheartoperation:"add"or"remove"display_value: Optional human-readable reaction text
Related Pages
- Artifact Builders —
url_artifact,file_artifact,data_artifactreference - Card — Card builder API reference
- Thread
- Message
- Event Handlers
- Message Mapping