An agentic orchestration framework for building agent networks that handle task automation.
Project description
Overview
Agentic orchestration framework for multi-agent networks and task graphs for complex task automation.
Visit:
Table of Content
- Key Features
- Quick Start
- Technologies Used
- Project Structure
- Setting Up Your Project
- Contributing
- Trouble Shooting
- Frequently Asked Questions (FAQ)
Key Features
versionhq is a Python framework for agent networks that handle complex task automation without human interaction.
Agents are model-agnostic, and will improve task output, while optimizing token cost and job latency, by sharing their memory, knowledge base, and RAG tools with other agents in the network.
Agent Network
Agents adapt their formation based on task complexity.
You can specify a desired formation or allow the agents to determine it autonomously (default).
| Solo Agent | Supervising | Squad | Random | |
|---|---|---|---|---|
| Formation | ||||
| Usage |
|
|
|
|
| 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. |
Graph Theory Concept
To completely automate task workflows, agents will build a task-oriented network by generating nodes that represent tasks and connecting them with dependency-defining edges.
Each node is triggered by specific events and executed by an assigned agent once all dependencies are met.
While the network automatically reconfigures itself, you retain the ability to direct the agents using should_reform variable.
The following code snippet demonstrates the TaskGraph and its visualization, saving the diagram to the uploads directory.
import versionhq as vhq
task_graph = vhq.TaskGraph(directed=False, should_reform=True) # triggering auto formation
task_a = vhq.Task(description="Research Topic")
task_b = vhq.Task(description="Outline Post")
task_c = vhq.Task(description="Write First Draft")
node_a = task_graph.add_task(task=task_a)
node_b = task_graph.add_task(task=task_b)
node_c = task_graph.add_task(task=task_c)
task_graph.add_dependency(
node_a.identifier, node_b.identifier,
dependency_type=vhq.DependencyType.FINISH_TO_START, weight=5, description="B depends on A"
)
task_graph.add_dependency(
node_a.identifier, node_c.identifier,
dependency_type=vhq.DependencyType.FINISH_TO_FINISH, lag=1, required=False, weight=3
)
# To visualize the graph:
task_graph.visualize()
# To start executing nodes:
latest_output, outputs = task_graph.activate()
assert isinstance(last_task_output, vhq.TaskOutput)
assert [k in task_graph.nodes.keys() and v and isinstance(v, vhq.TaskOutput) for k, v in outputs.items()]
Task Graph
A TaskGraph represents tasks as nodes and their execution dependencies as edges, automating rule-based execution.
Agent Networks can handle TaskGraph objects by optimizing their formations.
The following example demonstrates a simple concept of a supervising agent network handling a task graph with three tasks and one critical edge.
Optimization
Agents are model-agnostic and can handle multiple tasks, leveraging their own and their peers' knowledge sources, memories, and tools.
Agents are optimized during network formation, but customization is possible before or after.
The following code snippet demonstrates agent customization:
import versionhq as vhq
agent = vhq.Agent(role="Marketing Analyst")
# update the agent
agent.update(
llm="gemini-2.0", # updating LLM (Valid llm_config will be inherited to the new LLM.)
tools=[vhq.Tool(func=lambda x: x)], # adding tools
max_rpm=3,
knowledge_sources=["<KC1>", "<KS2>"], # adding knowledge sources. This will trigger the storage creation.
memory_config={"user_id": "0001"}, # adding memories
dummy="I am dummy" # <- invalid field will be automatically ignored
)
Quick Start
Package installation
pip install versionhq
(Python 3.11 | 3.12 | 3.13)
Launching an agent
import versionhq as vhq
agent = vhq.Agent(role="Marketer")
res = agent.start()
assert isinstance(res, vhq.TaskOutput) # contains agent's response in text, JSON, Pydantic formats with usage recordes and eval scores.
Automating workflows
import versionhq as vhq
network = vhq.form_agent_network(
task="draft a promo plan",
expected_outcome="marketing plan, budget, KPI targets",
)
res, tg = network.launch()
assert isinstance(res, vhq.TaskOutput) # the latest output from the workflow
assert isinstance(tg, vhq.TaskGraph) # contains task nodes and edges that connect the nodes with dep-met conditions
Executing a single task
You can simply build and execute a task using Task class.
import versionhq as vhq
from pydantic import BaseModel
class CustomOutput(BaseModel):
test1: str
test2: list[str]
def dummy_func(message: str, test1: str, test2: list[str]) -> str:
return f"""{message}: {test1}, {", ".join(test2)}"""
task = vhq.Task(
description="Amazing task",
pydantic_output=CustomOutput,
callback=dummy_func,
callback_kwargs=dict(message="Hi! Here is the result: ")
)
res = task.execute(context="testing a task function")
assert isinstance(res, vhq.TaskOutput)
Supervising agents
To create an agent network with one or more manager agents, designate members using the is_manager tag.
import versionhq as vhq
agent_a = vhq.Agent(role="Member", llm="gpt-4o")
agent_b = vhq.Agent(role="Leader", llm="gemini-2.0")
task_1 = vhq.Task(
description="Analyze the client's business model.",
response_fields=[vhq.ResponseField(title="test1", data_type=str, required=True),],
allow_delegation=True
)
task_2 = vhq.Task(
description="Define a cohort.",
response_fields=[vhq.ResponseField(title="test1", data_type=int, required=True),],
allow_delegation=False
)
network =vhq.AgentNetwork(
members=[
vhq.Member(agent=agent_a, is_manager=False, tasks=[task_1]),
vhq.Member(agent=agent_b, is_manager=True, tasks=[task_2]), # Agent B as a manager
],
)
res, tg = network.launch()
assert isinstance(res, vhq.NetworkOutput)
assert not [item for item in task_1.processed_agents if "vhq-Delegated-Agent" == item]
assert [item for item in task_1.processed_agents if "agent b" == item]
This will return a list with dictionaries with keys defined in the ResponseField of each task.
Tasks can be delegated to a manager, peers within the agent network, or a completely new agent.
Technologies Used
Schema, Data Validation
- Pydantic: Data validation and serialization library for Python.
- Upstage: Document processer for ML tasks. (Use
Document Parser APIto extract data from documents) - Docling: Document parsing
Workflow, Task Graph
- NetworkX: A Python package to analyze, create, and manipulate complex graph networks. Ref. Gallary
- Matplotlib: For graph visualization.
- Graphviz: For graph visualization.
LLM Curation
- LiteLLM: LLM orchestration platform
Tools
- Composio: Conect RAG agents with external tools, Apps, and APIs to perform actions and receive triggers. We use tools and RAG tools from Composio toolset.
Storage
- mem0ai: Agents' memory storage and management.
- Chroma DB: Vector database for storing and querying usage data.
- SQLite: C-language library to implements a small SQL database engine.
Deployment
- uv: Python package installer and resolver
- pre-commit: Manage and maintain pre-commit hooks
- setuptools: Build python modules
Project Structure
.
.github
└── workflows/ # Github actions
│
docs/ # Documentation
mkdocs.yml # MkDocs config
│
src/
└── versionhq/ # Orchestration framework package
│ ├── agent/ # Core components
│ └── llm/
│ └── task/
│ └── tool/
│ └── ...
│
└──tests/ # Pytest - by core component and use cases in the docs
│ └── agent/
│ └── llm/
│ └── ...
│
└── .diagrams/ [.gitignore] # Local directory to store graph diagrams
│
└── .logs/ [.gitignore] # Local directory to store error/warning logs for debugging
│
│
pyproject.toml # Project config
.env.sample # sample .env file
Setting Up Your Project
Installing package manager
For MacOS:
brew install uv
For Ubuntu/Debian:
sudo apt-get install uv
Installing dependencies
uv venv
source .venv/bin/activate
uv lock --upgrade
uv sync --all-extras
-
AssertionError/module mismatch errors: Set up default Python version using
.pyenvpyenv install 3.12.8 pyenv global 3.12.8 (optional: `pyenv global system` to get back to the system default ver.) uv python pin 3.12.8 echo 3.12.8 >> .python-version -
pygraphvizrelated errors: Run the following commands:brew install graphviz uv pip install --config-settings="--global-option=build_ext" \ --config-settings="--global-option=-I$(brew --prefix graphviz)/include/" \ --config-settings="--global-option=-L$(brew --prefix graphviz)/lib/" \ pygraphviz- If the error continues, skip pygraphviz installation by:
uv sync --all-extras --no-extra pygraphviz
Adding env secrets to .env file
Create .env file in the project root and add secret vars following .env.sample file.
Contributing
versionhq is a open source project.
Steps
-
Create your feature branch (
git checkout -b feature/your-amazing-feature) -
Create amazing features
-
Add a test funcition to the
testsdirectory and run pytest.-
Add secret values defined in
.github/workflows/run_test.ymlto your Githubrepository secretslocated at settings > secrets & variables > Actions. -
Run a following command:
uv run pytest tests -vv --cache-clear
Building a new pytest function
-
Files added to the
testsdirectory must end in_test.py. -
Test functions within the files must begin with
test_. -
Pytest priorities are
1. playground > 2. docs use cases > 3. other features
-
-
Update
docsaccordingly. -
Pull the latest version of source code from the main branch (
git pull origin main) *Address conflicts if any. -
Commit your changes (
git add ./git commit -m 'Add your-amazing-feature') -
Push to the branch (
git push origin feature/your-amazing-feature) -
Open a pull request
Optional
-
Flag with
#! REFINEMEfor any improvements needed and#! FIXMEfor any errors. -
Playgroundis available athttps://versi0n.io.
Package Management with uv
- Add a package:
uv add <package> - Remove a package:
uv remove <package> - Run a command in the virtual environment:
uv run <command>
- After updating dependencies, update
requirements.txtaccordingly or runuv pip freeze > requirements.txt
Pre-Commit Hooks
-
Install pre-commit hooks:
uv run pre-commit install -
Run pre-commit checks manually:
uv run pre-commit run --all-files
Pre-commit hooks help maintain code quality by running checks for formatting, linting, and other issues before each commit.
- To skip pre-commit hooks
git commit --no-verify -m "your-commit-message"
Documentation
-
To edit the documentation, see
docsrepository and edit the respective component. -
We use
mkdocsto update the docs. You can run the docs locally at http://127.0.0.1:8000/.uv run python3 -m mkdocs serve --clean -
To add a new page, update
mkdocs.ymlin the root. Refer to MkDocs documentation for more details.
Trouble Shooting
Common issues and solutions:
-
API key errors: Ensure all API keys in the
.envfile are correct and up to date. Make sure to addload_dotenv()on the top of the python file to apply the latest environment values. -
Database connection issues: Check if the Chroma DB is properly initialized and accessible.
-
Memory errors: If processing large contracts, you may need to increase the available memory for the Python process.
-
Issues related to dependencies:
rm -rf uv.lock,uv cache clean,uv venv, and runuv pip install -r requirements.txt -v. -
Issues related to agents and other systems: Check
.logsdirectory located in the root directory for error messages and stack traces. -
Issues related to
Python quit unexpectedly: Check this stackoverflow article. -
reportMissingImportserror from pyright after installing the package: This might occur when installing new libraries while VSCode is running. Open the command pallete (ctrl + shift + p) and run the Python: Restart language server task.
Frequently Asked Questions (FAQ)
Q. Where can I see if the agent is working?
A. Visit playground.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file versionhq-1.2.3.1.tar.gz.
File metadata
- Download URL: versionhq-1.2.3.1.tar.gz
- Upload date:
- Size: 551.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61ab7b3cc02835c0b9e5ac4524e0051de24a8f525f23290dbde16a122cf5ab30
|
|
| MD5 |
bc5b3035889f18d8a90b80306902a9d1
|
|
| BLAKE2b-256 |
960e4b291df65d8b9c96e8b30e0bdd592c8c704ae11640cee276a10ec929da5e
|
Provenance
The following attestation bundles were made for versionhq-1.2.3.1.tar.gz:
Publisher:
publish.yml on versionHQ/multi-agent-system
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
versionhq-1.2.3.1.tar.gz -
Subject digest:
61ab7b3cc02835c0b9e5ac4524e0051de24a8f525f23290dbde16a122cf5ab30 - Sigstore transparency entry: 177976372
- Sigstore integration time:
-
Permalink:
versionHQ/multi-agent-system@a006a19e60ff54c8514acf86f5ce46273fc783a8 -
Branch / Tag:
refs/tags/v1.2.3.1 - Owner: https://github.com/versionHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a006a19e60ff54c8514acf86f5ce46273fc783a8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file versionhq-1.2.3.1-py3-none-any.whl.
File metadata
- Download URL: versionhq-1.2.3.1-py3-none-any.whl
- Upload date:
- Size: 96.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86b6f727a9d82cff7155cbd39c27477d6e7a6f81735c3941a79c8c39c69ea32d
|
|
| MD5 |
c303b65c07e9c70c490d259c0c318846
|
|
| BLAKE2b-256 |
776b4322c95823c9aaca2c0bd4b9029ce783bb2408f87508be63d9313f06ca67
|
Provenance
The following attestation bundles were made for versionhq-1.2.3.1-py3-none-any.whl:
Publisher:
publish.yml on versionHQ/multi-agent-system
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
versionhq-1.2.3.1-py3-none-any.whl -
Subject digest:
86b6f727a9d82cff7155cbd39c27477d6e7a6f81735c3941a79c8c39c69ea32d - Sigstore transparency entry: 177976373
- Sigstore integration time:
-
Permalink:
versionHQ/multi-agent-system@a006a19e60ff54c8514acf86f5ce46273fc783a8 -
Branch / Tag:
refs/tags/v1.2.3.1 - Owner: https://github.com/versionHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a006a19e60ff54c8514acf86f5ce46273fc783a8 -
Trigger Event:
release
-
Statement type: