openhands-tools 1.8.1__py3-none-any.whl → 1.9.0__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.
@@ -9,7 +9,6 @@ from openhands.sdk.logger import get_logger
9
9
  from openhands.sdk.tool.tool import ToolExecutor
10
10
  from openhands.tools.delegate.definition import DelegateObservation
11
11
  from openhands.tools.delegate.registration import get_agent_factory
12
- from openhands.tools.delegate.visualizer import DelegationVisualizer
13
12
 
14
13
 
15
14
  if TYPE_CHECKING:
@@ -118,22 +117,24 @@ class DelegateExecutor(ToolExecutor):
118
117
  parent_visualizer = parent_conversation._visualizer
119
118
  workspace_path = parent_conversation.state.workspace.working_dir
120
119
 
120
+ # Disable streaming for sub-agents since they run in
121
+ # separate threads without token callbacks
122
+ sub_agent_llm = parent_llm.model_copy(update={"stream": False})
123
+
121
124
  resolved_agent_types = [
122
125
  self._resolve_agent_type(action, i) for i in range(len(action.ids))
123
126
  ]
124
127
 
125
128
  for agent_id, agent_type in zip(action.ids, resolved_agent_types):
126
129
  factory = get_agent_factory(agent_type)
127
- worker_agent = factory.factory_func(parent_llm)
128
-
129
- if isinstance(parent_visualizer, DelegationVisualizer):
130
- sub_visualizer = DelegationVisualizer(
131
- name=agent_id,
132
- highlight_regex=parent_visualizer._highlight_patterns,
133
- skip_user_messages=parent_visualizer._skip_user_messages,
134
- )
135
- else:
136
- sub_visualizer = None
130
+ worker_agent = factory.factory_func(sub_agent_llm)
131
+
132
+ # Use parent visualizer's create_sub_visualizer method if available
133
+ # This allows custom visualizers (e.g., TUI-based) to create
134
+ # appropriate sub-visualizers for their environment
135
+ sub_visualizer = None
136
+ if parent_visualizer is not None:
137
+ sub_visualizer = parent_visualizer.create_sub_visualizer(agent_id)
137
138
 
138
139
  sub_conversation = LocalConversation(
139
140
  agent=worker_agent,
@@ -207,13 +208,13 @@ class DelegateExecutor(ToolExecutor):
207
208
  results = {}
208
209
  errors = {}
209
210
 
210
- # Get the parent agent's name from the visualizer
211
+ # Get the parent agent's name from the visualizer if available
211
212
  parent_conversation = self.parent_conversation
212
213
  parent_name = None
213
214
  if hasattr(parent_conversation, "_visualizer"):
214
215
  visualizer = parent_conversation._visualizer
215
- if isinstance(visualizer, DelegationVisualizer):
216
- parent_name = visualizer._name
216
+ if visualizer is not None:
217
+ parent_name = getattr(visualizer, "_name", None)
217
218
 
218
219
  def run_task(
219
220
  agent_id: str,
@@ -61,6 +61,24 @@ class DelegationVisualizer(DefaultConversationVisualizer):
61
61
  )
62
62
  self._name = name
63
63
 
64
+ def create_sub_visualizer(self, agent_id: str) -> "DelegationVisualizer":
65
+ """Create a visualizer for a sub-agent during delegation.
66
+
67
+ Creates a new DelegationVisualizer instance for the sub-agent with
68
+ the same configuration as the parent visualizer.
69
+
70
+ Args:
71
+ agent_id: The identifier of the sub-agent being spawned
72
+
73
+ Returns:
74
+ A new DelegationVisualizer configured for the sub-agent
75
+ """
76
+ return DelegationVisualizer(
77
+ name=agent_id,
78
+ highlight_regex=self._highlight_patterns,
79
+ skip_user_messages=self._skip_user_messages,
80
+ )
81
+
64
82
  @staticmethod
65
83
  def _format_agent_name(name: str) -> str:
66
84
  """
@@ -1,7 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openhands-tools
3
- Version: 1.8.1
3
+ Version: 1.9.0
4
4
  Summary: OpenHands Tools - Runtime tools for AI agents
5
+ Project-URL: Source, https://github.com/OpenHands/software-agent-sdk
6
+ Project-URL: Homepage, https://github.com/OpenHands/software-agent-sdk
7
+ Project-URL: Documentation, https://docs.openhands.dev/sdk
8
+ Project-URL: Bug Tracker, https://github.com/OpenHands/software-agent-sdk/issues
5
9
  Requires-Python: >=3.12
6
10
  Requires-Dist: openhands-sdk
7
11
  Requires-Dist: bashlex>=0.18
@@ -11,9 +11,9 @@ openhands/tools/browser_use/logging_fix.py,sha256=6h5RhHnwL5wYo31ThuIqSA5-6hgFFE
11
11
  openhands/tools/browser_use/server.py,sha256=KQ_ULLQcJX0NtzWOUJUlppwKkZsHejT8ygHbLD40FRI,7720
12
12
  openhands/tools/delegate/__init__.py,sha256=Z3q2fvnkFp_n4FBN9KeZG70W-Ud_xUyaI8XUKrugDCs,511
13
13
  openhands/tools/delegate/definition.py,sha256=o3Jxiv5-fG3Om_PHgOCju0COuAtQ9Ylx5hJRxtqEV2g,3827
14
- openhands/tools/delegate/impl.py,sha256=sLVuGk5H6zQVj74DWazHhFioNN-sC5LAs-MxMo5z21A,11839
14
+ openhands/tools/delegate/impl.py,sha256=hy2vhPThKZoVdtE3I3YbsH4_HPV-wM7XZTLs9BYE59I,11966
15
15
  openhands/tools/delegate/registration.py,sha256=1kOY4x7hjT0wJ9Xvzledg5AhXmvzC8pOtcQxpr__XC8,3981
16
- openhands/tools/delegate/visualizer.py,sha256=uq3KO2leFO37j69OsanP9bL0Bo1HLXU8V0jJhjoPkBw,8347
16
+ openhands/tools/delegate/visualizer.py,sha256=yNHRKJQ9th9bqJwxhJ7M20bhZ8bTQQ3a28IoY94rRhE,8991
17
17
  openhands/tools/delegate/templates/delegate_tool_description.j2,sha256=U7dx1QycfFaBrkg8sBaS8hJBTHuihL6_o9u_x62hzvY,1580
18
18
  openhands/tools/file_editor/__init__.py,sha256=l6M91CSb1lVOWteg__y7t8BE2HSOY1x5GC8djrTJVJQ,337
19
19
  openhands/tools/file_editor/definition.py,sha256=_aJzJYqxe_GTaRU36gsX9ZBRToLTVkGzpLJAKEEto9o,9985
@@ -74,7 +74,7 @@ openhands/tools/tom_consult/definition.py,sha256=MTdOCOJaEGgOXhlJ9-x0HdhD6JiKNT2
74
74
  openhands/tools/tom_consult/executor.py,sha256=LkWeltj-7ZgLhVZKZP4cuhxqg2YuyRnqSz5S0U9WElk,16656
75
75
  openhands/tools/utils/__init__.py,sha256=AgJX59QLQTulZqIvJnUqM7LxAgsFhtqmgol-lKLc7Wc,1253
76
76
  openhands/tools/utils/timeout.py,sha256=AjKNLZa8NqQ0HllZzqWZwZMj-8PEWHHBXwOlMjTygpA,399
77
- openhands_tools-1.8.1.dist-info/METADATA,sha256=GIuc0crqb1kEmydgnUnioGVSloDXiADigWfzNZxULv4,418
78
- openhands_tools-1.8.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
79
- openhands_tools-1.8.1.dist-info/top_level.txt,sha256=jHgVu9I0Blam8BXFgedoGKfglPF8XvW1TsJFIjcgP4E,10
80
- openhands_tools-1.8.1.dist-info/RECORD,,
77
+ openhands_tools-1.9.0.dist-info/METADATA,sha256=dCw6hKDoYg_3Tk1aIgUB5vLulYEdpqHil0dS_A2ZxGY,698
78
+ openhands_tools-1.9.0.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
79
+ openhands_tools-1.9.0.dist-info/top_level.txt,sha256=jHgVu9I0Blam8BXFgedoGKfglPF8XvW1TsJFIjcgP4E,10
80
+ openhands_tools-1.9.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5