AgentXPipe

The AgentXPipe class from the superagentx.agentxpipe module is used to set up a pipeline that allows multiple agents to work together in sequence, Parallel or Hybrid. In this case, the AgentXPipe object enables the use of one or more agents (e.g., ecom_agent, ai_agent, content_creator_agent etc..) in combination with a memory store, allowing the system to persist context, share information between agents, and maintain state across multiple interactions.

AgentXPipe Parameters

AttributeParametersDescription
Pipe Id (optional)pipe_idA unique identifier for the agentxpipe. If not provided, a new UUID will be generated by default. Useful for tracking or referencing the agentxpipe in multi-engine environments.
Name (optional)nameAn optional name for the agentxpipe, providing a more friendly reference for display or logging purposes.
Description (optional)descriptionAn optional description that provides additional context or details about the agentxpipe’s purpose and capabilities.
Agents (optional)agentsA 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)memoryAn optional memory instance that allows the engine to retain information across interactions.This can enhance the pipe’s contextual awareness and improve its performance over time.
Stop if goal is not satisfied (optional)stop_if_goal_not_satisfiedA flag indicating whether to stop processing if the goal is not satisfied. When set to True, the agentxpipe 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.
from superagentx.agentxpipe import AgentXPipe

pipe = AgentXPipe(
    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
)

AgentXPipe Agent Configuration

Sequence

In sequence execution, agent(s) are performed one after another, with each agent(s) waiting for the previous one to finish before starting. This approach is simple but can be slow if agent(s) are independent.

from superagentx.agentxpipe import AgentXPipe

pipe = AgentXPipe(
    ...
    agents=[agent_1, agent_2, agent_3 ... agent_n],
    ...
)

# Agents execution will be in following order
# [agent_1, agent_2, agent_3 ... agent_n]

Alternate way of configure

from superagentx.agentxpipe import AgentXPipe

pipe = AgentXPipe(
    ...,
    ...
)

await pipe.add(agent_1, agent_2)
.
.
.
await pipe.add(agent_3, agent_4, execute_type='SEQUENCE')
.
.

# Agents execution will be in following order
# [agent_1, agent_2, agent_3, agent_4]

Parallel

In parallel execution, agent(s) run at the same time, speeding up the process by utilizing multiple threads or processes.

from superagentx.agentxpipe import AgentXPipe

pipe = AgentXPipe(
    ...
    agents=[[agent_1, agent_2, agent_3 ... agent_n]],
    ...
)

# Agents execution will be in following order
# [[agent_1, agent_2, agent_3 ... agent_n]]

Alternate way of configure

from superagentx.agentxpipe import AgentXPipe

pipe = AgentXPipe(
    ...,
    ...
)

await pipe.add(agent_1, agent_2, execute_type='PARALLEL')
.
.
.
await pipe.add(agent_3, agent_4, execute_type='PARALLEL')
.
.

# Agents execution will be in following order
# [[agent_1, agent_2, agent_3, agent_4]]

Mixed with Sequence and Parallel

from superagentx.agentxpipe import AgentXPipe

pipe = AgentXPipe(
    ...
    agents=[agent_1, [agent_2, agent_3], agent_4 ... agent_n],
    ...
)

# Agents execution will be in following order
# [agent_1, [agent_2, agent_3], agent_4, ... agent_n]]

Alternate way of configure

from superagentx.agentxpipe import AgentXPipe

pipe = AgentXPipe(
    ...,
    ...
)

await pipe.add(agent_1, agent_2, execute_type='SEQUENCE')
.
.
.
await pipe.add(agent_3, agent_4, execute_type='PARALLEL')
.
.

# Agents execution will be in following order
# [agent_1, agent_2, [agent_3, agent_4]]