Pydantic AI 将 E2B 沙箱接入为原生能力
Pydantic AI 把 E2B 接入为原生沙箱提供方,在智能体能力列表中加入 E2BSandbox() 后,所有 shell 命令和文件操作都在隔离的 E2B microVM 中执行,环境变量和 SSH 密钥不会进入沙箱。沙箱在运行结束后可暂停、下次运行恢复,文件系统和内存保持不变,并通过无凭据的引用标识跨进程复用。文章给出两个示例,一是诊断后暂停再修复的两轮运行,二是在 Temporal 工作流中杀掉 worker 后由新 worker 接着在同一个沙箱里完成修复。
t is off your machine Install the harness with the E2B and Temporal extras, the provider extras the snippets below use (the quick start calls Anthropic, the cookbook examples call OpenAI), and the Logfire extra so the runs are traced. Then set E2B API KEY and the provider key: uv add "pydantic-ai-harness[e2b,anthropic,temporal]" "pydantic-ai-slim[openai,logfire]" Then give the agent the sandbox alongside the tools that will use it: import logfire from pydantic ai import Agent from pydantic ai ha
匹配字段正文
