Skip to content

Database Configuration

LambChat uses MongoDB as the primary database and Redis for caching, SSE events, and pub/sub. PostgreSQL is optional for checkpoint storage.

Redis

VariableDefaultSensitiveDescription
REDIS_URLredis://localhost:6379/0YesRedis connection URL.
REDIS_PASSWORD(empty)YesRedis authentication password.

MongoDB

VariableDefaultSensitiveDescription
MONGODB_URLmongodb://localhost:27017YesMongoDB connection URL.
MONGODB_DBagent_stateNoDatabase name.
MONGODB_USERNAME(empty)NoAuthentication username.
MONGODB_PASSWORD(empty)YesAuthentication password.
MONGODB_AUTH_SOURCEadminNoAuthentication source database.
MONGODB_SESSIONS_COLLECTIONsessionsNoCollection name for sessions.
MONGODB_TRACES_COLLECTIONtracesNoCollection name for traces.

PostgreSQL (Optional)

Used for LangGraph checkpoint store to avoid MongoDB's 16MB BSON limit.

VariableDefaultSensitiveDescription
ENABLE_POSTGRES_STORAGEfalseNoEnable PostgreSQL storage backend.
POSTGRES_HOSTlocalhostNoPostgreSQL host.
POSTGRES_PORT5432NoPostgreSQL port.
POSTGRES_USERpostgresNoUsername.
POSTGRES_PASSWORDpostgresYesPassword.
POSTGRES_DBlanggraphNoDatabase name.
POSTGRES_POOL_MIN_SIZE2NoConnection pool minimum size.
POSTGRES_POOL_MAX_SIZE10NoConnection pool maximum size.

Checkpoint Backend

Choose where agent checkpoints are stored.

VariableDefaultDescription
CHECKPOINT_BACKENDmongodbCheckpoint storage: mongodb or postgres.
CHECKPOINT_PG_HOST(falls back to POSTGRES_HOST)Checkpoint-specific PostgreSQL host.
CHECKPOINT_PG_PORT5432Checkpoint-specific PostgreSQL port.
CHECKPOINT_PG_USER(falls back to POSTGRES_USER)Checkpoint-specific PostgreSQL user.
CHECKPOINT_PG_PASSWORD(falls back to POSTGRES_PASSWORD)Checkpoint-specific PostgreSQL password. Sensitive.
CHECKPOINT_PG_DB(falls back to POSTGRES_DB)Checkpoint-specific PostgreSQL database.
CHECKPOINT_PG_POOL_MIN_SIZE2Checkpoint PG pool minimum size.
CHECKPOINT_PG_POOL_MAX_SIZE10Checkpoint PG pool maximum size.

WARNING

MongoDB has a 16MB BSON document limit. For long-running agents with large state, use CHECKPOINT_BACKEND=postgres to avoid hitting this limit.

Example

bash
# Redis
REDIS_URL=redis://localhost:6379/0
REDIS_PASSWORD=your_redis_password

# MongoDB
MONGODB_URL=mongodb://localhost:27017
MONGODB_DB=agent_state
MONGODB_USERNAME=admin
MONGODB_PASSWORD=your_mongo_password

# PostgreSQL (optional)
ENABLE_POSTGRES_STORAGE=true
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_pg_password
POSTGRES_DB=langgraph
CHECKPOINT_BACKEND=postgres