versionhq 1.2.0.4__py3-none-any.whl → 1.2.1.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 +9 -9
- versionhq/_utils/logger.py +1 -1
- versionhq/agent/inhouse_agents.py +7 -0
- versionhq/agent/model.py +2 -2
- versionhq/{team → agent_network}/model.py +113 -115
- versionhq/clients/workflow/model.py +10 -10
- versionhq/knowledge/source.py +2 -2
- versionhq/knowledge/source_docling.py +1 -1
- versionhq/memory/model.py +1 -1
- versionhq/task/formation.py +11 -11
- versionhq/task/model.py +15 -16
- versionhq/{network → task_graph}/model.py +154 -82
- {versionhq-1.2.0.4.dist-info → versionhq-1.2.1.1.dist-info}/METADATA +54 -32
- {versionhq-1.2.0.4.dist-info → versionhq-1.2.1.1.dist-info}/RECORD +19 -20
- versionhq/team/team_planner.py +0 -92
- /versionhq/{network → agent_network}/__init__.py +0 -0
- /versionhq/{team → task_graph}/__init__.py +0 -0
- {versionhq-1.2.0.4.dist-info → versionhq-1.2.1.1.dist-info}/LICENSE +0 -0
- {versionhq-1.2.0.4.dist-info → versionhq-1.2.1.1.dist-info}/WHEEL +0 -0
- {versionhq-1.2.0.4.dist-info → versionhq-1.2.1.1.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: versionhq
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.1.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
|
@@ -81,10 +81,10 @@ Requires-Dist: pygraphviz>=1.14; extra == "pygraphviz"
|
|
81
81
|
|
82
82
|
# Overview
|
83
83
|
|
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
|
|
@@ -106,14 +106,16 @@ A Python framework for agentic orchestration that handles complex task automatio
|
|
106
106
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
107
107
|
|
108
108
|
- [Key Features](#key-features)
|
109
|
-
- [Agent
|
109
|
+
- [Agent Network](#agent-network)
|
110
110
|
- [Graph Theory Concept](#graph-theory-concept)
|
111
|
-
- [
|
111
|
+
- [Task Graph](#task-graph)
|
112
|
+
- [Optimization](#optimization)
|
112
113
|
- [Quick Start](#quick-start)
|
113
114
|
- [Package installation](#package-installation)
|
114
115
|
- [Forming a agent network](#forming-a-agent-network)
|
115
116
|
- [Executing tasks](#executing-tasks)
|
116
117
|
- [Supervising](#supervising)
|
118
|
+
- [Supervising](#supervising-1)
|
117
119
|
- [Technologies Used](#technologies-used)
|
118
120
|
- [Project Structure](#project-structure)
|
119
121
|
- [Setting Up a Project](#setting-up-a-project)
|
@@ -139,14 +141,14 @@ A Python framework for agentic orchestration that handles complex task automatio
|
|
139
141
|
Agents are model-agnostic, and will improve task output, while oprimizing token cost and job latency, by sharing their memory, knowledge base, and RAG tools with other agents in the network.
|
140
142
|
|
141
143
|
|
142
|
-
### Agent
|
144
|
+
### Agent Network
|
143
145
|
|
144
146
|
Agents adapt their formation based on task complexity.
|
145
147
|
|
146
148
|
You can specify a desired formation or allow the agents to determine it autonomously (default).
|
147
149
|
|
148
150
|
|
149
|
-
| | **Solo Agent** | **Supervising** | **
|
151
|
+
| | **Solo Agent** | **Supervising** | **Squad** | **Random** |
|
150
152
|
| :--- | :--- | :--- | :--- | :--- |
|
151
153
|
| **Formation** | <img src="https://res.cloudinary.com/dfeirxlea/image/upload/v1738818211/pj_m_agents/rbgxttfoeqqis1ettlfz.png" alt="solo" width="200"> | <img src="https://res.cloudinary.com/dfeirxlea/image/upload/v1738818211/pj_m_agents/zhungor3elxzer5dum10.png" alt="solo" width="200"> | <img src="https://res.cloudinary.com/dfeirxlea/image/upload/v1738818211/pj_m_agents/dnusl7iy7kiwkxwlpmg8.png" alt="solo" width="200"> | <img src="https://res.cloudinary.com/dfeirxlea/image/upload/v1738818211/pj_m_agents/sndpczatfzbrosxz9ama.png" alt="solo" width="200"> |
|
152
154
|
| **Usage** | <ul><li>A single agent with tools, knowledge, and memory.</li><li>When self-learning mode is on - it will turn into **Random** formation.</li></ul> | <ul><li>Leader agent gives directions, while sharing its knowledge and memory.</li><li>Subordinates can be solo agents or networks.</li></ul> | <ul><li>Share tasks, knowledge, and memory among network members.</li></ul> | <ul><li>A single agent handles tasks, asking help from other agents without sharing its memory or knowledge.</li></ul> |
|
@@ -192,7 +194,19 @@ task_graph.visualize()
|
|
192
194
|
|
193
195
|
<hr />
|
194
196
|
|
195
|
-
###
|
197
|
+
### Task Graph
|
198
|
+
|
199
|
+
A `TaskGraph` represents tasks as `nodes` and their execution dependencies as `edges`, automating rule-based execution.
|
200
|
+
|
201
|
+
`Agent Networks` can handle `TaskGraph` objects by optimizing their formations.
|
202
|
+
|
203
|
+
The following example demonstrates a simple concept of a `supervising` agent network handling a task graph with three tasks and one critical edge.
|
204
|
+
|
205
|
+
<img src="https://res.cloudinary.com/dfeirxlea/image/upload/v1739337639/pj_m_home/zfg4ccw1m1ww1tpnb0pa.png">
|
206
|
+
|
207
|
+
<hr />
|
208
|
+
|
209
|
+
### Optimization
|
196
210
|
|
197
211
|
Agents are model-agnostic and can handle multiple tasks, leveraging their own and their peers' knowledge sources, memories, and tools.
|
198
212
|
|
@@ -292,42 +306,50 @@ This will return a `TaskOutput` object that stores response in plane text, JSON,
|
|
292
306
|
|
293
307
|
### Supervising
|
294
308
|
|
295
|
-
|
296
|
-
import versionhq as vhq
|
309
|
+
## Supervising
|
297
310
|
|
298
|
-
|
299
|
-
agent_b = vhq.Agent(role="agent b", goal="My amazing goals", llm="llm-of-your-choice")
|
311
|
+
To create an agent network with one or more manager agents, designate members using the `is_manager` tag.
|
300
312
|
|
301
|
-
|
302
|
-
|
303
|
-
response_fields=[vhq.ResponseField(title="test1", data_type=str, required=True),],
|
304
|
-
allow_delegation=True
|
305
|
-
)
|
313
|
+
```python
|
314
|
+
import versionhq as vhq
|
306
315
|
|
307
|
-
|
308
|
-
|
309
|
-
response_fields=[ResponseField(title="test1", data_type=int, required=True),],
|
310
|
-
allow_delegation=False
|
311
|
-
)
|
316
|
+
agent_a = vhq.Agent(role="agent a", goal="My amazing goals", llm="llm-of-your-choice")
|
317
|
+
agent_b = vhq.Agent(role="agent b", goal="My amazing goals", llm="llm-of-your-choice")
|
312
318
|
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
319
|
+
task_1 = vhq.Task(
|
320
|
+
description="Analyze the client's business model.",
|
321
|
+
response_fields=[vhq.ResponseField(title="test1", data_type=str, required=True),],
|
322
|
+
allow_delegation=True
|
323
|
+
)
|
324
|
+
|
325
|
+
task_2 = vhq.Task(
|
326
|
+
description="Define a cohort.",
|
327
|
+
response_fields=[vhq.ResponseField(title="test1", data_type=int, required=True),],
|
328
|
+
allow_delegation=False
|
329
|
+
)
|
330
|
+
|
331
|
+
network =vhq.AgentNetwork(
|
332
|
+
members=[
|
333
|
+
vhq.Member(agent=agent_a, is_manager=False, tasks=[task_1]),
|
334
|
+
vhq.Member(agent=agent_b, is_manager=True, tasks=[task_2]), # Agent B as a manager
|
335
|
+
],
|
336
|
+
)
|
337
|
+
res = network.launch()
|
338
|
+
|
339
|
+
assert isinstance(res, vhq.NetworkOutput)
|
340
|
+
assert not [item for item in task_1.processed_agents if "vhq-Delegated-Agent" == item]
|
341
|
+
assert [item for item in task_1.processed_agents if "agent b" == item]
|
342
|
+
```
|
321
343
|
|
322
344
|
This will return a list with dictionaries with keys defined in the `ResponseField` of each task.
|
323
345
|
|
324
|
-
Tasks can be delegated to a
|
346
|
+
Tasks can be delegated to a manager, peers within the agent network, or a completely new agent.
|
325
347
|
|
326
348
|
<hr />
|
327
349
|
|
328
350
|
## Technologies Used
|
329
351
|
|
330
|
-
**Graph
|
352
|
+
**Task Graph**
|
331
353
|
|
332
354
|
* [NetworkX](https://networkx.org/documentation/stable/reference/introduction.html): A Python package to analyze, create, and manipulate complex graph networks.
|
333
355
|
* [Matplotlib](https://matplotlib.org/stable/index.html): Visualization library
|
@@ -1,17 +1,19 @@
|
|
1
|
-
versionhq/__init__.py,sha256=
|
1
|
+
versionhq/__init__.py,sha256=Ct-oSIm8Mw2K2UH9CNTtuKaLgwUTIcUa3ogDAFQYHZo,2817
|
2
2
|
versionhq/_utils/__init__.py,sha256=dzoZr4cBlh-2QZuPzTdehPUCe9lP1dmRtauD7qTjUaA,158
|
3
3
|
versionhq/_utils/i18n.py,sha256=TwA_PnYfDLA6VqlUDPuybdV9lgi3Frh_ASsb_X8jJo8,1483
|
4
|
-
versionhq/_utils/logger.py,sha256=
|
4
|
+
versionhq/_utils/logger.py,sha256=2qkODR6y8ApOoMjQZVecTboXvCLrMy2v_mTSOnNMKFY,1581
|
5
5
|
versionhq/_utils/process_config.py,sha256=jbPGXK2Kb4iyCugJ3FwRJuU0wL5Trq2x4xFQz2uOyFY,746
|
6
6
|
versionhq/_utils/usage_metrics.py,sha256=NXF18dn5NNvGK7EsQ4AAghpR8ppYOjMx6ABenLLHnmM,1066
|
7
7
|
versionhq/_utils/vars.py,sha256=bZ5Dx_bFKlt3hi4-NNGXqdk7B23If_WaTIju2fiTyPQ,57
|
8
8
|
versionhq/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
-
versionhq/agent/inhouse_agents.py,sha256=
|
10
|
-
versionhq/agent/model.py,sha256=
|
9
|
+
versionhq/agent/inhouse_agents.py,sha256=snDtgDmvZB2bZKH_RTcz5uFOMl3MTjLJwTQBebFt8hk,2532
|
10
|
+
versionhq/agent/model.py,sha256=HiEQulVjXx6fWGaP-DBWmiZv5uwXFPd4S8jyBU3ydm0,25442
|
11
11
|
versionhq/agent/parser.py,sha256=riG0dkdQCxH7uJ0AbdVdg7WvL0BXhUgJht0VtQvxJBc,4082
|
12
12
|
versionhq/agent/rpm_controller.py,sha256=grezIxyBci_lDlwAlgWFRyR5KOocXeOhYkgN02dNFNE,2360
|
13
13
|
versionhq/agent/TEMPLATES/Backstory.py,sha256=IAhGnnt6VUMe3wO6IzeyZPDNu7XE7Uiu3VEXUreOcKs,532
|
14
14
|
versionhq/agent/TEMPLATES/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
|
+
versionhq/agent_network/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
+
versionhq/agent_network/model.py,sha256=P3Ntr_OIK60EXjEfaEm31HTBFypZfVr__0aC4VBt9G0,19353
|
15
17
|
versionhq/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
18
|
versionhq/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
19
|
versionhq/clients/customer/__init__.py,sha256=-YXh1FQfvpfLacK8SUC7bD7Wx_eIEi4yrkCC_cUasFg,217
|
@@ -19,22 +21,20 @@ versionhq/clients/customer/model.py,sha256=_AtaVVMm9MgCwrQ-HTRQ2oXUMKrSCEfZwE2Jd
|
|
19
21
|
versionhq/clients/product/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
22
|
versionhq/clients/product/model.py,sha256=3w__pug9XRe4LIm9wX8C8WKqi40r081Eb1q2vWk9UaU,3694
|
21
23
|
versionhq/clients/workflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
|
-
versionhq/clients/workflow/model.py,sha256=
|
24
|
+
versionhq/clients/workflow/model.py,sha256=fqmTx8Y6P6i-sK045ENO88GDbf4WYY4hUA26RfEH8Ek,6011
|
23
25
|
versionhq/knowledge/__init__.py,sha256=qW7IgssTA4_bFFV9ziOcYRfGjlq1c8bkb-HnfWknpuQ,567
|
24
26
|
versionhq/knowledge/_utils.py,sha256=YWRF8U533cfZes_gZqUvdj-K24MD2ri1R0gjc_aPYyc,402
|
25
27
|
versionhq/knowledge/embedding.py,sha256=KfHc__1THxb5jrg1EMrF-v944RDuIr2hE0l-MtM3Bp0,6826
|
26
28
|
versionhq/knowledge/model.py,sha256=w29mrJv1kiznCh4P4yJMUQxIuyRw1Sk0XYtBXzCxaG4,1786
|
27
|
-
versionhq/knowledge/source.py,sha256
|
28
|
-
versionhq/knowledge/source_docling.py,sha256=
|
29
|
+
versionhq/knowledge/source.py,sha256=-hEUPtJUHHMx4rUKtiHl19J8xAMw-WVBw34zwa2jZ08,13630
|
30
|
+
versionhq/knowledge/source_docling.py,sha256=mg7bgvKePHn2LlA_XzSFCbS0zOo9xfu_aNOf5cEo6c4,5421
|
29
31
|
versionhq/knowledge/storage.py,sha256=7oxCg3W9mFjYH1YmuH9kFtTbNxquzYFjuUjd_TlsB9E,8170
|
30
32
|
versionhq/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
33
|
versionhq/llm/llm_vars.py,sha256=wjQK20cKvph6Vq1v71o4d16zBGcHlwq0bzOT_zWno7w,7041
|
32
34
|
versionhq/llm/model.py,sha256=wlzDUMEyIOm808d1vzqu9gmbB4ch-s_EUvwFR60gR80,17177
|
33
35
|
versionhq/memory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
36
|
versionhq/memory/contextual_memory.py,sha256=tCsOOAUnfrOL7YiakqGoi3uShzzS870TmGnlGd3z_A4,3556
|
35
|
-
versionhq/memory/model.py,sha256=
|
36
|
-
versionhq/network/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
|
-
versionhq/network/model.py,sha256=fKKMTviIS2uOwLYT_bGN_2-4R0gmnPB8x-dd05k5jFE,19700
|
37
|
+
versionhq/memory/model.py,sha256=MPO8dDP5eAuk9td6bMOq5j2huLzCADFJDrTujHhcWQY,8150
|
38
38
|
versionhq/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
39
|
versionhq/storage/base.py,sha256=p-Jas0fXQan_qotnRD6seQxrT2lj-uw9-SmHQhdppcs,355
|
40
40
|
versionhq/storage/ltm_sqlite_storage.py,sha256=wdUiuwHfJocdk0UGqyrdU4S5Nae1rgsoRNu3LWmGFcI,3951
|
@@ -44,15 +44,14 @@ versionhq/storage/task_output_storage.py,sha256=E1t_Fkt78dPYIOl3MP7LfQ8oGtjlzxBu
|
|
44
44
|
versionhq/storage/utils.py,sha256=ByYXPoEIGJYLUqz-DWjbCAnneNrH1otiYbp12SCILpM,747
|
45
45
|
versionhq/task/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
46
46
|
versionhq/task/evaluate.py,sha256=WdUgjbZL62XrxyWe5MTz29scfzwmuAHGxJ7GvAB8Fmk,3954
|
47
|
-
versionhq/task/formation.py,sha256=
|
47
|
+
versionhq/task/formation.py,sha256=gBrFmMHvoyqdK9wEa9aBkZImEQV3GMDDX6-RDpw0pEo,6421
|
48
48
|
versionhq/task/formatter.py,sha256=N8Kmk9vtrMtBdgJ8J7RmlKNMdZWSmV8O1bDexmCWgU0,643
|
49
49
|
versionhq/task/log_handler.py,sha256=LT7YnO7gcPR9IZS7eRvMjnHh8crMBFtqduxd8dxIbkk,1680
|
50
|
-
versionhq/task/model.py,sha256=
|
50
|
+
versionhq/task/model.py,sha256=oPnShLU6huN2cfuEiHVO8Zl9_w44G9ZsWEWMBjpHfK4,30675
|
51
51
|
versionhq/task/structured_response.py,sha256=4q-hQPu7oMMHHXEzh9YW4SJ7N5eCZ7OfZ65juyl_jCI,5000
|
52
52
|
versionhq/task/TEMPLATES/Description.py,sha256=V-4kh8xpQTKOcDMi2xnuP-fcNk6kuoz1_5tYBlDLQWQ,420
|
53
|
-
versionhq/
|
54
|
-
versionhq/
|
55
|
-
versionhq/team/team_planner.py,sha256=Zc3zvhPR7T0O8RQoq9CKOrvrll4klemY1rONLFeJ96M,3663
|
53
|
+
versionhq/task_graph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
54
|
+
versionhq/task_graph/model.py,sha256=TsszoTJFeJ4TfSdLAjcGa9QSQyf9Uy3WmechTw0qL3k,22832
|
56
55
|
versionhq/tool/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
57
56
|
versionhq/tool/cache_handler.py,sha256=iL8FH7X0G-cdT0uhJwzuhLDaadTXOdfybZcDy151-es,1085
|
58
57
|
versionhq/tool/composio_tool.py,sha256=38mEiVvTkuw1BLD233Bl1Gwxbpss1yfQiZLTWwX6BdA,8648
|
@@ -60,8 +59,8 @@ versionhq/tool/composio_tool_vars.py,sha256=FvBuEXsOQUYnN7RTFxT20kAkiEYkxWKkiVtg
|
|
60
59
|
versionhq/tool/decorator.py,sha256=C4ZM7Xi2gwtEMaSeRo-geo_g_MAkY77WkSLkAuY0AyI,1205
|
61
60
|
versionhq/tool/model.py,sha256=PO4zNWBZcJhYVur381YL1dy6zqurio2jWjtbxOxZMGI,12194
|
62
61
|
versionhq/tool/tool_handler.py,sha256=2m41K8qo5bGCCbwMFferEjT-XZ-mE9F0mDUOBkgivOI,1416
|
63
|
-
versionhq-1.2.
|
64
|
-
versionhq-1.2.
|
65
|
-
versionhq-1.2.
|
66
|
-
versionhq-1.2.
|
67
|
-
versionhq-1.2.
|
62
|
+
versionhq-1.2.1.1.dist-info/LICENSE,sha256=cRoGGdM73IiDs6nDWKqPlgSv7aR4n-qBXYnJlCMHCeE,1082
|
63
|
+
versionhq-1.2.1.1.dist-info/METADATA,sha256=cjE8Ov1BpANLgfAZAbHO0XmorFk9nAR-rVyJg1AczVc,22166
|
64
|
+
versionhq-1.2.1.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
65
|
+
versionhq-1.2.1.1.dist-info/top_level.txt,sha256=DClQwxDWqIUGeRJkA8vBlgeNsYZs4_nJWMonzFt5Wj0,10
|
66
|
+
versionhq-1.2.1.1.dist-info/RECORD,,
|
versionhq/team/team_planner.py
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
from typing import Any, List, Optional, Dict
|
3
|
-
from pydantic import BaseModel, Field
|
4
|
-
|
5
|
-
|
6
|
-
class TeamPlanner:
|
7
|
-
"""
|
8
|
-
A class to handle agent formations based on the given task description.
|
9
|
-
1) complexity
|
10
|
-
2) agent built (or use given agents)
|
11
|
-
3) knowledge, memory sharing
|
12
|
-
4) form a team
|
13
|
-
"""
|
14
|
-
|
15
|
-
from versionhq.task.model import Task, ResponseField, TaskOutput
|
16
|
-
from versionhq.agent.model import Agent
|
17
|
-
|
18
|
-
|
19
|
-
def __init__(self, tasks: List[Task], planner_llm: Optional[Any] = None):
|
20
|
-
self.tasks = tasks
|
21
|
-
self.planner_llm = planner_llm if planner_llm else os.environ.get("DEFAULT_MODEL_NAME")
|
22
|
-
|
23
|
-
|
24
|
-
def _handle_assign_agents(self, unassigned_tasks: List[Task]) -> List[Any]:
|
25
|
-
"""
|
26
|
-
Build an agent and assign it a task, then return a list of Member connecting the agent created and the task given.
|
27
|
-
"""
|
28
|
-
|
29
|
-
from versionhq.agent.model import Agent
|
30
|
-
from versionhq.task.model import Task, ResponseField
|
31
|
-
from versionhq.team.model import Member
|
32
|
-
|
33
|
-
new_member_list: List[Member] = []
|
34
|
-
agent_creator = Agent(
|
35
|
-
role="agent_creator",
|
36
|
-
goal="build an ai agent that can competitively handle the task given",
|
37
|
-
llm=self.planner_llm,
|
38
|
-
)
|
39
|
-
|
40
|
-
for unassgined_task in unassigned_tasks:
|
41
|
-
task = Task(
|
42
|
-
description=f"""
|
43
|
-
Based on the following task summary, draft a AI agent's role and goal in concise manner.
|
44
|
-
Task summary: {unassgined_task.summary}
|
45
|
-
""",
|
46
|
-
response_fields=[
|
47
|
-
ResponseField(title="goal", data_type=str, required=True),
|
48
|
-
ResponseField(title="role", data_type=str, required=True),
|
49
|
-
],
|
50
|
-
)
|
51
|
-
res = task.execute(agent=agent_creator)
|
52
|
-
agent = Agent(
|
53
|
-
role=res.json_dict["role"] if "role" in res.json_dict else res.raw,
|
54
|
-
goal=res.json_dict["goal"] if "goal" in res.json_dict else task.description
|
55
|
-
)
|
56
|
-
if agent.id:
|
57
|
-
team_member = Member(agent=agent, tasks=[unassgined_task], is_manager=False)
|
58
|
-
new_member_list.append(team_member)
|
59
|
-
|
60
|
-
return new_member_list
|
61
|
-
|
62
|
-
|
63
|
-
def _handle_task_planning(self, context: Optional[str] = None, tools: Optional[str] = None) -> TaskOutput:
|
64
|
-
"""
|
65
|
-
Handles the team planning by creating detailed step-by-step plans for each task.
|
66
|
-
"""
|
67
|
-
|
68
|
-
from versionhq.agent.model import Agent
|
69
|
-
from versionhq.task.model import Task
|
70
|
-
|
71
|
-
team_planner = Agent(
|
72
|
-
role="team planner",
|
73
|
-
goal="Plan extremely detailed, step-by-step plan based on the tasks and tools available to each agent so that they can perform the tasks in an exemplary manner and assign a task to each agent.",
|
74
|
-
llm=self.planner_llm,
|
75
|
-
)
|
76
|
-
|
77
|
-
task_summary_list = [task.summary for task in self.tasks]
|
78
|
-
|
79
|
-
class TeamPlanIdea(BaseModel):
|
80
|
-
plan: str | Dict[str, Any] = Field(default=None, description="a decriptive plan to be executed by the team")
|
81
|
-
|
82
|
-
|
83
|
-
task = Task(
|
84
|
-
description=f"""
|
85
|
-
Based on the following task summaries, create the most descriptive plan that the team can execute most efficiently. Take all the task summaries - task's description and tools available - into consideration. Your answer only contains a dictionary.
|
86
|
-
|
87
|
-
Task summaries: {" ".join(task_summary_list)}
|
88
|
-
""",
|
89
|
-
pydantic_output=TeamPlanIdea
|
90
|
-
)
|
91
|
-
output = task.execute(agent=team_planner, context=context, tools=tools)
|
92
|
-
return output
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|