Requirements
- A provisioned PostgreSQL database that your LangSmith instance will have network access to. We recommend using a managed PostgreSQL service like:
- Note: We only officially support PostgreSQL versions >= 14.
- We support password and IAM/Workload Identity authentication.
- A user with admin access to the PostgreSQL database. This user will be used to create the necessary tables, indexes, and schemas.
-
This user will also need to have the ability to create extensions in the database. We use/will try to install the
btree_gin,btree_gist,pgcrypto,citext,ltree, andpg_trgmextensions. - If using a schema other than public, ensure that you do not have any other schemas with the extensions enabled, or you must include that in your search path.
-
Support for pgbouncer and other connection poolers is community-based. Community members have reported that pgbouncer has worked with
pool_mode=sessionand a suitable setting forignore_startup_parameters(as of writing,search_pathandlock_timeoutneed to be ignored). Care is needed to avoid polluting connection pools; some level of PostgreSQL expertise is advisable. LangChain Inc currently does not have roadmap plans for formal test coverage or commercial support of pgbouncer or amazon rds proxy or any other poolers, but the community is welcome to discuss and collaborate on support through GitHub issues. - By default, we recommend an instance with at least 2 vCPUs and 8GB of memory. However, the actual requirements will depend on your workload and the number of users you have. We recommend monitoring your PostgreSQL instance and scaling up as needed.
Connection String
You will need to provide a connection string to your PostgreSQL database. This connection string should include the following information:- Host
- Port
- Database
- Username
- Password (Make sure to url encode this if there are any special characters) - Note: When using IAM authentication, the password is not required in the connection string. More below.
- URL params
Configuration
With your connection string in hand, you can configure your LangSmith instance to use an external PostgreSQL database. You can do this by modifying thevalues file for your LangSmith Helm Chart installation or the .env file for your Docker installation.
TLS with PostgreSQL
Use this section to configure TLS for PostgreSQL connections. For mounting internal/public CAs so LangSmith trusts your PostgreSQL server certificate, see Configure custom TLS certificates.Server TLS (one-way)
To validate the PostgreSQL server certificate:- Provide a CA bundle using
config.customCa.secretNameandconfig.customCa.secretKey. - Use
sslmode=requireorsslmode=verify-full, as well assslrootcert=systemto your connection URL.
Mutual TLS with Client Auth (mTLS)
As of LangSmith helm chart version 0.12.29, we support mTLS for PostgreSQL clients. For server-side authentication in mTLS, use the Server TLS steps (custom CA) in addition to the following client certificate configuration. If your PostgreSQL server requires client certificate authentication:- Provide a Secret with your client certificate and key.
- Reference it via
postgres.external.clientCert.secretNameand specify the keys withcertSecretKeyandkeySecretKey. - Use
sslmode=verify-fullandsslrootcert=systemin your connection URL.
Pod security context for certificate volumes
The certificate volumes mounted for mTLS are protected by file access restrictions. To ensure all LangSmith pods can read the certificate files, you must setfsGroup: 1000 in the pod security context.
You can configure this in one of two ways:
Option 1: Use commonPodSecurityContext
Set the fsGroup at the top level to apply it to all pods:
fsGroup to each pod’s security context individually. See the mTLS configuration example for a complete reference.
IAM Authentication
As of LangSmith helm chart version 0.12.34, we support IAM authentication for PostgreSQL. This allows you to use cloud provider workload identity instead of static passwords.Supported providers
| Provider | Database Service | Documentation |
|---|---|---|
| AWS | RDS PostgreSQL | IAM database authentication |
| GCP | Cloud SQL | IAM authentication |
| Azure | Azure Database for PostgreSQL | Microsoft Entra authentication |
Prerequisites
- Configure workload identity in your Kubernetes cluster. See your cloud provider’s documentation:
- Enable IAM authentication on your PostgreSQL instance and grant access to your workload identity. Refer to your cloud provider’s documentation linked above.
- Annotate your Kubernetes ServiceAccounts and Deployments/Jobs with the workload identity binding per your cloud provider’s requirements.
Configuration
To enable IAM authentication, set theiamAuthProvider field and use an IAM-compatible connection string (without password):
Helm
Kubernetes Secret
Required annotations
You must apply the ServiceAccount annotations and pod labels required by your cloud provider’s workload identity to all LangSmith components that connect to PostgreSQL. This includes: Deployments:backend, queue, platformBackend, hostBackend
Jobs: migrations, authBootstrap, feedbackConfigMigration, feedbackDataMigration, e2eTest
All jobs listed above (except
e2eTest) use the backend service account. For these jobs, you only need to configure pod labels if your cloud provider requires them (e.g., Azure requires azure.workload.identity/use: "true" on pods). The e2eTest job uses its own service account and requires separate annotation configuration.