除了基础 LangSmith 平台外,您还可以启用以下功能:
- - **LangSmith 部署** 添加了一个 控制平面 和 数据平面 让您可以直接通过 LangSmith UI 部署、扩展和管理代理和应用程序。
- - **Fleet** 让您无需编写代码即可直接在 LangSmith 内创建、部署和管理 AI 代理。
- - **Insights** 在 LangSmith 内提供对跟踪和应用程序数据的 AI 驱动分析。
- - **Chat** 提供工作区内的聊天体验,帮助您分析跟踪、线程、提示和实验结果。
前提条件
Install the base LangSmith platform
按照 Kubernetes 安装指南 安装基础 LangSmith 平台后再继续。
Install KEDA
运行以下命令在您的集群上安装 KEDA :
helm repo add kedacore https://kedacore.github.io/charts
helm upgrade --install keda kedacore/keda --namespace keda --create-namespace
Configure an ingress
为您的 LangSmith 实例配置入口、网关或 Istio。所有代理将作为 Kubernetes 服务部署在此入口后面。参见 设置入口。您必须在 hostname 中提供一个 langsmith_config.yaml.
Verify cluster capacity
确保您的集群有足够的容量来支持多个部署。建议使用集群自动扩缩容。
Verify storage
确保您的集群上有有效的动态 PV 配置器或 PV。
kubectl get storageclass
至少一个 StorageClass 应该有 PROVISIONER 值(不是 kubernetes.io/no-provisioner)并标记为 (default),否则您必须在继续之前配置一个。
Verify egress
确保到 https://beacon.langchain.com 的出口可用。参见 出口文档.
启用 LangSmith 部署
组件
启用 LangSmith 部署会在您的集群中配置以下资源:
- -
listener:监听 控制平面 以了解部署的变更并创建或更新下游 CRD。 - -
LangGraphPlatform CRD:管理 LangSmith Deployment 的实例。 - -
operator:处理 LangSmith CRD 的变更。 - -
host-backend:The 控制平面.
启用该功能
要启用 LangSmith Deployment,请更新您的 langsmith_config.yaml:
Enable deployment in your config
在您的 langsmith_config.yaml中,启用 deployment 选项。您还必须配置有效的 ingress。
config:
deployment:
enabled: true
(Optional) Configure image mirroring
如果需要将镜像镜像到私有仓库,请配置 hostBackendImage 和 operatorImage 中的选项 langsmith_config.yaml。请使用中指定 最新的 LangSmith Helm chart 版本.
hostBackendImage:
repository: "docker.io/langchain/hosted-langserve-backend"
pullPolicy: IfNotPresent
operatorImage:
repository: "docker.io/langchain/langgraph-operator"
pullPolicy: IfNotPresent
(Optional) Configure base agent templates
覆盖 中的基础代理模板 values.yaml (如果需要自定义 operator 创建代理 Kubernetes 资源的方式,最常见的用例是添加) imagePullSecrets 来向私有容器仓库进行身份验证。请参阅 配置私有仓库的身份验证 了解更多详细信息。
Apply the changes
运行以下命令来应用更改。本指南中每次要求您应用更改时都会使用此命令。请替换 <version> 和 <namespace> 为您的值:
helm upgrade -i langsmith langchain/langsmith --values langsmith_config.yaml --version <version> -n <namespace> --wait --debug
在继续之前,请验证新 pod 正在运行:
kubectl get pods -n <namespace>
您的实例现已准备好创建部署。
启用 Fleet、Insights 和 Chat
每个功能都需要一个 Fernet 加密密钥。您可以在单个 Helm 配置中启用所有三个功能。
组件
启用这些功能会在您的集群中为每个功能(Fleet、Insights、Chat)配置以下组件:
- -
api-server:处理该功能请求的主 API 服务器。 - -
queue:后台任务处理队列。 - -
postgres:用于该功能数据的专用 PostgreSQL 实例。可以替换为外部 PostgreSQL 实例。 - -
redis: Dedicated Redis instance for the feature's caching and pub/sub. Can be replaced with an external Redis instance.
Fleet 还会额外配置: - toolServer:为代理提供 MCP 工具执行。 - triggerServer:处理 webhook 和计划触发器。
生成加密密钥
每个功能使用自己的 Fernet 加密密钥来加密特定于功能的密钥(如凭证和令牌)。单独的密钥允许独立轮换,并在密钥泄露时限制暴露范围。使用 Python 为每个功能生成一个密钥:
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
我们建议将每个密钥存储在预定义的 Kubernetes secret 中,而不是直接在配置文件中设置它们。请参阅 使用现有 secret 了解相关参数: agent_builder_encryption_key, insights_encryption_key和 polly_encryption_key.
启用功能
Add the configuration to your langsmith_config.yaml
Using Kubernetes secrets (recommended)
按名称引用您现有的密钥。chart 读取 agent_builder_encryption_key, insights_encryption_key,以及 polly_encryption_key 并自动从中。
config:
existingSecretName: "<your-secret-name>"
fleet:
enabled: true
insights:
enabled: true
# Chat (formerly Polly)
polly:
enabled: true
fleetToolServer:
enabled: true
fleetTriggerServer:
enabled: true
Using inline values
直接在配置文件中设置加密密钥。请避免将此文件提交到版本控制。
fleet:
enabled: true
encryptionKey: "<fleet-encryption-key>"
insights:
enabled: true
encryptionKey: "<insights-encryption-key>"
polly:
enabled: true
encryptionKey: "<chat-encryption-key>"
fleetToolServer:
enabled: true
fleetTriggerServer:
enabled: true
每个功能默认部署自己专用的 PostgreSQL 和 Redis 实例。如需使用外部数据库,请配置 postgres.external 和 redis.external 部分(每个功能下)。例如:
fleet:
enabled: true
encryptionKey: "<fleet-encryption-key>"
postgres:
external:
enabled: true
connectionUrl: "<fleet-postgres-connection-url>"
redis:
external:
enabled: true
connectionUrl: "<fleet-redis-connection-url>"
Apply the changes
helm upgrade -i langsmith langchain/langsmith --values langsmith_config.yaml --version <version> -n <namespace> --wait --debug
验证 Fleet、Insights 和 Chat pods 是否正在运行:
kubectl get pods -n <namespace>
(可选)为 Fleet 启用 OAuth 工具和触发器
要在 Fleet 中启用基于 OAuth 的工具(如 Gmail、Slack 或 Linear),请配置 providerOrgId 并为您要使用的每个集成添加提供程序 ID。您可以启用任意组合的提供程序。
可用的提供程序
| 提供程序 | 启用的工具 | 启用的触发器 |
|---|---|---|
googleOAuthProvider<br />设置指南 | Gmail、Google日历、<br />Google Sheets、BigQuery | Gmail |
linearOAuthProvider<br />设置指南 | Linear | - |
linkedinOAuthProvider<br />设置指南 | - | |
microsoftOAuthProvider<br />设置指南 | Outlook、日历、Teams、SharePoint、<br />Word、Excel、PowerPoint | Outlook |
salesforceOAuthProvider<br />设置指南 | Salesforce | - |
slackOAuthProvider<br />设置指南 | Slack | Slack |
常规配置
将以下内容添加到您的 langsmith_config.yaml。仅包含您需要的提供程序。
fleet:
oauth:
# Organization ID where OAuth providers are configured
providerOrgId: "<your-org-id>"
# Add provider IDs for integrations you want to enable.
# Slack requires additional configuration.
slackOAuthProvider: "<provider-id>"
slackSigningSecret: "<signing-secret>"
slackBotId: "<bot-id>"
googleOAuthProvider: "<provider-id>"
linkedinOAuthProvider: "<provider-id>"
linearOAuthProvider: "<provider-id>"
microsoftOAuthProvider: "<provider-id>"
salesforceOAuthProvider: "<provider-id>"
提供程序设置指南
Google OAuth provider
要为 Fleet 启用 Google OAuth,请在 GCP 中创建一个 OAuth 客户端,并使用所需的 URL 和凭据对其进行配置。
Create OAuth client in GCP
Add URLs to GCP
将以下 URLs 添加到您的 OAuth 客户端,替换 <hostname> 替换为您 LangSmith 主机名和 <provider-id> 替换为您将使用的提供商 ID(例如, google):
已授权的 JavaScript 来源: - https://<hostname>
已授权的重定向 URI: - https://<hostname>/api-host/v2/auth/callback/<provider-id> - https://<hostname>/host-oauth-callback/<provider-id>
Copy credentials
复制 **客户端 ID** 和 **客户端密钥** 从 GCP OAuth 应用。
Configure OAuth provider in LangSmith
在 LangSmith 中,转到 **设置 > OAuth 提供商** 并添加一个新的提供商: - **客户端 ID**:来自 GCP - **客户端密钥**:来自 GCP - **授权 URL**: https://accounts.google.com/o/oauth2/auth - **令牌 URL**: https://oauth2.googleapis.com/token - **提供商 ID**:唯一字符串,例如: google
Apply the changes
将 LangSmith OAuth 提供商 ID 添加到您的 langsmith_config.yaml 并部署:
fleet:
oauth:
providerOrgId: "<your-org-id>"
googleOAuthProvider: "<provider-id>"
helm upgrade -i langsmith langchain/langsmith --values langsmith_config.yaml --version <version> -n <namespace> --wait --debug
Microsoft OAuth provider
要启用 Microsoft OAuth for Fleet,请创建 Azure 应用注册,添加所需的 Microsoft Graph 委派权限,并在 LangSmith 中配置 Microsoft OAuth 提供商。
Create an Azure app registration
在 Microsoft Entra 管理中心, go to **应用程序 > 应用注册** 并创建新的注册。
Choose supported account types
选择与您的部署匹配账户类型。如果您需要来自多个 Microsoft Entra 租户的用户进行身份验证,请选择多租户选项。如果您的部署仅限于一个租户,您可以使用单租户应用注册。
Add the redirect URI
添加以下 Web 重定向 URI,替换 <hostname> 替换为您 LangSmith 主机名和 <provider-id> 替换为您提供商 ID:
https://<hostname>/host-oauth-callback/<provider-id>
Create a client secret
In **证书和机密**,创建新的客户端机密。复制 **应用程序(客户端)ID** 和生成的客户端机密值。
Add Microsoft Graph delegated permissions
In **API 权限**,添加以下 Microsoft Graph 委派权限: - Mail.ReadWrite - Mail.Send - Calendars.ReadWrite - Team.ReadBasic.All - Channel.ReadBasic.All - Channel.Create - ChannelMessage.Send - ChannelMessage.Read.All - Chat.Create - Chat.ReadWrite - User.ReadBasic.All - Files.ReadWrite.All - Sites.ReadWrite.All
Grant tenant consent
如果您的 Microsoft 365 策略要求这些委派权限的租户管理员同意,请授予。
Configure OAuth provider in LangSmith
在 LangSmith 中,转到 **设置 > OAuth 提供商** 并添加一个新的提供商: - **名称**:例如, Microsoft - **提供商 ID**:唯一字符串,例如: microsoft-oauth-provider - **客户端 ID**:应用程序(客户端)ID 来自 Azure - **客户端密钥**:来自 Azure 的客户端密钥值 - **授权 URL**: https://login.microsoftonline.com/common/oauth2/v2.0/authorize - **令牌 URL**: https://login.microsoftonline.com/common/oauth2/v2.0/token - **提供商类型**: microsoft - **令牌端点身份验证方法**: client_secret_post
Apply the changes
将以下内容添加到您的 langsmith_config.yaml 并部署:
fleet:
oauth:
providerOrgId: "<your-org-id>"
microsoftOAuthProvider: "<provider-id>"
helm upgrade -i langsmith langchain/langsmith --values langsmith_config.yaml --version <version> -n <namespace> --wait --debug
Linear OAuth provider
要为 Fleet 启用 Linear OAuth,请创建一个 Linear OAuth 应用并使用所需的凭据进行配置。
Create a Linear OAuth app
Go to Linear 设置 > API > 应用程序 并创建一个新的 OAuth 应用程序。
Add callback URL
设置回调 URL,替换 <hostname> 为您的 LangSmith 主机名,以及 <provider-id> 为您的提供商 ID:
https://<hostname>/host-oauth-callback/<provider-id>
Copy credentials
创建应用后,复制 **客户端 ID** 和 **客户端密钥**.
Configure OAuth provider in LangSmith
在 LangSmith 中,转到 **设置 > OAuth 提供商** 并添加一个新的提供商: - **客户端 ID**:来自 Linear 应用 - **客户端密钥**:来自 Linear 应用 - **授权 URL**: https://linear.app/oauth/authorize - **令牌 URL**: https://api.linear.app/oauth/token - **提供商 ID**:唯一字符串,例如: linear
Apply the changes
将以下内容添加到您的 langsmith_config.yaml 并部署:
fleet:
oauth:
providerOrgId: "<your-org-id>"
linearOAuthProvider: "<provider-id>"
helm upgrade -i langsmith langchain/langsmith --values langsmith_config.yaml --version <version> -n <namespace> --wait --debug
LinkedIn OAuth provider
要为 Fleet 启用 LinkedIn OAuth,请创建一个 LinkedIn OAuth 应用并使用所需的凭据进行配置。
Create a LinkedIn OAuth app
Go to linkedin.com/developers/apps 并创建一个新应用。
Add redirect URI
在您的应用设置中,转到 **身份验证** 选项卡。添加以下重定向 URI,替换 <hostname> 为您的 LangSmith 主机名,以及 <provider-id> 为您的提供商 ID:
https://<hostname>/host-oauth-callback/<provider-id>
Copy credentials
复制 **客户端 ID** 和 **客户端密钥** 从身份验证选项卡中获取。
Configure OAuth provider in LangSmith
在 LangSmith 中,转到 **设置 > OAuth 提供商** 并添加一个新的提供商: - **客户端 ID**:来自 LinkedIn 应用 - **客户端密钥**:来自 LinkedIn 应用 - **授权 URL**: https://www.linkedin.com/oauth/v2/authorization - **令牌 URL**: https://www.linkedin.com/oauth/v2/accessToken - **提供商 ID**:唯一字符串,例如: linkedin
Apply the changes
将以下内容添加到您的 langsmith_config.yaml 并部署:
fleet:
oauth:
providerOrgId: "<your-org-id>"
linkedinOAuthProvider: "<provider-id>"
helm upgrade -i langsmith langchain/langsmith --values langsmith_config.yaml --version <version> -n <namespace> --wait --debug
Salesforce OAuth provider
要为 Fleet 启用 Salesforce OAuth,请创建一个 Salesforce 外部客户端应用,配置其 OAuth 设置和策略,检索其凭据,然后在 LangSmith 中配置 Salesforce OAuth 提供商。
Create an External Client App
在 Salesforce 中 **设置**,使用 **快速查找** 打开 **外部客户端应用管理器**,然后点击 **新建外部客户端应用**.
在 **基本信息**下,设置: - **外部客户端应用名称**:例如, LangSmith Fleet - **联系人邮箱**:管理员邮箱地址 - **分发状态**: **本地**
Enable OAuth and configure the OAuth settings
展开 **API(启用 OAuth 设置)** 并选择 **启用 OAuth**。然后配置:
- 回调 URL,将
<hostname>替换为您的 LangSmith 主机名,<provider-id>替换为您的提供商 ID:
https://<hostname>/host-oauth-callback/<provider-id>
- 已选 OAuth 范围:添加 **通过 API 管理用户数据(api)** 和 **随时执行请求(刷新_令牌、离线_访问)**.
- - 保持 **Web 服务器流程需要密钥** selected.
- - 保留 **启用授权码和凭证流程** 和 **启用客户端凭证流程** 未选中。Fleet 使用标准的 Web 服务器(授权码)流程。
点击 **创建**.
Set the OAuth policies
打开应用,选择 **策略** 选项卡,然后点击 **编辑**:
- 刷新令牌策略:选择 **刷新令牌在撤销前有效**.
- 授权用户:保留 **所有用户均可自行授权**。如果选择 **管理员批准的用户已预授权** ,则必须先将应用分配给权限集或配置文件,否则授权将失败。
点击 **保存**.
Copy the credentials
在 **设置** 选项卡下,在 **OAuth 设置**,选择 **消费者密钥和密钥**。 **消费者密钥** 是您的客户端 ID, **消费者密钥** 是您的客户端密钥。
Configure OAuth provider in LangSmith
在 LangSmith 中,转到 **设置 > OAuth 提供商**,点击 **OAuth 提供商**,并填写: - **提供商 ID**:唯一字符串,例如: salesforce-oauth-provider。在下一步中使用相同的值用于 salesforceOAuthProvider 。 - **显示名称**:例如, Salesforce - **客户端 ID**:来自 Salesforce 的消费者密钥 - **客户端密钥**:来自 Salesforce 的消费者密钥 - **授权 URL**: https://.my.salesforce.com/services/oauth2/authorize - **令牌 URL**: https://.my.salesforce.com/services/oauth2/token
LangSmith 会根据令牌 URL 自动识别 Salesforce,因此没有提供商类型或令牌认证方法字段需要设置。将 **启用 PKCE** 关闭以匹配上面配置的 Web 服务器流程。
Apply the changes
将以下内容添加到您的 langsmith_config.yaml 并部署:
fleet:
oauth:
providerOrgId: "<your-langsmith-org-id>"
salesforceOAuthProvider: "<provider-id>"
helm upgrade -i langsmith langchain/langsmith --values langsmith_config.yaml --version <version> -n <namespace> --wait --debug
Slack OAuth provider
要为 Fleet 启用 Slack OAuth,请创建一个 Slack 应用并使用所需的范围、凭据和事件订阅对其进行配置。
Create a Slack app
Go to api.slack.com/apps 然后点击 **创建新应用**.
Add scopes
In **OAuth 和权限**,添加以下范围: - channels:history - channels:read - chat:write - groups:history - groups:read - im:history - im:read - im:write - mpim:history - team:read - users:read - users:read.email
Copy credentials from Slack
复制 **客户端 ID**, **客户端密钥**和 **签名密钥** 从 Slack 应用设置中。
Configure OAuth provider in LangSmith
在 LangSmith 中,转到 **设置 > OAuth 提供商** 并添加一个新的提供商: - **客户端 ID**:来自 Slack 应用 - **客户端密钥**:来自 Slack 应用 - **授权 URL**: https://slack.com/oauth/v2/authorize - **令牌 URL**: https://slack.com/api/oauth.v2.access - **提供商 ID**:唯一字符串,例如: slack
Add redirect URI to Slack
将以下重定向 URI 添加到你的 Slack 应用中,位置在 **OAuth 和权限 > 重定向 URL**,将 <hostname> 替换为你的 LangSmith 主机名,并将 <provider-id> 替换为你的提供商 ID(例如, slack):
https://<hostname>/host-oauth-callback/<provider-id>
Get the bot ID
- 从 **OAuth 和权限** 中获取 bot 令牌。
- 运行以下命令:
curl -X POST https://slack.com/api/auth.test \
-H "Authorization: Bearer <bot-token>"
3. 从响应中复制 bot_id 。
Apply the changes
将以下内容添加到你的 langsmith_config.yaml 并部署:
fleet:
oauth:
providerOrgId: "<your-org-id>"
slackOAuthProvider: "<provider-id>"
slackSigningSecret: "<signing-secret>"
slackBotId: "<bot-id>"
helm upgrade -i langsmith langchain/langsmith --values langsmith_config.yaml --version <version> -n <namespace> --wait --debug
Enable event subscriptions
- 部署后,转到 **事件订阅** 在你的 Slack 应用中并启用事件。
- 设置 **请求 URL** to:
https://<hostname>/v1/triggers/webhooks/d809e66e-0000-4000-8000-000000000002
UUID 是一个固定的 LangSmith 标识符——不要替换它。
3. 添加以下 bot 事件: - message.channels - message.groups - message.im - message.mpim
Set up triggers and tools
1. 将 Slack bot 添加到你希望它读取的频道。 2. 在 Fleet 中配置 Slack 工具或触发器时,提供 **频道 ID** 和 **频道名称**.
(可选)为 Fleet 启用 GitHub 应用
Fleet 通过专用 **GitHub 应用** (不是 OAuth 应用)进行集成。GitHub 应用为 Fleet 的 GitHub 工具提供仓库访问权限,并支持私有仓库访问所需的用户授权流程。
设置涉及创建一个 GitHub 应用、收集其凭据、将它们存储为 Kubernetes 密钥,以及从你的 langsmith_config.yaml.
Create a GitHub App
Go to GitHub 设置 > 开发者设置 > GitHub 应用 并点击 **新建 GitHub 应用**.
Fill in basic details
- **GitHub 应用名称**:任何唯一名称,例如 acme-langsmith-fleet。请记下 GitHub 生成的 slug(名称的小写、连字符形式),因为这是您将用于 FLEET_GITHUB_APP_SLUG. - **主页 URL**:您的 LangSmith 主机名,例如 https://langsmith.acme.com. - 取消选择 **激活** 下的 **Webhook** 。稍后在生成 webhook 密钥后,您将在后续步骤中启用它。
Set callback URLs
在 **识别和授权用户**下,添加以下 **回调 URL**,将 <hostname> 替换为您的 LangSmith 主机名:
https://<hostname>/v1/platform/fleet/providers/github-app/auth/callback
选择 **更新时重定向**.
在 **安装后**下,添加以下 **设置 URL**:
https://<hostname>/v1/platform/fleet/providers/github-app/callback
选择 **更新时重定向**.
Set webhook URL and generate a webhook secret
生成随机 webhook 密钥:
python3 -c "import secrets; print(secrets.token_urlsafe(48))"
在 **Webhook**: - 选择 **激活**. - 设置 **Webhook URL** to:
https://<hostname>/v1/platform/fleet/providers/github-app/webhooks
- 将生成的值粘贴到 **Webhook 密钥**。保存它,因为稍后在创建 Kubernetes 密钥时需要相同的值。
Set repository permissions
在 **权限 > 仓库权限**下,授予以下权限:
- 内容:读写
- 问题:读写
- 拉取请求:读写
- 元数据:只读(自动选择)
在 **权限 > 账户权限**下,授予 **电子邮件地址:只读**.
Choose install visibility
在 **此 GitHub 应用可以在哪里安装?**下,选择与您的分发需求匹配的选项。对于大多数自托管部署, **仅在此账户上** 是正确的。
Create the app
点击 **创建 GitHub App**。在应用设置页面上,记下以下值:
| 值 | 查找位置 | 环境变量 |
|---|---|---|
| **App ID** | 数字,位于页面顶部 | FLEET_GITHUB_APP_ID |
| **公开链接** | 例如, https://github.com/apps/acme-langsmith-fleet | FLEET_GITHUB_APP_PUBLIC_LINK |
| App slug | 公开链接的最后一个路径段 | FLEET_GITHUB_APP_SLUG |
| **Client ID** | 在 **About** | FLEET_GITHUB_APP_CLIENT_ID |
Generate a client secret
下方 **Client secrets**,点击 **生成新的客户端密钥** 并复制该值。这是 FLEET_GITHUB_APP_CLIENT_SECRET。GitHub 仅显示一次。
Generate a private key
滚动到 **私钥** 并点击 **生成私钥**。GitHub 会下载一个 .pem 文件。请妥善保管此文件,因为它授予了对 GitHub App 的完全访问权限。PEM 内容为 FLEET_GITHUB_APP_PRIVATE_KEY.
Generate a state JWT secret
LangSmith 使用 HMAC 密钥对短生命周期 OAuth 状态令牌进行签名。生成一个:
python3 -c "import secrets; print(secrets.token_urlsafe(48))"
这是 FLEET_GITHUB_APP_STATE_JWT_SECRET.
Create a Kubernetes secret
将敏感值存储在 Kubernetes secret 中:
kubectl create secret generic fleet-github-app \
--namespace <your-langsmith-namespace> \
--from-literal=client_secret="<client-secret>" \
--from-literal=webhook_secret="<webhook-secret>" \
--from-literal=state_jwt_secret="<state-jwt-secret>" \
--from-file=private_key=/path/to/fleet-app.private-key.pem
对于生产部署,请通过您现有的 secret 工作流程管理此 secret(例如, Sealed Secrets or External Secrets Operator)。请参阅 使用现有 secret 了解更多。
Add the configuration to your langsmith_config.yaml
添加以下内容,将占位符值替换为上面收集的非敏感值:
commonEnv:
- name: FLEET_GITHUB_APP_ID
value: "<app-id>"
- name: FLEET_GITHUB_APP_SLUG
value: "<app-slug>"
- name: FLEET_GITHUB_APP_PUBLIC_LINK
value: "https://github.com/apps/<app-slug>"
- name: FLEET_GITHUB_APP_CLIENT_ID
value: "<client-id>"
- name: FLEET_GITHUB_APP_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: fleet-github-app
key: client_secret
- name: FLEET_GITHUB_APP_PRIVATE_KEY
valueFrom:
secretKeyRef:
name: fleet-github-app
key: private_key
- name: FLEET_GITHUB_APP_WEBHOOK_SECRET
valueFrom:
secretKeyRef:
name: fleet-github-app
key: webhook_secret
- name: FLEET_GITHUB_APP_STATE_JWT_SECRET
valueFrom:
secretKeyRef:
name: fleet-github-app
key: state_jwt_secret
fleetToolServer:
deployment:
extraEnv:
- name: FLEET_GITHUB_APP_ENABLED
value: "true"
Deploy and install the app on repositories
运行以下命令应用更改:
helm upgrade -i langsmith langchain/langsmith --values langsmith_config.yaml --version <version> -n <namespace> --wait --debug
Pod 就绪后:
- 在 LangSmith 中,打开一个 Fleet agent 并在 agent 编辑器中进入 GitHub 集成。
- 点击 **连接 GitHub** 以在 Fleet 应访问的仓库上安装该应用。
- 对于私有仓库,您必须在安装过程中明确选择每个仓库。
禁用功能
要禁用 Fleet、Insights 和 Chat 的任意组合,请将相应的标志设置为 false 在您的 langsmith_config.yaml:
fleet:
enabled: false
insights:
enabled: false
polly:
enabled: false
可选配置
配置其他数据平面
除上面创建的数据平面外,您还可以在不同的 Kubernetes 集群或同一集群的不同命名空间下创建更多数据平面。有多种方式可以实现此目的,因此请实施最适合您用例的解决方案。
先决条件
Review cluster organization
阅读 混合(传统)文档 中的集群组织指南,以了解如何为此用例进行组织。
Verify hybrid prerequisites
验证 混合部分 中新集群的先决条件。在第 5 步的 先决条件中,配置出口到您的 自托管 LangSmith 实例 而不是 https://api.host.langchain.com 和 https://api.smith.langchain.com.
Enable the feature in Postgres
针对您的 LangSmith Postgres 实例运行以下命令以启用此功能。记下工作区 ID 以便后续步骤使用。
update organizations set config = config || '{"enable_lgp_listeners_page": true}' where id = '<org id here>';
update tenants set config = config || '{"langgraph_remote_reconciler_enabled": true}' where id = '<workspace id here>';
部署到不同的集群
Follow the hybrid setup guide
按照 混合设置指南中的第 2 到 6 步进行操作。设置 config.langsmithWorkspaceId 为上一步中的工作区 ID。
(Optional) Add more data planes to the same cluster
要在同一集群中添加多个数据平面,请按照 在同一集群中配置额外数据平面的说明.
部署到同一集群中的不同命名空间
Update your config
在您的 langsmith_config.yaml中,进行以下修改: - 设置 operator.watchNamespaces 为您的自托管 LangSmith 实例当前运行所在的命名空间。这可以防止与新数据平面添加的 operator 发生冲突。 - 使用 Gateway API or an Istio Gateway。调整您的 langsmith_config.yaml accordingly.
Apply the changes
helm upgrade -i langsmith langchain/langsmith --values langsmith_config.yaml --version <version> -n <namespace> --wait --debug
Follow the hybrid setup guide
按照 混合设置指南中的第 2 到 6 步进行操作。设置 config.langsmithWorkspaceId 为上一步中的工作区 ID。设置 config.watchNamespaces 为与现有数据平面使用的不同的命名空间。
(Optional) Configure log access
配置控制平面从新命名空间读取 Agent Server 部署日志的访问权限。请参阅 从其他命名空间读取 Agent Server 日志.
配置私有注册表的身份验证
如果您的 Agent Server 部署 将使用来自私有容器注册表(例如 AWS ECR、Azure ACR 或 GCP Artifact Registry)的镜像,请配置镜像拉取密钥。此配置会自动应用到所有部署,允许它们与您的私有注册表进行身份验证。
Create a Kubernetes image pull secret
kubectl create secret docker-registry langsmith-registry-secret \
--docker-server=myregistry.com \
--docker-username=your-username \
--docker-password=your-password \
--docker-email=your-email@example.com \
-n langsmith
用您的注册表凭据替换这些值: - myregistry.com:您的注册表 URL - your-username:您的注册表用户名 - your-password: 您的镜像仓库密码或访问令牌 - langsmith: LangSmith 安装所在的 Kubernetes 命名空间
Configure the deployment template in your langsmith_config.yaml
要使 Agent Server 部署能够使用私有镜像仓库密钥,请添加 imagePullSecrets 到操作符的部署模板中:
operator:
templates:
deployment: |
apiVersion: apps/v1
kind: Deployment
metadata:
name: ${name}
namespace: ${namespace}
spec:
replicas: ${replicas}
revisionHistoryLimit: 10
selector:
matchLabels:
app: ${name}
template:
metadata:
labels:
app: ${name}
spec:
enableServiceLinks: false
imagePullSecrets:
- name: langsmith-registry-secret
containers:
- name: api-server
image: ${image}
ports:
- name: api-server
containerPort: 8000
protocol: TCP
livenessProbe:
httpGet:
path: /ok
port: 8000
periodSeconds: 15
timeoutSeconds: 5
failureThreshold: 6
readinessProbe:
httpGet:
path: /ok
port: 8000
periodSeconds: 15
timeoutSeconds: 5
failureThreshold: 6
Apply the changes
helm upgrade -i langsmith langchain/langsmith --values langsmith_config.yaml --version <version> -n <namespace> --wait --debug
所有通过 LangSmith UI 创建的用户部署都将继承这些镜像仓库凭证。
有关特定镜像仓库的身份验证方法,请参阅 Kubernetes 文档中关于从私有镜像仓库拉取镜像的内容.
从其他命名空间读取 Agent Server 日志
对于控制平面和数据平面在同一集群中的部署,请确保控制平面 Kubernetes 部署(host-backend)有权限 get, list和 watch Kubernetes deployments, pods, replicasets和 logs 来自 Agent Server 部署所在的命名空间。有多种方式可以实现此目的。以下示例使用 Kubernetes RBAC,但请使用最适合您用例的方法:
Create a Role with the required permissions
在 Agent Server 命名空间中创建一个 Role 替换 <data_plane_namespace>:
kubectl apply -n <data_plane_namespace> -f - <
<section class="mdx-block"><h3>Get the control plane ServiceAccount</h3>
替换 `<control_plane_namespace>`:
bash
kubectl get serviceaccounts -n 后续步骤
启用 LangSmith 部署后,请参阅 通过控制平面部署 以通过 LangSmith UI 构建和部署您的应用程序。