hap.models.graphΒΆ

AttributesΒΆ

ClassesΒΆ

HAPGraph

HAP graph with agent orchestration capabilities.

HAPNode

HAP node that can contain an agent.

Module ContentsΒΆ

class hap.models.graph.HAPGraph(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

HAP graph with agent orchestration capabilities.

Parameters:

data (Any)

add_agent_node(node_id: str, agent: haive.agents.base.agent.Agent, next_nodes: List[str] = None) HAPNodeΒΆ

Add an agent as a node to the graph.

Parameters:
  • node_id (str)

  • agent (haive.agents.base.agent.Agent)

  • next_nodes (List[str])

Return type:

HAPNode

add_entrypoint_node(node_id: str, entrypoint: str, next_nodes: List[str] = None) HAPNodeΒΆ

Add a node by entrypoint string.

Parameters:
  • node_id (str)

  • entrypoint (str)

  • next_nodes (List[str])

Return type:

HAPNode

async execute(initial_context: Dict[str, Any]) hap.models.context.HAPContextΒΆ

Execute the entire graph.

Parameters:

initial_context (Dict[str, Any])

Return type:

hap.models.context.HAPContext

topological_order() List[str]ΒΆ

Get topological ordering of nodes.

Return type:

List[str]

entry_node: str = NoneΒΆ
nodes: Dict[str, HAPNode] = NoneΒΆ
class hap.models.graph.HAPNode(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

HAP node that can contain an agent.

Parameters:

data (Any)

async execute(context: HAPContext) HAPContextΒΆ

Execute this node’s agent.

Parameters:

context (HAPContext)

Return type:

HAPContext

load_agent() haive.agents.base.agent.AgentΒΆ

Load agent from entrypoint if not already loaded.

Return type:

haive.agents.base.agent.Agent

agent_entrypoint: str = NoneΒΆ
agent_instance: haive.agents.base.agent.Agent | None = NoneΒΆ
id: str = NoneΒΆ
next_nodes: List[str] = NoneΒΆ
hap.models.graph.AgentGraphΒΆ
hap.models.graph.AgentNodeΒΆ