Sessions
session.history()
Read paged history for the current Session
session.history()
Example
const history = await session.history({
limit: 50,
});
console.log(history.items);What it returns
It returns a paged history object for the current session.
Common fields include:
history.sessionhistory.viewhistory.itemshistory.totalhistory.nextCursorhistory.hasMore
The default view is message.
If you want a flattened UI-oriented event stream, pass:
const history = await session.history({
view: "timeline",
limit: 100,
});Good use cases
- replaying a conversation in UI
- loading only the latest page in a transcript or sidebar
- debugging the current context
- exporting session history
If you need to understand why a particular answer came out the way it did, message history is usually one of the first places worth inspecting.