bohr-agent-sdk 0.1.24__py3-none-any.whl → 0.1.101__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bohr-agent-sdk
3
- Version: 0.1.24
3
+ Version: 0.1.101
4
4
  Summary: SDK for scientific agents
5
5
  Home-page: https://github.com/dptech-corp/bohr-agent-sdk/
6
6
  Author: DP Technology
@@ -4,7 +4,7 @@ dp/agent/adapter/adk/__init__.py,sha256=mxX2SxGgDjwQ7WjfKMw9mQkq4ddl8XlCA6gnUinC
4
4
  dp/agent/adapter/adk/storage_artifact_service.py,sha256=Hd1CmEB8HgEz3x_riHVSSmYdw6W2bDYYa3c5ySCqmCE,5414
5
5
  dp/agent/adapter/adk/utils.py,sha256=Hf6zZOmNi0YSI9t5acmR5kzowWaYr-UfyPiN8fefPkI,7359
6
6
  dp/agent/adapter/adk/client/__init__.py,sha256=F1xfFNa4ZG8jV9adeGI2D3YBiSX-5RkvqEdTqNdJce4,209
7
- dp/agent/adapter/adk/client/calculation_mcp_tool.py,sha256=njEf4DvZt7HaAMpMZ1od2emWwlFUP5FtebBJ17pi20U,11774
7
+ dp/agent/adapter/adk/client/calculation_mcp_tool.py,sha256=8_uBP12SLaYUiQL6c0vysVsePEZS_r0YMogvW93ZFHo,12188
8
8
  dp/agent/adapter/camel/__init__.py,sha256=RN1NhdmsJyN43fTxTXFld4UKZksjpSV0b2QvFn5gK7o,77
9
9
  dp/agent/adapter/camel/client/__init__.py,sha256=ld-r0_WsZLFv6yyrmxjWmR8JgnrQzOw4fX0hwVHzciY,93
10
10
  dp/agent/adapter/camel/client/calculation_mcp_client.py,sha256=JZZUYYfMgXvHzK4f6IJp-ia33wn3aYZqDSDVa5yKtdc,1860
@@ -20,7 +20,7 @@ dp/agent/device/device/__init__.py,sha256=w7_1S16S1vWUq0RGl0GFgjq2vFkc5oNvy8cQTn
20
20
  dp/agent/device/device/device.py,sha256=9ZRIJth-4qMO-i-u_b_cO3d6a4eTbTQjPaxFsV_zEkc,9643
21
21
  dp/agent/device/device/types.py,sha256=JuxB-hjf1CjjvfBxCLwRAXVFlYS-nPEdiJpBWLFVCzo,1924
22
22
  dp/agent/server/__init__.py,sha256=rckaYd8pbYyB4ENEhgjXKeGMXjdnrgcJpdM1gu5u1Wc,508
23
- dp/agent/server/calculation_mcp_server.py,sha256=oumU2xtqrrgp8BKiuF9YsqMNevXba2JACyYsvNy4nQo,11008
23
+ dp/agent/server/calculation_mcp_server.py,sha256=eClRP7A-t5hMGyTh81KC3GAKjSPNJIylOrOKyzqwo8o,11459
24
24
  dp/agent/server/preprocessor.py,sha256=XUWu7QOwo_sIDMYS2b1OTrM33EXEVH_73vk-ju1Ok8A,1264
25
25
  dp/agent/server/utils.py,sha256=8jgYZEW4XBp86AF2Km6QkwHltBmrnS-soTpHov7ZEJw,4501
26
26
  dp/agent/server/executor/__init__.py,sha256=s95M5qKQk39Yi9qaVJZhk_nfj54quSf7EDghR3OCFUA,248
@@ -33,8 +33,8 @@ dp/agent/server/storage/bohrium_storage.py,sha256=EsKX4dWWvZTn2TEhZv4zsvihfDK0mm
33
33
  dp/agent/server/storage/http_storage.py,sha256=KiySq7g9-iJr12XQCKKyJLn8wJoDnSRpQAR5_qPJ1ZU,1471
34
34
  dp/agent/server/storage/local_storage.py,sha256=t1wfjByjXew9ws3PuUxWxmZQ0-Wt1a6t4wmj3fW62GI,1352
35
35
  dp/agent/server/storage/oss_storage.py,sha256=pgjmi7Gir3Y5wkMDCvU4fvSls15fXT7Ax-h9MYHFPK0,3359
36
- bohr_agent_sdk-0.1.24.dist-info/METADATA,sha256=kmGJv8gXvQUdMe_P2QOBp_gz0IeP5oe9VUjmdSsmuZo,6329
37
- bohr_agent_sdk-0.1.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
- bohr_agent_sdk-0.1.24.dist-info/entry_points.txt,sha256=5n5kneF5IbDQtoQ2WfF-QuBjDtsimJte9Rv9baSGgc0,86
39
- bohr_agent_sdk-0.1.24.dist-info/top_level.txt,sha256=87xLUDhu_1nQHoGLwlhJ6XlO7OsjILh6i1nX6ljFzDo,3
40
- bohr_agent_sdk-0.1.24.dist-info/RECORD,,
36
+ bohr_agent_sdk-0.1.101.dist-info/METADATA,sha256=aPSBkjXZHVZyRBAqdWQl_BNJnVxAcRbuK-izY7ibVXw,6330
37
+ bohr_agent_sdk-0.1.101.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
+ bohr_agent_sdk-0.1.101.dist-info/entry_points.txt,sha256=5n5kneF5IbDQtoQ2WfF-QuBjDtsimJte9Rv9baSGgc0,86
39
+ bohr_agent_sdk-0.1.101.dist-info/top_level.txt,sha256=87xLUDhu_1nQHoGLwlhJ6XlO7OsjILh6i1nX6ljFzDo,3
40
+ bohr_agent_sdk-0.1.101.dist-info/RECORD,,
@@ -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
@@ -11,6 +11,8 @@ from typing import Literal, Optional, get_origin
11
11
  from mcp.server.fastmcp import FastMCP
12
12
  from mcp.server.fastmcp.server import Context
13
13
  from mcp.server.fastmcp.utilities.func_metadata import _get_typed_signature
14
+ from starlette.responses import JSONResponse
15
+ from starlette.routing import Route
14
16
 
15
17
  from .executor import executor_dict
16
18
  from .storage import storage_dict
@@ -282,4 +284,16 @@ class CalculationMCPServer:
282
284
  def run(self, **kwargs):
283
285
  if os.environ.get("DP_AGENT_RUNNING_MODE") in ["1", "true"]:
284
286
  return
287
+ async def health_check(request) :
288
+ return JSONResponse({"status": "ok"})
289
+
290
+ self.mcp._custom_starlette_routes.append(
291
+ Route(
292
+ "/health",
293
+ endpoint=health_check,
294
+ methods=["GET"],
295
+ name="health_check",
296
+ include_in_schema=True,
297
+ )
298
+ )
285
299
  self.mcp.run(**kwargs)