haive.agents.base.types¶

Core type system for the Haive agent framework.

Defines type variables, constraints, and base protocols for type-safe agent design.

Classes¶

Agent

Complete agent protocol combining all capabilities.

AgentInput

Default input schema for agents.

AgentOutput

Default output schema for agents.

AgentState

Default state schema for agents.

EngineProvider

Protocol for objects that provide engines.

GraphProvider

Protocol for objects that provide graphs.

GraphSegment

Represents a segment of a graph that can be composed.

HookContext

Context passed to hooks.

HookPoint

Standard hook points in agent lifecycle.

Invokable

Protocol for objects that can be invoked.

NodeConnection

Represents a connection between nodes in a graph.

StateProvider

Protocol for objects that provide state schemas.

Module Contents¶

class haive.agents.base.types.Agent¶

Bases: GraphProvider[TState], StateProvider[TState], Invokable[TInput, TOutput], EngineProvider[TEngine], Protocol[TEngine, TInput, TOutput, TState]

Complete agent protocol combining all capabilities.

class haive.agents.base.types.AgentInput(/, **data)¶

Bases: pydantic.BaseModel

Default input schema for agents.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class haive.agents.base.types.AgentOutput(/, **data)¶

Bases: pydantic.BaseModel

Default output schema for agents.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class haive.agents.base.types.AgentState(/, **data)¶

Bases: pydantic.BaseModel

Default state schema for agents.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class haive.agents.base.types.EngineProvider¶

Bases: Protocol[TEngine]

Protocol for objects that provide engines.

property engine: TEngine¶

Get the primary engine.

Return type:

TEngine

property engines: dict[str, haive.core.engine.base.Engine]¶

Get all engines.

Return type:

dict[str, haive.core.engine.base.Engine]

class haive.agents.base.types.GraphProvider¶

Bases: Protocol[TState]

Protocol for objects that provide graphs.

build_graph()¶

Build and return the graph.

Return type:

Any

class haive.agents.base.types.GraphSegment(/, **data)¶

Bases: pydantic.BaseModel, Generic[TState]

Represents a segment of a graph that can be composed.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class haive.agents.base.types.HookContext(/, **data)¶

Bases: pydantic.BaseModel, Generic[TState]

Context passed to hooks.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class haive.agents.base.types.HookPoint¶

Bases: str, enum.Enum

Standard hook points in agent lifecycle.

Initialize self. See help(type(self)) for accurate signature.

class haive.agents.base.types.Invokable¶

Bases: Protocol[TInput, TOutput]

Protocol for objects that can be invoked.

async ainvoke(input_data, config=None)¶

Async invoke with input data.

Parameters:
  • input_data (TInput)

  • config (dict[str, Any] | None)

Return type:

TOutput

invoke(input_data, config=None)¶

Invoke with input data.

Parameters:
  • input_data (TInput)

  • config (dict[str, Any] | None)

Return type:

TOutput

class haive.agents.base.types.NodeConnection(/, **data)¶

Bases: pydantic.BaseModel, Generic[TState]

Represents a connection between nodes in a graph.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class haive.agents.base.types.StateProvider¶

Bases: Protocol[TState]

Protocol for objects that provide state schemas.

property state_schema: type[TState]¶

Get the state schema type.

Return type:

type[TState]