bohr-agent-sdk 0.1.102__tar.gz → 0.1.103__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.
- bohr_agent_sdk-0.1.103/PKG-INFO +292 -0
- bohr_agent_sdk-0.1.103/README.md +234 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/pyproject.toml +1 -1
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/setup.py +1 -1
- bohr_agent_sdk-0.1.103/src/bohr_agent_sdk.egg-info/PKG-INFO +292 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/bohr_agent_sdk.egg-info/requires.txt +1 -1
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/cli.py +1 -1
- bohr_agent_sdk-0.1.102/PKG-INFO +0 -228
- bohr_agent_sdk-0.1.102/README.md +0 -170
- bohr_agent_sdk-0.1.102/src/bohr_agent_sdk.egg-info/PKG-INFO +0 -228
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/setup.cfg +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/bohr_agent_sdk.egg-info/SOURCES.txt +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/bohr_agent_sdk.egg-info/dependency_links.txt +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/bohr_agent_sdk.egg-info/entry_points.txt +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/bohr_agent_sdk.egg-info/top_level.txt +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/adapter/adk/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/adapter/adk/client/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/adapter/adk/client/calculation_mcp_tool.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/adapter/adk/storage_artifact_service.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/adapter/adk/utils.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/adapter/camel/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/adapter/camel/client/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/adapter/camel/client/calculation_mcp_client.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/calculation/simple.py.template +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/device/tescan_device.py.template +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/main.py.template +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/api/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/api/config.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/api/constants.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/api/debug.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/api/files.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/api/files_upload.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/api/files_user.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/api/messages.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/api/projects.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/api/sessions.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/api/utils.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/api/websocket.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/config/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/config/agent_config.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/frontend/index.html +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/frontend/package.json +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/frontend/tsconfig.json +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/frontend/tsconfig.node.json +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/frontend/ui-static/assets/index-DdAmKhul.js +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/frontend/ui-static/assets/index-DfN2raU9.css +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/frontend/ui-static/index.html +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/frontend/vite.config.ts +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/scripts/build_ui.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/server/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/server/app.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/server/connection.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/server/file_watcher.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/server/middleware.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/server/models.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/server/session_manager.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/server/user_files.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/server/utils.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/test_download.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/ui_utils.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cli/templates/ui/websocket-server.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cloud/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cloud/main.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cloud/mcp.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/cloud/mqtt.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/device/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/device/device/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/device/device/device.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/device/device/types.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/device/mqtt_device_twin.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/calculation_mcp_server.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/executor/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/executor/base_executor.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/executor/dispatcher_executor.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/executor/local_executor.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/preprocessor.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/storage/__init__.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/storage/base_storage.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/storage/bohrium_storage.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/storage/http_storage.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/storage/local_storage.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/storage/oss_storage.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/src/dp/agent/server/utils.py +0 -0
- {bohr_agent_sdk-0.1.102 → bohr_agent_sdk-0.1.103}/tests/test_cli.py +0 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bohr-agent-sdk
|
|
3
|
+
Version: 0.1.103
|
|
4
|
+
Summary: SDK for scientific agents
|
|
5
|
+
Home-page: https://github.com/dptech-corp/bohr-agent-sdk/
|
|
6
|
+
Author: DP Technology
|
|
7
|
+
Maintainer-email: liupeng <liupeng@dp.tech>, zjgemi <liuxzj@dp.tech>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/dptech-corp/bohr-agent-sdk
|
|
10
|
+
Project-URL: repository, https://github.com/dptech-corp/bohr-agent-sdk
|
|
11
|
+
Project-URL: Bug Reports, https://github.com/dptech-corp/bohr-agent-sdk/issues
|
|
12
|
+
Keywords: agent SDK,AI for science
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
Requires-Dist: click>=8.0.0
|
|
22
|
+
Requires-Dist: mcp
|
|
23
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
24
|
+
Requires-Dist: typing-extensions>=4.8.0
|
|
25
|
+
Requires-Dist: dpdispatcher>=0.6.8
|
|
26
|
+
Requires-Dist: lbg>=1.2.29
|
|
27
|
+
Requires-Dist: jsonpickle>=3.0.3
|
|
28
|
+
Requires-Dist: psutil>=5.9.6
|
|
29
|
+
Requires-Dist: paho-mqtt>=2.1.0
|
|
30
|
+
Requires-Dist: redis>=6.2.0
|
|
31
|
+
Requires-Dist: twine>=6.1.0
|
|
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
|
|
36
|
+
Provides-Extra: device
|
|
37
|
+
Requires-Dist: pywinauto-recorder>=0.1.0; extra == "device"
|
|
38
|
+
Provides-Extra: cloud
|
|
39
|
+
Requires-Dist: paho-mqtt>=1.6.1; extra == "cloud"
|
|
40
|
+
Requires-Dist: redis>=5.0.1; extra == "cloud"
|
|
41
|
+
Requires-Dist: aiohttp>=3.9.1; extra == "cloud"
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
44
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
|
|
45
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
46
|
+
Requires-Dist: black>=23.11.0; extra == "dev"
|
|
47
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
48
|
+
Requires-Dist: mypy>=1.7.0; extra == "dev"
|
|
49
|
+
Requires-Dist: pylint>=3.0.0; extra == "dev"
|
|
50
|
+
Requires-Dist: google-adk; extra == "dev"
|
|
51
|
+
Provides-Extra: docs
|
|
52
|
+
Requires-Dist: sphinx>=7.2.0; extra == "docs"
|
|
53
|
+
Requires-Dist: sphinx-rtd-theme>=1.3.0; extra == "docs"
|
|
54
|
+
Provides-Extra: all
|
|
55
|
+
Requires-Dist: bohr-agent-sdk[bohrium,cloud,dev,device,dispatcher,docs]; extra == "all"
|
|
56
|
+
Dynamic: home-page
|
|
57
|
+
Dynamic: requires-python
|
|
58
|
+
|
|
59
|
+
# Bohrium Science Agent SDK
|
|
60
|
+
|
|
61
|
+
[English](README.md) | [简体中文](README_CN.md)
|
|
62
|
+
|
|
63
|
+
**Transform Scientific Software into AI Assistants — 3 Steps to Intelligent Transformation**
|
|
64
|
+
|
|
65
|
+
## 📖 Introduction
|
|
66
|
+
|
|
67
|
+
The Bohrium platform introduces the **bohr-agent-sdk Scientific Agent Development Kit**, enabling AI systems to truly execute professional scientific tasks and helping developers quickly build their own specialized research agents. Through a three-step process — **Invoking MCP Tools, Orchestrating Agent Workflows, and Deploying Services** — any scientific software can be rapidly transformed into an AI assistant.
|
|
68
|
+
|
|
69
|
+
## ✨ Core Features
|
|
70
|
+
|
|
71
|
+
### 🎯 Intelligent Task Management: Simplified Development, Standardized Output
|
|
72
|
+
With a decorator pattern, just a few annotations can quickly transform scientific computing programs into MCP standard services. Built-in application templates turn scattered research code into standardized, reusable intelligent components.
|
|
73
|
+
|
|
74
|
+
### 🔧 Multi-Backend Framework Support
|
|
75
|
+
Supports mainstream Agent open frameworks including Google ADK, Langraph, and Camel, providing flexible choices for developers familiar with different technology stacks.
|
|
76
|
+
|
|
77
|
+
### ☁️ Flexible Deployment: Local Development, Cloud Production
|
|
78
|
+
Dual-mode architecture supports seamless transition between development and production. Local environments enable rapid iteration and feature validation, while Bohrium's cloud GPU clusters handle production-grade computing tasks. The SDK automatically manages the complete workflow of task scheduling, status monitoring, and result collection, with built-in file transfer mechanisms for handling large-scale data uploads and downloads. Developers focus on core algorithm implementation while infrastructure management is fully automated.
|
|
79
|
+
|
|
80
|
+
### 🖼️ Visual Interactive Interface: Professional Presentation, Intuitive Operation
|
|
81
|
+
Based on the modern React framework, deploy fully-featured web applications with one click. Built-in 3D molecular visualization engine supports multiple structure formats and rendering modes for interactive molecular structure display. Real-time data synchronization ensures instant computing status updates, while multi-session management supports parallel task processing. Integrated with enterprise-grade features including file management, project switching, and permission control. Transform command-line tools into professional visual applications, significantly enhancing user experience and tool usability.
|
|
82
|
+
|
|
83
|
+
## 🖼️ Interface Showcase
|
|
84
|
+
|
|
85
|
+
### Scientific Computing Master Console
|
|
86
|
+
<div align="center">
|
|
87
|
+
|
|
88
|
+

|
|
89
|
+
|
|
90
|
+
*Powerful scientific computing task management and monitoring platform*
|
|
91
|
+
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
### Visual Interactive Interface
|
|
95
|
+
<div align="center">
|
|
96
|
+
|
|
97
|
+

|
|
98
|
+
|
|
99
|
+
*Modern web application interface providing intuitive user experience*
|
|
100
|
+
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
## 🚀 Quick Start
|
|
104
|
+
|
|
105
|
+
### Installation
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pip install bohr-agent-sdk -i https://pypi.org/simple --upgrade
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Build Your Research Agent in 3 Steps
|
|
112
|
+
|
|
113
|
+
#### Step 1: Get Project Templates
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Get calculation project template
|
|
117
|
+
dp-agent fetch scaffolding --type=calculation
|
|
118
|
+
|
|
119
|
+
# Get device control project template
|
|
120
|
+
dp-agent fetch scaffolding --type=device
|
|
121
|
+
|
|
122
|
+
# Get configuration file
|
|
123
|
+
dp-agent fetch config
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### Step 2: Develop Your Agent
|
|
127
|
+
|
|
128
|
+
**Lab Mode Development Example**
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from typing import Dict, TypedDict
|
|
132
|
+
from dp.agent.device.device import Device, action, BaseParams, SuccessResult
|
|
133
|
+
|
|
134
|
+
class TakePictureParams(BaseParams):
|
|
135
|
+
"""Picture taking parameters"""
|
|
136
|
+
horizontal_width: str # Image horizontal width
|
|
137
|
+
|
|
138
|
+
class PictureData(TypedDict):
|
|
139
|
+
"""Picture data structure"""
|
|
140
|
+
image_id: str
|
|
141
|
+
|
|
142
|
+
class PictureResult(SuccessResult):
|
|
143
|
+
"""Picture taking result"""
|
|
144
|
+
data: PictureData
|
|
145
|
+
|
|
146
|
+
class MyDevice(Device):
|
|
147
|
+
"""Custom device class"""
|
|
148
|
+
device_name = "my_device"
|
|
149
|
+
|
|
150
|
+
@action("take_picture")
|
|
151
|
+
def take_picture(self, params: TakePictureParams) -> PictureResult:
|
|
152
|
+
"""
|
|
153
|
+
Execute picture taking action
|
|
154
|
+
|
|
155
|
+
Through the @action decorator, automatically register this method as an MCP standard service
|
|
156
|
+
"""
|
|
157
|
+
hw = params.get("horizontal_width", "default")
|
|
158
|
+
# Execute actual device control logic
|
|
159
|
+
return PictureResult(
|
|
160
|
+
message=f"Picture taken with {self.device_name}",
|
|
161
|
+
data={"image_id": "image_123"}
|
|
162
|
+
)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Cloud Mode Development Example**
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
"""
|
|
169
|
+
MCP protocol-based cloud device control example
|
|
170
|
+
"""
|
|
171
|
+
import signal
|
|
172
|
+
import sys
|
|
173
|
+
from dp.agent.cloud import mcp, get_mqtt_cloud_instance
|
|
174
|
+
from dp.agent.device.device import TescanDevice, register_mcp_tools
|
|
175
|
+
|
|
176
|
+
def signal_handler(sig, frame):
|
|
177
|
+
"""Graceful shutdown handling"""
|
|
178
|
+
print("Shutting down...")
|
|
179
|
+
get_mqtt_cloud_instance().stop()
|
|
180
|
+
sys.exit(0)
|
|
181
|
+
|
|
182
|
+
def main():
|
|
183
|
+
"""Start cloud services"""
|
|
184
|
+
print("Starting Tescan Device Twin Cloud Services...")
|
|
185
|
+
|
|
186
|
+
# Register signal handler
|
|
187
|
+
signal.signal(signal.SIGINT, signal_handler)
|
|
188
|
+
|
|
189
|
+
# Create device instance
|
|
190
|
+
device = TescanDevice(mcp, device)
|
|
191
|
+
|
|
192
|
+
# Automatically register device tools to MCP server
|
|
193
|
+
# register_mcp_tools implements automatic registration through Python introspection
|
|
194
|
+
register_mcp_tools(device)
|
|
195
|
+
|
|
196
|
+
# Start MCP server
|
|
197
|
+
print("Starting MCP server...")
|
|
198
|
+
mcp.run(transport="sse")
|
|
199
|
+
|
|
200
|
+
if __name__ == "__main__":
|
|
201
|
+
main()
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
#### Step 3: Run and Deploy
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# Local lab environment
|
|
208
|
+
dp-agent run tool device
|
|
209
|
+
|
|
210
|
+
# Cloud computing environment
|
|
211
|
+
dp-agent run tool cloud
|
|
212
|
+
|
|
213
|
+
# Scientific calculation mode
|
|
214
|
+
dp-agent run tool calculation
|
|
215
|
+
|
|
216
|
+
# Start agent (with Web UI)
|
|
217
|
+
dp-agent run agent --config
|
|
218
|
+
|
|
219
|
+
# Debug mode
|
|
220
|
+
dp-agent run debug
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## 🏗️ Project Structure
|
|
224
|
+
|
|
225
|
+
After running `dp-agent fetch scaffolding`, you'll get a standardized project structure:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
your-project/
|
|
229
|
+
├── lab/ # Lab mode
|
|
230
|
+
│ ├── __init__.py
|
|
231
|
+
│ └── tescan_device.py # Device control implementation
|
|
232
|
+
├── cloud/ # Cloud mode
|
|
233
|
+
│ ├── __init__.py
|
|
234
|
+
│ └── mcp_server.py # MCP service implementation
|
|
235
|
+
├── calculation/ # Calculation mode
|
|
236
|
+
│ └── __init__.py
|
|
237
|
+
├── .env # Environment configuration
|
|
238
|
+
└── main.py # Main program entry
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## ⚙️ Configuration
|
|
242
|
+
|
|
243
|
+
Configure necessary environment variables in the `.env` file:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# MQTT connection configuration
|
|
247
|
+
MQTT_INSTANCE_ID=your_instance_id
|
|
248
|
+
MQTT_ENDPOINT=your_endpoint
|
|
249
|
+
MQTT_DEVICE_ID=your_device_id
|
|
250
|
+
MQTT_GROUP_ID=your_group_id
|
|
251
|
+
MQTT_AK=your_access_key
|
|
252
|
+
MQTT_SK=your_secret_key
|
|
253
|
+
|
|
254
|
+
# Computing resource configuration
|
|
255
|
+
BOHRIUM_USERNAME=your_username
|
|
256
|
+
BOHRIUM_PASSWORD=your_password
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Note: The `dp-agent fetch config` command automatically downloads configuration files and replaces dynamic variables (such as MQTT_DEVICE_ID). For security reasons, this feature is only available in internal network environments.
|
|
260
|
+
|
|
261
|
+
## 🎯 Application Scenarios
|
|
262
|
+
|
|
263
|
+
- **Materials Science Computing**: Molecular dynamics simulation, first-principles calculations
|
|
264
|
+
- **Bioinformatics Analysis**: Gene sequence analysis, protein structure prediction
|
|
265
|
+
- **Laboratory Equipment Control**: Intelligent control of research equipment such as electron microscopes and X-ray diffractometers
|
|
266
|
+
- **Data Processing Workflows**: Automated data cleaning, analysis, and visualization
|
|
267
|
+
- **Machine Learning Training**: Model training, hyperparameter optimization, result evaluation
|
|
268
|
+
|
|
269
|
+
## 🔧 Advanced Features
|
|
270
|
+
|
|
271
|
+
### File Management
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# Upload files to cloud
|
|
275
|
+
dp-agent artifact upload <path>
|
|
276
|
+
|
|
277
|
+
# Download cloud files
|
|
278
|
+
dp-agent artifact download <artifact_id>
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Task Monitoring
|
|
282
|
+
|
|
283
|
+
The SDK provides real-time task status monitoring, supporting:
|
|
284
|
+
- Task queue management
|
|
285
|
+
- Computing resource scheduling
|
|
286
|
+
- Automatic result collection
|
|
287
|
+
- Exception handling and retry mechanisms
|
|
288
|
+
|
|
289
|
+
## 📚 Documentation & Support
|
|
290
|
+
|
|
291
|
+
- 📖 [Detailed Documentation](https://dptechnology.feishu.cn/wiki/ZSj9wbLJEiwdNek0Iu7cKsFanuW)
|
|
292
|
+
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Bohrium Science Agent SDK
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [简体中文](README_CN.md)
|
|
4
|
+
|
|
5
|
+
**Transform Scientific Software into AI Assistants — 3 Steps to Intelligent Transformation**
|
|
6
|
+
|
|
7
|
+
## 📖 Introduction
|
|
8
|
+
|
|
9
|
+
The Bohrium platform introduces the **bohr-agent-sdk Scientific Agent Development Kit**, enabling AI systems to truly execute professional scientific tasks and helping developers quickly build their own specialized research agents. Through a three-step process — **Invoking MCP Tools, Orchestrating Agent Workflows, and Deploying Services** — any scientific software can be rapidly transformed into an AI assistant.
|
|
10
|
+
|
|
11
|
+
## ✨ Core Features
|
|
12
|
+
|
|
13
|
+
### 🎯 Intelligent Task Management: Simplified Development, Standardized Output
|
|
14
|
+
With a decorator pattern, just a few annotations can quickly transform scientific computing programs into MCP standard services. Built-in application templates turn scattered research code into standardized, reusable intelligent components.
|
|
15
|
+
|
|
16
|
+
### 🔧 Multi-Backend Framework Support
|
|
17
|
+
Supports mainstream Agent open frameworks including Google ADK, Langraph, and Camel, providing flexible choices for developers familiar with different technology stacks.
|
|
18
|
+
|
|
19
|
+
### ☁️ Flexible Deployment: Local Development, Cloud Production
|
|
20
|
+
Dual-mode architecture supports seamless transition between development and production. Local environments enable rapid iteration and feature validation, while Bohrium's cloud GPU clusters handle production-grade computing tasks. The SDK automatically manages the complete workflow of task scheduling, status monitoring, and result collection, with built-in file transfer mechanisms for handling large-scale data uploads and downloads. Developers focus on core algorithm implementation while infrastructure management is fully automated.
|
|
21
|
+
|
|
22
|
+
### 🖼️ Visual Interactive Interface: Professional Presentation, Intuitive Operation
|
|
23
|
+
Based on the modern React framework, deploy fully-featured web applications with one click. Built-in 3D molecular visualization engine supports multiple structure formats and rendering modes for interactive molecular structure display. Real-time data synchronization ensures instant computing status updates, while multi-session management supports parallel task processing. Integrated with enterprise-grade features including file management, project switching, and permission control. Transform command-line tools into professional visual applications, significantly enhancing user experience and tool usability.
|
|
24
|
+
|
|
25
|
+
## 🖼️ Interface Showcase
|
|
26
|
+
|
|
27
|
+
### Scientific Computing Master Console
|
|
28
|
+
<div align="center">
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
*Powerful scientific computing task management and monitoring platform*
|
|
33
|
+
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
### Visual Interactive Interface
|
|
37
|
+
<div align="center">
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
*Modern web application interface providing intuitive user experience*
|
|
42
|
+
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
## 🚀 Quick Start
|
|
46
|
+
|
|
47
|
+
### Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install bohr-agent-sdk -i https://pypi.org/simple --upgrade
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Build Your Research Agent in 3 Steps
|
|
54
|
+
|
|
55
|
+
#### Step 1: Get Project Templates
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Get calculation project template
|
|
59
|
+
dp-agent fetch scaffolding --type=calculation
|
|
60
|
+
|
|
61
|
+
# Get device control project template
|
|
62
|
+
dp-agent fetch scaffolding --type=device
|
|
63
|
+
|
|
64
|
+
# Get configuration file
|
|
65
|
+
dp-agent fetch config
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### Step 2: Develop Your Agent
|
|
69
|
+
|
|
70
|
+
**Lab Mode Development Example**
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from typing import Dict, TypedDict
|
|
74
|
+
from dp.agent.device.device import Device, action, BaseParams, SuccessResult
|
|
75
|
+
|
|
76
|
+
class TakePictureParams(BaseParams):
|
|
77
|
+
"""Picture taking parameters"""
|
|
78
|
+
horizontal_width: str # Image horizontal width
|
|
79
|
+
|
|
80
|
+
class PictureData(TypedDict):
|
|
81
|
+
"""Picture data structure"""
|
|
82
|
+
image_id: str
|
|
83
|
+
|
|
84
|
+
class PictureResult(SuccessResult):
|
|
85
|
+
"""Picture taking result"""
|
|
86
|
+
data: PictureData
|
|
87
|
+
|
|
88
|
+
class MyDevice(Device):
|
|
89
|
+
"""Custom device class"""
|
|
90
|
+
device_name = "my_device"
|
|
91
|
+
|
|
92
|
+
@action("take_picture")
|
|
93
|
+
def take_picture(self, params: TakePictureParams) -> PictureResult:
|
|
94
|
+
"""
|
|
95
|
+
Execute picture taking action
|
|
96
|
+
|
|
97
|
+
Through the @action decorator, automatically register this method as an MCP standard service
|
|
98
|
+
"""
|
|
99
|
+
hw = params.get("horizontal_width", "default")
|
|
100
|
+
# Execute actual device control logic
|
|
101
|
+
return PictureResult(
|
|
102
|
+
message=f"Picture taken with {self.device_name}",
|
|
103
|
+
data={"image_id": "image_123"}
|
|
104
|
+
)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Cloud Mode Development Example**
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
"""
|
|
111
|
+
MCP protocol-based cloud device control example
|
|
112
|
+
"""
|
|
113
|
+
import signal
|
|
114
|
+
import sys
|
|
115
|
+
from dp.agent.cloud import mcp, get_mqtt_cloud_instance
|
|
116
|
+
from dp.agent.device.device import TescanDevice, register_mcp_tools
|
|
117
|
+
|
|
118
|
+
def signal_handler(sig, frame):
|
|
119
|
+
"""Graceful shutdown handling"""
|
|
120
|
+
print("Shutting down...")
|
|
121
|
+
get_mqtt_cloud_instance().stop()
|
|
122
|
+
sys.exit(0)
|
|
123
|
+
|
|
124
|
+
def main():
|
|
125
|
+
"""Start cloud services"""
|
|
126
|
+
print("Starting Tescan Device Twin Cloud Services...")
|
|
127
|
+
|
|
128
|
+
# Register signal handler
|
|
129
|
+
signal.signal(signal.SIGINT, signal_handler)
|
|
130
|
+
|
|
131
|
+
# Create device instance
|
|
132
|
+
device = TescanDevice(mcp, device)
|
|
133
|
+
|
|
134
|
+
# Automatically register device tools to MCP server
|
|
135
|
+
# register_mcp_tools implements automatic registration through Python introspection
|
|
136
|
+
register_mcp_tools(device)
|
|
137
|
+
|
|
138
|
+
# Start MCP server
|
|
139
|
+
print("Starting MCP server...")
|
|
140
|
+
mcp.run(transport="sse")
|
|
141
|
+
|
|
142
|
+
if __name__ == "__main__":
|
|
143
|
+
main()
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### Step 3: Run and Deploy
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Local lab environment
|
|
150
|
+
dp-agent run tool device
|
|
151
|
+
|
|
152
|
+
# Cloud computing environment
|
|
153
|
+
dp-agent run tool cloud
|
|
154
|
+
|
|
155
|
+
# Scientific calculation mode
|
|
156
|
+
dp-agent run tool calculation
|
|
157
|
+
|
|
158
|
+
# Start agent (with Web UI)
|
|
159
|
+
dp-agent run agent --config
|
|
160
|
+
|
|
161
|
+
# Debug mode
|
|
162
|
+
dp-agent run debug
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## 🏗️ Project Structure
|
|
166
|
+
|
|
167
|
+
After running `dp-agent fetch scaffolding`, you'll get a standardized project structure:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
your-project/
|
|
171
|
+
├── lab/ # Lab mode
|
|
172
|
+
│ ├── __init__.py
|
|
173
|
+
│ └── tescan_device.py # Device control implementation
|
|
174
|
+
├── cloud/ # Cloud mode
|
|
175
|
+
│ ├── __init__.py
|
|
176
|
+
│ └── mcp_server.py # MCP service implementation
|
|
177
|
+
├── calculation/ # Calculation mode
|
|
178
|
+
│ └── __init__.py
|
|
179
|
+
├── .env # Environment configuration
|
|
180
|
+
└── main.py # Main program entry
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## ⚙️ Configuration
|
|
184
|
+
|
|
185
|
+
Configure necessary environment variables in the `.env` file:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# MQTT connection configuration
|
|
189
|
+
MQTT_INSTANCE_ID=your_instance_id
|
|
190
|
+
MQTT_ENDPOINT=your_endpoint
|
|
191
|
+
MQTT_DEVICE_ID=your_device_id
|
|
192
|
+
MQTT_GROUP_ID=your_group_id
|
|
193
|
+
MQTT_AK=your_access_key
|
|
194
|
+
MQTT_SK=your_secret_key
|
|
195
|
+
|
|
196
|
+
# Computing resource configuration
|
|
197
|
+
BOHRIUM_USERNAME=your_username
|
|
198
|
+
BOHRIUM_PASSWORD=your_password
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Note: The `dp-agent fetch config` command automatically downloads configuration files and replaces dynamic variables (such as MQTT_DEVICE_ID). For security reasons, this feature is only available in internal network environments.
|
|
202
|
+
|
|
203
|
+
## 🎯 Application Scenarios
|
|
204
|
+
|
|
205
|
+
- **Materials Science Computing**: Molecular dynamics simulation, first-principles calculations
|
|
206
|
+
- **Bioinformatics Analysis**: Gene sequence analysis, protein structure prediction
|
|
207
|
+
- **Laboratory Equipment Control**: Intelligent control of research equipment such as electron microscopes and X-ray diffractometers
|
|
208
|
+
- **Data Processing Workflows**: Automated data cleaning, analysis, and visualization
|
|
209
|
+
- **Machine Learning Training**: Model training, hyperparameter optimization, result evaluation
|
|
210
|
+
|
|
211
|
+
## 🔧 Advanced Features
|
|
212
|
+
|
|
213
|
+
### File Management
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Upload files to cloud
|
|
217
|
+
dp-agent artifact upload <path>
|
|
218
|
+
|
|
219
|
+
# Download cloud files
|
|
220
|
+
dp-agent artifact download <artifact_id>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Task Monitoring
|
|
224
|
+
|
|
225
|
+
The SDK provides real-time task status monitoring, supporting:
|
|
226
|
+
- Task queue management
|
|
227
|
+
- Computing resource scheduling
|
|
228
|
+
- Automatic result collection
|
|
229
|
+
- Exception handling and retry mechanisms
|
|
230
|
+
|
|
231
|
+
## 📚 Documentation & Support
|
|
232
|
+
|
|
233
|
+
- 📖 [Detailed Documentation](https://dptechnology.feishu.cn/wiki/ZSj9wbLJEiwdNek0Iu7cKsFanuW)
|
|
234
|
+
|
|
@@ -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.
|
|
12
|
+
version="0.1.103",
|
|
13
13
|
description="SDK for science agent and mcp tools",
|
|
14
14
|
long_description=long_description,
|
|
15
15
|
long_description_content_type="text/markdown",
|