Pipe
EclipsePipe
The EclipsePipe
class from the eclipse.pipe
module is designed to establish a pipeline that enables multiple agents to collaborate in Sequence, Parallel, or Hybrid configurations. This setup allows various agents (e.g., ecom_agent
, ai_agent
, content_creator_agent
, etc.) to work together, optionally utilizing a memory store to persist context, share information, and maintain state across multiple interactions.
EclipsePipe Parameters
Pipe ID (optional)
pipe_id
A unique identifier for the EclipsePipe
. If not provided, a new UUID will be generated by default. Useful for tracking or referencing the EclipsePipe
in multi-engine environments.
Name (optional)
name
An optional name for the EclipsePipe
, providing a more user-friendly reference for display or logging purposes.
Description (optional)
description
An optional description that offers additional context or details about the EclipsePipe
’s purpose and capabilities.
Agents (optional)
agents
A list of Agent instances (or lists of Agent instances) that are part of this structure. These agents can perform tasks and contribute to achieving the defined goal.
Memory (optional)
memory
An optional memory instance that allows the engine to retain information across interactions. This enhances the pipe’s contextual awareness and improves its performance over time.
Stop if Goal Not Satisfied (optional)
stop_if_goal_not_satisfied
A flag indicating whether to stop processing if the goal is not satisfied. When set to True
, the EclipsePipe
operation will halt if the defined goal is not met, preventing any further actions. Defaults to False
, allowing the process to continue regardless of goal satisfaction.
Example Usage
from eclipse.pipe import EclipsePipe
pipe = EclipsePipe(
pipe_id='weather-id-1',
name='Weather Agent',
description=(
"Weather refers to the atmospheric conditions in a specific location over a short period of time, "
"including elements such as temperature, humidity, precipitation, wind speed, and atmospheric pressure. "
"It can change rapidly and influences daily activities and the environment."
),
agents=[lat_long_agent, weather_agent],
memory=None,
stop_if_goal_not_satisfied=False
)
Agent Configuration in EclipsePipe
Sequence Execution
In sequence execution, agents are performed one after another, with each agent waiting for the previous one to finish before starting. This approach is straightforward but can be slow if agents are independent.
from eclipse.pipe import EclipsePipe
pipe = EclipsePipe(
...,
agents=[agent_1, agent_2, agent_3, ..., agent_n],
...
)
# Agents will execute in the following order:
# [agent_1, agent_2, agent_3, ..., agent_n]
Alternate Configuration:
from eclipse.pipe import EclipsePipe
pipe = EclipsePipe(
...,
...
)
await pipe.add(agent_1, agent_2)
...
await pipe.add(agent_3, agent_4, execute_type='SEQUENCE')
...
# Agents will execute in the following order:
# [agent_1, agent_2, agent_3, agent_4]
Parallel Execution
In parallel execution, agents run simultaneously, speeding up the process by utilizing multiple threads or processes.
from eclipse.pipe import EclipsePipe
pipe = EclipsePipe(
...,
agents=[[agent_1, agent_2, agent_3, ..., agent_n]],
...
)
# Agents will execute in the following order:
# [[agent_1, agent_2, agent_3, ..., agent_n]]
Alternate Configuration:
from eclipse.pipe import EclipsePipe
pipe = EclipsePipe(
...,
...
)
await pipe.add(agent_1, agent_2, execute_type='PARALLEL')
...
await pipe.add(agent_3, agent_4, execute_type='PARALLEL')
...
# Agents will execute in the following order:
# [[agent_1, agent_2, agent_3, agent_4]]
Hybrid Execution (Sequence and Parallel)
EclipsePipe also supports hybrid configurations, combining both sequence and parallel executions.
from eclipse.pipe import EclipsePipe
pipe = EclipsePipe(
...,
agents=[agent_1, [agent_2, agent_3], agent_4, ..., agent_n],
...
)
# Agents will execute in the following order:
# [agent_1, [agent_2, agent_3], agent_4, ..., agent_n]
Alternate Configuration:
from eclipse.pipe import EclipsePipe
pipe = EclipsePipe(
...,
...
)
await pipe.add(agent_1, agent_2, execute_type='SEQUENCE')
...
await pipe.add(agent_3, agent_4, execute_type='PARALLEL')
...
# Agents will execute in the following order:
# [agent_1, agent_2, [agent_3, agent_4]]
By configuring agents in EclipsePipe
using sequence, parallel, or hybrid execution modes, you can optimize the performance and efficiency of your multi-agent applications.
Last updated