this.messages is the agent’s persistent conversation log. Messages are ordered by an
assigned monotonic seq (insertion order, not wall-clock), and the log is append-only —
there is no delete.
The log is the agent’s memory across turns. Append messages as they happen — user
input, assistant replies, tool results — and rebuild the next LLM request from
history: last(n) for a bounded window, or an adapter for a provider-shaped payload.
Because the log persists with the instance, a crash, a restart, or a week of idleness
doesn’t lose the thread. The Message History guide
walks the full loop.
Accessing the log
The log hangs off oneAgent property:
new MessageLog()
You rarely construct one —this.messages is built for you — but a standalone log
over the actor’s storage is a plain constructor call:
AgentMessage
ToolCall
StoredMessage
add()
append()
appendMany()
all()
last()
count()
Adapters
Each adapter reads the full history and converts it. They differ in how they treatsystem and tool messages:
append() with plain roles, or rebuild framework state
from toOpenAI() output instead.