Overview
IDManager maintains auto-incrementing ID sequences for LangChat’s Supabase tables. It handles concurrent inserts gracefully by using a retry-with-conflict-resolution strategy.
This is an internal component — you don’t interact with it directly under normal use.
How it works
- On initialization,
IDManagerreads the current maximum ID from each table - IDs are assigned from an in-memory counter
- When two concurrent requests try to insert with the same ID, the retry logic increments and retries automatically
- This avoids database sequences while maintaining consistent IDs
Constructor
Supabase client instance.
Starting ID value for new tables.
Number of retry attempts on ID conflict before raising an error.
Methods
insert_with_retry()
Insert a record with automatic ID assignment and conflict retry.
session.save_message() and metrics recording. You only need this if building a custom adapter.