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.
Files changed (133) hide show
  1. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/PKG-INFO +54 -32
  2. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/README.md +53 -31
  3. versionhq-1.2.1.1/docs/core/task/response-field.md +211 -0
  4. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/core/task/task-output.md +1 -1
  5. versionhq-1.2.1.1/docs/core/task-graph.md +83 -0
  6. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/core/task.md +29 -11
  7. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/index.md +27 -8
  8. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/quickstart.md +33 -27
  9. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/mkdocs.yml +1 -0
  10. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/pyproject.toml +1 -1
  11. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/__init__.py +9 -9
  12. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/_utils/logger.py +1 -1
  13. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/inhouse_agents.py +7 -0
  14. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/model.py +2 -2
  15. {versionhq-1.2.0.4/src/versionhq/team → versionhq-1.2.1.1/src/versionhq/agent_network}/model.py +113 -115
  16. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/clients/workflow/model.py +10 -10
  17. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/source.py +2 -2
  18. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/source_docling.py +1 -1
  19. {versionhq-1.2.0.4/src/versionhq/network → versionhq-1.2.1.1/src/versionhq/memory}/__init__.py +0 -0
  20. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/memory/model.py +1 -1
  21. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/formation.py +11 -11
  22. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/model.py +15 -16
  23. {versionhq-1.2.0.4/src/versionhq/team → versionhq-1.2.1.1/src/versionhq/task_graph}/__init__.py +0 -0
  24. {versionhq-1.2.0.4/src/versionhq/network → versionhq-1.2.1.1/src/versionhq/task_graph}/model.py +154 -82
  25. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq.egg-info/PKG-INFO +54 -32
  26. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq.egg-info/SOURCES.txt +11 -11
  27. versionhq-1.2.0.4/tests/team/team_test.py → versionhq-1.2.1.1/tests/agent_network/agent_network_test.py +58 -58
  28. {versionhq-1.2.0.4/tests/knowledge → versionhq-1.2.1.1/tests/cli}/__init__.py +0 -0
  29. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/doc_test.py +31 -0
  30. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/formation_test.py +3 -8
  31. {versionhq-1.2.0.4/tests/llm → versionhq-1.2.1.1/tests/knowledge}/__init__.py +0 -0
  32. {versionhq-1.2.0.4/tests/memory → versionhq-1.2.1.1/tests/llm}/__init__.py +0 -0
  33. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/task/doc_test.py +1 -1
  34. {versionhq-1.2.0.4/tests/team → versionhq-1.2.1.1/tests/task_graph}/__init__.py +0 -0
  35. {versionhq-1.2.0.4/tests/network → versionhq-1.2.1.1/tests/task_graph}/doc_test.py +10 -4
  36. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/usecase_test.py +1 -1
  37. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/uv.lock +1 -1
  38. versionhq-1.2.0.4/docs/core/task/response-field.md +0 -14
  39. versionhq-1.2.0.4/src/versionhq/team/team_planner.py +0 -92
  40. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.github/workflows/deploy_docs.yml +0 -0
  41. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.github/workflows/publish.yml +0 -0
  42. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.github/workflows/publish_testpypi.yml +0 -0
  43. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.github/workflows/run_tests.yml +0 -0
  44. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.github/workflows/security_check.yml +0 -0
  45. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.gitignore +0 -0
  46. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.pre-commit-config.yaml +0 -0
  47. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/.python-version +0 -0
  48. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/LICENSE +0 -0
  49. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/SECURITY.md +0 -0
  50. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/db/preprocess.py +0 -0
  51. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/CNAME +0 -0
  52. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/_logos/favicon.ico +0 -0
  53. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/_logos/logo192.png +0 -0
  54. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/core/Agent.md +0 -0
  55. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/core/tool.md +0 -0
  56. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/docs/stylesheets/main.css +0 -0
  57. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/requirements-dev.txt +0 -0
  58. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/requirements.txt +0 -0
  59. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/runtime.txt +0 -0
  60. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/setup.cfg +0 -0
  61. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/_utils/__init__.py +0 -0
  62. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/_utils/i18n.py +0 -0
  63. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/_utils/process_config.py +0 -0
  64. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/_utils/usage_metrics.py +0 -0
  65. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/_utils/vars.py +0 -0
  66. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/TEMPLATES/Backstory.py +0 -0
  67. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/TEMPLATES/__init__.py +0 -0
  68. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/__init__.py +0 -0
  69. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/parser.py +0 -0
  70. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/agent/rpm_controller.py +0 -0
  71. {versionhq-1.2.0.4/src/versionhq/cli → versionhq-1.2.1.1/src/versionhq/agent_network}/__init__.py +0 -0
  72. {versionhq-1.2.0.4/src/versionhq/clients → versionhq-1.2.1.1/src/versionhq/cli}/__init__.py +0 -0
  73. {versionhq-1.2.0.4/src/versionhq/clients/product → versionhq-1.2.1.1/src/versionhq/clients}/__init__.py +0 -0
  74. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/clients/customer/__init__.py +0 -0
  75. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/clients/customer/model.py +0 -0
  76. {versionhq-1.2.0.4/src/versionhq/clients/workflow → versionhq-1.2.1.1/src/versionhq/clients/product}/__init__.py +0 -0
  77. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/clients/product/model.py +0 -0
  78. {versionhq-1.2.0.4/src/versionhq/llm → versionhq-1.2.1.1/src/versionhq/clients/workflow}/__init__.py +0 -0
  79. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/__init__.py +0 -0
  80. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/_utils.py +0 -0
  81. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/embedding.py +0 -0
  82. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/model.py +0 -0
  83. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/knowledge/storage.py +0 -0
  84. {versionhq-1.2.0.4/src/versionhq/memory → versionhq-1.2.1.1/src/versionhq/llm}/__init__.py +0 -0
  85. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/llm/llm_vars.py +0 -0
  86. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/llm/model.py +0 -0
  87. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/memory/contextual_memory.py +0 -0
  88. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/__init__.py +0 -0
  89. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/base.py +0 -0
  90. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/ltm_sqlite_storage.py +0 -0
  91. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/mem0_storage.py +0 -0
  92. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/rag_storage.py +0 -0
  93. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/task_output_storage.py +0 -0
  94. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/storage/utils.py +0 -0
  95. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/TEMPLATES/Description.py +0 -0
  96. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/__init__.py +0 -0
  97. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/evaluate.py +0 -0
  98. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/formatter.py +0 -0
  99. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/log_handler.py +0 -0
  100. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/task/structured_response.py +0 -0
  101. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/__init__.py +0 -0
  102. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/cache_handler.py +0 -0
  103. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/composio_tool.py +0 -0
  104. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/composio_tool_vars.py +0 -0
  105. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/decorator.py +0 -0
  106. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/model.py +0 -0
  107. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq/tool/tool_handler.py +0 -0
  108. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq.egg-info/dependency_links.txt +0 -0
  109. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq.egg-info/requires.txt +0 -0
  110. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/src/versionhq.egg-info/top_level.txt +0 -0
  111. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/__init__.py +0 -0
  112. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/agent/__init__.py +0 -0
  113. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/agent/agent_test.py +0 -0
  114. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/agent/doc_test.py +0 -0
  115. {versionhq-1.2.0.4/tests/team → versionhq-1.2.1.1/tests/agent_network}/Prompts/Demo_test.py +0 -0
  116. {versionhq-1.2.0.4/tests/cli → versionhq-1.2.1.1/tests/agent_network}/__init__.py +0 -0
  117. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/clients/customer_test.py +0 -0
  118. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/clients/product_test.py +0 -0
  119. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/clients/workflow_test.py +0 -0
  120. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/conftest.py +0 -0
  121. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/knowledge/knowledge_test.py +0 -0
  122. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/knowledge/mock_report_compressed.pdf +0 -0
  123. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/llm/llm_test.py +0 -0
  124. {versionhq-1.2.0.4/tests/network → versionhq-1.2.1.1/tests/memory}/__init__.py +0 -0
  125. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/memory/memory_test.py +0 -0
  126. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/task/__init__.py +0 -0
  127. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/task/llm_connection_test.py +0 -0
  128. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/task/task_test.py +0 -0
  129. /versionhq-1.2.0.4/tests/network/network_test.py → /versionhq-1.2.1.1/tests/task_graph/task_graph_test.py +0 -0
  130. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/tool/__init__.py +0 -0
  131. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/tool/composio_test.py +0 -0
  132. {versionhq-1.2.0.4 → versionhq-1.2.1.1}/tests/tool/doc_test.py +0 -0
  133. {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.0.4
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
- [![DL](https://img.shields.io/badge/Download-15K+-red)](https://clickpy.clickhouse.com/dashboard/versionhq)
84
+ [![DL](https://img.shields.io/badge/Download-17K+-red)](https://clickpy.clickhouse.com/dashboard/versionhq)
85
85
  ![MIT license](https://img.shields.io/badge/License-MIT-green)
86
86
  [![Publisher](https://github.com/versionHQ/multi-agent-system/actions/workflows/publish.yml/badge.svg)](https://github.com/versionHQ/multi-agent-system/actions/workflows/publish.yml)
87
- ![PyPI](https://img.shields.io/badge/PyPI-v1.2.0+-blue)
87
+ ![PyPI](https://img.shields.io/badge/PyPI-v1.2.1+-blue)
88
88
  ![python ver](https://img.shields.io/badge/Python-3.11/3.12-purple)
89
89
  ![pyenv ver](https://img.shields.io/badge/pyenv-2.5.0-orange)
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 formation](#agent-formation)
109
+ - [Agent Network](#agent-network)
110
110
  - [Graph Theory Concept](#graph-theory-concept)
111
- - [Agent optimization](#agent-optimization)
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 formation
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** | **Network** | **Random** |
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
- ### Agent optimization
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
- ```python
296
- import versionhq as vhq
309
+ ## Supervising
297
310
 
298
- agent_a = vhq.Agent(role="agent a", goal="My amazing goals", llm="llm-of-your-choice")
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
- task_1 = vhq.Task(
302
- description="Analyze the client's business model.",
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
- task_2 = vhq.Task(
308
- description="Define the cohort.",
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
- team = vhq.Team(
314
- members=[
315
- vhq.Member(agent=agent_a, is_manager=False, task=task_1),
316
- vhq.Member(agent=agent_b, is_manager=True, task=task_2),
317
- ],
318
- )
319
- res = team.launch()
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 team manager, peers in the team, or completely new agent.
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 Theory (Analysis and Visualization)**
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
- [![DL](https://img.shields.io/badge/Download-15K+-red)](https://clickpy.clickhouse.com/dashboard/versionhq)
3
+ [![DL](https://img.shields.io/badge/Download-17K+-red)](https://clickpy.clickhouse.com/dashboard/versionhq)
4
4
  ![MIT license](https://img.shields.io/badge/License-MIT-green)
5
5
  [![Publisher](https://github.com/versionHQ/multi-agent-system/actions/workflows/publish.yml/badge.svg)](https://github.com/versionHQ/multi-agent-system/actions/workflows/publish.yml)
6
- ![PyPI](https://img.shields.io/badge/PyPI-v1.2.0+-blue)
6
+ ![PyPI](https://img.shields.io/badge/PyPI-v1.2.1+-blue)
7
7
  ![python ver](https://img.shields.io/badge/Python-3.11/3.12-purple)
8
8
  ![pyenv ver](https://img.shields.io/badge/pyenv-2.5.0-orange)
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 formation](#agent-formation)
28
+ - [Agent Network](#agent-network)
29
29
  - [Graph Theory Concept](#graph-theory-concept)
30
- - [Agent optimization](#agent-optimization)
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 formation
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** | **Network** | **Random** |
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
- ### Agent optimization
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
- ```python
215
- import versionhq as vhq
228
+ ## Supervising
216
229
 
217
- agent_a = vhq.Agent(role="agent a", goal="My amazing goals", llm="llm-of-your-choice")
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
- task_1 = vhq.Task(
221
- description="Analyze the client's business model.",
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
- task_2 = vhq.Task(
227
- description="Define the cohort.",
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
- team = vhq.Team(
233
- members=[
234
- vhq.Member(agent=agent_a, is_manager=False, task=task_1),
235
- vhq.Member(agent=agent_b, is_manager=True, task=task_2),
236
- ],
237
- )
238
- res = team.launch()
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 team manager, peers in the team, or completely new agent.
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 Theory (Analysis and Visualization)**
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
+ ```
@@ -7,7 +7,7 @@ tags:
7
7
 
8
8
  # TaskOutput
9
9
 
10
- <class>`class` versionhq.tasks.model.<bold>TaskOutput<bold></class>
10
+ <class>`class` versionhq.task.model.<bold>TaskOutput<bold></class>
11
11
 
12
12
  A class to store and manage output from the `Task` object.
13
13
 
@@ -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
+ ```