Merge branch 'feature/moshui20260411-deepagents-0_5_2' into dev
This commit is contained in:
commit
d7130337b0
@ -405,22 +405,22 @@ def create_custom_cli_agent(
|
|||||||
# Use LocalShellBackend for filesystem + shell execution
|
# Use LocalShellBackend for filesystem + shell execution
|
||||||
backend = LocalShellBackend(
|
backend = LocalShellBackend(
|
||||||
root_dir=workspace_root,
|
root_dir=workspace_root,
|
||||||
virtual_mode=True,
|
virtual_mode=False,
|
||||||
inherit_env=True,
|
inherit_env=True,
|
||||||
env=final_shell_env,
|
env=final_shell_env,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# No shell access - use plain FilesystemBackend
|
# 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 (参考新版本实现)
|
# Set up composite backend with routing (参考新版本实现)
|
||||||
large_results_backend = FilesystemBackend(
|
large_results_backend = FilesystemBackend(
|
||||||
root_dir=tempfile.mkdtemp(prefix="deepagents_large_results_"),
|
root_dir=tempfile.mkdtemp(prefix="deepagents_large_results_"),
|
||||||
virtual_mode=True,
|
virtual_mode=False,
|
||||||
)
|
)
|
||||||
conversation_history_backend = FilesystemBackend(
|
conversation_history_backend = FilesystemBackend(
|
||||||
root_dir=tempfile.mkdtemp(prefix="deepagents_conversation_history_"),
|
root_dir=tempfile.mkdtemp(prefix="deepagents_conversation_history_"),
|
||||||
virtual_mode=True,
|
virtual_mode=False,
|
||||||
)
|
)
|
||||||
composite_backend = CompositeBackend(
|
composite_backend = CompositeBackend(
|
||||||
default=backend,
|
default=backend,
|
||||||
@ -436,7 +436,7 @@ def create_custom_cli_agent(
|
|||||||
|
|
||||||
agent_middleware.append(
|
agent_middleware.append(
|
||||||
CustomSkillsMiddleware(
|
CustomSkillsMiddleware(
|
||||||
backend=FilesystemBackend(root_dir=workspace_root, virtual_mode=True),
|
backend=FilesystemBackend(root_dir=workspace_root, virtual_mode=False),
|
||||||
sources=skills_sources,
|
sources=skills_sources,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -60,7 +60,7 @@ from deepagents.backends import LocalShellBackend
|
|||||||
# 创建 backend,支持自定义环境变量
|
# 创建 backend,支持自定义环境变量
|
||||||
backend = LocalShellBackend(
|
backend = LocalShellBackend(
|
||||||
root_dir=workspace_root,
|
root_dir=workspace_root,
|
||||||
virtual_mode=True,
|
virtual_mode=False,
|
||||||
env={"ASSISTANT_ID": "xxx", "USER_IDENTIFIER": "yyy"}, # 自定义环境变量
|
env={"ASSISTANT_ID": "xxx", "USER_IDENTIFIER": "yyy"}, # 自定义环境变量
|
||||||
inherit_env=True, # 继承父进程环境变量
|
inherit_env=True, # 继承父进程环境变量
|
||||||
)
|
)
|
||||||
@ -92,7 +92,7 @@ backend = LocalShellBackend(
|
|||||||
```python
|
```python
|
||||||
# 当前实现
|
# 当前实现
|
||||||
composite_backend = CompositeBackend(
|
composite_backend = CompositeBackend(
|
||||||
default=FilesystemBackend(root_dir=workspace_root, virtual_mode=True),
|
default=FilesystemBackend(root_dir=workspace_root, virtual_mode=False),
|
||||||
routes={},
|
routes={},
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
@ -120,14 +120,14 @@ from deepagents.backends import LocalShellBackend
|
|||||||
# 创建带自定义环境变量的 backend
|
# 创建带自定义环境变量的 backend
|
||||||
shell_backend = LocalShellBackend(
|
shell_backend = LocalShellBackend(
|
||||||
root_dir=workspace_root,
|
root_dir=workspace_root,
|
||||||
virtual_mode=True,
|
virtual_mode=False,
|
||||||
env=shell_env,
|
env=shell_env,
|
||||||
inherit_env=True,
|
inherit_env=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# 或使用 CompositeBackend 路由
|
# 或使用 CompositeBackend 路由
|
||||||
composite_backend = CompositeBackend(
|
composite_backend = CompositeBackend(
|
||||||
default=FilesystemBackend(root_dir=workspace_root, virtual_mode=True),
|
default=FilesystemBackend(root_dir=workspace_root, virtual_mode=False),
|
||||||
routes={
|
routes={
|
||||||
"/shell/": shell_backend, # shell 命令路由
|
"/shell/": shell_backend, # shell 命令路由
|
||||||
},
|
},
|
||||||
@ -209,7 +209,7 @@ if enable_shell:
|
|||||||
final_shell_env = shell_env or {}
|
final_shell_env = shell_env or {}
|
||||||
shell_backend = LocalShellBackend(
|
shell_backend = LocalShellBackend(
|
||||||
root_dir=workspace_root,
|
root_dir=workspace_root,
|
||||||
virtual_mode=True,
|
virtual_mode=False,
|
||||||
env=final_shell_env,
|
env=final_shell_env,
|
||||||
inherit_env=True, # 继承 os.environ
|
inherit_env=True, # 继承 os.environ
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user