swarmauri.core.swarms.ISwarmFactory module
- class swarmauri.core.swarms.ISwarmFactory.AgentDefinition(type, configuration, capabilities, dependencies, execution_context)[source]
Bases:
NamedTuple
-
capabilities:
List
[str
] Alias for field number 2
-
configuration:
Dict
[str
,Any
] Alias for field number 1
- count(value, /)
Return number of occurrences of value.
-
dependencies:
List
[str
] Alias for field number 3
-
execution_context:
Dict
[str
,Any
] Alias for field number 4
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
-
type:
str
Alias for field number 0
-
capabilities:
- class swarmauri.core.swarms.ISwarmFactory.CallableChainItem(key, execution_context, steps)[source]
Bases:
NamedTuple
- count(value, /)
Return number of occurrences of value.
-
execution_context:
Dict
[str
,Any
] Alias for field number 1
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
-
key:
str
Alias for field number 0
- class swarmauri.core.swarms.ISwarmFactory.FunctionDefinition(identifier, parameters, return_type, execution_context, callable_source)[source]
Bases:
NamedTuple
-
callable_source:
Callable
Alias for field number 4
- count(value, /)
Return number of occurrences of value.
-
execution_context:
Dict
[str
,Any
] Alias for field number 3
-
identifier:
str
Alias for field number 0
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
-
parameters:
List
[FunctionParameter
] Alias for field number 1
-
return_type:
Type
Alias for field number 2
-
callable_source:
- class swarmauri.core.swarms.ISwarmFactory.FunctionParameter(name, type, default, required)[source]
Bases:
NamedTuple
- count(value, /)
Return number of occurrences of value.
-
default:
Optional
[Any
] Alias for field number 2
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
-
name:
str
Alias for field number 0
-
required:
bool
Alias for field number 3
-
type:
Type
Alias for field number 1
- class swarmauri.core.swarms.ISwarmFactory.ISwarmFactory[source]
Bases:
ABC
- abstract create_agent(agent_definition)[source]
Creates a new agent based on the provided enhanced agent definition.
- Parameters:
agent_definition (
AgentDefinition
) – An instance of AgentDefinition detailing the agent’s setup.- Return type:
- Returns:
An instance or identifier of the newly created agent.
- abstract create_callable_chain(chain_definition)[source]
Creates a new callable chain based on the provided definition.
- Parameters:
chain_definition (
List
[CallableChainItem
]) – Details required to build the chain, such as sequence of functions and arguments.- Returns:
The constructed callable chain instance.
- Return type:
- abstract create_swarm(*args, **kwargs)[source]
Creates and returns a new swarm instance configured with the provided arguments.
- Return type:
- abstract export_callable_chains(format_type='json')[source]
Exports configurations of all callable chains in the specified format. Supported formats: ‘json’, ‘pickle’.
- Parameters:
format_type (str) – The format for exporting the configurations.
- Returns:
The callable chain configurations in the specified format.
- Return type:
Union[dict, str, bytes]
- abstract export_configuration(format_type='json')[source]
Exports the swarm’s and agents’ configurations in the specified format. Supported formats: ‘json’, ‘pickle’. Default is ‘json’.
- Parameters:
format_type (str) – The format for exporting the configurations.
- Returns:
The configurations in the specified format.
- Return type:
Union[dict, str, bytes]
- abstract load_callable_chains(chains_data, format_type='json')[source]
Loads callable chain configurations from given data.
- Parameters:
chains_data (Union[dict, str, bytes]) – Data containing callable chain configurations.
format_type (str) – The format of the provided chains data.
- abstract register_function(function_definition)[source]
Registers a function within the factory ecosystem, making it available for callable chains and agents.
- Parameters:
function_definition (
FunctionDefinition
) – An instance of FunctionDefinition detailing the function’s specification.- Return type:
None
- class swarmauri.core.swarms.ISwarmFactory.Step(description, callable, args, kwargs)[source]
Bases:
NamedTuple
-
args:
Optional
[List
[Any
]] Alias for field number 2
-
callable:
Callable
Alias for field number 1
- count(value, /)
Return number of occurrences of value.
-
description:
str
Alias for field number 0
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
-
kwargs:
Optional
[Dict
[str
,Any
]] Alias for field number 3
-
args: