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¶
Builder class for creating chain workflows. |
|
Configuration for ExtendedChainAgent. |
|
An edge connection between chain nodes. |
|
A node in a chain workflow. |
|
State schema for chain execution. |
|
Extended chain agent for complex multi-step workflows. |
Functions¶
|
Create a simple sequential chain from a list of agents. |
|
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:
from_node (str)
to_node (str)
condition (collections.abc.Callable | None)
- Return type:
- add_node(name, agent, config=None)¶
Add a node to the chain.
- Parameters:
- Return type:
- build()¶
Build the chain configuration.
- Return type:
- 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:
node_name (str)
state (ChainState)
- Return type:
Any
- get_next_nodes(current_node, state)¶
Get the next nodes to execute based on current state.
- Parameters:
current_node (str)
state (ChainState)
- Return type:
- 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:
- agents.chain.extended_chain.chain_with_edges(nodes, edges)¶
Create a chain with explicit nodes and edges.
- Parameters:
- Returns:
ChainBuilder instance with the specified structure
- Return type: