agents.chain.extended_chain

Extended Chain Agent with simplified chain building capabilities.

This module provides the ExtendedChainAgent class and utilities for building complex multi-step agent workflows with easy-to-use chain syntax.

Classes

ChainBuilder

Builder class for creating chain workflows.

ChainConfig

Configuration for ExtendedChainAgent.

ChainEdge

An edge connection between chain nodes.

ChainNode

A node in a chain workflow.

ChainState

State schema for chain execution.

ExtendedChainAgent

Extended chain agent for complex multi-step workflows.

Functions

chain(*agents)

Create a simple sequential chain from a list of agents.

chain_with_edges(nodes, edges)

Create a chain with explicit nodes and edges.

Module Contents

class agents.chain.extended_chain.ChainBuilder

Builder class for creating chain workflows.

Init .

add_edge(from_node, to_node, condition=None)

Add an edge between nodes.

Parameters:
Return type:

ChainBuilder

add_node(name, agent, config=None)

Add a node to the chain.

Parameters:
  • name (str)

  • agent (Any)

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

Return type:

ChainBuilder

build()

Build the chain configuration.

Return type:

ChainConfig

class agents.chain.extended_chain.ChainConfig

Bases: haive.core.engine.agent.AgentConfig

Configuration for ExtendedChainAgent.

class agents.chain.extended_chain.ChainEdge(/, **data)

Bases: pydantic.BaseModel

An edge connection between chain nodes.

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 agents.chain.extended_chain.ChainNode(/, **data)

Bases: pydantic.BaseModel

A node in a chain workflow.

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 agents.chain.extended_chain.ChainState(/, **data)

Bases: haive.core.schema.state_schema.StateSchema

State schema for chain execution.

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 agents.chain.extended_chain.ExtendedChainAgent(config)

Bases: haive.core.engine.agent.Agent

Extended chain agent for complex multi-step workflows.

This agent provides a simplified interface for building complex chains of agents with dependencies, conditional execution, and state management.

Init .

Parameters:

config (ChainConfig) – [TODO: Add description]

execute_node(node_name, state)

Execute a specific node in the chain.

Parameters:
Return type:

Any

get_next_nodes(current_node, state)

Get the next nodes to execute based on current state.

Parameters:
Return type:

list[str]

setup_workflow()

Set up the chain workflow.

Return type:

None

agents.chain.extended_chain.chain(*agents)

Create a simple sequential chain from a list of agents.

Parameters:

*agents (Any) – Variable number of agents to chain together

Returns:

ChainBuilder instance with sequential chain setup

Return type:

ChainBuilder

agents.chain.extended_chain.chain_with_edges(nodes, edges)

Create a chain with explicit nodes and edges.

Parameters:
  • nodes (dict[str, Any]) – Dictionary mapping node names to agents

  • edges (list[tuple]) – List of (from_node, to_node) tuples

Returns:

ChainBuilder instance with the specified structure

Return type:

ChainBuilder