You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By creating a crew with a manager agent and using the kickoff_for_each function, the execution stops with the following issue:
.venv/lib/python3.12/site-packages/pydantic/functional_validators.py:787: UserWarning: Pydantic serializer warnings:
Expected `InstanceOf` but got `CrewAgentExecutor` with value `<crewai.agents.crew_agent...bject at 0x7f213dc6c1d0>` - serialized value may not be as expected
function=lambda v, h: h(v), schema=original_schema
3 validation errors for Crew
manager_agent.id
This field is not to be set by the user. [type=may_not_set_field, input_value=UUID('29858c29-f8d3-491b-b347-3d4405847131'), input_type=UUID]
manager_agent.agent_executor
Input should be an instance of InstanceOf [type=is_instance_of, input_value=<crewai.agents.crew_agent...bject at 0x7f213dc6c1d0>, input_type=CrewAgentExecutor]
For further information visit https://errors.pydantic.dev/2.10/v/is_instance_of
manager_agent.cache_handler
Input should be an instance of CacheHandler [type=is_instance_of, input_value={}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.10/v/is_instance_of
The issue does not occur on using kickoff() or using a manager_llm instead of an agent.
Steps to Reproduce
Execute the following code:
import os
import json
from typing import List
from azure.identity import DefaultAzureCredential
from crewai import Agent, Task, Crew, Process
from crewai.crews.crew_output import CrewOutput
# Define your agents
researcher = Agent(
role="Researcher",
goal="Conduct thorough research and analysis on AI and AI agents",
backstory="You're an expert researcher, specialized in technology, software engineering, AI, and startups. You work as a freelancer and are currently researching for a new client.",
allow_delegation=False
)
writer = Agent(
role="Senior Writer",
goal="Create compelling content about AI and AI agents",
backstory="You're a senior writer, specialized in technology, software engineering, AI, and startups. You work as a freelancer and are currently writing content for a new client.",
allow_delegation=False
)
# Define your task
task = Task(
description="Generate a list of 5 interesting ideas for an article, then write one captivating paragraph for each idea that showcases the potential of a full article on this topic. Return the list of ideas with their paragraphs and your notes.",
expected_output="5 bullet points, each with a paragraph and accompanying notes.",
)
# Define the manager agent
manager = Agent(
role="Project Manager",
goal="Efficiently manage the crew and ensure high-quality task completion",
backstory="You're an experienced project manager, skilled in overseeing complex projects and guiding teams to success. Your role is to coordinate the efforts of the crew members, ensuring that each task is completed on time and to the highest standard.",
allow_delegation=True
)
# Instantiate your crew with a custom manager
crew = Crew(
agents=[researcher, writer],
tasks=[task],
manager_agent=manager,
process=Process.hierarchical,
verbose=True
)
with open('bar.json') as f:
d = json.load(f)
try:
outputs: List[CrewOutput] | None = crew.kickoff_for_each(inputs=[
{"document": document} for document in d["foo"]
])
except Exception as e:
print(f"{e}")
Expected behavior
The example crew is run for each child of the json element "foo" within the file bar.json
Screenshots/Code snippets
See "Steps to reproduce"
Operating System
Ubuntu 20.04
Python Version
3.12
crewAI Version
0.102.0
crewAI Tools Version
0.36.0
Virtual Environment
Venv
Evidence
Possible Solution
None
Additional context
None
The text was updated successfully, but these errors were encountered:
This commit addresses issue #2260 by:
1. Adding manager_agent to the exclude list in the Crew.copy() method
2. Implementing proper error handling for manager_agent copying
3. Adding comprehensive tests to verify the fix
4. Enhancing test data for better coverage
5. Improving docstrings for better code documentation
Co-Authored-By: Joe Moura <[email protected]>
Description
By creating a crew with a manager agent and using the kickoff_for_each function, the execution stops with the following issue:
The issue does not occur on using kickoff() or using a manager_llm instead of an agent.
Steps to Reproduce
Execute the following code:
Expected behavior
The example crew is run for each child of the json element "foo" within the file bar.json
Screenshots/Code snippets
See "Steps to reproduce"
Operating System
Ubuntu 20.04
Python Version
3.12
crewAI Version
0.102.0
crewAI Tools Version
0.36.0
Virtual Environment
Venv
Evidence
Possible Solution
None
Additional context
None
The text was updated successfully, but these errors were encountered: