Fix #2787: Add direct kickoff methods to CrewBase instances

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-05-08 11:46:41 +00:00
parent 409892d65f
commit ca318d2bc2
3 changed files with 165 additions and 0 deletions

36
tests/reproduce_2787.py Normal file
View File

@@ -0,0 +1,36 @@
from crewai import Agent, Crew, Task, Process
from crewai.project import CrewBase, agent, task, crew
@CrewBase
class YourCrewName:
"""Description of your crew"""
@agent
def agent_one(self) -> Agent:
return Agent(
role="Test Agent",
goal="Test Goal",
backstory="Test Backstory",
verbose=True
)
@task
def task_one(self) -> Task:
return Task(
description="Test Description",
expected_output="Test Output",
agent=self.agent_one()
)
@crew
def crew(self) -> Crew:
return Crew(
agents=[self.agent_one()],
tasks=[self.task_one()],
process=Process.sequential,
verbose=True,
)
c = YourCrewName()
result = c.kickoff()
print(result)