bohr-agent-sdk 0.1.100__tar.gz → 0.1.102__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/PKG-INFO +6 -2
  2. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/README.md +1 -1
  3. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/pyproject.toml +38 -0
  4. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/setup.py +8 -1
  5. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/bohr_agent_sdk.egg-info/PKG-INFO +6 -2
  6. bohr_agent_sdk-0.1.102/src/bohr_agent_sdk.egg-info/SOURCES.txt +85 -0
  7. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/bohr_agent_sdk.egg-info/requires.txt +4 -0
  8. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/adk/client/calculation_mcp_tool.py +10 -2
  9. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/cli/cli.py +126 -25
  10. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/__init__.py +1 -0
  11. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/calculation/simple.py.template +15 -0
  12. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/device/tescan_device.py.template +158 -0
  13. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/main.py.template +67 -0
  14. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/__init__.py +1 -0
  15. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/__init__.py +1 -0
  16. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/config.py +32 -0
  17. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/constants.py +61 -0
  18. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/debug.py +257 -0
  19. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/files.py +469 -0
  20. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/files_upload.py +115 -0
  21. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/files_user.py +50 -0
  22. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/messages.py +161 -0
  23. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/projects.py +146 -0
  24. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/sessions.py +93 -0
  25. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/utils.py +161 -0
  26. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/websocket.py +184 -0
  27. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/config/__init__.py +1 -0
  28. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/config/agent_config.py +257 -0
  29. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/index.html +13 -0
  30. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/package.json +46 -0
  31. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/tsconfig.json +26 -0
  32. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/tsconfig.node.json +10 -0
  33. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/ui-static/assets/index-DdAmKhul.js +105 -0
  34. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/ui-static/assets/index-DfN2raU9.css +1 -0
  35. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/ui-static/index.html +14 -0
  36. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/vite.config.ts +37 -0
  37. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/scripts/build_ui.py +56 -0
  38. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/__init__.py +0 -0
  39. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/app.py +98 -0
  40. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/connection.py +210 -0
  41. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/file_watcher.py +85 -0
  42. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/middleware.py +43 -0
  43. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/models.py +53 -0
  44. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/session_manager.py +1158 -0
  45. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/user_files.py +85 -0
  46. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/utils.py +50 -0
  47. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/test_download.py +98 -0
  48. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/ui_utils.py +260 -0
  49. bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/websocket-server.py +87 -0
  50. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/storage/http_storage.py +1 -1
  51. bohr_agent_sdk-0.1.100/src/bohr_agent_sdk.egg-info/SOURCES.txt +0 -45
  52. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/setup.cfg +0 -0
  53. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/bohr_agent_sdk.egg-info/dependency_links.txt +0 -0
  54. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/bohr_agent_sdk.egg-info/entry_points.txt +0 -0
  55. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/bohr_agent_sdk.egg-info/top_level.txt +0 -0
  56. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/__init__.py +0 -0
  57. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/__init__.py +0 -0
  58. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/adk/__init__.py +0 -0
  59. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/adk/client/__init__.py +0 -0
  60. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/adk/storage_artifact_service.py +0 -0
  61. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/adk/utils.py +0 -0
  62. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/camel/__init__.py +0 -0
  63. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/camel/client/__init__.py +0 -0
  64. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/camel/client/calculation_mcp_client.py +0 -0
  65. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/cli/__init__.py +0 -0
  66. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/cloud/__init__.py +0 -0
  67. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/cloud/main.py +0 -0
  68. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/cloud/mcp.py +0 -0
  69. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/cloud/mqtt.py +0 -0
  70. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/device/__init__.py +0 -0
  71. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/device/device/__init__.py +0 -0
  72. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/device/device/device.py +0 -0
  73. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/device/device/types.py +0 -0
  74. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/device/mqtt_device_twin.py +0 -0
  75. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/__init__.py +0 -0
  76. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/calculation_mcp_server.py +0 -0
  77. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/executor/__init__.py +0 -0
  78. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/executor/base_executor.py +0 -0
  79. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/executor/dispatcher_executor.py +0 -0
  80. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/executor/local_executor.py +0 -0
  81. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/preprocessor.py +0 -0
  82. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/storage/__init__.py +0 -0
  83. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/storage/base_storage.py +0 -0
  84. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/storage/bohrium_storage.py +0 -0
  85. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/storage/local_storage.py +0 -0
  86. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/storage/oss_storage.py +0 -0
  87. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/utils.py +0 -0
  88. {bohr_agent_sdk-0.1.100 → bohr_agent_sdk-0.1.102}/tests/test_cli.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bohr-agent-sdk
3
- Version: 0.1.100
3
+ Version: 0.1.102
4
4
  Summary: SDK for scientific agents
5
5
  Home-page: https://github.com/dptech-corp/bohr-agent-sdk/
6
6
  Author: DP Technology
@@ -30,6 +30,9 @@ Requires-Dist: paho-mqtt>=2.1.0
30
30
  Requires-Dist: redis>=6.2.0
31
31
  Requires-Dist: twine>=6.1.0
32
32
  Requires-Dist: build>=1.2.2.post1
33
+ Requires-Dist: watchdog>=6.0.0
34
+ Requires-Dist: fastapi>=0.116.0
35
+ Requires-Dist: bohrium-open-sdk==0.1.5
33
36
  Provides-Extra: device
34
37
  Requires-Dist: pywinauto-recorder>=0.1.0; extra == "device"
35
38
  Provides-Extra: cloud
@@ -44,6 +47,7 @@ Requires-Dist: black>=23.11.0; extra == "dev"
44
47
  Requires-Dist: isort>=5.12.0; extra == "dev"
45
48
  Requires-Dist: mypy>=1.7.0; extra == "dev"
46
49
  Requires-Dist: pylint>=3.0.0; extra == "dev"
50
+ Requires-Dist: google-adk; extra == "dev"
47
51
  Provides-Extra: docs
48
52
  Requires-Dist: sphinx>=7.2.0; extra == "docs"
49
53
  Requires-Dist: sphinx-rtd-theme>=1.3.0; extra == "docs"
@@ -92,7 +96,7 @@ dp-agent run tool cloud
92
96
  dp-agent run tool calculation
93
97
 
94
98
  # 运行代理
95
- dp-agent run agent
99
+ dp-agent run agent --config config.json
96
100
 
97
101
  # 调试模式
98
102
  dp-agent run debug
@@ -38,7 +38,7 @@ dp-agent run tool cloud
38
38
  dp-agent run tool calculation
39
39
 
40
40
  # 运行代理
41
- dp-agent run agent
41
+ dp-agent run agent --config config.json
42
42
 
43
43
  # 调试模式
44
44
  dp-agent run debug
@@ -33,6 +33,9 @@ dependencies = [
33
33
  "redis>=6.2.0",
34
34
  "twine>=6.1.0",
35
35
  "build>=1.2.2.post1",
36
+ "watchdog>=6.0.0",
37
+ "fastapi>=0.116.0",
38
+ "bohrium-open-sdk==0.1.5"
36
39
  ]
37
40
 
38
41
  # 可选依赖
@@ -58,6 +61,7 @@ dev = [
58
61
  "isort>=5.12.0",
59
62
  "mypy>=1.7.0",
60
63
  "pylint>=3.0.0",
64
+ "google-adk"
61
65
  ]
62
66
 
63
67
  # 文档工具依赖
@@ -86,6 +90,40 @@ where = ["src"]
86
90
 
87
91
  [tool.setuptools]
88
92
  package-dir = {"" = "src"}
93
+ include-package-data = false # 关闭自动包含,使用显式配置
94
+
95
+ [tool.setuptools.package-data]
96
+ "dp.agent.cli.templates" = [
97
+ "**/*.template",
98
+ "**/*.json",
99
+ "**/*.md",
100
+ "**/*.txt",
101
+ "**/*.py"
102
+ ]
103
+ "dp.agent.cli.templates.ui" = [
104
+ "**/*.py",
105
+ "config/*.json",
106
+ "*.txt"
107
+ ]
108
+ # 包含前端静态文件和必要的配置文件(用于开发模式)
109
+ "dp.agent.cli.templates.ui.frontend" = [
110
+ "ui-static/**/*",
111
+ "package.json", # 开发模式需要
112
+ "vite.config.ts", # Vite 配置
113
+ "tsconfig.json", # TypeScript 配置
114
+ "index.html" # 开发模式入口
115
+ ]
116
+
117
+ # 使用 exclude-package-data 排除不需要的文件
118
+ [tool.setuptools.exclude-package-data]
119
+ "dp.agent.cli.templates.ui.frontend" = [
120
+ "*.sh",
121
+ ".eslintrc.cjs",
122
+ "tsconfig.node.json", # 排除这个,但保留 tsconfig.json
123
+ "src/**/*", # 排除源码
124
+ "public/**/*", # 排除 public 目录
125
+ "node_modules/**/*" # 排除 node_modules
126
+ ]
89
127
 
90
128
  [build-system]
91
129
  requires = [
@@ -9,7 +9,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
9
9
 
10
10
  setup(
11
11
  name="bohr-agent-sdk",
12
- version="0.1.100",
12
+ version="0.1.102",
13
13
  description="SDK for science agent and mcp tools",
14
14
  long_description=long_description,
15
15
  long_description_content_type="text/markdown",
@@ -28,6 +28,13 @@ setup(
28
28
  "python-dotenv>=1.0.0", # 环境变量管理
29
29
  "typing-extensions>=4.8.0", # 额外的类型提示功能
30
30
  "aiohttp>=3.9.1", # 异步HTTP客户端
31
+ "fastapi>=0.116",
32
+ "uvicorn>=0.24.0", # ASGI服务器
33
+ "websockets>=12.0", # WebSocket支持
34
+ "watchdog>=3.0.0", # 文件监视
35
+ "google-genai", # Google AI SDK
36
+ "google-generativeai", # Google Generative AI
37
+ "aiofiles",
31
38
  ],
32
39
  # extras_require={
33
40
  # "dev": [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bohr-agent-sdk
3
- Version: 0.1.100
3
+ Version: 0.1.102
4
4
  Summary: SDK for scientific agents
5
5
  Home-page: https://github.com/dptech-corp/bohr-agent-sdk/
6
6
  Author: DP Technology
@@ -30,6 +30,9 @@ Requires-Dist: paho-mqtt>=2.1.0
30
30
  Requires-Dist: redis>=6.2.0
31
31
  Requires-Dist: twine>=6.1.0
32
32
  Requires-Dist: build>=1.2.2.post1
33
+ Requires-Dist: watchdog>=6.0.0
34
+ Requires-Dist: fastapi>=0.116.0
35
+ Requires-Dist: bohrium-open-sdk==0.1.5
33
36
  Provides-Extra: device
34
37
  Requires-Dist: pywinauto-recorder>=0.1.0; extra == "device"
35
38
  Provides-Extra: cloud
@@ -44,6 +47,7 @@ Requires-Dist: black>=23.11.0; extra == "dev"
44
47
  Requires-Dist: isort>=5.12.0; extra == "dev"
45
48
  Requires-Dist: mypy>=1.7.0; extra == "dev"
46
49
  Requires-Dist: pylint>=3.0.0; extra == "dev"
50
+ Requires-Dist: google-adk; extra == "dev"
47
51
  Provides-Extra: docs
48
52
  Requires-Dist: sphinx>=7.2.0; extra == "docs"
49
53
  Requires-Dist: sphinx-rtd-theme>=1.3.0; extra == "docs"
@@ -92,7 +96,7 @@ dp-agent run tool cloud
92
96
  dp-agent run tool calculation
93
97
 
94
98
  # 运行代理
95
- dp-agent run agent
99
+ dp-agent run agent --config config.json
96
100
 
97
101
  # 调试模式
98
102
  dp-agent run debug
@@ -0,0 +1,85 @@
1
+ README.md
2
+ pyproject.toml
3
+ setup.py
4
+ src/bohr_agent_sdk.egg-info/PKG-INFO
5
+ src/bohr_agent_sdk.egg-info/SOURCES.txt
6
+ src/bohr_agent_sdk.egg-info/dependency_links.txt
7
+ src/bohr_agent_sdk.egg-info/entry_points.txt
8
+ src/bohr_agent_sdk.egg-info/requires.txt
9
+ src/bohr_agent_sdk.egg-info/top_level.txt
10
+ src/dp/__init__.py
11
+ src/dp/agent/__init__.py
12
+ src/dp/agent/adapter/adk/__init__.py
13
+ src/dp/agent/adapter/adk/storage_artifact_service.py
14
+ src/dp/agent/adapter/adk/utils.py
15
+ src/dp/agent/adapter/adk/client/__init__.py
16
+ src/dp/agent/adapter/adk/client/calculation_mcp_tool.py
17
+ src/dp/agent/adapter/camel/__init__.py
18
+ src/dp/agent/adapter/camel/client/__init__.py
19
+ src/dp/agent/adapter/camel/client/calculation_mcp_client.py
20
+ src/dp/agent/cli/__init__.py
21
+ src/dp/agent/cli/cli.py
22
+ src/dp/agent/cli/templates/__init__.py
23
+ src/dp/agent/cli/templates/main.py.template
24
+ src/dp/agent/cli/templates/calculation/simple.py.template
25
+ src/dp/agent/cli/templates/device/tescan_device.py.template
26
+ src/dp/agent/cli/templates/ui/__init__.py
27
+ src/dp/agent/cli/templates/ui/test_download.py
28
+ src/dp/agent/cli/templates/ui/ui_utils.py
29
+ src/dp/agent/cli/templates/ui/websocket-server.py
30
+ src/dp/agent/cli/templates/ui/api/__init__.py
31
+ src/dp/agent/cli/templates/ui/api/config.py
32
+ src/dp/agent/cli/templates/ui/api/constants.py
33
+ src/dp/agent/cli/templates/ui/api/debug.py
34
+ src/dp/agent/cli/templates/ui/api/files.py
35
+ src/dp/agent/cli/templates/ui/api/files_upload.py
36
+ src/dp/agent/cli/templates/ui/api/files_user.py
37
+ src/dp/agent/cli/templates/ui/api/messages.py
38
+ src/dp/agent/cli/templates/ui/api/projects.py
39
+ src/dp/agent/cli/templates/ui/api/sessions.py
40
+ src/dp/agent/cli/templates/ui/api/utils.py
41
+ src/dp/agent/cli/templates/ui/api/websocket.py
42
+ src/dp/agent/cli/templates/ui/config/__init__.py
43
+ src/dp/agent/cli/templates/ui/config/agent_config.py
44
+ src/dp/agent/cli/templates/ui/frontend/index.html
45
+ src/dp/agent/cli/templates/ui/frontend/package.json
46
+ src/dp/agent/cli/templates/ui/frontend/tsconfig.json
47
+ src/dp/agent/cli/templates/ui/frontend/tsconfig.node.json
48
+ src/dp/agent/cli/templates/ui/frontend/vite.config.ts
49
+ src/dp/agent/cli/templates/ui/frontend/ui-static/index.html
50
+ src/dp/agent/cli/templates/ui/frontend/ui-static/assets/index-DdAmKhul.js
51
+ src/dp/agent/cli/templates/ui/frontend/ui-static/assets/index-DfN2raU9.css
52
+ src/dp/agent/cli/templates/ui/scripts/build_ui.py
53
+ src/dp/agent/cli/templates/ui/server/__init__.py
54
+ src/dp/agent/cli/templates/ui/server/app.py
55
+ src/dp/agent/cli/templates/ui/server/connection.py
56
+ src/dp/agent/cli/templates/ui/server/file_watcher.py
57
+ src/dp/agent/cli/templates/ui/server/middleware.py
58
+ src/dp/agent/cli/templates/ui/server/models.py
59
+ src/dp/agent/cli/templates/ui/server/session_manager.py
60
+ src/dp/agent/cli/templates/ui/server/user_files.py
61
+ src/dp/agent/cli/templates/ui/server/utils.py
62
+ src/dp/agent/cloud/__init__.py
63
+ src/dp/agent/cloud/main.py
64
+ src/dp/agent/cloud/mcp.py
65
+ src/dp/agent/cloud/mqtt.py
66
+ src/dp/agent/device/__init__.py
67
+ src/dp/agent/device/mqtt_device_twin.py
68
+ src/dp/agent/device/device/__init__.py
69
+ src/dp/agent/device/device/device.py
70
+ src/dp/agent/device/device/types.py
71
+ src/dp/agent/server/__init__.py
72
+ src/dp/agent/server/calculation_mcp_server.py
73
+ src/dp/agent/server/preprocessor.py
74
+ src/dp/agent/server/utils.py
75
+ src/dp/agent/server/executor/__init__.py
76
+ src/dp/agent/server/executor/base_executor.py
77
+ src/dp/agent/server/executor/dispatcher_executor.py
78
+ src/dp/agent/server/executor/local_executor.py
79
+ src/dp/agent/server/storage/__init__.py
80
+ src/dp/agent/server/storage/base_storage.py
81
+ src/dp/agent/server/storage/bohrium_storage.py
82
+ src/dp/agent/server/storage/http_storage.py
83
+ src/dp/agent/server/storage/local_storage.py
84
+ src/dp/agent/server/storage/oss_storage.py
85
+ tests/test_cli.py
@@ -10,6 +10,9 @@ paho-mqtt>=2.1.0
10
10
  redis>=6.2.0
11
11
  twine>=6.1.0
12
12
  build>=1.2.2.post1
13
+ watchdog>=6.0.0
14
+ fastapi>=0.116.0
15
+ bohrium-open-sdk==0.1.5
13
16
 
14
17
  [all]
15
18
  bohr-agent-sdk[bohrium,cloud,dev,device,dispatcher,docs]
@@ -27,6 +30,7 @@ black>=23.11.0
27
30
  isort>=5.12.0
28
31
  mypy>=1.7.0
29
32
  pylint>=3.0.0
33
+ google-adk
30
34
 
31
35
  [device]
32
36
  pywinauto-recorder>=0.1.0
@@ -49,6 +49,7 @@ class CalculationMCPTool(MCPTool):
49
49
  results_tool: Optional[MCPTool] = None,
50
50
  query_interval: int = 10,
51
51
  logging_callback: Callable = logging_handler,
52
+ override: bool = True,
52
53
  ):
53
54
  """Calculation MCP tool
54
55
  extended from google.adk.tools.mcp_tool.MCPTool
@@ -71,6 +72,7 @@ class CalculationMCPTool(MCPTool):
71
72
  results_tool: The tool of getting job results
72
73
  query_interval: Time interval of querying job status
73
74
  logging_callback: Callback function for server notifications
75
+ override: Override storage and executor in tool params or not
74
76
  """
75
77
  self.executor = executor
76
78
  self.storage = storage
@@ -82,6 +84,7 @@ class CalculationMCPTool(MCPTool):
82
84
  self.query_interval = query_interval
83
85
  self.wait = wait
84
86
  self.logging_callback = logging_callback
87
+ self.override = override
85
88
 
86
89
  async def log(self, level: str, message: Any, tool_context: ToolContext):
87
90
  await self.logging_callback(types.LoggingMessageNotificationParams(
@@ -90,9 +93,9 @@ class CalculationMCPTool(MCPTool):
90
93
  async def run_async(self, args, tool_context: ToolContext, **kwargs):
91
94
  # TODO: add progress callback when run_async
92
95
  args = deepcopy(args)
93
- if "executor" not in args:
96
+ if self.override or "executor" not in args:
94
97
  args["executor"] = self.executor
95
- if "storage" not in args:
98
+ if self.override or "storage" not in args:
96
99
  args["storage"] = self.storage
97
100
  if not self.async_mode and self.wait:
98
101
  return await super().run_async(
@@ -155,6 +158,7 @@ class CalculationMCPToolset(MCPToolset):
155
158
  async_mode: bool = False,
156
159
  wait: bool = True,
157
160
  logging_callback: Callable = logging_handler,
161
+ override: bool = True,
158
162
  **kwargs,
159
163
  ):
160
164
  """
@@ -174,7 +178,9 @@ class CalculationMCPToolset(MCPToolset):
174
178
  tools
175
179
  async_mode: Submit and query until the job finishes, instead of
176
180
  waiting in single connection
181
+ wait: Wait for the job to finish or directly return
177
182
  logging_callback: Callback function for server notifications
183
+ override: Override storage and executor in tool params or not
178
184
  """
179
185
  super().__init__(**kwargs)
180
186
  self.logging_callback = logging_callback
@@ -191,6 +197,7 @@ class CalculationMCPToolset(MCPToolset):
191
197
  self.query_tool = None
192
198
  self.terminate_tool = None
193
199
  self.results_tool = None
200
+ self.override = override
194
201
 
195
202
  async def get_tools(self, *args, **kwargs) -> List[CalculationMCPTool]:
196
203
  tools = await super().get_tools(*args, **kwargs)
@@ -213,6 +220,7 @@ class CalculationMCPToolset(MCPToolset):
213
220
  terminate_tool=tools.get("terminate_job"),
214
221
  results_tool=tools.get("get_job_results"),
215
222
  logging_callback=self.logging_callback,
223
+ override=self.override,
216
224
  )
217
225
  calc_tool.__dict__.update(tool.__dict__)
218
226
  calc_tool.is_long_running = not self.wait
@@ -8,7 +8,18 @@ import signal
8
8
  import uuid
9
9
  import requests
10
10
 
11
+ try:
12
+ from dotenv import load_dotenv
13
+ env_file = Path('.env')
14
+ if not env_file.exists():
15
+ env_file = Path(__file__).parent.parent.parent.parent.parent / '.env'
16
+ if env_file.exists():
17
+ load_dotenv(env_file)
18
+ except ImportError:
19
+ pass
20
+
11
21
  from ..server.storage import storage_dict
22
+ from .templates.ui.ui_utils import UIConfigManager, UIProcessManager
12
23
 
13
24
  @click.group()
14
25
  def cli():
@@ -29,37 +40,34 @@ def scaffolding(type):
29
40
  """Fetch scaffolding for the science agent."""
30
41
  click.echo(f"Generating {type} project scaffold...")
31
42
 
32
- # 获取模板目录路径
33
43
  templates_dir = Path(__file__).parent / 'templates'
34
-
35
- # 获取用户当前工作目录
36
44
  current_dir = Path.cwd()
37
45
 
38
46
 
39
- # 创建必要的目录结构
47
+ # Create necessary directory structure
40
48
  if type == 'device':
41
- project_dirs = project_dirs = ['cloud', 'device']
49
+ project_dirs = ['cloud', 'device']
42
50
  elif type == 'calculation':
43
- project_dirs = project_dirs = ['calculation']
51
+ project_dirs = ['calculation']
44
52
 
45
53
  for dir_name in project_dirs:
46
54
  dst_dir = current_dir / dir_name
47
55
 
48
56
  if dst_dir.exists():
49
- click.echo(f"Warning: {dir_name} already existsskipping...")
50
- click.echo(f"If you want to create a new scaffold, please delete the existing project folder first.")
57
+ click.echo(f"Warning: {dir_name} already exists, skipping...")
58
+ click.echo(f"To create a new scaffold, please delete the existing folder first.")
51
59
  continue
52
60
 
53
- # 只创建目录,不复制SDK文件
61
+ # Create directory only
54
62
  dst_dir.mkdir(parents=True, exist_ok=True)
55
63
 
56
- # 创建__init__.py文件以使目录成为Python
64
+ # Create __init__.py files to make directories Python packages
57
65
  for dir_name in project_dirs:
58
66
  init_file = current_dir / dir_name / '__init__.py'
59
67
  if not init_file.exists():
60
68
  init_file.write_text('')
61
69
 
62
- # 从模板创建main.py文件
70
+ # Create main.py from template
63
71
  main_template = templates_dir / 'main.py.template'
64
72
  main_file = current_dir / 'main.py'
65
73
  if not main_file.exists():
@@ -78,11 +86,11 @@ def scaffolding(type):
78
86
  calculation_file = current_dir / 'calculation' / 'simple.py'
79
87
  if not calculation_file.exists():
80
88
  shutil.copy2(calculation_template, calculation_file)
81
- click.echo("\nCreated calculation example implementation in calculation/calculation.py")
82
- click.echo("Please modify this file according to your actual calculation control requirements.")
89
+ click.echo("\nCreated calculation example implementation in calculation/simple.py")
90
+ click.echo("Please modify this file according to your actual calculation requirements.")
83
91
 
84
- click.echo("\nSucceed for fetching scaffold!")
85
- click.echo("Now you can use dp-agent run-cloud or dp-agent run-device to run this project!")
92
+ click.echo("\nSuccessfully created scaffold!")
93
+ click.echo("Now you can use dp-agent run tool cloud/device/calculation to run this project!")
86
94
 
87
95
  @fetch.command()
88
96
  def config():
@@ -104,7 +112,6 @@ def config():
104
112
  response = requests.get(remote_env_url)
105
113
  with open(env_file, 'w') as f:
106
114
  f.write(response.text)
107
- #shutil.copy2(env_template, env_file)
108
115
  click.echo("Configuration file .env has been created.")
109
116
  click.echo("\nIMPORTANT: Please update the following configurations in your .env file:")
110
117
  click.echo("1. MQTT_INSTANCE_ID - Your Aliyun MQTT instance ID")
@@ -172,16 +179,109 @@ def calculation():
172
179
  sys.exit(1)
173
180
 
174
181
  @run.command()
175
- def agent():
176
- """Run the science agent."""
177
- click.echo("Starting agent...")
178
- click.echo("Agent started.")
182
+ @click.option('--ui/--no-ui', default=True, help='Enable/disable Web UI interface')
183
+ @click.option('--config', help='Configuration file path (default: agent-config.json)')
184
+ @click.option('--port', type=int, help='Server port (default from config)')
185
+ @click.option('--module', help='Agent module path (default: agent)')
186
+ @click.option('--agent-name', help='Agent variable name (default: root_agent)')
187
+ @click.option('--dev/--prod', default=False, help='Development mode (default: production)')
188
+ def agent(ui, config, port, module, agent_name, dev):
189
+ """Run the science agent with optional UI interface."""
190
+ if not ui:
191
+ click.echo("Starting agent in console mode...")
192
+ click.echo("Console mode not yet implemented.")
193
+ return
194
+
195
+ current_dir = Path.cwd()
196
+ config_path = Path(config) if config else current_dir / "agent-config.json"
197
+ config_manager = UIConfigManager(config_path if config_path.exists() else None)
198
+
199
+ if module:
200
+ config_manager.config['agent']['module'] = module
201
+
202
+ agent_module = config_manager.config['agent']['module']
203
+
204
+ if '/' in agent_module or '\\' in agent_module or agent_module.endswith('.py'):
205
+ file_path = Path(agent_module)
206
+
207
+ if not file_path.is_absolute():
208
+ file_path = current_dir / file_path
209
+
210
+ if not file_path.exists():
211
+ click.echo(f"Error: Agent file not found: {file_path}")
212
+ click.echo("\nPlease ensure:")
213
+ click.echo("1. File path is correct")
214
+ click.echo("2. File exists and is accessible")
215
+ sys.exit(1)
216
+ else:
217
+ module_parts = agent_module.split('.')
218
+ module_dir = current_dir / Path(*module_parts[:-1])
219
+ module_file = current_dir / Path(*module_parts[:-1]) / f"{module_parts[-1]}.py"
220
+ module_init = module_dir / "__init__.py"
221
+
222
+ if not (module_dir.exists() or module_file.exists()):
223
+ click.echo(f"Error: Module {agent_module} not found.")
224
+ click.echo(f"Tried to find: {module_dir} or {module_file}")
225
+ click.echo("\nPlease ensure:")
226
+ click.echo("1. You have created the agent module")
227
+ click.echo("2. The 'agent.module' path is correctly configured in config.json")
228
+ click.echo("3. Or use --module parameter to specify the correct module path")
229
+ sys.exit(1)
230
+
231
+ if os.environ.get('UI_TEMPLATE_DIR'):
232
+ ui_dir = Path(os.environ.get('UI_TEMPLATE_DIR'))
233
+ else:
234
+ try:
235
+ current_file = Path(__file__).resolve()
236
+
237
+ if 'site-packages' in str(current_file):
238
+ ui_dir = Path(__file__).parent / "templates" / "ui"
239
+ else:
240
+ ui_dir = current_file.parent / "templates" / "ui"
241
+ click.echo(f"🔧 Development mode detected, using source path: {ui_dir}")
242
+
243
+ except Exception:
244
+ ui_dir = Path(__file__).parent / "templates" / "ui"
245
+
246
+ if not ui_dir.exists():
247
+ click.echo(f"Error: UI template directory not found: {ui_dir}")
248
+ click.echo("Tip: You can specify template path via UI_TEMPLATE_DIR environment variable")
249
+ sys.exit(1)
250
+
251
+ if agent_name:
252
+ config_manager.config['agent']['rootAgent'] = agent_name
253
+ if port:
254
+ config_manager.config['server']['port'] = port
255
+
256
+ temp_config = ui_dir / "config" / "agent-config.temp.json"
257
+ config_manager.save_config(temp_config)
258
+
259
+ os.environ['AGENT_CONFIG_PATH'] = str(temp_config)
260
+ os.environ['PYTHONPATH'] = f"{current_dir}:{os.environ.get('PYTHONPATH', '')}"
261
+
262
+ try:
263
+ process_manager = UIProcessManager(ui_dir, config_manager.config)
264
+
265
+ process_manager.start_websocket_server()
266
+ process_manager.start_frontend_server(dev_mode=dev)
267
+
268
+ click.echo("\nPress Ctrl+C to stop the service...")
269
+ process_manager.wait_for_processes()
270
+
271
+ except KeyboardInterrupt:
272
+ click.echo("\nShutting down services...")
273
+ if 'process_manager' in locals():
274
+ process_manager.cleanup()
275
+ sys.exit(0)
276
+ except Exception as e:
277
+ click.echo(f"Error: {e}")
278
+ if 'process_manager' in locals():
279
+ process_manager.cleanup()
280
+ sys.exit(1)
281
+ finally:
282
+ if 'temp_config' in locals() and temp_config.exists():
283
+ temp_config.unlink()
179
284
 
180
- @run.command()
181
- def debug():
182
- """Debug the science agent in cloud environment."""
183
- click.echo("Starting cloud environment in debug mode...")
184
- click.echo("Cloud environment debug mode started.")
185
285
 
186
286
  @cli.group()
187
287
  def artifact():
@@ -229,6 +329,7 @@ def download(**kwargs):
229
329
  path = storage.download(key, path)
230
330
  click.echo("%s has been downloaded to %s" % (uri, path))
231
331
 
332
+
232
333
  def main():
233
334
  cli()
234
335
 
@@ -0,0 +1 @@
1
+ # CLI 模板包
@@ -0,0 +1,15 @@
1
+ from dp.agent.server import CalculationMCPServer
2
+
3
+ # 创建 MCP Server 实例
4
+ mcp = CalculationMCPServer("Demo", host="0.0.0.0", port=5001)
5
+
6
+ # 用装饰器注册远程调用函数
7
+ @mcp.tool()
8
+ def add_numbers(a: int, b: int) -> int:
9
+ """Add two numbers."""
10
+ return a + b
11
+
12
+ def run():
13
+ print("Starting MCP server on http://127.0.0.1:5001 ...")
14
+ mcp.run(transport="streamable-http")
15
+