versionhq 1.2.0.4__tar.gz → 1.2.1.1__tar.gz
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-1.2.0.4 → versionhq-1.2.1.1}/PKG-INFO +54 -32
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/README.md +53 -31
- versionhq-1.2.1.1/docs/core/task/response-field.md +211 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/core/task/task-output.md +1 -1
- versionhq-1.2.1.1/docs/core/task-graph.md +83 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/core/task.md +29 -11
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/index.md +27 -8
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/quickstart.md +33 -27
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/mkdocs.yml +1 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/pyproject.toml +1 -1
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/__init__.py +9 -9
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/_utils/logger.py +1 -1
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/inhouse_agents.py +7 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/model.py +2 -2
- {versionhq-1.2.0.4/src/versionhq/team → versionhq-1.2.1.1/src/versionhq/agent_network}/model.py +113 -115
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/clients/workflow/model.py +10 -10
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/source.py +2 -2
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/source_docling.py +1 -1
- {versionhq-1.2.0.4/src/versionhq/network → versionhq-1.2.1.1/src/versionhq/memory}/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/memory/model.py +1 -1
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/formation.py +11 -11
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/model.py +15 -16
- {versionhq-1.2.0.4/src/versionhq/team → versionhq-1.2.1.1/src/versionhq/task_graph}/__init__.py +0 -0
- {versionhq-1.2.0.4/src/versionhq/network → versionhq-1.2.1.1/src/versionhq/task_graph}/model.py +154 -82
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq.egg-info/PKG-INFO +54 -32
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq.egg-info/SOURCES.txt +11 -11
- versionhq-1.2.0.4/tests/team/team_test.py → versionhq-1.2.1.1/tests/agent_network/agent_network_test.py +58 -58
- {versionhq-1.2.0.4/tests/knowledge → versionhq-1.2.1.1/tests/cli}/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/doc_test.py +31 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/formation_test.py +3 -8
- {versionhq-1.2.0.4/tests/llm → versionhq-1.2.1.1/tests/knowledge}/__init__.py +0 -0
- {versionhq-1.2.0.4/tests/memory → versionhq-1.2.1.1/tests/llm}/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/task/doc_test.py +1 -1
- {versionhq-1.2.0.4/tests/team → versionhq-1.2.1.1/tests/task_graph}/__init__.py +0 -0
- {versionhq-1.2.0.4/tests/network → versionhq-1.2.1.1/tests/task_graph}/doc_test.py +10 -4
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/usecase_test.py +1 -1
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/uv.lock +1 -1
- versionhq-1.2.0.4/docs/core/task/response-field.md +0 -14
- versionhq-1.2.0.4/src/versionhq/team/team_planner.py +0 -92
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.github/workflows/deploy_docs.yml +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.github/workflows/publish.yml +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.github/workflows/publish_testpypi.yml +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.github/workflows/run_tests.yml +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.github/workflows/security_check.yml +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.gitignore +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.pre-commit-config.yaml +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.python-version +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/LICENSE +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/SECURITY.md +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/db/preprocess.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/CNAME +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/_logos/favicon.ico +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/_logos/logo192.png +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/core/Agent.md +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/core/tool.md +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/stylesheets/main.css +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/requirements-dev.txt +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/requirements.txt +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/runtime.txt +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/setup.cfg +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/_utils/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/_utils/i18n.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/_utils/process_config.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/_utils/usage_metrics.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/_utils/vars.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/TEMPLATES/Backstory.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/TEMPLATES/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/parser.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/rpm_controller.py +0 -0
- {versionhq-1.2.0.4/src/versionhq/cli → versionhq-1.2.1.1/src/versionhq/agent_network}/__init__.py +0 -0
- {versionhq-1.2.0.4/src/versionhq/clients → versionhq-1.2.1.1/src/versionhq/cli}/__init__.py +0 -0
- {versionhq-1.2.0.4/src/versionhq/clients/product → versionhq-1.2.1.1/src/versionhq/clients}/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/clients/customer/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/clients/customer/model.py +0 -0
- {versionhq-1.2.0.4/src/versionhq/clients/workflow → versionhq-1.2.1.1/src/versionhq/clients/product}/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/clients/product/model.py +0 -0
- {versionhq-1.2.0.4/src/versionhq/llm → versionhq-1.2.1.1/src/versionhq/clients/workflow}/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/_utils.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/embedding.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/model.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/storage.py +0 -0
- {versionhq-1.2.0.4/src/versionhq/memory → versionhq-1.2.1.1/src/versionhq/llm}/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/llm/llm_vars.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/llm/model.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/memory/contextual_memory.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/base.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/ltm_sqlite_storage.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/mem0_storage.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/rag_storage.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/task_output_storage.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/utils.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/TEMPLATES/Description.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/evaluate.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/formatter.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/log_handler.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/structured_response.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/cache_handler.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/composio_tool.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/composio_tool_vars.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/decorator.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/model.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/tool_handler.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq.egg-info/dependency_links.txt +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq.egg-info/requires.txt +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq.egg-info/top_level.txt +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/agent/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/agent/agent_test.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/agent/doc_test.py +0 -0
- {versionhq-1.2.0.4/tests/team → versionhq-1.2.1.1/tests/agent_network}/Prompts/Demo_test.py +0 -0
- {versionhq-1.2.0.4/tests/cli → versionhq-1.2.1.1/tests/agent_network}/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/clients/customer_test.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/clients/product_test.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/clients/workflow_test.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/conftest.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/knowledge/knowledge_test.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/knowledge/mock_report_compressed.pdf +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/llm/llm_test.py +0 -0
- {versionhq-1.2.0.4/tests/network → versionhq-1.2.1.1/tests/memory}/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/memory/memory_test.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/task/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/task/llm_connection_test.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/task/task_test.py +0 -0
- /versionhq-1.2.0.4/tests/network/network_test.py → /versionhq-1.2.1.1/tests/task_graph/task_graph_test.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/tool/__init__.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/tool/composio_test.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/tool/doc_test.py +0 -0
- {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/tool/tool_test.py +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,9 +1,9 @@
|
|
1
1
|
# Overview
|
2
2
|
|
3
|
-
[](https://clickpy.clickhouse.com/dashboard/versionhq)
|
4
4
|

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

|
7
7
|

|
8
8
|

|
9
9
|
|
@@ -25,14 +25,16 @@ A Python framework for agentic orchestration that handles complex task automatio
|
|
25
25
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
26
26
|
|
27
27
|
- [Key Features](#key-features)
|
28
|
-
- [Agent
|
28
|
+
- [Agent Network](#agent-network)
|
29
29
|
- [Graph Theory Concept](#graph-theory-concept)
|
30
|
-
- [
|
30
|
+
- [Task Graph](#task-graph)
|
31
|
+
- [Optimization](#optimization)
|
31
32
|
- [Quick Start](#quick-start)
|
32
33
|
- [Package installation](#package-installation)
|
33
34
|
- [Forming a agent network](#forming-a-agent-network)
|
34
35
|
- [Executing tasks](#executing-tasks)
|
35
36
|
- [Supervising](#supervising)
|
37
|
+
- [Supervising](#supervising-1)
|
36
38
|
- [Technologies Used](#technologies-used)
|
37
39
|
- [Project Structure](#project-structure)
|
38
40
|
- [Setting Up a Project](#setting-up-a-project)
|
@@ -58,14 +60,14 @@ A Python framework for agentic orchestration that handles complex task automatio
|
|
58
60
|
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.
|
59
61
|
|
60
62
|
|
61
|
-
### Agent
|
63
|
+
### Agent Network
|
62
64
|
|
63
65
|
Agents adapt their formation based on task complexity.
|
64
66
|
|
65
67
|
You can specify a desired formation or allow the agents to determine it autonomously (default).
|
66
68
|
|
67
69
|
|
68
|
-
| | **Solo Agent** | **Supervising** | **
|
70
|
+
| | **Solo Agent** | **Supervising** | **Squad** | **Random** |
|
69
71
|
| :--- | :--- | :--- | :--- | :--- |
|
70
72
|
| **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"> |
|
71
73
|
| **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> |
|
@@ -111,7 +113,19 @@ task_graph.visualize()
|
|
111
113
|
|
112
114
|
<hr />
|
113
115
|
|
114
|
-
###
|
116
|
+
### Task Graph
|
117
|
+
|
118
|
+
A `TaskGraph` represents tasks as `nodes` and their execution dependencies as `edges`, automating rule-based execution.
|
119
|
+
|
120
|
+
`Agent Networks` can handle `TaskGraph` objects by optimizing their formations.
|
121
|
+
|
122
|
+
The following example demonstrates a simple concept of a `supervising` agent network handling a task graph with three tasks and one critical edge.
|
123
|
+
|
124
|
+
<img src="https://res.cloudinary.com/dfeirxlea/image/upload/v1739337639/pj_m_home/zfg4ccw1m1ww1tpnb0pa.png">
|
125
|
+
|
126
|
+
<hr />
|
127
|
+
|
128
|
+
### Optimization
|
115
129
|
|
116
130
|
Agents are model-agnostic and can handle multiple tasks, leveraging their own and their peers' knowledge sources, memories, and tools.
|
117
131
|
|
@@ -211,42 +225,50 @@ This will return a `TaskOutput` object that stores response in plane text, JSON,
|
|
211
225
|
|
212
226
|
### Supervising
|
213
227
|
|
214
|
-
|
215
|
-
import versionhq as vhq
|
228
|
+
## Supervising
|
216
229
|
|
217
|
-
|
218
|
-
agent_b = vhq.Agent(role="agent b", goal="My amazing goals", llm="llm-of-your-choice")
|
230
|
+
To create an agent network with one or more manager agents, designate members using the `is_manager` tag.
|
219
231
|
|
220
|
-
|
221
|
-
|
222
|
-
response_fields=[vhq.ResponseField(title="test1", data_type=str, required=True),],
|
223
|
-
allow_delegation=True
|
224
|
-
)
|
232
|
+
```python
|
233
|
+
import versionhq as vhq
|
225
234
|
|
226
|
-
|
227
|
-
|
228
|
-
response_fields=[ResponseField(title="test1", data_type=int, required=True),],
|
229
|
-
allow_delegation=False
|
230
|
-
)
|
235
|
+
agent_a = vhq.Agent(role="agent a", goal="My amazing goals", llm="llm-of-your-choice")
|
236
|
+
agent_b = vhq.Agent(role="agent b", goal="My amazing goals", llm="llm-of-your-choice")
|
231
237
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
238
|
+
task_1 = vhq.Task(
|
239
|
+
description="Analyze the client's business model.",
|
240
|
+
response_fields=[vhq.ResponseField(title="test1", data_type=str, required=True),],
|
241
|
+
allow_delegation=True
|
242
|
+
)
|
243
|
+
|
244
|
+
task_2 = vhq.Task(
|
245
|
+
description="Define a cohort.",
|
246
|
+
response_fields=[vhq.ResponseField(title="test1", data_type=int, required=True),],
|
247
|
+
allow_delegation=False
|
248
|
+
)
|
249
|
+
|
250
|
+
network =vhq.AgentNetwork(
|
251
|
+
members=[
|
252
|
+
vhq.Member(agent=agent_a, is_manager=False, tasks=[task_1]),
|
253
|
+
vhq.Member(agent=agent_b, is_manager=True, tasks=[task_2]), # Agent B as a manager
|
254
|
+
],
|
255
|
+
)
|
256
|
+
res = network.launch()
|
257
|
+
|
258
|
+
assert isinstance(res, vhq.NetworkOutput)
|
259
|
+
assert not [item for item in task_1.processed_agents if "vhq-Delegated-Agent" == item]
|
260
|
+
assert [item for item in task_1.processed_agents if "agent b" == item]
|
261
|
+
```
|
240
262
|
|
241
263
|
This will return a list with dictionaries with keys defined in the `ResponseField` of each task.
|
242
264
|
|
243
|
-
Tasks can be delegated to a
|
265
|
+
Tasks can be delegated to a manager, peers within the agent network, or a completely new agent.
|
244
266
|
|
245
267
|
<hr />
|
246
268
|
|
247
269
|
## Technologies Used
|
248
270
|
|
249
|
-
**Graph
|
271
|
+
**Task Graph**
|
250
272
|
|
251
273
|
* [NetworkX](https://networkx.org/documentation/stable/reference/introduction.html): A Python package to analyze, create, and manipulate complex graph networks.
|
252
274
|
* [Matplotlib](https://matplotlib.org/stable/index.html): Visualization library
|
@@ -0,0 +1,211 @@
|
|
1
|
+
---
|
2
|
+
tags:
|
3
|
+
- HTML5
|
4
|
+
- JavaScript
|
5
|
+
- CSS
|
6
|
+
---
|
7
|
+
|
8
|
+
# ResponseField
|
9
|
+
|
10
|
+
<class>`class` versionhq.task.model.<bold>ResponseField<bold></class>
|
11
|
+
|
12
|
+
A class to store response formats to create JSON response schema.
|
13
|
+
|
14
|
+
<hr/>
|
15
|
+
|
16
|
+
## Core Usage
|
17
|
+
|
18
|
+
`[var]`<bold>`title: str = None`</bold>
|
19
|
+
|
20
|
+
`[var]`<bold>`data_type: Type = None`</bold>
|
21
|
+
|
22
|
+
Define a response format with field titles and data types.
|
23
|
+
|
24
|
+
|
25
|
+
```python
|
26
|
+
import versionhq as vhq
|
27
|
+
|
28
|
+
response_field = vhq.ResponseField(
|
29
|
+
title="summary",
|
30
|
+
data_type=str,
|
31
|
+
nullable=False, # default = False. Explicitly mentioned.
|
32
|
+
)
|
33
|
+
|
34
|
+
## Agent output:
|
35
|
+
# "summary": <AGENT_RESPONSE_IN_STRING>
|
36
|
+
```
|
37
|
+
|
38
|
+
### Object
|
39
|
+
|
40
|
+
`[var]`<bold>`properties: List[InstanceOf[ResponseField]] = None`</bold>
|
41
|
+
|
42
|
+
To format an object, add `ResponseField` objects to the `properties` fields.
|
43
|
+
|
44
|
+
Missing properties for dict will trigger an error.
|
45
|
+
|
46
|
+
```python
|
47
|
+
import versionhq as vhq
|
48
|
+
|
49
|
+
response_field = vhq.ResponseField(
|
50
|
+
title="dict-summary",
|
51
|
+
data_type=dict,
|
52
|
+
nullable=False,
|
53
|
+
properties=[
|
54
|
+
vhq.ResponseField(title="summary-1", data_type=str),
|
55
|
+
vhq.ResponseField(title="summary-2", data_type=int),
|
56
|
+
]
|
57
|
+
)
|
58
|
+
|
59
|
+
## Agent output:
|
60
|
+
# dict-summary: {
|
61
|
+
# "summary-1": <AGENT_RESPONSE_1_IN_STRING>,
|
62
|
+
# "summary-2": <AGENT_RESPONSE_2_IN_INTEGER>,
|
63
|
+
# }
|
64
|
+
```
|
65
|
+
|
66
|
+
<hr />
|
67
|
+
|
68
|
+
### List
|
69
|
+
|
70
|
+
`[var]`<bold>`items: Optional[Type] = None`</bold>
|
71
|
+
|
72
|
+
To format a list, add data types of the list items to the `items` field.
|
73
|
+
|
74
|
+
Missing items for list will trigger an error.
|
75
|
+
|
76
|
+
```python
|
77
|
+
import versionhq as vhq
|
78
|
+
|
79
|
+
response_field = vhq.ResponseField(
|
80
|
+
title="list-summary",
|
81
|
+
data_type=list,
|
82
|
+
nullable=False,
|
83
|
+
items=str
|
84
|
+
)
|
85
|
+
|
86
|
+
## Agent output:
|
87
|
+
# list-summary: [
|
88
|
+
# <AGENT_RESPONSE_1_IN_STRING>,
|
89
|
+
# <AGENT_RESPONSE_2_IN_STRING>,
|
90
|
+
# ...
|
91
|
+
# ]
|
92
|
+
```
|
93
|
+
|
94
|
+
<hr />
|
95
|
+
|
96
|
+
## Nesting
|
97
|
+
|
98
|
+
Agents can handle **one layer** of nested items usign `properties` and `items` fields.
|
99
|
+
|
100
|
+
We highly recommend to use `gemini-x` or `gpt-x` to get stable results.
|
101
|
+
|
102
|
+
### List with Object
|
103
|
+
|
104
|
+
```python
|
105
|
+
import versionhq as vhq
|
106
|
+
|
107
|
+
list_with_objects = vhq.ResponseField(
|
108
|
+
title="parent",
|
109
|
+
data_type=list,
|
110
|
+
items=dict,
|
111
|
+
properties=[
|
112
|
+
vhq.ResponseField(title="nest-1", data_type=str),
|
113
|
+
vhq.ResponseField(title="nest-2", data_type=float),
|
114
|
+
]
|
115
|
+
)
|
116
|
+
|
117
|
+
# Agent output
|
118
|
+
# parent: [
|
119
|
+
# { "nest-1": <AGENT_RESOPONSE_IN_STRING>},
|
120
|
+
# { "nest-2": <AGENT_RESOPONSE_IN_NUMBER>},
|
121
|
+
# ]
|
122
|
+
```
|
123
|
+
|
124
|
+
<hr />
|
125
|
+
|
126
|
+
### List with List
|
127
|
+
|
128
|
+
```python
|
129
|
+
import versionhq as vhq
|
130
|
+
|
131
|
+
list_with_list = vhq.ResponseField(
|
132
|
+
title="parent",
|
133
|
+
data_type=list,
|
134
|
+
items=list
|
135
|
+
)
|
136
|
+
|
137
|
+
# Agent output
|
138
|
+
# parent: [
|
139
|
+
# [<AGENT_RESOPONSE_IN_STRING>, ...],
|
140
|
+
# [<AGENT_RESOPONSE_IN_STRING>, ...]
|
141
|
+
# ...
|
142
|
+
# ]
|
143
|
+
```
|
144
|
+
|
145
|
+
<hr />
|
146
|
+
|
147
|
+
### Object with List
|
148
|
+
|
149
|
+
```python
|
150
|
+
import versionhq as vhq
|
151
|
+
|
152
|
+
dict_with_list = vhq.ResponseField(
|
153
|
+
title="parent",
|
154
|
+
data_type=dict,
|
155
|
+
properties=[
|
156
|
+
vhq.ResponseField(title="nest-1", data_type=list, items=str),
|
157
|
+
vhq.ResponseField(title="nest-2", data_type=list, items=int),
|
158
|
+
]
|
159
|
+
)
|
160
|
+
|
161
|
+
# Agent output
|
162
|
+
# parent: {
|
163
|
+
# nest-1: [<AGENT_RESOPONSE_IN_STRING>, ...],
|
164
|
+
# nest-2: [<AGENT_RESOPONSE_IN_INTEGER>, ...]
|
165
|
+
# }
|
166
|
+
```
|
167
|
+
|
168
|
+
<hr />
|
169
|
+
|
170
|
+
### Object with Object
|
171
|
+
|
172
|
+
```python
|
173
|
+
import versionhq as vhq
|
174
|
+
|
175
|
+
dict_with_dict = vhq.ResponseField(
|
176
|
+
title="parent",
|
177
|
+
data_type=dict,
|
178
|
+
properties=[
|
179
|
+
vhq.ResponseField(title="nest-1", data_type=dict, properties=[
|
180
|
+
vhq.ResponseField(title="nest-1-1", data_type=str)
|
181
|
+
]),
|
182
|
+
vhq.ResponseField(title="nest-2", data_type=list, items=int),
|
183
|
+
]
|
184
|
+
)
|
185
|
+
|
186
|
+
# Agent output
|
187
|
+
# parent: {
|
188
|
+
# nest-1: { nest-1-1: <AGENT_RESOPONSE_IN_STRING>, },
|
189
|
+
# nest-2: [<AGENT_RESOPONSE_IN_INTEGER>, ...]
|
190
|
+
# }
|
191
|
+
```
|
192
|
+
|
193
|
+
### Config
|
194
|
+
|
195
|
+
`[var]`<bold>`config: Optional[Dict[str, Any]] = {}`</bold>
|
196
|
+
|
197
|
+
You can add other configs you want to pass to the LLM.
|
198
|
+
|
199
|
+
```python
|
200
|
+
import versionhq as vhq
|
201
|
+
|
202
|
+
response_field = vhq.ResponseField(
|
203
|
+
title="summary-with-config",
|
204
|
+
data_type=str,
|
205
|
+
nullable=False,
|
206
|
+
config=dict(required=False, )
|
207
|
+
)
|
208
|
+
|
209
|
+
# Agent output:
|
210
|
+
# summary-with-config: <AGENT_RESPONSE_IN_STRING>
|
211
|
+
```
|
@@ -0,0 +1,83 @@
|
|
1
|
+
---
|
2
|
+
tags:
|
3
|
+
- HTML5
|
4
|
+
- JavaScript
|
5
|
+
- CSS
|
6
|
+
---
|
7
|
+
|
8
|
+
# TaskGraph
|
9
|
+
|
10
|
+
<class>`class` versionhq.graph.model.<bold>TaskGraph<bold></class>
|
11
|
+
|
12
|
+
A `TaskGraph` represents tasks as `nodes` and their execution dependencies as `edges`, automating rule-based execution.
|
13
|
+
|
14
|
+
`Agent Networks` can handle `TaskGraph` objects by optimizing their formations.
|
15
|
+
|
16
|
+
The following example demonstrates a simple concept of a `supervising` agent network handling a task graph with three tasks and one critical edge.
|
17
|
+
|
18
|
+
<img src="https://res.cloudinary.com/dfeirxlea/image/upload/v1739337639/pj_m_home/zfg4ccw1m1ww1tpnb0pa.png">
|
19
|
+
|
20
|
+
|
21
|
+
## Core Usage
|
22
|
+
|
23
|
+
`TaskGraph` needs at least two `nodes` and one `edges` to connect the nodes to function.
|
24
|
+
|
25
|
+
You can define nodes and edges mannually by creating nodes from tasks, and defining edges.
|
26
|
+
|
27
|
+
|
28
|
+
### Generating TaskGraph
|
29
|
+
|
30
|
+
```python
|
31
|
+
import versionhq as vhq
|
32
|
+
|
33
|
+
task_graph = vhq.TaskGraph(directed=False, should_reform=True)
|
34
|
+
|
35
|
+
task_a = vhq.Task(description="Research Topic")
|
36
|
+
task_b = vhq.Task(description="Outline Post")
|
37
|
+
task_c = vhq.Task(description="Write First Draft")
|
38
|
+
|
39
|
+
node_a = task_graph.add_task(task=task_a)
|
40
|
+
node_b = task_graph.add_task(task=task_b)
|
41
|
+
node_c = task_graph.add_task(task=task_c)
|
42
|
+
|
43
|
+
task_graph.add_dependency(
|
44
|
+
node_a.identifier, node_b.identifier,
|
45
|
+
type=vhq.DependencyType.FINISH_TO_START, weight=5, description="B depends on A"
|
46
|
+
)
|
47
|
+
task_graph.add_dependency(
|
48
|
+
node_a.identifier, node_c.identifier,
|
49
|
+
type=vhq.DependencyType.FINISH_TO_FINISH, lag=1, required=False, weight=3
|
50
|
+
)
|
51
|
+
|
52
|
+
critical_path, duration, paths = task_graph.find_critical_path()
|
53
|
+
|
54
|
+
import uuid
|
55
|
+
assert isinstance(task_graph, vhq.TaskGraph)
|
56
|
+
assert [type(k) == uuid.uuid4 and isinstance(v, vhq.Node) and isinstance(v.task, vhq.Task) for k, v in task_graph.nodes.items()]
|
57
|
+
assert [type(k) == uuid.uuid4 and isinstance(v, vhq.Edge) for k, v in task_graph.edges.items()]
|
58
|
+
assert critical_path and duration and paths
|
59
|
+
```
|
60
|
+
|
61
|
+
|
62
|
+
### Activating TaskGraph
|
63
|
+
|
64
|
+
Calling `.activate()` begins execution of the graph's nodes, respecting dependencies [`dependency-met`] and prioritizing the critical path.
|
65
|
+
|
66
|
+
|
67
|
+
**[NOTES]**
|
68
|
+
|
69
|
+
- If all nodes are already complete, outputs are returned without further execution.
|
70
|
+
|
71
|
+
- If no critical path is found, execution begins with any dependency-met start nodes.
|
72
|
+
|
73
|
+
|
74
|
+
```python
|
75
|
+
import versionhq as vhq
|
76
|
+
|
77
|
+
# Inherting the `task_graph` object in the previous code snippet,
|
78
|
+
|
79
|
+
last_task_output, outputs = task_graph.activate()
|
80
|
+
|
81
|
+
assert isinstance(last_task_output, vhq.TaskOutput)
|
82
|
+
assert [k in task_graph.nodes.keys() and v and isinstance(v, vhq.TaskOutput) for k, v in outputs.items()]
|
83
|
+
```
|