Agno AgentOS can now list a session's compactions with GET /sessions/{session_id}/compactions, so a chat UI can keep showing how far a conversation was folded after the page reloads. A compaction is one fold made by an Agent's compaction setting, which archives the older messages of a long session behind a summary and keeps the last few runs word for word.
agent = Agent(db=SqliteDb(db_file="agno.db"), compaction=True)curl "http://localhost:7777/sessions/s1/compactions?type=agent"The route returns every compaction of the session, newest first, with no pagination. Each item carries id, run_id, messages_compacted, tokens_before, tokens_after, created_at and archived, which says whether the replaced messages were stored and can be read back. The summary text and the archived messages stay out of the response. It takes the same optional type, user_id, db_id and table query parameters as the session runs route, answers 404 for a session that does not exist or that the caller's user cannot read, and needs the sessions:read scope when AgentOS authorization is on. SqliteDb and PostgresDb store compaction records; every other database returns an empty list. The Python AgentOSClient has no method for it yet, so call the route over HTTP.
We ran it on this release with a 12-run session in SqliteDb and the stub summarizer from the release's own tests in place of a model. The token counts come from Agno's real counter. agent.compact() folded the first 18 messages and kept the last three runs, and the route then reported the fold:
Compacted 18 messages (15864 -> 3988 tokens).
GET /sessions/s1/compactions -> 200 [{"messages_compacted": 18, "tokens_before": 15864, "tokens_after": 3988, "archived": true, ...}]
See the manual compaction cookbook, and learn more about sessions and AgentOS scopes in the documentation.
Frequently asked questions
When an Agent runs with compaction set, Agno archives the older messages of a long session and replaces them with a summary, keeping the most recent runs verbatim. With compaction=True it folds only when the provider rejects a request as too long, or on demand with agent.compact(). To fold at a set size, pass Compaction(compact_at_tokens=...). Each fold is stored as one compaction record.
Only SqliteDb and PostgresDb store compaction records. Every other database, including the async AsyncSqliteDb and AsyncPostgresDb and a remote AgentOS database, answers with an empty list and a 200, so a client can call the route without checking the backend first.
An automatic compaction carries the run_id of the run that triggered it. A manual one from agent.compact() or the compact route is made by no run, so the field is left out and a client places it in the conversation by created_at.
On a 12-run SqliteDb session with a stand-in summarizer, agent.compact() returned COMPACTED | Compacted 18 messages (15864 -> 3988 tokens). and the route returned 200 [{"id": "56f0abb1b3a94ebba421fb1411d6dcb1", "messages_compacted": 18, "tokens_before": 15864, "tokens_after": 3988, "created_at": "2026-11-23T19:05:27Z", "archived": true}]. The same script on PostgresDb gave the same counts, and an unknown session id returned 404 {"detail": "Session with ID nope not found"}.



