openhands-sdk 1.5.1__py3-none-any.whl → 1.5.2__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.
- openhands/sdk/agent/base.py +19 -6
- openhands/sdk/tool/tool.py +2 -2
- {openhands_sdk-1.5.1.dist-info → openhands_sdk-1.5.2.dist-info}/METADATA +1 -1
- {openhands_sdk-1.5.1.dist-info → openhands_sdk-1.5.2.dist-info}/RECORD +6 -6
- {openhands_sdk-1.5.1.dist-info → openhands_sdk-1.5.2.dist-info}/WHEEL +0 -0
- {openhands_sdk-1.5.1.dist-info → openhands_sdk-1.5.2.dist-info}/top_level.txt +0 -0
openhands/sdk/agent/base.py
CHANGED
|
@@ -3,6 +3,7 @@ import re
|
|
|
3
3
|
import sys
|
|
4
4
|
from abc import ABC, abstractmethod
|
|
5
5
|
from collections.abc import Generator, Iterable
|
|
6
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
6
7
|
from typing import TYPE_CHECKING, Any
|
|
7
8
|
|
|
8
9
|
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
|
|
@@ -196,13 +197,25 @@ class AgentBase(DiscriminatedUnionMixin, ABC):
|
|
|
196
197
|
return
|
|
197
198
|
|
|
198
199
|
tools: list[ToolDefinition] = []
|
|
199
|
-
for tool_spec in self.tools:
|
|
200
|
-
tools.extend(resolve_tool(tool_spec, state))
|
|
201
200
|
|
|
202
|
-
#
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
201
|
+
# Use ThreadPoolExecutor to parallelize tool resolution
|
|
202
|
+
with ThreadPoolExecutor(max_workers=4) as executor:
|
|
203
|
+
futures = []
|
|
204
|
+
|
|
205
|
+
# Submit tool resolution tasks
|
|
206
|
+
for tool_spec in self.tools:
|
|
207
|
+
future = executor.submit(resolve_tool, tool_spec, state)
|
|
208
|
+
futures.append(future)
|
|
209
|
+
|
|
210
|
+
# Submit MCP tools creation if configured
|
|
211
|
+
if self.mcp_config:
|
|
212
|
+
future = executor.submit(create_mcp_tools, self.mcp_config, 30)
|
|
213
|
+
futures.append(future)
|
|
214
|
+
|
|
215
|
+
# Collect results as they complete
|
|
216
|
+
for future in futures:
|
|
217
|
+
result = future.result()
|
|
218
|
+
tools.extend(result)
|
|
206
219
|
|
|
207
220
|
logger.info(
|
|
208
221
|
f"Loaded {len(tools)} tools from spec: {[tool.name for tool in tools]}"
|
openhands/sdk/tool/tool.py
CHANGED
|
@@ -364,7 +364,7 @@ class ToolDefinition[ActionT, ObservationT](DiscriminatedUnionMixin, ABC):
|
|
|
364
364
|
action_type: type[Schema] | None = None,
|
|
365
365
|
) -> dict[str, Any]:
|
|
366
366
|
action_type = action_type or self.action_type
|
|
367
|
-
action_type_with_risk =
|
|
367
|
+
action_type_with_risk = create_action_type_with_risk(action_type)
|
|
368
368
|
|
|
369
369
|
add_security_risk_prediction = add_security_risk_prediction and (
|
|
370
370
|
self.annotations is None or (not self.annotations.readOnlyHint)
|
|
@@ -460,7 +460,7 @@ class ToolDefinition[ActionT, ObservationT](DiscriminatedUnionMixin, ABC):
|
|
|
460
460
|
raise ValueError(error_msg)
|
|
461
461
|
|
|
462
462
|
|
|
463
|
-
def
|
|
463
|
+
def create_action_type_with_risk(action_type: type[Schema]) -> type[Schema]:
|
|
464
464
|
action_type_with_risk = _action_types_with_risk.get(action_type)
|
|
465
465
|
if action_type_with_risk:
|
|
466
466
|
return action_type_with_risk
|
|
@@ -2,7 +2,7 @@ openhands/sdk/__init__.py,sha256=SsB5acHhWvF6e3FlbR72PzZHH9ByJiXc7vnwxBPqmhw,237
|
|
|
2
2
|
openhands/sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
openhands/sdk/agent/__init__.py,sha256=yOn1ZCgTTq2VJlTzKDSzmWVPli1siBzqV89vlEHCwOg,137
|
|
4
4
|
openhands/sdk/agent/agent.py,sha256=OCR7JJytiiTHLuFwU3XjMtJx11Y2Io-DamdbMa2mf60,23760
|
|
5
|
-
openhands/sdk/agent/base.py,sha256=
|
|
5
|
+
openhands/sdk/agent/base.py,sha256=DcWIKQrX4f0EgXMTU_PN-DmEDznRWrPNJLUwuFVVZAc,16628
|
|
6
6
|
openhands/sdk/agent/utils.py,sha256=alYsAQ611XQ_94ogJacYD22BLbgSJjzd3Xex_b9KuC4,7418
|
|
7
7
|
openhands/sdk/agent/prompts/in_context_learning_example.j2,sha256=MGB0dPUlh6pwLoR_dBK-M3e5dtETX6C6WNjPcPixZmU,5512
|
|
8
8
|
openhands/sdk/agent/prompts/in_context_learning_example_suffix.j2,sha256=k3Zwnd7Iq7kL4lo307RDuu1mxWXn6pSLsEdvKEXN3BU,164
|
|
@@ -133,7 +133,7 @@ openhands/sdk/tool/__init__.py,sha256=Fpcy_I5CYC8lDf2KNLj7LJg9YpoDObbacMFOvM9fI5
|
|
|
133
133
|
openhands/sdk/tool/registry.py,sha256=x5j8DwOjH3YJijhXe_3nRPsSr1A2sDPpNhxCuvFrHK0,5456
|
|
134
134
|
openhands/sdk/tool/schema.py,sha256=PdQbkzPER-Z9B-eKPMr16M8ap27gghszq1xSHH5DGZQ,9114
|
|
135
135
|
openhands/sdk/tool/spec.py,sha256=EbtWasVhwjLKNJywHubbwfYqfgXnZbU4QE6XUOLhsdk,1221
|
|
136
|
-
openhands/sdk/tool/tool.py,sha256=
|
|
136
|
+
openhands/sdk/tool/tool.py,sha256=UrsUiBmywGXtCKlGCxSF650wSx9kX76RpaTs6U3Jb5w,17796
|
|
137
137
|
openhands/sdk/tool/builtins/__init__.py,sha256=30MfENomH9JBPwKs03Xwgny09dDUOt3FSIQ3egRJKhM,729
|
|
138
138
|
openhands/sdk/tool/builtins/finish.py,sha256=pPv_bKDOQE4sUK9lNh1H1lDaxavHozjOwLCIuYrb424,3136
|
|
139
139
|
openhands/sdk/tool/builtins/think.py,sha256=Jp8CBHJZwrtNuVCLrxKlVwb9HeQ1lZB56PCYMxW3wWk,4050
|
|
@@ -159,7 +159,7 @@ openhands/sdk/workspace/remote/__init__.py,sha256=eKkj6NOESMUBGDVC6_L2Wfuc4K6G-m
|
|
|
159
159
|
openhands/sdk/workspace/remote/async_remote_workspace.py,sha256=ftv1Vdx4mmM3AjygJpemMJGvhaQel7ORxdQVk12z4ZE,5061
|
|
160
160
|
openhands/sdk/workspace/remote/base.py,sha256=72C9MZV7ch5n6oHNvFMo6irW7b6Le8n4gk3yFuc0798,5605
|
|
161
161
|
openhands/sdk/workspace/remote/remote_workspace_mixin.py,sha256=CzHfnLUIra5sgPkP9kcggb1vHGOPpYQzLsHvGO2rRt0,10963
|
|
162
|
-
openhands_sdk-1.5.
|
|
163
|
-
openhands_sdk-1.5.
|
|
164
|
-
openhands_sdk-1.5.
|
|
165
|
-
openhands_sdk-1.5.
|
|
162
|
+
openhands_sdk-1.5.2.dist-info/METADATA,sha256=XwPv6tZdwg8wHnixpnTWtNI3d_Df6V3w5xeYzdbnBtA,545
|
|
163
|
+
openhands_sdk-1.5.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
164
|
+
openhands_sdk-1.5.2.dist-info/top_level.txt,sha256=jHgVu9I0Blam8BXFgedoGKfglPF8XvW1TsJFIjcgP4E,10
|
|
165
|
+
openhands_sdk-1.5.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|