该服务提供持久化执行、记忆、沙箱、通道、评估(evals)及生产级基础设施。 🔗 阅读原文 via AIHOT · https://aihot.virxact.com/items/cmsj81yyp02cwroo5rcq20vke
今天,托管深度智能代理(Managed Deep Agents)已在公开测试阶段上线。从原型到生产级别扩展,无需自己管理底层基础设施。您可以使用 Python 或 TypeScript 编写深度智能代理,在本地测试,然后通过一条命令将其部署到托管运行环境。
您可以控制模型、指令、工具、中间件、子代理等。LangSmith 负责运行时处理,包括持久化、内存挂载、技能加载、沙箱生命周期和部署。
使用以下命令开始:
我们围绕在有用代理中反复看到的模式构建了深度智能代理(Deep Agents)。代理通常需要:
您可以在底层框架基础上自行构建所有这些功能,但该模式足够常见,应该作为一个可重用的框架提供给公司,自主拥有和控制。深度智能代理就是这样的框架。它是开源的并且与模型无关,允许您带入自己的模型、指令、工具和业务逻辑。
深度智能代理使构建高效代理变得更容易。托管深度智能代理使在生产环境中运行这些代理变得更简单。
它负责构建和维护成本高昂的生产基础设施,同时将使您的代理独特的部分保持在您控制之下。这意味着您可以将时间花在代理的行为上,包括提示、工具、中间件、身份规则、评估和领域逻辑,而不是重建每个代理都需要的相同基础设施:
托管深度智能代理是您代码仓库中的首要代码项目。它允许您轻松将代理的所有原语组织到一个简单的目录中:
一旦您编写好项目并运行 mda deploy,托管深度智能代理会编译项目,将部署拥有的上下文同步到 LangSmith Context Hub:https://docs.langchain.com/langsmith/prompt-context-hub,上传构建内容,并创建一个托管的 LangSmith 部署。
大多数生产基础设施假设请求是短暂且无状态的。但代理通常会打破这两个假设。代理通常会运行几分钟、几小时甚至几天。它可能需要暂停以等待批准,在用户回复后继续运行,在工作期间实时传输进度,并在基础设施重启时恢复而不丢失状态。它可能需要持久线程、持久内存、取消、重试行为,以及跨模型调用、工具调用、文件、错误和运行时状态的可追踪性。
从零开始构建这种基础设施可能需要几个月甚至几个季度,而且还需要维护。持久执行、流式传输、人类批准、身份认证、调度和对话状态都会引入围绕持久性、重试、超时和可靠性的边缘情况,这些都会直接影响用户体验和代理的实用性。
Managed Deep Agents 构建在团队已经用于在生产中运行代理的相同 LangSmith Deployment Agent Server 之上。它将产品代理所需的操作模式打包成一个针对 Deep Agents 更具规范性的运行时。
这为你提供了开箱即用的生产原语:
许多有用的代理需要一个独立的工作环境来检查文件、写入输出、运行测试、安装依赖项、调用命令行工具或安全执行代码。
Deep Agents 支持此类工作的沙箱后端。我们为 Managed Deep Agents 构建了对 LangSmith Sandboxes 的一流支持:https://docs.langchain.com/langsmith/sandboxes。
你只需几行代码就可以配置沙箱:
默认情况下,每个持久线程都有自己的沙箱。这对于需要为每个用户对话或任务提供独立工作空间的代理非常适用,例如编程代理。当代理进程应在多个线程之间共享一个沙箱时,你也可以将范围设置为代理。
Managed Deep Agents 为代理提供了一个受控的工作场所,而无需你自己管理沙箱的配置、生命周期和清理。沙箱活动会被追踪到 LangSmith,因此你可以检查运行成功或失败时的具体情况。
验证代理行为不仅仅是评估提示和预期答案。你需要检查代理在获得最终答案的过程中采取了哪些操作。这就是评估(evals)的作用。例如:
它是否调用了正确的工具?它是否编辑了正确的文件?它是否创建了预期的成果?最终的工作区状态是否与任务匹配?对于基于代码和文件的代理,这些基于状态的检查通常比只评估最终信息更有用。
Managed Deep Agents 使用 Harbor:https://www.harborframework.com/docs 来处理此工作流程。Harbor 任务会给代理一个指令,在隔离环境中运行它,并使用验证器对生成的文件或状态进行评分。
通常困难的部分是将代理打包以便 Harbor 可以运行它。Managed Deep Agents 会为你处理这个打包,只需几个简单的终端命令即可完成:
mda evals init 会在 evals/ 下创建已签入的 Harbor 任务。mda evals compile 会在 .mda/evals/ 下构建一个 Harbor 交接件,包括已编译的代理成果、Harbor 用于运行代理的适配器,以及示例 Harbor 作业配置。
你仍然需要直接运行 Harbor,可以在本地的 Docker 中运行,或者在你配置的其他 Harbor 环境中运行。这样可以保持你的评估可移植。Managed Deep Agents 提供了从生产就绪代理到 Harbor 就绪成果的桥梁。
一旦代理部署,你就可以在 LangSmith 中管理你的评估并监控生产行为。每次运行都会在 LangSmith 中被追踪,因此生产中的失败可以成为未来的测试用例,从而闭合反馈循环。
渠道是你向用户开放代理的方式。Managed Deep Agents 对渠道提供一流的支持,使定义代理如何连接到不同渠道(如 Slack)变得直接。只需在 channels/ 下添加一个文件,运行时即可挂载提供者事件端点,验证提供者签名,使用身份标记调用你的代理,并能在原始对话中回复。
对于 Slack,这可以简单到只需定义一个渠道文件:
渠道让你的代理能够从像 Slack 这样的系统接收事件并响应,而无需单独的集成服务。这对于与用户协作的代理尤其有用,例如可以在 GitHub 上评论的代码审查代理,或在 Slack 中响应的支持或运维代理。用户可以在团队已经讨论的工作中标记代理。
线程状态帮助代理管理单个对话,但代理通常需要比一个线程更长时间的上下文。记忆使它们能够拥有持久的偏好和跨对话携带的上下文。
Managed Deep Agents 为每个部署的代理提供了以代理为范围的初始记忆。你可以在 memory.py 或 memory.ts 中定义记忆行为,运行时由 Context Hub 支持记忆。在运行时,代理会在 /memories/ 目录下读写记忆文件。
Deploy 会同步项目中的指令和技能,但会保留运行时创建的记忆。这意味着你可以重新部署你的代理来更新其执行行为,而不会清除代理已学到的内容。
Managed Deep Agents 目前包含一个基本的身份模型,我们将继续添加更先进的认证和凭证流程。
现在,你的代理可以使用固定的凭证集运行。如果你在 identity.py 或 identity.ts 中定义了 OIDC 提供者,Managed Deep Agents 会根据来自你的 OIDC 提供者的每个终端用户 ID 为线程设定范围。这能在同一部署下隔离每个用户的线程。
身份系统也是范围记忆和未来凭证模式的基础。这为你的代理提供了一种可信的方式来识别是谁触发了运行,而无需依赖提示文本或可伪造的请求字段。
团队已经在使用 Managed Deep Agents 更快地交付,通过专注于代理行为而不是基础设施、扩展和运行时逻辑。
当你希望拥有一个以代码为先的 Deep Agent,由 LangSmith 管理持久化、执行、部署以及围绕执行环境的常用生产框架时,Managed Deep Agents 非常有用。
如果你需要自定义路由、与图形一起的应用代码、自定义认证逻辑或直接控制持久化层,请直接使用 LangSmith Deployment。如果你想自己操作执行环境,Deep Agents 是开源的,因此你可以在你选择的基础设施上运行它。
这些是测试原语,我们很高兴在听取使用 Managed Deep Agents 运行工作负载的团队反馈时进一步改进它。
请按照快速入门指南:https://docs.langchain.com/langsmith/python/managed-deep-agents-quickstart 部署你的第一个托管深度代理。教程:https://docs.langchain.com/langsmith/python/managed-deep-agents-tutorial 会一步步添加身份、记忆、工具和评估功能。
如果你想先使用开源工具,请从深度代理概览开始:https://docs.langchain.com/oss/python/deepagents/overview。当你准备将该工具投入生产时,使用托管深度代理将其部署到 LangSmith。
我们非常愿意了解你构建了什么,默认设置在哪些情况下有效,以及你在哪些情况下需要更多控制。
LangSmith,我们的代理工程平台,帮助开发者调试每一个代理决策、评估更改,并一键部署。
Today, Managed Deep Agents is available in public beta. Go from prototype to production scale without managing the underlying infrastructure yourself. You can author a Deep Agent in Python or TypeScript, test it locally, and deploy it to a managed runtime with one command.
You control the model, instructions, tools, middleware, subagents, and more. LangSmith handles the runtime, including persistence, memory mounts, skill loading, sandbox lifecycle, and deployment.
Get started with the commands below:
We built Deep Agents around a pattern we kept seeing in useful agents. Agents often need to:
You can build all of that yourself on top of a lower-level framework, but the pattern is common enough that it should be available as a reusable harness that companies can own and control. Deep Agents is that harness. It's open source and model agnostic, allowing you to bring your model, your instructions, your tools, and your business logic.
Deep Agents makes it easier to build capable agents. Managed Deep Agents makes it easier to run those agents in production.
It handles the production infrastructure that’s costly to build and maintain, while keeping the parts that make your agent unique in your control. That means you can spend your time on the agent's behavior, including prompts, tools, middleware, identity rules, evals, and domain logic instead of rebuilding the same infra that every agent requires:
A Managed Deep Agent is a code-first project in your repo. It allows you to easily organize all your agent’s primitives into a simple directory:
Once you author your project and run mda deploy , Managed Deep Agents compiles the project, syncs deploy-owned context to LangSmith Context Hub:https://docs.langchain.com/langsmith/prompt-context-hub, uploads the build, and creates a hosted LangSmith deployment.
Most production infrastructure assumes short-lived, stateless requests. Agents often break both assumptions. Agents often run for minutes, hours, and even days. It may need to pause for approval, resume after a user replies, stream progress while it works, and recover from infrastructure restarts without losing state. It may need durable threads, persistent memory, cancellation, retry behavior, and traceability across model calls, tool calls, files, errors, and runtime state.
Building this infrastructure from scratch can take months or even quarters, and it has to be maintained. Durable execution, streaming, human approval, auth, scheduling, and conversation state all introduce edge cases around persistence, retries, timeouts, and reliability that directly impact user experience and agent usefulness.
Managed Deep Agents is built on the same LangSmith Deployment Agent Server that teams already use to run agents in production. It packages the operational patterns required for product agents into a more opinionated runtime for Deep Agents.
That gives you production primitives out of the box:
Many useful agents need an isolated working environment to inspect files, write outputs, run tests, install dependencies, call CLIs, or execute code securely.
Deep Agents supports sandbox backends for this kind of work. We have built first class support for LangSmith Sandboxes:https://docs.langchain.com/langsmith/sandboxes for Managed Deep Agents.
You configure a sandbox in just a few lines of code:
By default, each durable thread gets its own sandbox. That works well for agents that need an isolated workspace per user conversation or task, such as a coding agent. You can also set the scope to agent when the agent process should share one sandbox across threads.
Managed Deep Agents gives agents a controlled place to work without making you manage sandbox provisioning, lifecycle, and cleanup yourself. Sandbox activity is traced to LangSmith , so you can inspect what happened when a run succeeds or fails.
Verifying agent behavior requires more than evaluating just a prompt and expected answer. You need to check what actions the agent took along the way to get to the final answer. That's where evals come in. For example:
Did it call the right tools? Did it edit the right files? Did it create the expected artifact? Did the final workspace state match the task? For code and file-based agents, those state-based checks are often more useful than only scoring the final message.
Managed Deep Agents uses Harbor:https://www.harborframework.com/docs for this workflow. Harbor tasks give the agent an instruction, run it in an isolated environment, and grade the resulting files or state with a verifier.
The hard part is usually packaging your agent so Harbor can run it. Managed Deep Agents handles this packaging for you, in just a few short terminal commands:
mda evals init creates checked-in Harbor tasks under evals/ . mda evals compile builds a Harbor handoff under .mda/evals/ , including the compiled agent artifact, the adapter Harbor uses to run the agent, and an example Harbor job config.
You still run Harbor directly, either locally in Docker or in another Harbor environment you configure. That keeps your evals portable. Managed Deep Agents gives you the bridge from your production-ready agent to a Harbor-ready artifact.
Once the agent is deployed, you can manage your evals and monitor production behavior in LangSmith. Every run is traced in LangSmith, so production failures become future test cases, closing the feedback loop.
Channels are how you expose your agent to users. Managed Deep Agents has first class support for channels, making it straightforward to define how your agent connects to different channels, such as Slack. Add a file under channels/ , and the runtime mounts the provider event endpoint, verifies provider signatures, invokes your agent with identity stamps, and can reply in the originating conversation.
For Slack, that can be as simple as defining a channel file:
Channels let your agent receive events from systems like Slack and respond without a separate integration service. This is especially useful for agents that collaborate with users, such as a code review agent that can comment on GitHub or a support or operations agent that responds in Slack. Users can tag an agent where the team is already discussing the work.
Thread state helps an agent manage a single conversation, but agents often need context that lasts longer than one thread. Memory gives them durable preferences and context they can carry across conversations.
Managed Deep Agents gives every deployment agent-scoped memory to start. You define memory behavior in memory.py or memory.ts , and the runtime backs memory with Context Hub. At runtime, the agent reads and writes memory files under /memories/ .
Deploy syncs instructions and skills from your project, but it preserves runtime-created memories. That means you can redeploy your agent to update its harness behavior without wiping what the agent learned.
Managed Deep Agents includes a basic identity model today, and we will keep adding more advanced auth and credential flows going forward.
Today, your agent can run with a fixed set of credentials. If you define an OIDC provider in identity.py or identity.ts , Managed Deep Agents scopes threads per end user id from your OIDC provider. That keeps each user's threads isolated under the same deployment.
The identity system is also the basis for scoped memory and future credential patterns. That gives your agent a trusted way to know who triggered the run without relying on prompt text or spoofable request fields.
Teams are already using Managed Deep Agents to ship faster by focusing on agent behavior instead of infrastructure, scaling, and runtime logic.
Managed Deep Agents is useful when you want a code-first Deep Agent with LangSmith owning persistence, execution, deployment, and the common production scaffolding around the harness.
If you need custom routes, application code alongside the graph, custom auth logic, or direct control over the persistence layer, use LangSmith Deployment directly. If you want to operate the harness yourself, Deep Agents is open source, so you can run it on the infrastructure you choose.
These are beta primitives, and we are excited to hear evolve it as we hear feedback from teams running workloads on Managed Deep Agents
Follow the quickstart:https://docs.langchain.com/langsmith/python/managed-deep-agents-quickstart to deploy your first Managed Deep Agent. The tutorial:https://docs.langchain.com/langsmith/python/managed-deep-agents-tutorial adds identity, memory, tools, and evals step by step.
If you want the open source harness first, start with the Deep Agents overview:https://docs.langchain.com/oss/python/deepagents/overview. When you are ready to productionize that harness, use Managed Deep Agents to deploy it to LangSmith.
We would love to hear what you build, where the defaults work, and where you need more control.
LangSmith, our agent engineering platform, helps developers debug every agent decision, eval changes, and deploy in one click.