Chain#

class council.chains.Chain(name: str, description: str, runners: Sequence[RunnerBase], support_instructions: bool = False)[source]#

Bases: ChainBase

Represents a chain of skills that can be executed in a specific order.

__init__(name: str, description: str, runners: Sequence[RunnerBase], support_instructions: bool = False)[source]#

Initializes the Chain object.

Parameters:
  • name (str) – The name of the chain.

  • description (str) – The description of the chain.

  • runners (List[RunnerBase]) – The list of runners representing the skills in the chain.

Raises:

None

property description: str#

the description of the chain.

execute(context: ChainContext, executor: ThreadPoolExecutor | None = None) None#

Executes the chain of skills based on the provided context, budget, and optional executor.

Parameters:
  • context (ChainContext) – The context for executing the chain.

  • executor (Optional[RunnerExecutor]) – The skill executor to use for executing the chain.

Returns:

The result of executing the chain.

Return type:

Any

Raises:

None

property name: str#

the name of the chain

render_as_dict(include_children: bool = True) Dict[str, Any]#

returns the graph of operation as a dictionary

render_as_json() str#

returns the graph of operation as a JSON string

property runner: RunnerBase#

the runner of the chain