Skip to main content
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.
The functions take no context argument. 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.
Every read goes to the task store, so every instance of the agent answers from the same data. What the turn has emitted but the server has not saved yet is not there.

Tasks

Tasks are a2a.types.Task objects.

Artifact versions

The same artifact_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

An opaque marker of this use of the conversation’s id. It changes when a deleted conversation’s id is taken again, so state you keep outside the server under the conversation’s id - a branch, a file - can tell an earlier conversation from the current one. Compare it; do not parse it.

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:
The history does not include the conversation’s messages. To read earlier turns, use your framework’s own state: the LangGraph checkpoint or the ADK session.