Skip to content

Agent

class versionhq.agent.model.Agent

A Pydantic class to store an Agent object that handles Task execution.

Quick Start

By defining its role and goal in a simple sentence, the AI agent will be set up to run on gpt-4o by default.

Calling .start() method can start the agent operation and generate response in text and JSON formats stored in the TaskOutput object.

import versionhq as vhq

agent = vhq.Agent(
    role="Marketing Analyst",
    goal="Coping with price competition in saturated markets"
)

res = agent.start(context="Planning a new campaign promotion starting this summer")

assert agent.id
assert isinstance(res, vhq.TaskOutput)
assert res.json

Ref. Task class / LLM class