Skip to main content
When deploying agents to LangSmith, the server provides a built-in Postgres-backed long-term memory store with optional vector search via pgvector. You can replace this with your own BaseStore implementation to use a different storage backend, custom indexing, or specialized search capabilities. You provide a path to an async context manager that yields a BaseStore instance, and the server manages the store’s lifecycle automatically.
Custom stores are in alpha. This feature may experience breaking changes in minor version updates.

Define the store

Starting from an existing LangSmith application, create a file that defines an async context manager yielding your custom store. If you are beginning a new project, you can create an app from a template using the CLI.
The async context manager pattern lets the server open and close the store connection at the right points in the application lifecycle. The following example uses AsyncSqliteStore with semantic search:
SQLite is not recommended for use in production deployments.
When a custom store is configured, it replaces the built-in Postgres store entirely. Capabilities like semantic search and TTL sweeping depend on your implementation.

Configure langgraph.json

Add the store key to your langgraph.json configuration file. The path points to the async context manager you defined earlier.

Start server

Test the server out locally:
The server logs will confirm that your custom store is active:

Deploying

You can deploy this app as-is to LangSmith or to your self-hosted platform.

Next steps