versionhq 1.1.13.1__tar.gz → 1.2.0.2__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.1.13.1 → versionhq-1.2.0.2}/PKG-INFO +7 -7
  2. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/README.md +6 -6
  3. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/docs/core/Agent.md +1 -1
  4. versionhq-1.2.0.2/docs/core/task/response-field.md +14 -0
  5. versionhq-1.2.0.2/docs/core/task/task-output.md +14 -0
  6. versionhq-1.2.0.2/docs/core/task.md +282 -0
  7. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/docs/core/tool.md +4 -4
  8. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/docs/index.md +1 -1
  9. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/docs/quickstart.md +1 -1
  10. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/mkdocs.yml +4 -6
  11. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/pyproject.toml +1 -1
  12. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/__init__.py +3 -3
  13. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/agent/model.py +1 -1
  14. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/network/model.py +150 -44
  15. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/task/evaluate.py +1 -1
  16. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/task/formation.py +1 -1
  17. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/task/model.py +120 -86
  18. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/task/structured_response.py +16 -14
  19. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/team/model.py +11 -10
  20. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/team/team_planner.py +2 -4
  21. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq.egg-info/PKG-INFO +7 -7
  22. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq.egg-info/SOURCES.txt +5 -0
  23. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/agent/agent_test.py +3 -3
  24. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/agent/doc_test.py +13 -13
  25. versionhq-1.2.0.2/tests/doc_test.py +39 -0
  26. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/network/doc_test.py +2 -4
  27. versionhq-1.2.0.2/tests/task/doc_test.py +136 -0
  28. versionhq-1.2.0.2/tests/task/llm_connection_test.py +106 -0
  29. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/task/task_test.py +50 -86
  30. versionhq-1.2.0.2/tests/tool/__init__.py +0 -0
  31. {versionhq-1.1.13.1/tests → versionhq-1.2.0.2/tests/tool}/doc_test.py +20 -74
  32. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/usecase_test.py +13 -18
  33. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/uv.lock +1 -1
  34. versionhq-1.1.13.1/tests/task/__init__.py +0 -59
  35. versionhq-1.1.13.1/tests/task/llm_connection_test.py +0 -69
  36. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/.github/workflows/deploy_docs.yml +0 -0
  37. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/.github/workflows/publish.yml +0 -0
  38. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/.github/workflows/publish_testpypi.yml +0 -0
  39. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/.github/workflows/run_tests.yml +0 -0
  40. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/.github/workflows/security_check.yml +0 -0
  41. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/.gitignore +0 -0
  42. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/.pre-commit-config.yaml +0 -0
  43. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/.python-version +0 -0
  44. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/LICENSE +0 -0
  45. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/SECURITY.md +0 -0
  46. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/db/preprocess.py +0 -0
  47. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/docs/CNAME +0 -0
  48. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/docs/_logos/favicon.ico +0 -0
  49. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/docs/_logos/logo192.png +0 -0
  50. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/docs/stylesheets/main.css +0 -0
  51. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/requirements-dev.txt +0 -0
  52. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/requirements.txt +0 -0
  53. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/runtime.txt +0 -0
  54. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/setup.cfg +0 -0
  55. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/_utils/__init__.py +0 -0
  56. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/_utils/i18n.py +0 -0
  57. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/_utils/logger.py +0 -0
  58. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/_utils/process_config.py +0 -0
  59. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/_utils/usage_metrics.py +0 -0
  60. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/_utils/vars.py +0 -0
  61. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/agent/TEMPLATES/Backstory.py +0 -0
  62. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/agent/TEMPLATES/__init__.py +0 -0
  63. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/agent/__init__.py +0 -0
  64. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/agent/inhouse_agents.py +0 -0
  65. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/agent/parser.py +0 -0
  66. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/agent/rpm_controller.py +0 -0
  67. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/cli/__init__.py +0 -0
  68. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/clients/__init__.py +0 -0
  69. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/clients/customer/__init__.py +0 -0
  70. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/clients/customer/model.py +0 -0
  71. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/clients/product/__init__.py +0 -0
  72. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/clients/product/model.py +0 -0
  73. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/clients/workflow/__init__.py +0 -0
  74. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/clients/workflow/model.py +0 -0
  75. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/knowledge/__init__.py +0 -0
  76. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/knowledge/_utils.py +0 -0
  77. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/knowledge/embedding.py +0 -0
  78. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/knowledge/model.py +0 -0
  79. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/knowledge/source.py +0 -0
  80. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/knowledge/source_docling.py +0 -0
  81. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/knowledge/storage.py +0 -0
  82. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/llm/__init__.py +0 -0
  83. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/llm/llm_vars.py +0 -0
  84. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/llm/model.py +0 -0
  85. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/memory/__init__.py +0 -0
  86. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/memory/contextual_memory.py +0 -0
  87. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/memory/model.py +0 -0
  88. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/network/__init__.py +0 -0
  89. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/storage/__init__.py +0 -0
  90. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/storage/base.py +0 -0
  91. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/storage/ltm_sqlite_storage.py +0 -0
  92. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/storage/mem0_storage.py +0 -0
  93. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/storage/rag_storage.py +0 -0
  94. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/storage/task_output_storage.py +0 -0
  95. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/storage/utils.py +0 -0
  96. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/task/TEMPLATES/Description.py +0 -0
  97. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/task/__init__.py +0 -0
  98. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/task/formatter.py +0 -0
  99. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/task/log_handler.py +0 -0
  100. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/team/__init__.py +0 -0
  101. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/tool/__init__.py +0 -0
  102. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/tool/cache_handler.py +0 -0
  103. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/tool/composio_tool.py +0 -0
  104. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/tool/composio_tool_vars.py +0 -0
  105. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/tool/decorator.py +0 -0
  106. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/tool/model.py +0 -0
  107. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq/tool/tool_handler.py +0 -0
  108. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq.egg-info/dependency_links.txt +0 -0
  109. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq.egg-info/requires.txt +0 -0
  110. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/src/versionhq.egg-info/top_level.txt +0 -0
  111. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/__init__.py +0 -0
  112. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/agent/__init__.py +0 -0
  113. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/cli/__init__.py +0 -0
  114. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/clients/customer_test.py +0 -0
  115. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/clients/product_test.py +0 -0
  116. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/clients/workflow_test.py +0 -0
  117. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/conftest.py +0 -0
  118. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/formation_test.py +0 -0
  119. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/knowledge/__init__.py +0 -0
  120. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/knowledge/knowledge_test.py +0 -0
  121. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/knowledge/mock_report_compressed.pdf +0 -0
  122. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/llm/__init__.py +0 -0
  123. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/llm/llm_test.py +0 -0
  124. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/memory/__init__.py +0 -0
  125. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/memory/memory_test.py +0 -0
  126. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/network/__init__.py +0 -0
  127. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/network/network_test.py +0 -0
  128. {versionhq-1.1.13.1/tests/team → versionhq-1.2.0.2/tests/task}/__init__.py +0 -0
  129. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/team/Prompts/Demo_test.py +0 -0
  130. {versionhq-1.1.13.1/tests/tool → versionhq-1.2.0.2/tests/team}/__init__.py +0 -0
  131. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/team/team_test.py +0 -0
  132. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/tool/composio_test.py +0 -0
  133. {versionhq-1.1.13.1 → versionhq-1.2.0.2}/tests/tool/tool_test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: versionhq
3
- Version: 1.1.13.1
3
+ Version: 1.2.0.2
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
@@ -86,8 +86,8 @@ Requires-Dist: matplotlib>=3.10.0; extra == "matplotlib"
86
86
  [![DL](https://img.shields.io/badge/Download-15K+-red)](https://clickpy.clickhouse.com/dashboard/versionhq)
87
87
  ![MIT license](https://img.shields.io/badge/License-MIT-green)
88
88
  [![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)
89
- ![PyPI](https://img.shields.io/badge/PyPI-v1.1.12+-blue)
90
- ![python ver](https://img.shields.io/badge/Python-3.11+-purple)
89
+ ![PyPI](https://img.shields.io/badge/PyPI-v1.2.0+-blue)
90
+ ![python ver](https://img.shields.io/badge/Python-3.11/3.12-purple)
91
91
  ![pyenv ver](https://img.shields.io/badge/pyenv-2.5.0-orange)
92
92
 
93
93
 
@@ -266,9 +266,6 @@ By default, agents prioritize JSON over plane text outputs.
266
266
  def dummy_func(message: str, test1: str, test2: list[str]) -> str:
267
267
  return f"""{message}: {test1}, {", ".join(test2)}"""
268
268
 
269
-
270
- agent = vhq.Agent(role="demo", goal="amazing project goal")
271
-
272
269
  task = vhq.Task(
273
270
  description="Amazing task",
274
271
  pydantic_output=CustomOutput,
@@ -276,7 +273,7 @@ By default, agents prioritize JSON over plane text outputs.
276
273
  callback_kwargs=dict(message="Hi! Here is the result: ")
277
274
  )
278
275
 
279
- res = task.execute_sync(agent=agent, context="amazing context to consider.")
276
+ res = task.execute(context="amazing context to consider.")
280
277
  print(res)
281
278
  ```
282
279
 
@@ -377,6 +374,7 @@ Tasks can be delegated to a team manager, peers in the team, or completely new a
377
374
  └── workflows/ # Github actions
378
375
 
379
376
  docs/ # Documentation built by MkDocs
377
+ mkdocs.yml # MkDocs config
380
378
 
381
379
  src/
382
380
  └── versionhq/ # Orchestration framework package
@@ -392,6 +390,8 @@ src/
392
390
  │ └── ...
393
391
 
394
392
  └── uploads/ [.gitignore] # Local directory to store uploaded files such as graphviz diagrams generatd by `Network` class
393
+ |
394
+ pyproject.toml # Project config
395
395
 
396
396
  ```
397
397
 
@@ -3,8 +3,8 @@
3
3
  [![DL](https://img.shields.io/badge/Download-15K+-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.1.12+-blue)
7
- ![python ver](https://img.shields.io/badge/Python-3.11+-purple)
6
+ ![PyPI](https://img.shields.io/badge/PyPI-v1.2.0+-blue)
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
 
10
10
 
@@ -183,9 +183,6 @@ By default, agents prioritize JSON over plane text outputs.
183
183
  def dummy_func(message: str, test1: str, test2: list[str]) -> str:
184
184
  return f"""{message}: {test1}, {", ".join(test2)}"""
185
185
 
186
-
187
- agent = vhq.Agent(role="demo", goal="amazing project goal")
188
-
189
186
  task = vhq.Task(
190
187
  description="Amazing task",
191
188
  pydantic_output=CustomOutput,
@@ -193,7 +190,7 @@ By default, agents prioritize JSON over plane text outputs.
193
190
  callback_kwargs=dict(message="Hi! Here is the result: ")
194
191
  )
195
192
 
196
- res = task.execute_sync(agent=agent, context="amazing context to consider.")
193
+ res = task.execute(context="amazing context to consider.")
197
194
  print(res)
198
195
  ```
199
196
 
@@ -294,6 +291,7 @@ Tasks can be delegated to a team manager, peers in the team, or completely new a
294
291
  └── workflows/ # Github actions
295
292
 
296
293
  docs/ # Documentation built by MkDocs
294
+ mkdocs.yml # MkDocs config
297
295
 
298
296
  src/
299
297
  └── versionhq/ # Orchestration framework package
@@ -309,6 +307,8 @@ src/
309
307
  │ └── ...
310
308
 
311
309
  └── uploads/ [.gitignore] # Local directory to store uploaded files such as graphviz diagrams generatd by `Network` class
310
+ |
311
+ pyproject.toml # Project config
312
312
 
313
313
  ```
314
314
 
@@ -367,7 +367,7 @@ task = Task(
367
367
  description="Answer the following question: What is Kuriko's favorite color?"
368
368
  )
369
369
 
370
- res = task.execute_sync(agent=agent)
370
+ res = task.execute(agent=agent)
371
371
  assert "gold" in res.raw == True
372
372
  ```
373
373
 
@@ -0,0 +1,14 @@
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/>
@@ -0,0 +1,14 @@
1
+ ---
2
+ tags:
3
+ - HTML5
4
+ - JavaScript
5
+ - CSS
6
+ ---
7
+
8
+ # TaskOutput
9
+
10
+ <class>`class` versionhq.tasks.model.<bold>TaskOutput<bold></class>
11
+
12
+ A class to store and manage output from the `Task` object.
13
+
14
+ <hr />
@@ -0,0 +1,282 @@
1
+ ---
2
+ tags:
3
+ - HTML5
4
+ - JavaScript
5
+ - CSS
6
+ ---
7
+
8
+ # Task
9
+
10
+ <class>`class` versionhq.tasks.model.<bold>Task<bold></class>
11
+
12
+ A class to store and manage information for individual tasks, including their assignment to agents or teams, and dependencies via a node-based system that tracks conditions and status.
13
+
14
+ Ref. Node / Edge / TaskGraph class
15
+
16
+ <hr />
17
+
18
+ ## Core usage
19
+
20
+ Create a task by defining its description in one simple sentence. The `description` will be used for task prompting later.
21
+
22
+ Each task will be assigned a unique ID as an identifier.
23
+
24
+ ```python
25
+ import versionhq as vhq
26
+
27
+ task = vhq.Task(description="MY AMAZING TASK")
28
+
29
+ import uuid
30
+ assert uuid.UUID(str(task.id), version=4)
31
+ ```
32
+
33
+
34
+ And you can simply execute the task by calling `.execute()` function.
35
+
36
+ ```python
37
+ import versionhq as vhq
38
+
39
+ task = vhq.Task(description="MY AMAZING TASK")
40
+ res = task.execute()
41
+
42
+ assert isinstance(res, vhq.TaskOutput) # Generates TaskOutput object
43
+ assert res.raw and res.json # By default, TaskOutput object stores output in plane text and json formats.
44
+ assert task.processed_agents is not None # Agents will be automatically assigned to the given task.
45
+ ```
46
+
47
+ <hr />
48
+
49
+ ## Customizing tasks
50
+
51
+ ### Structured outputs
52
+
53
+ By default, agents will generate plane text and JSON outputs, and store them in the `TaskOutput` object.
54
+
55
+ * Ref. <a href="/core/task/task-output">`TaskOutput`</a> class
56
+
57
+ But you can choose to generate Pydantic class or specifig JSON object as response.
58
+
59
+ <hr />
60
+
61
+ **1. Pydantic**
62
+
63
+ `[var]`<bold>`pydantic_output: Optional[Type[BaseModel]] = "None"`</bold>
64
+
65
+ Create and add a `custom Pydantic class` as a structured response format to the `pydantic_output` field.
66
+
67
+ The custom class can accept **one layer of a nested child** as you can see in the following code snippet:
68
+
69
+ ```python
70
+ import versionhq as vhq
71
+ from pydantic import BaseModel
72
+ from typing import Any
73
+
74
+
75
+ # 1. Define Pydantic class using description (optional), annotation and field name.
76
+ class Demo(BaseModel):
77
+ """
78
+ A demo pydantic class to validate the outcome with various nested data types.
79
+ """
80
+ demo_1: int
81
+ demo_2: float
82
+ demo_3: str
83
+ demo_4: bool
84
+ demo_5: list[str]
85
+ demo_6: dict[str, Any]
86
+ demo_nest_1: list[dict[str, Any]] # 1 layer of nested child is ok.
87
+ demo_nest_2: list[list[str]]
88
+ demo_nest_3: dict[str, list[str]]
89
+ demo_nest_4: dict[str, dict[str, Any]]
90
+ # error_1: list[list[dict[str, list[str]]]] # <- Trigger 400 error due to 2+ layers of nested child.
91
+ # error_2: InstanceOf[AnotherPydanticClass] # <- Trigger 400 error due to non-typing annotation.
92
+ # error_3: list[InstanceOf[AnotherPydanticClass]] # <- Same as above
93
+
94
+ # 2. Define a task
95
+ task = vhq.Task(
96
+ description="generate random output that strictly follows the given format",
97
+ pydantic_output=Demo,
98
+ )
99
+
100
+ # 3. Execute
101
+ res = task.execute()
102
+
103
+ assert isinstance(res, vhq.TaskOutput)
104
+ assert res.raw and res.json
105
+ assert isinstance(res.raw, str) and isinstance(res.json_dict, dict)
106
+ assert [
107
+ getattr(res.pydantic, k) and v.annotation == Demo.model_fields[k].annotation
108
+ for k, v in res.pydantic.model_fields.items()
109
+ ]
110
+ ```
111
+
112
+ **2. JSON**
113
+
114
+ `[var]`<bold>`response_fields: List[InstanceOf[ResponseField]] = "None"`</bold>
115
+
116
+ Similar to Pydantic, JSON output structure can be defined by using a list of `ResponseField` objects.
117
+
118
+ The following code snippet demonstrates how to use `ResponseField` to generate output with a maximum of one level of nesting.
119
+
120
+ Custom JSON outputs can accept **one layer of a nested child**.
121
+
122
+ **[NOTES]**
123
+
124
+ - `demo_response_fields` in the following case is identical to the previous Demo class, except that titles are specified for nested fields.
125
+
126
+ - Agents generate JSON output by default, whether or not `response_fields` are used.
127
+
128
+ - However, response_fields are REQUIRED to specify JSON key titles and data types.
129
+
130
+ ```python
131
+ import versionhq as vhq
132
+
133
+ # 1. Define a list of ResponseField objects.
134
+ demo_response_fields = [
135
+ vhq.ResponseField(title="demo_1", data_type=int),
136
+ vhq.ResponseField(title="demo_2", data_type=float),
137
+ vhq.ResponseField(title="demo_3", data_type=str),
138
+ vhq.ResponseField(title="demo_4", data_type=bool),
139
+ vhq.ResponseField(title="demo_5", data_type=list, items=str),
140
+ vhq.ResponseField(title="demo_6", data_type=dict, properties=[vhq.ResponseField(title="demo-item", data_type=str)]),
141
+ vhq.ResponseField(title="demo_nest_1", data_type=list, items=str, properties=([
142
+ vhq.ResponseField(title="nest1", data_type=dict, properties=[vhq.ResponseField(title="nest11", data_type=str)])
143
+ ])), # you can specify field title of nested items
144
+ vhq.ResponseField(title="demo_nest_2", data_type=list, items=list),
145
+ vhq.ResponseField(title="demo_nest_3", data_type=dict, properties=[
146
+ vhq.ResponseField(title="nest1", data_type=list, items=str)
147
+ ]),
148
+ vhq.ResponseField(title="demo_nest_4", data_type=dict, properties=[
149
+ vhq.ResponseField(title="nest1", data_type=dict, properties=[vhq.ResponseField(title="nest12", data_type=str)])
150
+ ])
151
+ ]
152
+
153
+
154
+ # 2. Define a task
155
+ task = vhq.Task(
156
+ description="Output random values strictly following the data type defined in the given response format.",
157
+ response_fields=demo_response_fields
158
+ )
159
+
160
+
161
+ # 3. Execute
162
+ res = task.execute()
163
+
164
+ assert isinstance(res, vhq.TaskOutput) and res.task_id is task.id
165
+ assert res.raw and res.json and res.pydantic is None
166
+ assert [v and type(v) == task.response_fields[i].data_type for i, (k, v) in enumerate(res.json_dict.items())]
167
+ ```
168
+
169
+ * Ref. <a href="/core/task/response-field">`ResponseField`</a> class
170
+
171
+
172
+ **Structuring reponse format**
173
+
174
+ - Higlhy recommends assigning agents optimized for `gemini-x` or `gpt-x` to produce structured outputs with nested items.
175
+
176
+ - To generate response with more than 2 layers of nested items, seperate them into multipe tasks or utilize nodes.
177
+
178
+ The following case demonstrates to returning a `Main` class that contains a nested `Sub` class.
179
+
180
+ **[NOTES]**
181
+
182
+ - Using `callback` functions to format the final response. (You can try other functions suitable for your use case.)
183
+
184
+ - Passing parameter: `sub` to the callback function via the `callback_kwargs` variable.
185
+
186
+ - By default, the outputs of `main_task` are automatically passed to the callback function; you do NOT need to explicitly define them.
187
+
188
+ - Callback results will be stored in the `callback_output` field of the `TaskOutput` class.
189
+
190
+
191
+ ```python
192
+ import versionhq as vhq
193
+ from pydantic import BaseModel
194
+ from typing import Any
195
+
196
+ # 1. Define and execute a sub task with Pydantic output.
197
+ class Sub(BaseModel):
198
+ sub1: list[dict[str, Any]]
199
+ sub2: dict[str, Any]
200
+
201
+ sub_task = vhq.Task(
202
+ description="generate random values that strictly follows the given format.",
203
+ pydantic_output=Sub
204
+ )
205
+ sub_res = sub_task.execute()
206
+
207
+ # 2. Define a main task, callback function to format the final response.
208
+ class Main(BaseModel):
209
+ main1: list[Any] # <= assume expecting to store Sub object in this field.
210
+ # error_main1: list[InstanceOf[Sub]] # as this will trigger 400 error!
211
+ main2: dict[str, Any]
212
+
213
+ def format_response(sub: InstanceOf[Sub], main1: list[Any], main2: dict[str, Any]) -> Main:
214
+ main1.append(sub)
215
+ main = Main(main1=main1, main2=main2)
216
+ return main
217
+
218
+ # 3. Execute
219
+ main_task = vhq.Task(
220
+ description="generate random values that strictly follows the given format.",
221
+ pydantic_output=Main,
222
+ callback=format_response,
223
+ callback_kwargs=dict(sub=Sub(sub1=sub_res.pydantic.sub1, sub2=sub_res.pydantic.sub2)),
224
+ )
225
+ res = main_task.execute(context=sub_res.raw) # [Optional] Adding sub_task's response as context.
226
+
227
+ assert [item for item in res.callback_output.main1 if isinstance(item, Sub)]
228
+ ```
229
+
230
+ To skip these manual setups, refer to Node/Graph pages.
231
+
232
+
233
+ <!-- ### Context
234
+ # task setup
235
+ context: Optional[List["Task"]] = Field(default=None, description="other tasks whose outputs should be used as context")
236
+ prompt_context: Optional[str] = Field(default=None)
237
+
238
+
239
+ ### Execution rules
240
+ EXECUTION type
241
+ allow_delegation: bool = Field(default=False, description="ask other agents for help and run the task instead")
242
+
243
+ callback: Optional[Callable] = Field(default=None, description="callback to be executed after the task is completed.")
244
+ callback_kwargs: Optional[Dict[str, Any]] = Field(default_factory=dict, description="kwargs for the callback when the callback is callable")
245
+
246
+
247
+ ### tools
248
+ tools: Optional[List[ToolSet | Tool | Any]] = Field(default_factory=list, description="tools that the agent can use aside from their tools")
249
+ can_use_agent_tools: bool = Field(default=False, description="whether the agent can use their own tools when executing the task")
250
+ tool_res_as_final: bool = Field(default=False, description="when set True, tools res will be stored in the `TaskOutput`") -->
251
+
252
+
253
+ <hr />
254
+
255
+ ## Executing tasks
256
+
257
+ ### Sync
258
+
259
+ <hr />
260
+
261
+ ### Async
262
+
263
+ <hr />
264
+
265
+ ### Assigning agents
266
+
267
+ <hr />
268
+
269
+ ### Context
270
+
271
+
272
+
273
+ ## Evaluating task outputs
274
+ <!--
275
+ # evaluation
276
+ should_evaluate: bool = Field(default=False, description="True to run the evaluation flow")
277
+ eval_criteria: Optional[List[str]] = Field(default_factory=list, description="criteria to evaluate the outcome. i.e., fit to the brand tone") -->
278
+
279
+
280
+ ## Recording
281
+
282
+ <!-- output: Optional[TaskOutput] = Field(default=None, description="store the final task output in TaskOutput class") -->
@@ -253,7 +253,7 @@ task = Task(
253
253
  tool_res_as_final=True
254
254
  )
255
255
 
256
- res = task.execute_sync(agent=agent)
256
+ res = task.execute(agent=agent)
257
257
  print(res)
258
258
  # demo func
259
259
  ```
@@ -279,7 +279,7 @@ task = Task(
279
279
  tool_res_as_final=True
280
280
  )
281
281
 
282
- res = task.execute_sync(agent=agent)
282
+ res = task.execute(agent=agent)
283
283
  print(res.tool_output)
284
284
  # demo func
285
285
  ```
@@ -301,7 +301,7 @@ task = Task(
301
301
  tool_res_as_final=True
302
302
  )
303
303
 
304
- res = task.execute_sync(agent=agent)
304
+ res = task.execute(agent=agent)
305
305
  print(res.tool_output)
306
306
  # "demo func"
307
307
 
@@ -356,7 +356,7 @@ task = Task(
356
356
  tool_res_as_final=True
357
357
  )
358
358
 
359
- res = task.execute_sync(agent=agent)
359
+ res = task.execute(agent=agent)
360
360
  print(res)
361
361
  # empty func_demo
362
362
  ```
@@ -10,7 +10,7 @@ tags:
10
10
  [![DL](https://img.shields.io/badge/Download-15K+-red)](https://clickpy.clickhouse.com/dashboard/versionhq)
11
11
  ![MIT license](https://img.shields.io/badge/License-MIT-green)
12
12
  [![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)
13
- ![PyPI](https://img.shields.io/badge/PyPI-v1.1.12+-blue)
13
+ ![PyPI](https://img.shields.io/badge/PyPI-v1.2.0+-blue)
14
14
  ![python ver](https://img.shields.io/badge/Python-3.11/3.12-purple)
15
15
  ![pyenv ver](https://img.shields.io/badge/pyenv-2.5.0-orange)
16
16
 
@@ -64,7 +64,7 @@ Agents can execute tasks using `Task` model and return JSON format by default wi
64
64
  callback_kwargs=dict(message="Hi! Here is the result: ")
65
65
  )
66
66
 
67
- res = task.execute_sync(agent=agent, context="amazing context to consider.")
67
+ res = task.execute(agent=agent, context="amazing context to consider.")
68
68
  print(res)
69
69
  ```
70
70
 
@@ -110,14 +110,12 @@ nav:
110
110
  - Quick Start: 'quickstart.md'
111
111
  - Core Components:
112
112
  - Agent: 'core/agent.md'
113
+ - Task:
114
+ - Overview: 'core/task.md'
115
+ - ResponseField: 'core/task/response-field.md'
116
+ - TaskOutput: 'core/task/task-output.md'
113
117
  - Tool: 'core/tool.md'
114
- # - Task: 'core/task.md'
115
118
  # - Compoio Tools: 'core/composio-tool.md'
116
- # - How to Guides:
117
- # - Form agent networks: 'guides/form-agent-network.md'
118
- # - Create custom tools: 'guides/create-custom-tool.md'
119
- # - Customize Agent: 'guides/customize-agent.md'
120
- # - Connect to any LLM: 'guides/connect-to-any-llm.md'
121
119
  - Examples:
122
120
  - Playground: https://versi0n.io
123
121
  - Experiment - Agent Performance: https://github.com/versionHQ/exp-agent-performance
@@ -15,7 +15,7 @@ exclude = ["test*", "__pycache__", "*.egg-info"]
15
15
 
16
16
  [project]
17
17
  name = "versionhq"
18
- version = "1.1.13.1"
18
+ version = "1.2.0.2"
19
19
  authors = [{ name = "Kuriko Iwai", email = "kuriko@versi0n.io" }]
20
20
  description = "An agentic orchestration framework for building agent networks that handle task automation."
21
21
  readme = "README.md"
@@ -17,7 +17,7 @@ from versionhq.knowledge.model import Knowledge, KnowledgeStorage
17
17
  from versionhq.knowledge.source import PDFKnowledgeSource, CSVKnowledgeSource, JSONKnowledgeSource, TextFileKnowledgeSource, ExcelKnowledgeSource, StringKnowledgeSource
18
18
  from versionhq.knowledge.source_docling import DoclingSource
19
19
  from versionhq.network.model import TaskStatus, TaskGraph, Node, Edge, DependencyType
20
- from versionhq.task.model import Task, TaskOutput, ConditionalTask, ResponseField
20
+ from versionhq.task.model import Task, TaskOutput, ResponseField, TaskExecutionType
21
21
  from versionhq.task.evaluate import Evaluation, EvaluationItem
22
22
  from versionhq.team.model import Team, TeamOutput, Formation, Member, TaskHandlingProcess
23
23
  from versionhq.tool.model import Tool, ToolSet
@@ -30,7 +30,7 @@ from versionhq.memory.model import ShortTermMemory,LongTermMemory, UserMemory, M
30
30
  from versionhq.task.formation import form_agent_network
31
31
 
32
32
 
33
- __version__ = "1.1.13.1"
33
+ __version__ = "1.2.0.2"
34
34
  __all__ = [
35
35
  "Agent",
36
36
 
@@ -64,8 +64,8 @@ __all__ = [
64
64
 
65
65
  "Task",
66
66
  "TaskOutput",
67
- "ConditionalTask",
68
67
  "ResponseField",
68
+ "TaskExecutionType",
69
69
 
70
70
  "Evaluation",
71
71
  "EvaluationItem",
@@ -584,4 +584,4 @@ class Agent(BaseModel):
584
584
 
585
585
 
586
586
  def __repr__(self):
587
- return f"Agent(role={self.role}, goal={self.goal}, backstory={self.backstory})"
587
+ return f"Agent(role={self.role}, goal={self.goal}"