Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix co-worker task delegation failure #976

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

charl3sj
Copy link

No description provided.

The `name` parameter had to be added to fix the following error:
```
I encountered an error while trying to use the tool. This was the error: 1 validation error for Task
name
  Field required [type=missing, input_value={'description': 'conduct ...or the context shared.'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.7/v/missing.
 Tool Delegate work to coworker accepts these inputs: Delegate a specific task to one of the following coworkers: web researcher
The input to this tool should be the coworker, the task you want them to do, and ALL necessary context to execute the task, they know nothing about the task, so share absolute everything you know, don't reference things but instead explain them.
```
@joaomdmoura
Copy link
Collaborator

Oh interesting, I was not aware of this, so this is to make sure the agent being delegated can use the tasks tools?

@charl3sj
Copy link
Author

The problem I was trying to fix is of AgentTools (Delegate work to coworker and Ask question to coworker) not being loaded because of being appended to the task in this method:

def _add_delegation_tools(self, task: Task):

... causing delegation to not work.

@charl3sj
Copy link
Author

After going through the docs and code again, I realized that delegation is meant for only hierarchical processes and I was trying delegation with a sequential process. That's why it didn't work. Feel free to close this PR if it's not a use-case you want to or makes sense to support.

@joaomdmoura
Copy link
Collaborator

Oh it was supposed to work on sequential as well, I'll run some tests locally

@Tehsmash
Copy link

Just ran into this exact issue, the docs say that delegation should work for Sequential but I was never seeing coworkers being used.

Looking at the proposed change, I think it might read better if _prepare_agent_tools was removed which adds the delegation tasks to the task's tool list (which is a bit weird given allow_delegation is a property of an Agent not a task).
Instead, we can move the manager tool setup into the if self.process == Process.hieracchical in _execute_tasks, and then for the Sequential case use the union logic to join task.agent.tools, task.tools, and task.agent.get_delegation_tools().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants