crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

Questions about agent allow_delegation

Open Meguminnnnnnnn opened this issue 1 year ago • 5 comments
trafficstars

I've noticed that when the 'allow_delegation' field is set within an agent, the crew will convert other agents into tools and add them to this agent.

        return [
           Tool.from_function(
                func=self.delegate_work,
                name="Delegate work to co-worker",
                description=self.i18n.tools("delegate_work").format(
                    coworkers=", ".join([agent.role for agent in self.agents])
                ),
            ),
            Tool.from_function(
                func=self.ask_question,
                name="Ask question to co-worker",
                description=self.i18n.tools("ask_question").format(
                    coworkers=", ".join([agent.role for agent in self.agents])
                ),
            ),
        ]

My point of confusion comes from why we need to use two types of tools: 'delegate' and 'question'.

Meguminnnnnnnn avatar Apr 09 '24 08:04 Meguminnnnnnnn

I presume it could be that one tool takes care of delegation to whom to delegate and the other generates input to the delegated agent. I may be wrong as well as right here.

emilmirzayev avatar Apr 10 '24 12:04 emilmirzayev

I was facing many errors due to this default value of True, I have turned it off and my tasks were completed much cleaner.

Error details below: Action 'None' don't exist, these are the only available Actions: Delegate work to co-worker: Delegate work to co-worker(coworker: str, task: str, context: str) - Delegate a specific task to one of the following co-workers: ['task1 desc'] The input to this tool should be the coworker, the task you want them to do, and ALL necessary context to exectue the task, they know nothing about the task, so share absolute everything you know, don't reference things but instead explain them. Ask question to co-worker: Ask question to co-worker(coworker: str, question: str, context: str) - Ask a specific question to one of the following co-workers: ['task2 desc'] The input to this tool should be the coworker, the question you have for them, and ALL necessary context to ask the question properly, they know nothing about the question, so share absolute everything you know, don't reference things but instead explain them.

raghav135 avatar Apr 10 '24 15:04 raghav135

I presume it could be that one tool takes care of delegation to whom to delegate and the other generates input to the delegated agent. I may be wrong as well as right here.

    def delegate_work(self, coworker: str, task: str, context: str):
        """Useful to delegate a specific task to a coworker passing all necessary context and names."""
        return self._execute(coworker, task, context)

    def ask_question(self, coworker: str, question: str, context: str):
        """Useful to ask a question, opinion or take from a coworker passing all necessary context and names."""
        return self._execute(coworker, question, context)

But the binding functions are same. I think that dividing agent into 'delegate task' and 'ask question' may better guide the LLM model to select the right tool and provide appropriate parameters. However, I'm not quite certain why this works, as intuitively, these two descriptions seem to have no difference. In other words, would the removal of one of the tools lead to a performance degradation in certain scenarios?

Meguminnnnnnnn avatar Apr 12 '24 07:04 Meguminnnnnnnn

I think that dividing agent into 'delegate task' and 'ask question' may better guide the LLM model to select the right tool and provide appropriate parameters.

On point, the whole idea is to better guide the model on when using the tool be more specific about the expected outcome.

We could try removing them and run benchmarks for testing. Also am open to the idea of making them false by default, but would also like to run that through out internal benchmark before pulling the trigger on it

joaomdmoura avatar Apr 12 '24 07:04 joaomdmoura

As being my self a noob, I'm working with four agents, one of them is tasked to grab events to an external solution and provide that information to the remaining agents for further analysis and reporting.

I don't know if that is the desired objective. When I sent the first agent to delegation : False, he grab the information but other agents are not able to use that information.

And if use the first task as the context to the second task it doesn't work as well.

In this type of scenario, I need to have the delegation set to True?

Regards,

a-ml avatar May 01 '24 14:05 a-ml

I get this same issue when I attempt to run locally. If I run it with OpenAI something is being done in the background that allows me to move forward. I don't think the solution is to just turn off delegation as the idea is to get these agents working together and not as a silo. Setting delegation to false just yields a silo product. In the end they cannot produce a coherent product. For me openai is a deal breaker. I am really hoping to see a working multi-agent local example. I can't get it to work.

JTMarsh556 avatar May 25 '24 04:05 JTMarsh556

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Aug 18 '24 12:08 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Aug 24 '24 12:08 github-actions[bot]