virtual_mode=False

This commit is contained in:
朱潮 2026-04-11 17:52:48 +08:00
parent 7d22f0b34d
commit 3da3cc90e1
2 changed files with 10 additions and 10 deletions

View File

@ -405,22 +405,22 @@ def create_custom_cli_agent(
# Use LocalShellBackend for filesystem + shell execution
backend = LocalShellBackend(
root_dir=workspace_root,
virtual_mode=True,
virtual_mode=False,
inherit_env=True,
env=final_shell_env,
)
else:
# No shell access - use plain FilesystemBackend
backend = FilesystemBackend(root_dir=workspace_root, virtual_mode=True)
backend = FilesystemBackend(root_dir=workspace_root, virtual_mode=False)
# Set up composite backend with routing (参考新版本实现)
large_results_backend = FilesystemBackend(
root_dir=tempfile.mkdtemp(prefix="deepagents_large_results_"),
virtual_mode=True,
virtual_mode=False,
)
conversation_history_backend = FilesystemBackend(
root_dir=tempfile.mkdtemp(prefix="deepagents_conversation_history_"),
virtual_mode=True,
virtual_mode=False,
)
composite_backend = CompositeBackend(
default=backend,
@ -436,7 +436,7 @@ def create_custom_cli_agent(
agent_middleware.append(
CustomSkillsMiddleware(
backend=FilesystemBackend(root_dir=workspace_root, virtual_mode=True),
backend=FilesystemBackend(root_dir=workspace_root, virtual_mode=False),
sources=skills_sources,
)
)

View File

@ -60,7 +60,7 @@ from deepagents.backends import LocalShellBackend
# 创建 backend支持自定义环境变量
backend = LocalShellBackend(
root_dir=workspace_root,
virtual_mode=True,
virtual_mode=False,
env={"ASSISTANT_ID": "xxx", "USER_IDENTIFIER": "yyy"}, # 自定义环境变量
inherit_env=True, # 继承父进程环境变量
)
@ -92,7 +92,7 @@ backend = LocalShellBackend(
```python
# 当前实现
composite_backend = CompositeBackend(
default=FilesystemBackend(root_dir=workspace_root, virtual_mode=True),
default=FilesystemBackend(root_dir=workspace_root, virtual_mode=False),
routes={},
)
```
@ -120,14 +120,14 @@ from deepagents.backends import LocalShellBackend
# 创建带自定义环境变量的 backend
shell_backend = LocalShellBackend(
root_dir=workspace_root,
virtual_mode=True,
virtual_mode=False,
env=shell_env,
inherit_env=True,
)
# 或使用 CompositeBackend 路由
composite_backend = CompositeBackend(
default=FilesystemBackend(root_dir=workspace_root, virtual_mode=True),
default=FilesystemBackend(root_dir=workspace_root, virtual_mode=False),
routes={
"/shell/": shell_backend, # shell 命令路由
},
@ -209,7 +209,7 @@ if enable_shell:
final_shell_env = shell_env or {}
shell_backend = LocalShellBackend(
root_dir=workspace_root,
virtual_mode=True,
virtual_mode=False,
env=final_shell_env,
inherit_env=True, # 继承 os.environ
)