nat.plugins.langchain.control_flow.parallel_executor#

Attributes#

Exceptions#

UnknownParallelToolsError

Raised when one or more configured tools cannot be resolved.

Classes#

ParallelExecutorConfig

Configuration for parallel execution of independent tools.

Functions#

_invoke_branch(→ Any)

_format_branch_error(→ str)

parallel_execution(...)

Create a parallel executor that fans out input to all tools and fans in branch outputs.

Module Contents#

logger#
exception UnknownParallelToolsError(tool_names: list[str])#

Bases: ValueError

Raised when one or more configured tools cannot be resolved.

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

class ParallelExecutorConfig#

Bases: nat.data_models.function.FunctionBaseConfig

Configuration for parallel execution of independent tools.

description: str = None#
tool_list: list[nat.data_models.component_ref.FunctionRef] = None#
detailed_logs: bool = None#
return_error_on_exception: bool = None#
async _invoke_branch(
tool_name: str,
tool: langchain_core.tools.base.BaseTool,
input_message: object,
detailed_logs: bool,
log_prefix: str,
return_error_on_exception: bool,
) Any#
_format_branch_error(error: Exception) str#
async parallel_execution(
config: ParallelExecutorConfig,
builder: nat.builder.builder.Builder,
) collections.abc.AsyncIterator[nat.builder.function_info.FunctionInfo]#

Create a parallel executor that fans out input to all tools and fans in branch outputs.