versionhq 1.2.3.8__tar.gz → 1.2.4.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.
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/PKG-INFO +11 -16
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/README.md +8 -8
- versionhq-1.2.4.2/docs/_logos/favicon.ico +0 -0
- versionhq-1.2.4.2/docs/_logos/logo192.png +0 -0
- versionhq-1.2.4.2/docs/core/agent-network/ref.md +140 -0
- versionhq-1.2.4.2/docs/core/task/reference.md +126 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/task/response-field.md +2 -14
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/task/task-execution.md +57 -20
- versionhq-1.2.4.2/docs/core/task/task-output.md +61 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/index.md +14 -15
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/pyproject.toml +3 -9
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/requirements.txt +0 -5
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/__init__.py +3 -2
- versionhq-1.2.4.2/src/versionhq/_prompt/auto_feedback.py +103 -0
- versionhq-1.2.4.2/src/versionhq/_prompt/constants.py +30 -0
- versionhq-1.2.4.2/src/versionhq/_prompt/model.py +218 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/_utils/__init__.py +1 -0
- versionhq-1.2.4.2/src/versionhq/_utils/is_valid_url.py +15 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/agent/model.py +33 -67
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/agent_network/formation.py +18 -10
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/agent_network/model.py +2 -6
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/knowledge/source_docling.py +3 -19
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/llm/model.py +8 -12
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/task/evaluation.py +1 -1
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/task/model.py +142 -142
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/task/structured_response.py +3 -1
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/task_graph/draft.py +11 -19
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/task_graph/model.py +90 -34
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq.egg-info/PKG-INFO +11 -16
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq.egg-info/SOURCES.txt +8 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq.egg-info/requires.txt +0 -5
- versionhq-1.2.4.2/tests/_prompt/auto_feedback_test.py +34 -0
- versionhq-1.2.4.2/tests/_prompt/prompt_test.py +67 -0
- versionhq-1.2.4.2/tests/_sample/sample.mp3 +0 -0
- versionhq-1.2.4.2/tests/_sample/screenshot.png +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/agent/agent_test.py +9 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/agent_network/agent_network_test.py +0 -31
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/agent_network/doc_test.py +0 -1
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/doc_test.py +1 -1
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/formation_test.py +3 -4
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/task/doc_taskoutput_test.py +6 -4
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/task/doc_test.py +33 -18
- versionhq-1.2.4.2/tests/task/task_test.py +190 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/task_graph/task_graph_test.py +13 -7
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/tool/rag_tool_test.py +1 -1
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/usecase_test.py +25 -1
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/uv.lock +224 -307
- versionhq-1.2.3.8/docs/_logos/favicon.ico +0 -0
- versionhq-1.2.3.8/docs/_logos/logo192.png +0 -0
- versionhq-1.2.3.8/docs/core/agent-network/ref.md +0 -141
- versionhq-1.2.3.8/docs/core/task/reference.md +0 -105
- versionhq-1.2.3.8/docs/core/task/task-output.md +0 -80
- versionhq-1.2.3.8/tests/task/task_test.py +0 -265
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/.env.sample +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/.github/workflows/deploy_docs.yml +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/.github/workflows/publish.yml +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/.github/workflows/publish_testpypi.yml +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/.github/workflows/run_tests.yml +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/.github/workflows/security_check.yml +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/.gitignore +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/.pre-commit-config.yaml +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/.python-version +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/LICENSE +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/SECURITY.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/db/preprocess.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/CNAME +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/agent/config.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/agent/index.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/agent/task-handling.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/agent-network/config.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/agent-network/form.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/agent-network/index.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/knowledge.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/llm/index.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/memory.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/rag-tool.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/task/evaluation.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/task/index.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/task/task-strc-response.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/task-graph/index.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/core/tool.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/quickstart.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/stylesheets/main.css +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/docs/tags.md +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/mkdocs.yml +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/requirements-dev.txt +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/runtime.txt +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/setup.cfg +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/_utils/i18n.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/_utils/llm_as_a_judge.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/_utils/logger.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/_utils/process_config.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/_utils/usage_metrics.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/_utils/vars.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/agent/TEMPLATES/Backstory.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/agent/TEMPLATES/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/agent/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/agent/inhouse_agents.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/agent/parser.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/agent/rpm_controller.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/agent_network/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/cli/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/clients/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/clients/customer/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/clients/customer/model.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/clients/product/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/clients/product/model.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/clients/workflow/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/clients/workflow/model.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/knowledge/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/knowledge/_utils.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/knowledge/embedding.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/knowledge/model.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/knowledge/source.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/knowledge/storage.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/llm/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/llm/llm_vars.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/memory/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/memory/contextual_memory.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/memory/model.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/storage/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/storage/base.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/storage/ltm_sqlite_storage.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/storage/mem0_storage.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/storage/rag_storage.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/storage/task_output_storage.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/storage/utils.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/task/TEMPLATES/Description.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/task/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/task/formatter.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/task_graph/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/task_graph/colors.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/tool/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/tool/cache_handler.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/tool/composio_tool.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/tool/composio_tool_vars.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/tool/decorator.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/tool/model.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/tool/rag_tool.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq/tool/tool_handler.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq.egg-info/dependency_links.txt +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/src/versionhq.egg-info/top_level.txt +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/_sample/sample.csv +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/_sample/sample.json +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/agent/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/agent/doc_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/agent_network/Prompts/Demo_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/agent_network/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/cli/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/clients/customer_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/clients/product_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/clients/workflow_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/conftest.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/knowledge/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/knowledge/knowledge_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/knowledge/mock_report_compressed.pdf +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/llm/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/llm/llm_connection_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/llm/llm_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/memory/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/memory/memory_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/task/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/task/doc_eval_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/task/eval_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/task_graph/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/task_graph/doc_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/tool/__init__.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/tool/composio_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/tool/doc_test.py +0 -0
- {versionhq-1.2.3.8 → versionhq-1.2.4.2}/tests/tool/tool_test.py +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: versionhq
|
3
|
-
Version: 1.2.
|
4
|
-
Summary:
|
3
|
+
Version: 1.2.4.2
|
4
|
+
Summary: Autonomous agent networks for task automation with multi-step reasoning.
|
5
5
|
Author-email: Kuriko Iwai <kuriko@versi0n.io>
|
6
6
|
License: MIT License
|
7
7
|
|
@@ -29,7 +29,7 @@ Project-URL: Homepage, https://versi0n.io
|
|
29
29
|
Project-URL: Documentation, https://docs.versi0n.io
|
30
30
|
Project-URL: Repository, https://github.com/versionHQ/multi-agent-system
|
31
31
|
Project-URL: Issues, https://github.com/versionHQ/multi-agent-system/issues
|
32
|
-
Keywords:
|
32
|
+
Keywords: autonomic agent networks,deep agent,agentic orchestration framework
|
33
33
|
Classifier: Programming Language :: Python
|
34
34
|
Classifier: Programming Language :: Python :: 3
|
35
35
|
Classifier: Programming Language :: Python :: 3.11
|
@@ -47,12 +47,9 @@ License-File: LICENSE
|
|
47
47
|
Requires-Dist: regex==2024.11.6
|
48
48
|
Requires-Dist: requests>=2.32.3
|
49
49
|
Requires-Dist: pydantic>=2.10.6
|
50
|
-
Requires-Dist: werkzeug>=3.1.3
|
51
50
|
Requires-Dist: typing>=0.0.0
|
52
51
|
Requires-Dist: json-repair>=0.0.0
|
53
52
|
Requires-Dist: litellm>=1.55.8
|
54
|
-
Requires-Dist: openai>=1.64.0
|
55
|
-
Requires-Dist: composio-openai>=0.6.9
|
56
53
|
Requires-Dist: composio>=0.1.0
|
57
54
|
Requires-Dist: setuptools>=75.6.0
|
58
55
|
Requires-Dist: wheel>=0.45.1
|
@@ -60,10 +57,8 @@ Requires-Dist: python-dotenv>=1.0.0
|
|
60
57
|
Requires-Dist: appdirs>=1.4.4
|
61
58
|
Requires-Dist: langchain>=0.3.14
|
62
59
|
Requires-Dist: langchain-openai>=0.2.14
|
63
|
-
Requires-Dist: composio-langchain>=0.6.12
|
64
60
|
Requires-Dist: chromadb>=0.6.3
|
65
61
|
Requires-Dist: wheel>=0.45.1
|
66
|
-
Requires-Dist: envoy>=0.0.3
|
67
62
|
Requires-Dist: composio-core==0.7.0
|
68
63
|
Requires-Dist: networkx>=3.4.2
|
69
64
|
Requires-Dist: matplotlib>=3.10.0
|
@@ -88,15 +83,15 @@ Requires-Dist: torchvision>=0.21.0; extra == "torch"
|
|
88
83
|
|
89
84
|
# Overview
|
90
85
|
|
91
|
-
[](https://clickpy.clickhouse.com/dashboard/versionhq)
|
92
87
|

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

|
95
90
|

|
96
91
|

|
97
92
|
|
98
93
|
|
99
|
-
|
94
|
+
A Python framework for autonomous agent networks that handle task automation with multi-step reasoning.
|
100
95
|
|
101
96
|
**Visit:**
|
102
97
|
|
@@ -154,11 +149,11 @@ Agents adapt their formation based on task complexity.
|
|
154
149
|
You can specify a desired formation or allow the agents to determine it autonomously (default).
|
155
150
|
|
156
151
|
|
157
|
-
|
|
158
|
-
| :---
|
159
|
-
| **Formation**
|
160
|
-
| **Usage**
|
161
|
-
| **Use case**
|
152
|
+
| | **Solo Agent** | **Supervising** | **Squad** | **Random** |
|
153
|
+
| :--- | :--- | :--- | :--- | :--- |
|
154
|
+
| **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"> |
|
155
|
+
| **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> |
|
156
|
+
| **Use case** | An email agent drafts promo message for the given audience. | The leader agent strategizes an outbound campaign plan and assigns components such as media mix or message creation to subordinate agents. | An email agent and social media agent share the product knowledge and deploy multi-channel outbound campaign. | 1. An email agent drafts promo message for the given audience, asking insights on tones from other email agents which oversee other clusters. 2. An agent calls the external agent to deploy the campaign. |
|
162
157
|
|
163
158
|
<hr />
|
164
159
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# Overview
|
2
2
|
|
3
|
-
[](https://clickpy.clickhouse.com/dashboard/versionhq)
|
4
4
|

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

|
7
7
|

|
8
8
|

|
9
9
|
|
10
10
|
|
11
|
-
|
11
|
+
A Python framework for autonomous agent networks that handle task automation with multi-step reasoning.
|
12
12
|
|
13
13
|
**Visit:**
|
14
14
|
|
@@ -66,11 +66,11 @@ Agents adapt their formation based on task complexity.
|
|
66
66
|
You can specify a desired formation or allow the agents to determine it autonomously (default).
|
67
67
|
|
68
68
|
|
69
|
-
|
|
70
|
-
| :---
|
71
|
-
| **Formation**
|
72
|
-
| **Usage**
|
73
|
-
| **Use case**
|
69
|
+
| | **Solo Agent** | **Supervising** | **Squad** | **Random** |
|
70
|
+
| :--- | :--- | :--- | :--- | :--- |
|
71
|
+
| **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"> |
|
72
|
+
| **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> |
|
73
|
+
| **Use case** | An email agent drafts promo message for the given audience. | The leader agent strategizes an outbound campaign plan and assigns components such as media mix or message creation to subordinate agents. | An email agent and social media agent share the product knowledge and deploy multi-channel outbound campaign. | 1. An email agent drafts promo message for the given audience, asking insights on tones from other email agents which oversee other clusters. 2. An agent calls the external agent to deploy the campaign. |
|
74
74
|
|
75
75
|
<hr />
|
76
76
|
|
Binary file
|
Binary file
|
@@ -0,0 +1,140 @@
|
|
1
|
+
---
|
2
|
+
tags:
|
3
|
+
- Agent Network
|
4
|
+
---
|
5
|
+
|
6
|
+
|
7
|
+
## Class `AgentNetwork`
|
8
|
+
|
9
|
+
### Variable
|
10
|
+
|
11
|
+
| <div style="width:200px">**Variable**</div> | **Data Type** | **Default** | **Description** |
|
12
|
+
| :--- | :--- | :--- | :--- |
|
13
|
+
| **`id`** | UUID4 | uuid.uuid4() | Stores auto-generated ID as identifier. Not editable. |
|
14
|
+
| **`name`** | str | None | Stores a name of the network. |
|
15
|
+
| **`members`** | List[`Member`] | list() | Stores a list of `Member` objects. |
|
16
|
+
| **`formation`** | `Formation` | None | Stores `Formation` enum. |
|
17
|
+
| **`should_reform`** | bool | False | Whether to reform the network during the activation. |
|
18
|
+
| **`network_tasks`** | List[`Task`] | list() | A list of `Task` objects unassigned to any network members. |
|
19
|
+
| **`prompt_file`** | str | None | Absolute file path to the prompt file w/ JSON formatted prompt. |
|
20
|
+
| **`process`** | `TaskHandlingProcess` | TaskHandlingProcess.SEQUENTIAL | Enum of the task handling process. |
|
21
|
+
| **`consent_trigger`** | Callable[..., Any] | None | A trigger event (func) for consentual processing. |
|
22
|
+
| **`pre_launch_callbacks`** | List[Callable[..., Any]] | list() | Stores callbacks to run before the network launch. |
|
23
|
+
| **`post_launch_callbacks`** | List[Callable[..., Any]] | list() | Stores callbacks to run after the network launch. |
|
24
|
+
| **`step_callbacks`** | Callable[..., Any] | None | Stores callbacks to run at every step of each member agent takes during the activation. |
|
25
|
+
| **`cache`** | bool | True | Whether to store cache. |
|
26
|
+
| **`execution_logs`** | List[Dict[str, Any]] | list() | Stores a list of execution logs of all the tasks in the network. |
|
27
|
+
|
28
|
+
|
29
|
+
### Class Methods
|
30
|
+
|
31
|
+
| <div style="width:200px">**Method**</div> | **Params** | **Returns** | **Description** |
|
32
|
+
| :--- | :--- | :--- | :--- |
|
33
|
+
| **`launch`** | kwargs_pre: Optional[Dict[str, str]] = None <br> kwargs_post: Optional[Dict[str, Any]] = None <br> start_index: int = None | Tuple[TaskOutput, TaskGraph]: | Core method to launch the network and execute tasks |
|
34
|
+
|
35
|
+
|
36
|
+
### Properties
|
37
|
+
|
38
|
+
| <div style="width:200px">**Property**</div> | **Returns** | **Description** |
|
39
|
+
| :--- | :--- | :--- |
|
40
|
+
| **`key`** | str | Unique identifier. |
|
41
|
+
| **`managers`** | List[InstanceOf[`Member`]] | A list of manager members. |
|
42
|
+
| **`manager_tasks`** | List[InstanceOf[`Task`]] | A list of tasks handled by managers. |
|
43
|
+
| **`tasks`** | List[InstanceOf[`Task`]] | All the tasks in the network. |
|
44
|
+
| **`unassigned_member_tasks`** | List[InstanceOf[`Task`]] | Unassigned member-level tasks. |
|
45
|
+
|
46
|
+
|
47
|
+
<hr>
|
48
|
+
|
49
|
+
## Class `Member`
|
50
|
+
|
51
|
+
### Variable
|
52
|
+
|
53
|
+
| <div style="width:200px">**Variable**</div> | **Data Type** | **Default** | **Description** |
|
54
|
+
| :--- | :--- | :--- | :--- |
|
55
|
+
| **`agent`** | InstanceOf[`Agent`] | None | Agent as a member |
|
56
|
+
| **`is_manager`** | bool | False | Whether the member is a manager. |
|
57
|
+
| **`can_share_knowledge`** | bool | True | Whether the member can share its knowledge among the other network members. |
|
58
|
+
| **`can_share_memory`** | bool | True | Whether the member can share its memories among the other network members. |
|
59
|
+
| **`tasks`** | List[InstanceOf[`Task`]] | list() | Assinged tasks. |
|
60
|
+
|
61
|
+
|
62
|
+
### Properties
|
63
|
+
|
64
|
+
| <div style="width:200px">**Property**</div> | **Returns** | **Description** |
|
65
|
+
| :--- | :--- | :--- |
|
66
|
+
| **`is_idling`** | bool | Whether it has unprocessed assgined task/s |
|
67
|
+
|
68
|
+
<hr>
|
69
|
+
|
70
|
+
## Class `Agent`
|
71
|
+
|
72
|
+
### Variables
|
73
|
+
|
74
|
+
| <div style="width:200px">**Variable**</div> | **Data Type** | **Default** | **Description** |
|
75
|
+
| :--- | :--- | :--- | :--- |
|
76
|
+
| **`id`** | UUID4 | uuid.uuid4() | Stores auto-generated ID as identifier. Not editable. |
|
77
|
+
| **`role`** | str | None | Stores a role of the agent. |
|
78
|
+
| **`goal`** | str | None | Stores a goal of the agent. |
|
79
|
+
| **`backstory`** | str | None | Stores backstory of the agent. Utilized as system prompt. |
|
80
|
+
| **`self_learn`** | bool | False | Whether to self-learn|
|
81
|
+
| **`tools`** | List[InstanceOf[`ToolSet`] \| Type[`Tool`]] | None | Stores tools to be used when executing a task. |
|
82
|
+
| **`knowledge_sources`** | List[`BaseKnowledgeSource` \| Any] | None | Stores knowledge sources in text, file path, or url. |
|
83
|
+
| **`embedder_config`** | Dict[str, Any] | None | Stores embedding configuration for storing knowledge sources. |
|
84
|
+
| **`with_memory`** | bool | False | Whether to store tasks and results in memory. |
|
85
|
+
| **`memory_config`** | Dict[str, Any] | None | Stores configuration of the memory. |
|
86
|
+
| **`short_term_memory`** | InstanceOf[`ShortTermMemory`] | None | Stores `ShortTermMemory` object. |
|
87
|
+
| **`long_term_memory`** | InstanceOf[`LongTermMemory`] | None | Stores `LongTermMemory` object. |
|
88
|
+
| **`user_memory`** | InstanceOf[`UserMemory`] | None | Stores `UserMemory` object. |
|
89
|
+
| **`use_developer_prompt`** | bool | True | Whether to use the system (developer) prompt when calling the model. |
|
90
|
+
| **`developer_promt_template`** | str | None | File path to the prompt template. |
|
91
|
+
| **`user_promt_template`** | str | None | File path to the prompt template. |
|
92
|
+
| **`networks`** | List[Any] | list() | Stores a list of agent networks that the agent belongs to. |
|
93
|
+
| **`allow_delegation`** | bool | False | Whether the agent can delegate assinged tasks to another agent. |
|
94
|
+
| **`max_retry_limit`** | int | 2 | Maximum number of retries when the task execution failed. |
|
95
|
+
| **`maxit`** | int | 25 | Maximum number of total optimization loops during error handling. |
|
96
|
+
| **`callbacks`** | List[Callabale] | None | Stores a list of step callback functions. |
|
97
|
+
| **`llm`** | str \| InstanceOf[`LLM`] \| Dict[str, Any] | None | Stores the main LLM. |
|
98
|
+
| **`func_calling_llm`** | str \| InstanceOf[`LLM`] \| Dict[str, Any] | None | Stores the function calling LLM. |
|
99
|
+
| **`respect_context_window`** | bool | True | Whether to follow the main model's maximum context window size. |
|
100
|
+
| **`max_execution_time`** | int | None | Stores maximum execution time in seconds. |
|
101
|
+
| **`max_rpm`** | int | None | Stores maximum number of requests per minute. |
|
102
|
+
| **`llm_config`** | Dict[str, Any] | None | Stores configuration of `LLM` object. |
|
103
|
+
| **`config`** | Dict[str, Any] | None | Stores model config. |
|
104
|
+
|
105
|
+
|
106
|
+
### Class Methods
|
107
|
+
|
108
|
+
| <div style="width:200px">**Method**</div> | **Params** | **Returns** | **Description** |
|
109
|
+
| :--- | :--- | :--- | :--- |
|
110
|
+
| **`update`** | **kwargs: Any | Self | Updates agents with given kwargs. Invalid keys will be ignored. |
|
111
|
+
| **`start`** | context: Any = None <br> tool_res_as_final: bool = False | `TaskOutput` \| None | Starts to operate the agent. |
|
112
|
+
| **`execute_task`** | task: [Task] <br> context: Any = None <br> task_tools: Optional[List[Tool \| ToolSet]] = list() | str | Returns response from the model in plane text format. |
|
113
|
+
|
114
|
+
|
115
|
+
### Properties
|
116
|
+
|
117
|
+
| <div style="width:200px">**Property**</div> | **Returns** | **Description** |
|
118
|
+
| :--- | :--- | :--- |
|
119
|
+
| **`key`** | str | Unique identifier of the agent using its ID and sanitized role. |
|
120
|
+
|
121
|
+
|
122
|
+
## ENUM `Formation`
|
123
|
+
|
124
|
+
```python
|
125
|
+
class Formation(str, Enum):
|
126
|
+
SOLO = 1
|
127
|
+
SUPERVISING = 2
|
128
|
+
SQUAD = 3
|
129
|
+
RANDOM = 4
|
130
|
+
HYBRID = 10
|
131
|
+
```
|
132
|
+
|
133
|
+
## ENUM `TaskHandlingProcess`
|
134
|
+
|
135
|
+
```python
|
136
|
+
class TaskHandlingProcess(str, Enum):
|
137
|
+
HIERARCHY = 1
|
138
|
+
SEQUENTIAL = 2
|
139
|
+
CONSENSUAL = 3
|
140
|
+
```
|
@@ -0,0 +1,126 @@
|
|
1
|
+
## Class `Task`
|
2
|
+
|
3
|
+
### Variables
|
4
|
+
|
5
|
+
| <div style="width:160px">**Variable**</div> | **Data Type** | **Default** | **Description** |
|
6
|
+
| :--- | :--- | :--- | :--- |
|
7
|
+
| **`id`** | UUID | uuid.uuid4() | Stores task `id` as an identifier. |
|
8
|
+
| **`name`** | Optional[str] | None | Stores a task name (Inherited as `node` identifier if the task is dependent) |
|
9
|
+
| **`description`** | str | None | Required field to store a concise task description |
|
10
|
+
| **`pydantic_output`** | Optional[Type[BaseModel]] | None | Stores pydantic custom output class for structured response |
|
11
|
+
| **`response_fields`** | Optional[List[ResponseField]] | list() | Stores JSON formats for stuructured response |
|
12
|
+
| **`tools`** | Optional[List[BaseTool \| ToolSet]] | None | Stores tools to be called when the agent executes the task. |
|
13
|
+
| **`can_use_agent_tools`** | bool | True | Whether to use the agent tools |
|
14
|
+
| **`tool_res_as_final`** | bool | False | Whether to make a tool output as a final response from the agent |
|
15
|
+
| **`image`** | Optional[str] | None | Stores an absolute file path or URL to the image file in string |
|
16
|
+
| **`file`** | Optional[str] | None | Stores an absolute file path or URL to the file in string |
|
17
|
+
| **`audio`** | Optional[str] | None | Stores an absolute file path or URL to the audio file in string |
|
18
|
+
| **`should_test_run`** | bool | False | Whether to turn on auto-feedback learning |
|
19
|
+
| **`human`** | bool | False | Whether to ask human input during the task execution |
|
20
|
+
| **`execution_type`** | TaskExecutionType | TaskExecutionType.SYNC | Sync or async execution |
|
21
|
+
| **`allow_delegation`** | bool | False | Whether to allow the agent to delegate the task to another agent |
|
22
|
+
| **`callback`** | Optional[Callable] | None | Callback function to be executed after LLM calling |
|
23
|
+
| **`callback_kwargs`** | Optional[Dict[str, Any]] | dict() | Args for the callback function (if any)|
|
24
|
+
| **`should_evaluate`** | bool | False | Whether to evaluate the task output using eval criteria |
|
25
|
+
| **`eval_criteria`** | Optional[List[str]] | list() | Evaluation criteria given by the human client |
|
26
|
+
| **`fsls`** | Optional[List[str]] | None | Examples of competitive and/or weak responses |
|
27
|
+
| **`processed_agents`** | Set[str] | set() | Stores keys of agents that executed the task |
|
28
|
+
| **`output`** | Optional[TaskOutput] | None | Stores `TaskOutput` object after the execution |
|
29
|
+
|
30
|
+
|
31
|
+
### Class Methods
|
32
|
+
|
33
|
+
| <div style="width:160px">**Method**</div> | <div style="width:300px">**Params**</div> | **Returns** | **Description** |
|
34
|
+
| :--- | :--- | :--- | :--- |
|
35
|
+
| **`execute`** | <p>type: TaskExecutionType = None<br>agent: Optional["vhq.Agent"] = None<br>context: Optional[Any] = None</p> | InstanceOf[`TaskOutput`] or None (error) | A main method to handle task execution. Auto-build an agent when the agent is not given. |
|
36
|
+
|
37
|
+
|
38
|
+
### Properties
|
39
|
+
|
40
|
+
| <div style="width:160px">**Property**</div> | **Data_Type** | **Description** |
|
41
|
+
| :--- | :--- | :--- |
|
42
|
+
| **`key`** | str | Returns task key based on its description and output format. |
|
43
|
+
| **`summary`** | str | Returns a summary of the task based on its id, description and tools. |
|
44
|
+
|
45
|
+
<hr>
|
46
|
+
|
47
|
+
## Class `ResponseField`
|
48
|
+
|
49
|
+
### Variables
|
50
|
+
|
51
|
+
| <div style="width:160px">**Variable**</div> | **Data Type** | **Default** | **Description** |
|
52
|
+
| :--- | :--- | :--- | :--- |
|
53
|
+
| **`title`** | str | None | Stores a field title. |
|
54
|
+
| **`data_type`** | Type | None | Stores data type of the response. |
|
55
|
+
| **`items`** | Type | None | Stores data type of items in the list. `None` when `data_type` is not list. |
|
56
|
+
| **`properties`** | List[`ResponseField`] | None | Stores properties in a list of `ResponseFormat` objects when the `data_type` is dict. |
|
57
|
+
| **`nullable`** | bool | False | If the field is nullable. |
|
58
|
+
| **`config`** | Dict[str, Any] | None | Stores other configs passed to response schema. |
|
59
|
+
|
60
|
+
|
61
|
+
<hr>
|
62
|
+
|
63
|
+
## Class `TaskOutput`
|
64
|
+
|
65
|
+
### Variables
|
66
|
+
|
67
|
+
| <div style="width:160px">**Variable**</div> | **Data Type** | **Default** | **Description** |
|
68
|
+
| :--- | :--- | :--- | :--- |
|
69
|
+
| **`task_id`** | UUID | uuid.uuid4() | Stores task `id` as an identifier. |
|
70
|
+
| **`raw`** | str | None | Stores response in plane text format. `None` or `""` when the model returned errors.|
|
71
|
+
| **`json_dict`** | Dict[str, Any] | None | Stores response in JSON serializable dictionary. When the system failed formatting or executing tasks without response_fields, `{ output: <res.raw> }` will be returned. |
|
72
|
+
| **`pydantic`** | Type[`BaseModel`] | None | Populates and stores Pydantic class object defined in the `pydantic_output` field if given. |
|
73
|
+
| **`tool_output`** | Optional[Any] | None | Stores results from the tools of the task or agents ONLY when `tool_res_as_final` set as `True`. |
|
74
|
+
| **`callback_output`** | Optional[Any] | None | Stores results from callback functions if any. |
|
75
|
+
| **`latency`** | Optional[float] | None | Stores job latency in milseconds. |
|
76
|
+
| **`evaluation`** | Optional[InstanceOf[`Evaluation`]] | None | Stores overall evaluations and usage of the task output. |
|
77
|
+
|
78
|
+
|
79
|
+
### Class Methods
|
80
|
+
|
81
|
+
| <div style="width:160px">**Method**</div> | **Params** | **Returns** | **Description** |
|
82
|
+
| :--- | :--- | :--- | :--- |
|
83
|
+
| **`evaluate`** | task: InstanceOf[`Task`] | InstanceOf[`Evaluation`] | Evaluates task output based on the criteria |
|
84
|
+
|
85
|
+
|
86
|
+
### Properties
|
87
|
+
|
88
|
+
| <div style="width:160px">**Property**</div> | **Data_Type** | **Description** |
|
89
|
+
| :--- | :--- | :--- |
|
90
|
+
| **`final`** | Any | Returns the final output of the task |
|
91
|
+
| **`aggregate_score`** | float | Calucurates weighted average eval scores of the task output. |
|
92
|
+
| **`json_string`** | str | Returns `json_dict` in string format. |
|
93
|
+
|
94
|
+
|
95
|
+
<hr>
|
96
|
+
|
97
|
+
## Class `Evaluation`
|
98
|
+
|
99
|
+
### Variables
|
100
|
+
|
101
|
+
| <div style="width:160px">**Variable**</div> | **Data Type** | **Default** | **Description** |
|
102
|
+
| :--- | :--- | :--- | :--- |
|
103
|
+
| **`items`** | List[InstanceOf[EvaluationItem]] | list() | Stores evaluation items. |
|
104
|
+
| **`eval_by`** | Optional[InstanceOf[Agent]] | None | Stores an agent assigned to evaluate the output. |
|
105
|
+
|
106
|
+
|
107
|
+
### Properties
|
108
|
+
|
109
|
+
| <div style="width:160px">**Property**</div> | **Data_Type** | **Description** |
|
110
|
+
| :--- | :--- | :--- |
|
111
|
+
| **`aggregate_score`** | float | Calucurates weighted average eval scores of the task output. |
|
112
|
+
| **`suggestion_summary`** | str | Returns summary of the suggestions. |
|
113
|
+
|
114
|
+
|
115
|
+
<hr>
|
116
|
+
|
117
|
+
## Sub-class `EvaluationItem`
|
118
|
+
|
119
|
+
### Variables
|
120
|
+
|
121
|
+
| <div style="width:160px">**Variable**</div> | **Data Type** | **Default** | **Description** |
|
122
|
+
| :--- | :--- | :--- | :--- |
|
123
|
+
| **`criteria`** | str | None | Stores evaluation criteria given by the client. |
|
124
|
+
| **`suggestion`** | str | None | Stores suggestion on improvement from the evaluator agent. |
|
125
|
+
| **`score`** | float | None | Stores the score on a 0 to 1 scale. |
|
126
|
+
| **`weight`** | int | None | Stores the weight (importance of the criteria) at any scale. |
|
@@ -4,20 +4,6 @@
|
|
4
4
|
|
5
5
|
A Pydantic class to store response formats to generate a structured response in JSON.
|
6
6
|
|
7
|
-
<hr/>
|
8
|
-
|
9
|
-
## Variables
|
10
|
-
|
11
|
-
| <div style="width:120px">**Variable**</div> | **Data Type** | **Default** | **Nullable** | **Description** |
|
12
|
-
| :--- | :--- | :--- | :--- | :--- |
|
13
|
-
| **`title`** | str | None | False | Stores a field title. |
|
14
|
-
| **`data_type`** | Type | None | False | Stores data type of the response. |
|
15
|
-
| **`items`** | Type | None | True | Stores data type of items in the list. Can leave it None when `data_type` is not list. |
|
16
|
-
| **`properties`** | List[`ResponseField`] | None | True | Stores properties as a list of `ResponseFormat` objects when the `data_type` is dict. |
|
17
|
-
| **`nullable`** | bool | False | False | If the field is nullable. |
|
18
|
-
| **`config`** | Dict[str, Any] | None | True | Stores other configs passed to response schema. |
|
19
|
-
|
20
|
-
|
21
7
|
**Quick Start**
|
22
8
|
|
23
9
|
Define a response format with field titles and data types.
|
@@ -210,3 +196,5 @@ response_field = vhq.ResponseField(
|
|
210
196
|
# Agent output:
|
211
197
|
# summary-with-config: <AGENT_RESPONSE_IN_STRING>
|
212
198
|
```
|
199
|
+
|
200
|
+
Ref. <a href="/core/task/reference/#responsefield">List of variables</a>
|
@@ -3,39 +3,51 @@
|
|
3
3
|
|
4
4
|
## Prompt Engineering
|
5
5
|
|
6
|
-
|
6
|
+
Prompt messages are generated automatically based on the task `description`, response format, context, agent `role`, and `goal`.
|
7
7
|
|
8
8
|
|
9
9
|
**Context**
|
10
10
|
|
11
|
-
The following snippet demonstrates
|
11
|
+
The following snippet demonstrates adding `context` from tools and sub tasks as well as `multi-modal content` to the prompt.
|
12
12
|
|
13
13
|
```python
|
14
14
|
import versionhq as vhq
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
agent = vhq.Agent(llm="gemini-2.0", role="Content Interpretator", tools=[rag_tool])
|
17
|
+
task = vhq.Task(description="dummy task", image="image file path")
|
18
|
+
sub_task = vhq.Task(description="sub task")
|
19
|
+
rag_tool = vhq.RagTool(url="https://github.com/chroma-core/chroma/issues/3233", query="What is the next action plan?")
|
18
20
|
|
19
|
-
sub_task_2 = vhq.Task(description="Run a sub demo part 2")
|
20
21
|
|
21
|
-
|
22
|
+
# Explicitly mentioned for explanation purpose. By default, `task.execute()` will trigger this formula.
|
23
|
+
from versionhq._prompt.model import Prompt
|
24
|
+
_, _, messages = Prompt(task=main_task, agent=agent, context=["context 1", "context 2", sub_task]).format_core()
|
22
25
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
task_prompt = task._prompt(context=context)
|
28
|
-
|
29
|
-
assert sub_res.to_context_prompt() in task_prompt
|
30
|
-
assert sub_task_2.output and sub_task_2.output.to_context_prompt() in task_prompt # sub tasks' outputs are included in the task prompt.
|
31
|
-
assert "context to add in string" in task_promp
|
32
|
-
assert res
|
26
|
+
assert messages[0]["role"] == "user"
|
27
|
+
assert isinstance(messages[0]["content"], list) # adding context and image, file, audio data to the prompt
|
28
|
+
assert messages[1]["role"] == "developer" # adding developer prompt
|
29
|
+
assert messages[1]["content"] == agent.backstory
|
33
30
|
```
|
34
31
|
|
35
32
|
Context can consist of `Task` objects, `TaskOutput` objects, plain text `strings`, or `lists` containing any of these.
|
36
33
|
|
37
34
|
In this scenario, `sub_task_2` executes before the main task. Its string output is then incorporated into the main task's context prompt on top of other context before the main task is executed.
|
38
35
|
|
36
|
+
|
37
|
+
**Auto Feedback Learning**
|
38
|
+
|
39
|
+
To automatically improve prompts, trigger `test_run` of the task.
|
40
|
+
|
41
|
+
```python
|
42
|
+
import versionhq as vhq
|
43
|
+
|
44
|
+
task = vhq.Task(description="Create a short story.", should_test_run=True, human=True)
|
45
|
+
res = task.execute()
|
46
|
+
|
47
|
+
assert isinstance(res, vhq.TaskOutput)
|
48
|
+
```
|
49
|
+
|
50
|
+
|
39
51
|
<hr>
|
40
52
|
|
41
53
|
## Delegation
|
@@ -55,7 +67,7 @@ task.execute()
|
|
55
67
|
|
56
68
|
assert task.output is not None
|
57
69
|
assert task.processed_agents is not None # auto assigned
|
58
|
-
assert task.
|
70
|
+
assert task._delegations ==1
|
59
71
|
```
|
60
72
|
|
61
73
|
<hr>
|
@@ -75,7 +87,7 @@ task = vhq.Task(
|
|
75
87
|
)
|
76
88
|
|
77
89
|
from unittest.mock import patch
|
78
|
-
with patch.object(vhq.Agent, "execute_task", return_value="test") as execute:
|
90
|
+
with patch.object(vhq.Agent, "execute_task", return_value=("user prompt", "dev prompt", "test")) as execute:
|
79
91
|
res = task.execute()
|
80
92
|
assert res.raw == "test"
|
81
93
|
execute.assert_called_once_with(task=task, context=None, task_tools=list())
|
@@ -83,7 +95,7 @@ with patch.object(vhq.Agent, "execute_task", return_value="test") as execute:
|
|
83
95
|
|
84
96
|
<hr>
|
85
97
|
|
86
|
-
##
|
98
|
+
## Tools
|
87
99
|
|
88
100
|
`[var]`<bold>`tools: Optional[List[ToolSet | Tool | Any]] = None`</bold>
|
89
101
|
|
@@ -116,7 +128,9 @@ res = task.execute()
|
|
116
128
|
assert res.tool_output == "empty func_demo"
|
117
129
|
```
|
118
130
|
|
119
|
-
Ref. <a href="/core/tool">Tool</a> class / <a href="/core/
|
131
|
+
Ref 1. <a href="/core/tool">Tool</a> class / <a href="/core/rag-tool">RAGTool</a> class
|
132
|
+
|
133
|
+
Ref 2. <a href="/core/task/task-output">TaskOutput</a> class
|
120
134
|
|
121
135
|
<hr>
|
122
136
|
|
@@ -142,6 +156,29 @@ assert res.tool_output == "simple func"
|
|
142
156
|
|
143
157
|
<hr>
|
144
158
|
|
159
|
+
## Image, Audio, File Content
|
160
|
+
|
161
|
+
Refer the content by adding an absolute file path to the content file or URL to the task object.
|
162
|
+
|
163
|
+
|
164
|
+
```python
|
165
|
+
import versionhq as vhq
|
166
|
+
from pathlib import Path
|
167
|
+
|
168
|
+
current_dir = Path(__file__).parent.parent
|
169
|
+
file_path = current_dir / "_sample/screenshot.png"
|
170
|
+
audio_path = current_dir / "_sample/sample.mp3"
|
171
|
+
|
172
|
+
task = vhq.Task(description="Summarize the given content", image=str(file_path), audio=str(audio_path))
|
173
|
+
res = task.execute(agent=vhq.Agent(llm="gemini-2.0", role="Content Interpretator"))
|
174
|
+
|
175
|
+
assert res.raw is not None
|
176
|
+
```
|
177
|
+
|
178
|
+
* Audio files are only applicable to `gemini` models.
|
179
|
+
|
180
|
+
<hr>
|
181
|
+
|
145
182
|
## Callbacks
|
146
183
|
|
147
184
|
`[var]`<bold>`callback: Optional[Callable] = None`</bold>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
---
|
2
|
+
tags:
|
3
|
+
- Task Graph
|
4
|
+
---
|
5
|
+
|
6
|
+
# Task Output
|
7
|
+
|
8
|
+
<class>`class` versionhq.task.model.<bold>TaskOutput<bold></class>
|
9
|
+
|
10
|
+
A Pydantic class to store and manage results of `Task`.
|
11
|
+
|
12
|
+
The following snippet demonstrates the `TaskOutput` object when the task is all-in with Pydantic response format, callbacks, tools, and evaluation.
|
13
|
+
|
14
|
+
```python
|
15
|
+
import versionhq as vhq
|
16
|
+
from pydantic import BaseModel
|
17
|
+
|
18
|
+
class CustomOutput(BaseModel):
|
19
|
+
test1: str
|
20
|
+
test2: list[str]
|
21
|
+
|
22
|
+
def dummy_tool():
|
23
|
+
return "dummy"
|
24
|
+
|
25
|
+
def summarize_response(message: str, test1: str, test2: list[str]) -> str:
|
26
|
+
return f"""{message}: {test1}, {", ".join(test2)}"""
|
27
|
+
|
28
|
+
task = vhq.Task(
|
29
|
+
description="Research a topic to teach a kid aged 6 about math.",
|
30
|
+
pydantic_output=CustomOutput,
|
31
|
+
tools=[dummy_tool],
|
32
|
+
callback=summarize_response,
|
33
|
+
callback_kwargs=dict(message="Hi! Here is the result: "),
|
34
|
+
should_evaluate=True, # triggers evaluation
|
35
|
+
eval_criteria=["Uniquness", "Fit to audience",],
|
36
|
+
|
37
|
+
)
|
38
|
+
res = task.execute()
|
39
|
+
|
40
|
+
assert res.task_id == task.id
|
41
|
+
assert res.raw
|
42
|
+
assert res.json_dict
|
43
|
+
assert res.pydantic.test1 and res.pydantic.test2
|
44
|
+
assert "Hi! Here is the result: " in res.callback_output
|
45
|
+
assert res.pydantic.test1 in res.callback_output and ", ".join(res.pydantic.test2) in res.callback_output
|
46
|
+
assert res.tool_output is None
|
47
|
+
assert res.evaluation and isinstance(res.evaluation, vhq.Evaluation)
|
48
|
+
```
|
49
|
+
|
50
|
+
|
51
|
+
The `TaskOutput` object has a `final` field that contains the task's definitive result.
|
52
|
+
|
53
|
+
Result priority is: `callback` > `tool` (when tool_res_as_final is true) > `pydantic` > `json_dict` > `raw` output.
|
54
|
+
|
55
|
+
|
56
|
+
```python
|
57
|
+
assert res.final == res.callback_output
|
58
|
+
```
|
59
|
+
|
60
|
+
|
61
|
+
Ref. <a href="/core/task/reference/#taskoutput">List of variables and class methods</a>
|