versionhq 1.1.13.1__tar.gz → 1.2.0.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.1.13.1 → versionhq-1.2.0.1}/PKG-INFO +6 -4
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/README.md +5 -3
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/docs/core/Agent.md +1 -1
- versionhq-1.2.0.1/docs/core/task/response-field.md +14 -0
- versionhq-1.2.0.1/docs/core/task/task-output.md +14 -0
- versionhq-1.2.0.1/docs/core/task.md +282 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/docs/core/tool.md +4 -4
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/docs/index.md +1 -1
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/docs/quickstart.md +1 -1
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/mkdocs.yml +4 -6
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/pyproject.toml +1 -1
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/__init__.py +3 -3
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/agent/model.py +1 -1
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/network/model.py +148 -42
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/task/evaluate.py +1 -1
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/task/formation.py +1 -1
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/task/model.py +120 -86
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/task/structured_response.py +16 -14
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/team/model.py +11 -10
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/team/team_planner.py +2 -4
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq.egg-info/PKG-INFO +6 -4
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq.egg-info/SOURCES.txt +5 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/agent/agent_test.py +3 -3
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/agent/doc_test.py +13 -13
- versionhq-1.2.0.1/tests/doc_test.py +39 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/network/doc_test.py +2 -4
- versionhq-1.2.0.1/tests/task/doc_test.py +136 -0
- versionhq-1.2.0.1/tests/task/llm_connection_test.py +106 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/task/task_test.py +50 -86
- versionhq-1.2.0.1/tests/tool/__init__.py +0 -0
- {versionhq-1.1.13.1/tests → versionhq-1.2.0.1/tests/tool}/doc_test.py +20 -74
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/usecase_test.py +13 -18
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/uv.lock +1 -1
- versionhq-1.1.13.1/tests/task/__init__.py +0 -59
- versionhq-1.1.13.1/tests/task/llm_connection_test.py +0 -69
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/.github/workflows/deploy_docs.yml +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/.github/workflows/publish.yml +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/.github/workflows/publish_testpypi.yml +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/.github/workflows/run_tests.yml +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/.github/workflows/security_check.yml +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/.gitignore +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/.pre-commit-config.yaml +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/.python-version +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/LICENSE +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/SECURITY.md +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/db/preprocess.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/docs/CNAME +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/docs/_logos/favicon.ico +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/docs/_logos/logo192.png +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/docs/stylesheets/main.css +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/requirements-dev.txt +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/requirements.txt +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/runtime.txt +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/setup.cfg +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/_utils/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/_utils/i18n.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/_utils/logger.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/_utils/process_config.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/_utils/usage_metrics.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/_utils/vars.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/agent/TEMPLATES/Backstory.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/agent/TEMPLATES/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/agent/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/agent/inhouse_agents.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/agent/parser.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/agent/rpm_controller.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/cli/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/clients/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/clients/customer/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/clients/customer/model.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/clients/product/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/clients/product/model.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/clients/workflow/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/clients/workflow/model.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/knowledge/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/knowledge/_utils.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/knowledge/embedding.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/knowledge/model.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/knowledge/source.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/knowledge/source_docling.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/knowledge/storage.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/llm/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/llm/llm_vars.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/llm/model.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/memory/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/memory/contextual_memory.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/memory/model.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/network/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/storage/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/storage/base.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/storage/ltm_sqlite_storage.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/storage/mem0_storage.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/storage/rag_storage.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/storage/task_output_storage.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/storage/utils.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/task/TEMPLATES/Description.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/task/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/task/formatter.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/task/log_handler.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/team/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/tool/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/tool/cache_handler.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/tool/composio_tool.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/tool/composio_tool_vars.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/tool/decorator.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/tool/model.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq/tool/tool_handler.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq.egg-info/dependency_links.txt +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq.egg-info/requires.txt +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/src/versionhq.egg-info/top_level.txt +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/agent/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/cli/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/clients/customer_test.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/clients/product_test.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/clients/workflow_test.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/conftest.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/formation_test.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/knowledge/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/knowledge/knowledge_test.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/knowledge/mock_report_compressed.pdf +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/llm/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/llm/llm_test.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/memory/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/memory/memory_test.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/network/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/network/network_test.py +0 -0
- {versionhq-1.1.13.1/tests/team → versionhq-1.2.0.1/tests/task}/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/team/Prompts/Demo_test.py +0 -0
- {versionhq-1.1.13.1/tests/tool → versionhq-1.2.0.1/tests/team}/__init__.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/team/team_test.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.1}/tests/tool/composio_test.py +0 -0
- {versionhq-1.1.13.1 → versionhq-1.2.0.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.
|
3
|
+
Version: 1.2.0.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
|
@@ -86,7 +86,7 @@ Requires-Dist: matplotlib>=3.10.0; extra == "matplotlib"
|
|
86
86
|
[](https://clickpy.clickhouse.com/dashboard/versionhq)
|
87
87
|

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

|
90
90
|

|
91
91
|

|
92
92
|
|
@@ -268,7 +268,6 @@ By default, agents prioritize JSON over plane text outputs.
|
|
268
268
|
|
269
269
|
|
270
270
|
agent = vhq.Agent(role="demo", goal="amazing project goal")
|
271
|
-
|
272
271
|
task = vhq.Task(
|
273
272
|
description="Amazing task",
|
274
273
|
pydantic_output=CustomOutput,
|
@@ -276,7 +275,7 @@ By default, agents prioritize JSON over plane text outputs.
|
|
276
275
|
callback_kwargs=dict(message="Hi! Here is the result: ")
|
277
276
|
)
|
278
277
|
|
279
|
-
res = task.
|
278
|
+
res = task.execute(agent=agent, context="amazing context to consider.")
|
280
279
|
print(res)
|
281
280
|
```
|
282
281
|
|
@@ -377,6 +376,7 @@ Tasks can be delegated to a team manager, peers in the team, or completely new a
|
|
377
376
|
└── workflows/ # Github actions
|
378
377
|
│
|
379
378
|
docs/ # Documentation built by MkDocs
|
379
|
+
mkdocs.yml # MkDocs config
|
380
380
|
│
|
381
381
|
src/
|
382
382
|
└── versionhq/ # Orchestration framework package
|
@@ -392,6 +392,8 @@ src/
|
|
392
392
|
│ └── ...
|
393
393
|
│
|
394
394
|
└── uploads/ [.gitignore] # Local directory to store uploaded files such as graphviz diagrams generatd by `Network` class
|
395
|
+
|
|
396
|
+
pyproject.toml # Project config
|
395
397
|
|
396
398
|
```
|
397
399
|
|
@@ -3,7 +3,7 @@
|
|
3
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
|
|
@@ -185,7 +185,6 @@ By default, agents prioritize JSON over plane text outputs.
|
|
185
185
|
|
186
186
|
|
187
187
|
agent = vhq.Agent(role="demo", goal="amazing project goal")
|
188
|
-
|
189
188
|
task = vhq.Task(
|
190
189
|
description="Amazing task",
|
191
190
|
pydantic_output=CustomOutput,
|
@@ -193,7 +192,7 @@ By default, agents prioritize JSON over plane text outputs.
|
|
193
192
|
callback_kwargs=dict(message="Hi! Here is the result: ")
|
194
193
|
)
|
195
194
|
|
196
|
-
res = task.
|
195
|
+
res = task.execute(agent=agent, context="amazing context to consider.")
|
197
196
|
print(res)
|
198
197
|
```
|
199
198
|
|
@@ -294,6 +293,7 @@ Tasks can be delegated to a team manager, peers in the team, or completely new a
|
|
294
293
|
└── workflows/ # Github actions
|
295
294
|
│
|
296
295
|
docs/ # Documentation built by MkDocs
|
296
|
+
mkdocs.yml # MkDocs config
|
297
297
|
│
|
298
298
|
src/
|
299
299
|
└── versionhq/ # Orchestration framework package
|
@@ -309,6 +309,8 @@ src/
|
|
309
309
|
│ └── ...
|
310
310
|
│
|
311
311
|
└── uploads/ [.gitignore] # Local directory to store uploaded files such as graphviz diagrams generatd by `Network` class
|
312
|
+
|
|
313
|
+
pyproject.toml # Project config
|
312
314
|
|
313
315
|
```
|
314
316
|
|
@@ -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.
|
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.
|
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.
|
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.
|
359
|
+
res = task.execute(agent=agent)
|
360
360
|
print(res)
|
361
361
|
# empty func_demo
|
362
362
|
```
|
@@ -10,7 +10,7 @@ tags:
|
|
10
10
|
[](https://clickpy.clickhouse.com/dashboard/versionhq)
|
11
11
|

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

|
14
14
|

|
15
15
|

|
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.
|
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.
|
18
|
+
version = "1.2.0.1"
|
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,
|
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.
|
33
|
+
__version__ = "1.2.0.1"
|
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",
|