langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Multiple agents in one flow

Open sampratha28 opened this issue 1 year ago • 1 comments

can i have one more than one agent in a single flow?

for example, one vector store agent and multiple other agents for specific tasks

sampratha28 avatar Jan 02 '24 07:01 sampratha28

🤖

Hello @sampratha28! I'm Dosu, a friendly bot here to assist you with your questions, help solve bugs, and guide you on how to contribute. While we wait for a human maintainer to chime in, don't hesitate to ask me anything regarding the repository. Let's make your experience with langflow as smooth as possible! :blush:

Yes, it is indeed possible to have more than one agent in a single flow in Langflow. The AgentCreator class is responsible for creating and managing agents. It maintains a dictionary (type_to_loader_dict) mapping agent types to their corresponding classes. This suggests that multiple agents can be instantiated and used within a single flow.

Here is an example of how you might use the AgentCreator to instantiate multiple agents:

# Instantiate the AgentCreator
agent_creator = AgentCreator()

# Get the names of all available agents
agent_names = agent_creator.to_list()

# Instantiate each agent
agents = []
for name in agent_names:
    signature = agent_creator.get_signature(name)
    if signature is not None:
        agent_class = agent_creator.type_to_loader_dict[name]
        agent = agent_class(**signature)
        agents.append(agent)

In this example, agents would be a list of instantiated agents.

However, the specific implementation details of how these agents are used within a flow are not provided in the given context. Therefore, while it is technically possible to have multiple agents in a single flow, the exact process for doing so would depend on the specifics of the Langflow application and the requirements of the flow.

You can find more details in the src/backend/langflow/interface/agents/base.py file.

Please let me know if you need further clarification or have any other questions.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

dosubot[bot] avatar Jan 02 '24 07:01 dosubot[bot]