aion.core.agent.conversation reads what the conversation of the current turn already holds: its tasks, the
versions of its artifacts and the generation of its id. It is the counterpart of emit_*, which write what a
turn says. It lives in aion.core, so a LangGraph graph, an ADK agent and an executable extension use it alike.
aion serve installs the history of every turn it runs on the turn’s
AionRuntimeContext, and the functions read it from there. Outside a
turn - in a unit test, or in code that runs before the server starts the turn - they raise
ConversationUnavailableError.
Who sees what
A turn reads the context of its task as the caller that started the turn was admitted into it:- in a private conversation - an anonymous session, the application’s own user - it reads that caller’s tasks;
- in a conversation Aion routes through its gateway, it reads every participant’s tasks, whoever started them;
- it never reads another context, and a context that is being deleted reads as empty.
Tasks
Tasks are
a2a.types.Task objects.
Artifact versions
The sameartifact_id written by several tasks of a conversation is one artifact in several versions, numbered
from 0 in the artifact’s metadata["version"].
A version is an
ArtifactVersion with task_id, artifact (an a2a.types.Artifact), version and
updated_at.
A task keeps the number it took: chunks and replacements of the artifact, and the artifact in a later turn of the
same task, carry the same number. Two tasks of one conversation that write the same artifact at the same time can
take the same number.
Generation
Binding the history
conversation.history() returns the current turn’s history object. Its methods are the functions above, bound to
this turn, so you can hand one to code that runs later in the turn: