Skip to content

Task

class versionhq.task.model.Task

A Pydantic class to store and manage information for individual tasks, including their assignment to agents or agent networks, and dependencies via a node-based system that tracks conditions and status.

Ref. Node / Edge / TaskGraph class


Quick Start

Create a task by defining its description in one simple sentence. The description will be used in the prompt later.

Each task will be assigned a unique ID as an identifier.

import versionhq as vhq

task = vhq.Task(description="MY AMAZING TASK")

import uuid
assert uuid.UUID(str(task.id), version=4)

And you can simply execute the task by calling .execute() function.

import versionhq as vhq

task = vhq.Task(description="MY AMAZING TASK")
res = task.execute()

assert isinstance(res, vhq.TaskOutput) # Generates TaskOutput object
assert res.raw and res.json # By default, TaskOutput object stores output in plane text and json formats.
assert task.processed_agents is not None # Agents will be automatically assigned to the given task.

Evaluating

[var]should_evaluate: bool = False

[var]eval_criteria: Optional[List[str]] = list()

You can turn on customized evaluations using the given criteria.

Refer TaskOutput class for details.