Source: Sessions (OpenAI Agents SDK docs)

How OpenAI Agents SDK sessions store and replay conversation history, their backends, and their security and compaction caveats.

Contents

Summary

A session retrieves stored history before each run, prepends it to the new input, and stores the new items afterwards. The page lists implementations, the session operations, session_input_callback, and limits including trust and compaction behaviour.

Key claims

  • Implementations: SQLiteSession (default), AsyncSQLiteSession, OpenAIConversationsSession, RedisSession, SQLAlchemySession, EncryptedSession, OpenAIResponsesCompactionSession, plus MongoDB, Dapr and AdvancedSQLite.
  • Operations: get_items, add_items, pop_item, clear_session.
  • All items are retrieved by default; SessionSettings(limit=N) caps it.
  • Session IDs select history but do not authorise access; SQLite rows are not tamper-checked.
  • Encryption is not integrity: EncryptedSession does not verify completeness or order.
  • Automatic compaction can keep streamed runs open a few seconds; it can be run manually instead.

Feeds

Suggest changes →