-
LangSmith Deployment 添加了控制平面和数据平面,让你可以直接通过 LangSmith UI 部署、扩展和管理代理与应用程序。
如果不需要完整的基于 UI 的设置,请参阅独立服务器,了解轻量级替代方案。
- Fleet 允许你在 LangSmith 中直接创建、部署和管理 AI 代理,无需编写代码。
- Insights 在 LangSmith 中提供由 AI 驱动的轨迹和应用程序数据分析。
- Chat 提供工作区内的聊天体验,帮助你分析轨迹、线程、提示词和实验结果。
前置条件
Install the base LangSmith platform
Install KEDA
KEDA:Configure an ingress
langsmith_config.yaml 中提供 hostname。Verify cluster capacity
Verify storage
PROVISIONER 值(不能是 kubernetes.io/no-provisioner)并标记为 (default);否则,必须先进行配置。Verify egress
https://beacon.langchain.com。请参阅 egress 文档。启用 LangSmith Deployment
组件
启用 LangSmith Deployment 后,会在集群中配置以下资源:listener:监听控制平面中部署的变化,并创建或更新下游 CRD。LangGraphPlatform CRD:管理 LangSmith Deployment 实例。operator:处理 LangSmith CRD 的变化。host-backend:控制平面。
启用功能
要启用 LangSmith Deployment,请更新langsmith_config.yaml:
Enable deployment in your config
langsmith_config.yaml 中启用 deployment 选项。同时必须配置有效的 ingress。langgraphPlatform 选项已弃用。对于 v0.12.0 之后的任何版本,请使用 config.deployment。(Optional) Configure image mirroring
langsmith_config.yaml 中配置 hostBackendImage 和 operatorImage 选项。请使用最新 LangSmith Helm chart 版本中指定的镜像标签。(Optional) Configure base agent templates
values.yaml 中的基础代理模板。最常见的用例是添加 imagePullSecrets,以便通过身份验证访问私有容器仓库。详情请参阅配置私有仓库身份验证。Apply the changes
<version> 和 <namespace> 替换为你的值:启用 Fleet、Insights 和 Chat
组件
启用这些功能后,集群中会针对每项功能(Fleet、Insights、Chat)配置以下组件:api-server:处理该功能请求的主 API 服务器。queue:后台任务处理队列。postgres:用于存储该功能数据的专用 PostgreSQL 实例。可以替换为外部 PostgreSQL 实例。redis:用于该功能缓存和发布/订阅的专用 Redis 实例。可以替换为外部 Redis 实例。
toolServer:为代理提供 MCP 工具执行能力。triggerServer:处理 Webhook 和计划触发器。
生成加密密钥
每项功能都使用自己的 Fernet 加密密钥来加密该功能专用的机密信息,例如凭据和令牌。使用独立密钥可以分别进行轮换,并在密钥泄露时限制影响范围。使用 Python 为每项功能生成一个密钥:agent_builder_encryption_key、insights_encryption_key 和 polly_encryption_key。
启用功能
Add the configuration to your langsmith_config.yaml
- Using Kubernetes secrets (recommended)
- Using inline values
agent_builder_encryption_key、insights_encryption_key 和 polly_encryption_key。fleetToolServer 和 fleetTriggerServer。从 Helm chart v15 开始,这两个配置项替代了已弃用的 agentBuilderToolServer 和 agentBuilderTriggerServer。postgres.external 和 redis.external 部分。例如:Apply the changes
(可选)为 Fleet 启用 OAuth 工具和触发器
要在 Fleet 中启用 Gmail、Slack 或 Linear 等基于 OAuth 的工具,请配置providerOrgId,并为每个要使用的集成添加 provider ID。你可以启用任意组合的 provider。
可用 provider
通用配置
将以下内容添加到langsmith_config.yaml 中。只包含你需要的 provider。
Provider 设置指南
Google OAuth provider
Google OAuth provider
Create OAuth client in GCP
Add URLs to GCP
<hostname> 替换为 LangSmith 主机名,将 <provider-id> 替换为你要使用的 provider ID(例如 google):已获授权的 JavaScript 来源:https://<hostname>
https://<hostname>/api-host/v2/auth/callback/<provider-id>https://<hostname>/host-oauth-callback/<provider-id>
Copy credentials
Configure OAuth provider in LangSmith
- Client ID:来自 GCP
- Client Secret:来自 GCP
- Authorization URL:
https://accounts.google.com/o/oauth2/auth - Token URL:
https://oauth2.googleapis.com/token - Provider ID:唯一字符串,例如:
google
Apply the changes
Microsoft OAuth provider
Microsoft OAuth provider
Create an Azure app registration
Choose supported account types
Add the redirect URI
<hostname> 替换为 LangSmith 主机名,将 <provider-id> 替换为 provider ID:Create a client secret
Add Microsoft Graph delegated permissions
Mail.ReadWriteMail.SendCalendars.ReadWriteTeam.ReadBasic.AllChannel.ReadBasic.AllChannel.CreateChannelMessage.SendChannelMessage.Read.AllChat.CreateChat.ReadWriteUser.ReadBasic.AllFiles.ReadWrite.AllSites.ReadWrite.All
offline_access,以便用户接收刷新令牌。Grant tenant consent
Configure OAuth provider in LangSmith
- Name:例如
Microsoft - Provider ID:唯一字符串,例如:
microsoft-oauth-provider - Client ID:来自 Azure 的 Application (client) ID
- Client Secret:来自 Azure 的客户端密钥值
- Authorization URL:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize - Token URL:
https://login.microsoftonline.com/common/oauth2/v2.0/token - Provider Type:
microsoft - Token endpoint auth method:
client_secret_post
common 替换为租户 ID。Apply the changes
Linear OAuth provider
Linear OAuth provider
Create a Linear OAuth app
Add callback URL
<hostname> 替换为 LangSmith 主机名,将 <provider-id> 替换为 provider ID:Copy credentials
Configure OAuth provider in LangSmith
- Client ID:来自 Linear 应用
- Client Secret:来自 Linear 应用
- Authorization URL:
https://linear.app/oauth/authorize - Token URL:
https://api.linear.app/oauth/token - Provider ID:唯一字符串,例如:
linear
Apply the changes
LinkedIn OAuth provider
LinkedIn OAuth provider
Create a LinkedIn OAuth app
Add redirect URI
<hostname> 替换为 LangSmith 主机名,将 <provider-id> 替换为 provider ID:Copy credentials
Configure OAuth provider in LangSmith
- Client ID:来自 LinkedIn 应用
- Client Secret:来自 LinkedIn 应用
- Authorization URL:
https://www.linkedin.com/oauth/v2/authorization - Token URL:
https://www.linkedin.com/oauth/v2/accessToken - Provider ID:唯一字符串,例如:
linkedin
Apply the changes
Salesforce OAuth provider
Salesforce OAuth provider
Create an External Client App
- External Client App Name:例如
LangSmith Fleet - Contact Email:管理员邮箱地址
- Distribution State:Local
Enable OAuth and configure the OAuth settings
- Callback URL:将
<hostname>替换为 LangSmith 主机名,将<provider-id>替换为 provider ID:
- Selected OAuth Scopes:添加 Manage user data via APIs (api) 和 Perform requests at any time (refresh_token, offline_access)。
- 保持选中 Require Secret for the Web Server Flow。
- 不要选择 Enable Authorization Code and Credentials Flow 和 Enable Client Credentials Flow。Fleet 使用标准 Web 服务器(授权码)流程。
Set the OAuth policies
- Refresh Token Policy:选择 Refresh token is valid until revoked。
- Permitted Users:保留 All users may self-authorize。如果改为 Admin approved users are pre-authorized,则必须先通过权限集或配置文件为应用分配权限,否则授权会失败。
Copy the credentials
Configure OAuth provider in LangSmith
- Provider ID:唯一字符串,例如:
salesforce-oauth-provider。下一步的salesforceOAuthProvider使用相同的值。 - Display Name:例如
Salesforce - Client ID:来自 Salesforce 的 Consumer Key
- Client Secret:来自 Salesforce 的 Consumer Secret
- Authorization URL:
https://<MyDomain>.my.salesforce.com/services/oauth2/authorize - Token URL:
https://<MyDomain>.my.salesforce.com/services/oauth2/token
<MyDomain> 替换为组织的 My Domain,可在 Setup > My Domain 中找到。对于沙盒环境,请使用 https://<MyDomain>--<SandboxName>.sandbox.my.salesforce.com/services/oauth2/authorize 以及相匹配的 token URL。Apply the changes
Slack OAuth provider
Slack OAuth provider
(可选)为 Fleet 启用 GitHub App
Fleet 通过专用的 GitHub App(不是 OAuth 应用)与 GitHub 集成。GitHub App 为 Fleet 的 GitHub 工具提供仓库访问权限,并支持访问私有仓库所需的用户授权流程。 设置过程包括创建 GitHub App、收集其凭据、将凭据存储为 Kubernetes secret,并在langsmith_config.yaml 中引用这些凭据。
Create a GitHub App
Fill in basic details
- GitHub App name:任意唯一名称,例如
acme-langsmith-fleet。记下 GitHub 生成的 slug(名称的小写、连字符形式),稍后将其用于FLEET_GITHUB_APP_SLUG。 - Homepage URL:LangSmith 主机名,例如
https://langsmith.acme.com。 - 暂时取消选择 Webhook 下的 Active。生成 Webhook secret 后,再在后续步骤中启用。
Set callback URLs
<hostname> 替换为 LangSmith 主机名:Set webhook URL and generate a webhook secret
- 选择 Active。
-
将 Webhook URL 设置为:
- 将生成的值粘贴到 Webhook secret 中。请保存该值,稍后创建 Kubernetes secret 时还需要使用相同的值。
Set repository permissions
- Contents:Read and write
- Issues:Read and write
- Pull requests:Read and write
- Metadata:Read-only(自动选择)
Choose install visibility
Create the app
Generate a client secret
FLEET_GITHUB_APP_CLIENT_SECRET。GitHub 只会显示一次。Generate a private key
.pem 文件。请妥善保管该文件,因为它授予 GitHub App 完整访问权限。PEM 内容就是 FLEET_GITHUB_APP_PRIVATE_KEY。Generate a state JWT secret
FLEET_GITHUB_APP_STATE_JWT_SECRET。Create a Kubernetes secret
Add the configuration to your langsmith_config.yaml
FLEET_GITHUB_APP_ENABLED,这样才能注册 GitHub 工具。其余 FLEET_GITHUB_APP_* 变量由平台后端使用,并放在 commonEnv 下。Deploy and install the app on repositories
- 在 LangSmith 中打开 Fleet 代理,并在代理编辑器中前往 GitHub 集成。
- 点击 Connect GitHub,将应用安装到 Fleet 应访问的仓库。
- 对于私有仓库,必须在安装过程中明确选择每个仓库。
禁用功能
要禁用 Fleet、Insights 和 Chat 中的任意组合,请在langsmith_config.yaml 中将对应标志设置为 false:
可选配置
配置其他数据平面
除了上面创建的数据平面之外,还可以在不同的 Kubernetes 集群中,或在同一集群的其他命名空间中创建更多数据平面。有多种实现方式,请根据用例选择最合适的方案。前置条件
Review cluster organization
Verify hybrid prerequisites
https://api.host.langchain.com 和 https://api.smith.langchain.com。Enable the feature in Postgres
部署到其他集群
Follow the hybrid setup guide
config.langsmithWorkspaceId 设置为上一步获取的 workspace ID。(Optional) Add more data planes to the same cluster
部署到同一集群中的其他命名空间
Update your config
langsmith_config.yaml 中进行以下修改:- 将
operator.watchNamespaces设置为当前运行自托管 LangSmith 实例的命名空间,以避免与新数据平面添加的 operator 冲突。 - 使用 Gateway API 或 Istio Gateway。相应地调整
langsmith_config.yaml。
Apply the changes
Follow the hybrid setup guide
config.langsmithWorkspaceId 设置为上一步获取的 workspace ID。将 config.watchNamespaces 设置为不同于现有数据平面所使用的命名空间。(Optional) Configure log access
配置私有仓库身份验证
如果你的 Agent Server 部署将使用私有容器仓库中的镜像(例如 AWS ECR、Azure ACR 或 GCP Artifact Registry),请配置镜像拉取 secret。此配置会自动应用于所有部署,使它们能够通过身份验证访问私有仓库。Create a Kubernetes image pull secret
myregistry.com:仓库 URLyour-username:仓库用户名your-password:仓库密码或访问令牌langsmith:安装 LangSmith 的 Kubernetes 命名空间
Configure the deployment template in your langsmith_config.yaml
imagePullSecrets 添加到 operator 的部署模板中:Apply the changes
读取其他命名空间中的 Agent Server 日志
对于控制平面和数据平面位于同一集群的部署,请确保控制平面 Kubernetes 部署(host-backend)有权限从 Agent Server 部署所在的命名空间中对 Kubernetes deployments、pods、replicasets 和 logs 执行 get、list 和 watch 操作。有多种实现方式。下面的示例使用 Kubernetes RBAC,但你应选择最适合用例的方案:
Create a Role with the required permissions
Role。替换 <data_plane_namespace>:Get the control plane ServiceAccount
<control_plane_namespace>:Bind the Role to the control plane ServiceAccount
<data_plane_namespace>、<control_plane_namespace> 和 <control_plane_service_account>:
