Skip to main content
The official LangSmith Terraform provider lets you manage LangSmith organization and workspace resources as code—workspaces, custom roles, organization and workspace members, evaluators, run rules, and alert rules. It’s the infrastructure-as-code counterpart to managing your organization using the API.
Before diving in, it might be helpful to read:

Install and configure

Add the provider to your Terraform configuration and pin a version:
Then run terraform init to download the provider.

Authentication

The provider resolves credentials the same way as the LangSmith SDK and CLI. Prefer environment variables or a profile over hardcoding api_key:
  • EnvironmentLANGSMITH_API_KEY, LANGSMITH_ENDPOINT (API URL), LANGSMITH_WORKSPACE_ID.
  • Profile—set profile (or LANGSMITH_PROFILE) to use a LangSmith CLI profile.
  • Provider argumentsapi_key, api_url, workspace_id, profile.
Create an API key or service key in your LangSmith settings. See Authentication methods for the available key types.
Organization-scoped operations—creating workspaces and inviting organization members—require an organization-scoped service key with Organization Admin permissions. Set workspace_id (or LANGSMITH_WORKSPACE_ID) to target workspace-scoped resources such as workspace memberships, evaluators, and run rules.

Examples

Create a workspace

Manage roles and members

Look up built-in roles with data sources, then assign them. This invites a user to the organization and grants them admin on the workspace:
You can also define a custom workspace role, for example by cloning an existing role’s permissions:

Automate evaluators, run rules, and alerts

The provider manages more than accounts. You can codify online code evaluators, the run rules that apply them, and alerts alongside your workspaces:

Resource reference

The full list of resources and data sources—with every argument and attribute—is published and kept in sync on the Terraform Registry:

LangSmith provider on the Terraform Registry

Browse the complete reference for all resources and data sources.