Skip to main content
Deployment namespaces let administrators assign dedicated Kubernetes namespaces to each workspace’s Agent Server deployments. Use them to separate workloads and apply per-namespace resource quotas, network policies, and role-based access control (RBAC).
Standalone self-hosted installations require langsmith Helm chart version 0.19.0-rc.2 or later and LangSmith backend and frontend images 0.19.2rc1 or later.
Deployments assigned to a remote listener (source_config.listener_id) and scale-to-zero deployments do not support deployment namespaces.

Prerequisites

On standalone self-hosted installations, set images.backendImage.tag and images.frontendImage.tag to 0.19.2rc1 or later. Chart releases through 0.19.0-rc.6 default to 0.18.29rc1, which does not support this configuration on standalone installations. Prepare your cluster and Helm values before you continue:
  • Agent Server hosting enabled: Set config.deployment.enabled: true in your Helm values. See Enable Agent Server hosting.
  • Gateway API or Istio Gateway: Enable gateway.enabled: true (Gateway API) or istioGateway.enabled: true (Istio Gateway). The shared Kubernetes Ingress (ingress.enabled: true alone) does not support deployment namespaces.
  • Cross-namespace route allowance (Gateway API): When using gateway.enabled: true, configure your Kubernetes Gateway listener to allow HTTPRoute resources from the target namespaces. For example, set allowedRoutes.namespaces.from: All or a matching label Selector.
  • Pre-existing namespaces: Create every target Kubernetes namespace before upgrading the chart. The chart does not create namespaces.
  • Image pull secrets in each target namespace: When images.imagePullSecrets or operator.templates.deployment specifies pull secrets, create matching Secret objects in every target namespace. Kubernetes resolves pull secrets in the pod’s own namespace, and the chart does not create or copy them. See Configure authentication for private registries.
  • Workspace IDs: Gather the UUID of each LangSmith workspace that receives allowed namespaces.

Configure allowed namespaces

Map each workspace UUID to its allowed Kubernetes namespaces under config.deployment.namespaces in your langsmith_config.yaml file. To configure deployment namespaces:
1

Create target namespaces and pull secrets

Create each target namespace in your cluster. If your installation uses images.imagePullSecrets, create matching pull secrets in each target namespace.
2

Add config.deployment.namespaces to your Helm values

Add the workspace-to-namespace map and image tags alongside config.deployment.enabled: true and either gateway.enabled: true or istioGateway.enabled: true. Replace the workspace ID and Gateway name and namespace with your values:
3

Upgrade the LangSmith Helm release

Apply the updated values to your LangSmith release. Replace <version> and <namespace> with your chart version and installation namespace:

Review Helm chart configuration

When config.deployment.enabled is true and config.deployment.namespaces is non-empty, the chart creates and updates the following resources:
  • Allowlist environment variable: Sets HOST_DEPLOYMENT_NAMESPACES as a JSON object in the shared ConfigMap read by host-backend and the in-cluster deployment worker (listener). For backward compatibility, host-backend also reads HOST_BYOC_DEPLOYMENT_NAMESPACES as a fallback alias; HOST_DEPLOYMENT_NAMESPACES takes precedence when both are set.
  • Control plane and worker RBAC: When hostBackend.rbac.create is true (default), the chart creates a ClusterRole named <release-fullname>-<release-namespace>-deployment-namespaces. It also creates a RoleBinding in each listed namespace outside the release namespace, binding both the host-backend and listener ServiceAccounts from the release namespace. The chart skips the release namespace because both ServiceAccounts already have access there.
  • Operator watch scope: When operator.watchNamespaces is a non-empty comma-separated list, the chart appends the deduplicated namespaces from config.deployment.namespaces to WATCH_NAMESPACE. When operator.rbac.create is true, it also creates per-namespace Role and RoleBinding resources for the operator in each watched namespace. When operator.watchNamespaces is empty (default), WATCH_NAMESPACE remains empty and the operator watches all namespaces cluster-wide.
The chart’s ClusterRole grants the following namespace-scoped permissions through each RoleBinding: If you set hostBackend.rbac.create: false, create equivalent RoleBinding grants in every target namespace for both the host-backend and listener ServiceAccounts before creating deployments.

Check namespace constraints

The Helm chart and host-backend enforce the following constraints. Chart validation runs even when config.skipValidation is true.
  • Valid workspace UUIDs: Every key in config.deployment.namespaces must be a valid workspace UUID.
  • One workspace per namespace: Each namespace belongs to at most one workspace. Helm template rendering fails if the same namespace appears under more than one workspace. At runtime, host-backend rejects deployments into any namespace listed under multiple workspaces in HOST_DEPLOYMENT_NAMESPACES for all of them.
  • Reserved system namespaces: Both the chart and host-backend reject namespaces starting with kube-, gke-, or gmp-. They also reject default, crossplane-system, istio-system, istio-ingress, buildkit-system, cert-manager, external-secrets, gatekeeper-system, keda, karpenter, observability, sandbox, and sandbox-workloads.
  • Valid DNS label: Namespace names passed to the API must match ^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$ and contain at most 63 characters.
  • Cross-workspace conflict check: Creating a deployment in a namespace fails with 409 if another workspace still has any deployment there. This includes deployments currently being deleted.
  • Immutable after creation: A deployment’s namespace is fixed at creation time and cannot be changed later.

Understand workload and build placement

Selecting a deployment namespace changes where runtime resources run, while image builds stay in the LangSmith installation namespace:
  • Runtime resources: The selected namespace runs the LGP custom resource, API server and queue worker pods, and managed PostgreSQL and Redis pods. Services, Secrets, PersistentVolumeClaims, and HTTPRoute or VirtualService objects also live there.
  • Build jobs: When builds are configured on your installation, build jobs still run in the LangSmith installation namespace rather than the selected deployment namespace.
  • Runtime logs: host-backend reads deployment pod logs directly from the selected namespace using the RBAC bindings configured by the chart.

Select a namespace

Users with deployment creation permissions can choose from the namespaces allowed for their workspace through the LangSmith UI or the control plane API.

Use the LangSmith UI

When your workspace has allowed namespaces, the deployment creation form shows a Kubernetes namespace dropdown. It appears for Docker image deployments and, when GitHub builds are enabled, GitHub repository deployments. To place a new deployment in an allowed namespace:
  1. In LangSmith, open the deployment creation form for your workspace.
  2. Select an allowed namespace from Kubernetes namespace. Leave it unset to use the installation namespace. To clear a selection, select the same namespace again.
  3. Complete the remaining deployment settings and submit.
LangSmith hides the dropdown if the namespace request fails or returns no allowed namespaces. It also hides the dropdown when you select a remote listener or a scale-to-zero deployment.

Use the control plane API

For standalone self-hosted installations, use https://<host>/api-host as the control plane API base URL. For BYOC, use your data plane endpoint with the same /api-host prefix. Include X-Api-Key and X-Tenant-Id headers on every request.

List allowed namespaces

Call GET /v2/deployments/namespaces to retrieve the namespaces allowed for the workspace, sorted alphabetically by name:
Example response:
The endpoint returns an empty items array when no namespaces are allowed for the workspace, on LangSmith Cloud, or on listener-backed installations.

Create a deployment in a namespace

Set source_config.k8s_namespace on POST /v2/deployments. Omit the field or pass null to place the deployment in the installation namespace:
Before creating the deployment record, host-backend runs a Kubernetes SelfSubjectAccessReview check in the target namespace. That check confirms host-backend can list pods, read pod logs, and get deployments there. During deployment, the worker checks that the namespace is still in HOST_DEPLOYMENT_NAMESPACES for the workspace. It then runs a SelfSubjectAccessReview for the full set of deployment permissions. GET /v2/deployments/{deployment_id} returns the selected namespace in source_config.k8s_namespace, or null when the deployment runs in the installation namespace. Sending a non-null source_config.k8s_namespace on PATCH /v2/deployments/{deployment_id} returns 400 ('source_config.k8s_namespace' cannot be updated.). To move a deployment to another namespace, create a new deployment in the target namespace and delete the old deployment.

Remove or reassign a namespace

Delete all deployments in a namespace before removing it from config.deployment.namespaces or reassigning it to another workspace. Removing a namespace while deployments still run there has the following effects:
  • New revisions fail: The deployment worker rejects namespaces no longer listed for that workspace in HOST_DEPLOYMENT_NAMESPACES without retrying.
  • Scoped operator stops reconciling: When operator.watchNamespaces is set, removing the namespace drops it from WATCH_NAMESPACE. The upgrade also deletes the operator’s Role and RoleBinding in that namespace.
  • Reassignment conflicts: If deployments from the previous workspace remain (including deployments being deleted), calls to POST /v2/deployments in the new workspace return 409.

Verify the configuration

Run these commands after upgrading the Helm release to confirm the allowlist, RBAC bindings, and API endpoint are active. Replace <fullname> with the chart’s full release name (for example, langsmith when the release name contains langsmith, or <release>-langsmith otherwise):
After creating a deployment in <target-namespace>, confirm its custom resource and pods land in that namespace:

Troubleshoot

See also