versionhq 1.2.2.0__py3-none-any.whl → 1.2.2.1__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.
- versionhq/__init__.py +1 -1
- versionhq/agent_network/formation.py +13 -3
- versionhq/agent_network/model.py +1 -88
- {versionhq-1.2.2.0.dist-info → versionhq-1.2.2.1.dist-info}/METADATA +10 -9
- {versionhq-1.2.2.0.dist-info → versionhq-1.2.2.1.dist-info}/RECORD +8 -8
- {versionhq-1.2.2.0.dist-info → versionhq-1.2.2.1.dist-info}/LICENSE +0 -0
- {versionhq-1.2.2.0.dist-info → versionhq-1.2.2.1.dist-info}/WHEEL +0 -0
- {versionhq-1.2.2.0.dist-info → versionhq-1.2.2.1.dist-info}/top_level.txt +0 -0
versionhq/__init__.py
CHANGED
@@ -61,7 +61,7 @@ def form_agent_network(
|
|
61
61
|
# try:
|
62
62
|
prompt_formation = formation.name if formation and isinstance(formation, Formation) else f"Select the best formation to effectively execute the tasks from the given Enum sets: {str(Formation.__dict__)}."
|
63
63
|
|
64
|
-
prompt_expected_outcome = expected_outcome if isinstance(expected_outcome, str) else expected_outcome.
|
64
|
+
prompt_expected_outcome = expected_outcome if isinstance(expected_outcome, str) else str(expected_outcome.model_dump()) if type(expected_outcome) == BaseModel else ""
|
65
65
|
|
66
66
|
class Outcome(BaseModel):
|
67
67
|
formation: Enum
|
@@ -76,7 +76,7 @@ def form_agent_network(
|
|
76
76
|
)
|
77
77
|
|
78
78
|
if agents:
|
79
|
-
vhq_task.description += "
|
79
|
+
vhq_task.description += "You MUST add the following agents' roles in the network formation: " + ", ".join([agent.role for agent in agents if isinstance(agent, Agent)])
|
80
80
|
|
81
81
|
res = vhq_task.execute(agent=vhq_formation_planner, context=context)
|
82
82
|
|
@@ -88,7 +88,17 @@ def form_agent_network(
|
|
88
88
|
members = []
|
89
89
|
leader = str(res.pydantic.leader_agent) if res.pydantic else str(res.json_dict["leader_agent"])
|
90
90
|
|
91
|
-
|
91
|
+
agent_roles = res.pydantic.agent_roles if res.pydantic else res.json_dict["agent_roles"]
|
92
|
+
created_agents = [Agent(role=str(item), goal=str(item)) for item in agent_roles]
|
93
|
+
|
94
|
+
if agents:
|
95
|
+
for i, agent in enumerate(created_agents):
|
96
|
+
matches = [item for item in agents if item.role == agent.role]
|
97
|
+
if matches:
|
98
|
+
created_agents[i] = matches[0]
|
99
|
+
else:
|
100
|
+
pass
|
101
|
+
|
92
102
|
created_tasks = []
|
93
103
|
|
94
104
|
if res.pydantic:
|
versionhq/agent_network/model.py
CHANGED
@@ -255,44 +255,6 @@ class AgentNetwork(BaseModel):
|
|
255
255
|
return member.agent
|
256
256
|
|
257
257
|
|
258
|
-
# task execution
|
259
|
-
# def _process_async_tasks(self, futures: List[Tuple[Task, Future[TaskOutput], int]], was_replayed: bool = False) -> List[TaskOutput]:
|
260
|
-
# """
|
261
|
-
# When we have `Future` tasks, updated task outputs and task execution logs accordingly.
|
262
|
-
# """
|
263
|
-
|
264
|
-
# task_outputs: List[TaskOutput] = []
|
265
|
-
|
266
|
-
# for future_task, future, task_index in futures:
|
267
|
-
# task_output = future.result()
|
268
|
-
# task_outputs.append(task_output)
|
269
|
-
# future_task._store_execution_log(task_index, was_replayed)
|
270
|
-
|
271
|
-
# return task_outputs
|
272
|
-
|
273
|
-
|
274
|
-
# def _calculate_usage_metrics(self) -> UsageMetrics:
|
275
|
-
# """
|
276
|
-
# Calculate and return the usage metrics that consumed by the agent network.
|
277
|
-
# """
|
278
|
-
# total_usage_metrics = UsageMetrics()
|
279
|
-
|
280
|
-
# for member in self.members:
|
281
|
-
# agent = member.agent
|
282
|
-
# if hasattr(agent, "_token_process"):
|
283
|
-
# token_sum = agent._token_process.get_summary()
|
284
|
-
# total_usage_metrics.add_usage_metrics(token_sum)
|
285
|
-
|
286
|
-
# if self.managers:
|
287
|
-
# for manager in self.managers:
|
288
|
-
# if hasattr(manager.agent, "_token_process"):
|
289
|
-
# token_sum = manager.agent._token_process.get_summary()
|
290
|
-
# total_usage_metrics.add_usage_metrics(token_sum)
|
291
|
-
|
292
|
-
# self.usage_metrics = total_usage_metrics
|
293
|
-
# return total_usage_metrics
|
294
|
-
|
295
|
-
|
296
258
|
def _execute_tasks(self, tasks: List[Task], start_index: Optional[int] = None) -> Tuple[TaskOutput, TaskGraph]:
|
297
259
|
"""Executes tasks and returns TaskOutput object as concl or latest response in the network."""
|
298
260
|
res, task_graph = None, None
|
@@ -303,7 +265,6 @@ class AgentNetwork(BaseModel):
|
|
303
265
|
res = task.execute(agent=responsible_agent)
|
304
266
|
return res, task_graph
|
305
267
|
|
306
|
-
|
307
268
|
nodes = [
|
308
269
|
Node(
|
309
270
|
task=task,
|
@@ -332,47 +293,6 @@ class AgentNetwork(BaseModel):
|
|
332
293
|
else:
|
333
294
|
res, _ = task_graph.activate()
|
334
295
|
|
335
|
-
# task_outputs: List[TaskOutput] = []
|
336
|
-
# lead_task_output: TaskOutput = None
|
337
|
-
# futures: List[Tuple[Task, Future[TaskOutput], int]] = []
|
338
|
-
# last_sync_output: Optional[TaskOutput] = None
|
339
|
-
|
340
|
-
# for task_index, task in enumerate(tasks):
|
341
|
-
# if start_index is not None and task_index < start_index:
|
342
|
-
# if task.output:
|
343
|
-
# if task.execution_type == TaskExecutionType.ASYNC:
|
344
|
-
# task_outputs.append(task.output)
|
345
|
-
# else:
|
346
|
-
# task_outputs = [task.output]
|
347
|
-
# last_sync_output = task.output
|
348
|
-
# continue
|
349
|
-
|
350
|
-
# responsible_agent = self._get_responsible_agent(task=task)
|
351
|
-
|
352
|
-
# ## commented out - this will be handled by node objects
|
353
|
-
# # if isinstance(task, ConditionalTask):
|
354
|
-
# # skipped_task_output = task._handle_conditional_task(task_outputs, futures, task_index, was_replayed)
|
355
|
-
# # if skipped_task_output:
|
356
|
-
# # continue
|
357
|
-
|
358
|
-
# # self._log_task_start(task, responsible_agent)
|
359
|
-
|
360
|
-
# context = create_raw_outputs(tasks=[task, ], task_outputs=([last_sync_output,] if last_sync_output else []))
|
361
|
-
# res = task.execute(agent=responsible_agent, context=context)
|
362
|
-
|
363
|
-
# if isinstance(res, Future):
|
364
|
-
# futures.append((task, res, task_index))
|
365
|
-
# else:
|
366
|
-
# # if self.managers and responsible_agent in [manager.agent for manager in self.managers]:
|
367
|
-
# # lead_task_output = task_output
|
368
|
-
|
369
|
-
# task_outputs.append(res)
|
370
|
-
# task._store_log(task_index, was_replayed, self._inputs)
|
371
|
-
|
372
|
-
|
373
|
-
# if futures:
|
374
|
-
# task_outputs = self._process_async_tasks(futures, was_replayed)
|
375
|
-
|
376
296
|
if not res:
|
377
297
|
Logger().log(level="error", message="Missing task outputs.", color="red")
|
378
298
|
raise ValueError("Missing task outputs")
|
@@ -380,7 +300,6 @@ class AgentNetwork(BaseModel):
|
|
380
300
|
return res, task_graph
|
381
301
|
|
382
302
|
|
383
|
-
|
384
303
|
def launch(
|
385
304
|
self, kwargs_pre: Optional[Dict[str, str]] = None, kwargs_post: Optional[Dict[str, Any]] = None, start_index: int = None
|
386
305
|
) -> Tuple[TaskOutput, TaskGraph]:
|
@@ -391,7 +310,7 @@ class AgentNetwork(BaseModel):
|
|
391
310
|
self._assign_tasks()
|
392
311
|
|
393
312
|
if kwargs_pre:
|
394
|
-
for func in self.pre_launch_callbacks:
|
313
|
+
for func in self.pre_launch_callbacks: #! REFINEME - signature check
|
395
314
|
func(**kwargs_pre)
|
396
315
|
|
397
316
|
for member in self.members:
|
@@ -420,12 +339,6 @@ class AgentNetwork(BaseModel):
|
|
420
339
|
case _:
|
421
340
|
pass
|
422
341
|
|
423
|
-
# metrics += [member.agent._token_process.get_summary() for member in self.members]
|
424
|
-
|
425
|
-
# self.usage_metrics = UsageMetrics()
|
426
|
-
# for metric in metrics:
|
427
|
-
# self.usage_metrics.add_usage_metrics(metric)
|
428
|
-
|
429
342
|
return result, tg
|
430
343
|
|
431
344
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: versionhq
|
3
|
-
Version: 1.2.2.
|
3
|
+
Version: 1.2.2.1
|
4
4
|
Summary: An agentic orchestration framework for building agent networks that handle task automation.
|
5
5
|
Author-email: Kuriko Iwai <kuriko@versi0n.io>
|
6
6
|
License: MIT License
|
@@ -84,7 +84,7 @@ Requires-Dist: pygraphviz>=1.14; extra == "pygraphviz"
|
|
84
84
|
[](https://clickpy.clickhouse.com/dashboard/versionhq)
|
85
85
|

|
86
86
|
[](https://github.com/versionHQ/multi-agent-system/actions/workflows/publish.yml)
|
87
|
-

|
88
88
|

|
89
89
|

|
90
90
|
|
@@ -255,14 +255,14 @@ agent.update(
|
|
255
255
|
```python
|
256
256
|
import versionhq as vhq
|
257
257
|
|
258
|
-
network =
|
258
|
+
network = work(
|
259
259
|
task="YOUR AMAZING TASK OVERVIEW",
|
260
260
|
expected_outcome="YOUR OUTCOME EXPECTATION",
|
261
261
|
)
|
262
|
-
res,
|
262
|
+
res, tg = network.launch()
|
263
263
|
```
|
264
264
|
|
265
|
-
This will form a network with multiple agents on `Formation` and return `TaskOutput` object
|
265
|
+
This will form a agent network with multiple agents on `Formation` and return response in `TaskOutput` object and `TaskGraph` that connects multiple tasks as nodes.
|
266
266
|
|
267
267
|
|
268
268
|
### Executing tasks
|
@@ -295,7 +295,6 @@ res = task.execute(context="context to consider")
|
|
295
295
|
assert isinstance(res, vhq.TaskOutput)
|
296
296
|
```
|
297
297
|
|
298
|
-
|
299
298
|
This will return a `TaskOutput` object that stores response in plane text, JSON, and Pydantic model: `CustomOutput` formats with a callback result, tool output (if given), and evaluation results (if given).
|
300
299
|
|
301
300
|
```python
|
@@ -338,11 +337,13 @@ network =vhq.AgentNetwork(
|
|
338
337
|
vhq.Member(agent=agent_b, is_manager=True, tasks=[task_2]), # Agent B as a manager
|
339
338
|
],
|
340
339
|
)
|
341
|
-
res,
|
340
|
+
res, tg = network.launch()
|
342
341
|
|
343
342
|
assert isinstance(res, vhq.TaskOutput)
|
344
|
-
assert
|
345
|
-
assert
|
343
|
+
assert agent_b.key in task_1.processed_agents
|
344
|
+
assert agent_b.key in task_2.processed_agents
|
345
|
+
|
346
|
+
assert isinstance(tg, vhq.TaskGraph)
|
346
347
|
```
|
347
348
|
|
348
349
|
This will return a list with dictionaries with keys defined in the `ResponseField` of each task.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
versionhq/__init__.py,sha256=
|
1
|
+
versionhq/__init__.py,sha256=6i-QHTxLobpE8uqqoiPoPnfeTOqY4J8i3ptRaGfo_c0,2857
|
2
2
|
versionhq/_utils/__init__.py,sha256=d-vYVcORZKG-kkLe_fzE8VbViDpAk9DDOKe2fVK25ew,178
|
3
3
|
versionhq/_utils/i18n.py,sha256=TwA_PnYfDLA6VqlUDPuybdV9lgi3Frh_ASsb_X8jJo8,1483
|
4
4
|
versionhq/_utils/logger.py,sha256=iHxGjm3BvUo5dHKLU88_pc0Z45wzSHOjyJGQkb7OADk,3255
|
@@ -13,8 +13,8 @@ versionhq/agent/rpm_controller.py,sha256=grezIxyBci_lDlwAlgWFRyR5KOocXeOhYkgN02d
|
|
13
13
|
versionhq/agent/TEMPLATES/Backstory.py,sha256=IAhGnnt6VUMe3wO6IzeyZPDNu7XE7Uiu3VEXUreOcKs,532
|
14
14
|
versionhq/agent/TEMPLATES/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
15
|
versionhq/agent_network/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
-
versionhq/agent_network/formation.py,sha256=
|
17
|
-
versionhq/agent_network/model.py,sha256=
|
16
|
+
versionhq/agent_network/formation.py,sha256=CYKNUeKC392wW3leIDIAaGiKADSsumC_vTe0VOnNwRs,7901
|
17
|
+
versionhq/agent_network/model.py,sha256=f2i26vyVagzq4g2lIxNivhab45i1dnK8HZV8mVO6Og8,15564
|
18
18
|
versionhq/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
19
|
versionhq/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
20
|
versionhq/clients/customer/__init__.py,sha256=-YXh1FQfvpfLacK8SUC7bD7Wx_eIEi4yrkCC_cUasFg,217
|
@@ -60,8 +60,8 @@ versionhq/tool/composio_tool_vars.py,sha256=FvBuEXsOQUYnN7RTFxT20kAkiEYkxWKkiVtg
|
|
60
60
|
versionhq/tool/decorator.py,sha256=C4ZM7Xi2gwtEMaSeRo-geo_g_MAkY77WkSLkAuY0AyI,1205
|
61
61
|
versionhq/tool/model.py,sha256=PO4zNWBZcJhYVur381YL1dy6zqurio2jWjtbxOxZMGI,12194
|
62
62
|
versionhq/tool/tool_handler.py,sha256=2m41K8qo5bGCCbwMFferEjT-XZ-mE9F0mDUOBkgivOI,1416
|
63
|
-
versionhq-1.2.2.
|
64
|
-
versionhq-1.2.2.
|
65
|
-
versionhq-1.2.2.
|
66
|
-
versionhq-1.2.2.
|
67
|
-
versionhq-1.2.2.
|
63
|
+
versionhq-1.2.2.1.dist-info/LICENSE,sha256=cRoGGdM73IiDs6nDWKqPlgSv7aR4n-qBXYnJlCMHCeE,1082
|
64
|
+
versionhq-1.2.2.1.dist-info/METADATA,sha256=WIONV5Bz91sfCUeeiFQP4GU9TnIletGgOYW-f3mjbEo,22015
|
65
|
+
versionhq-1.2.2.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
66
|
+
versionhq-1.2.2.1.dist-info/top_level.txt,sha256=DClQwxDWqIUGeRJkA8vBlgeNsYZs4_nJWMonzFt5Wj0,10
|
67
|
+
versionhq-1.2.2.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|