The docs do not include an @llm decorator, but it seems to work in this repo: GitHub - rthidden/game-builder-crew and the example @Max_Moura shared above.
Does that mean we can create our own decorators for any attribute we want to include in the YAML? For example, @function_calling_llm or @prompt_template
senior_engineer_agent:
role: >
Senior Software Engineer
goal: >
Create software as needed
backstory: >
You are a Senior Software Engineer at a leading tech think tank.
Your expertise in programming in Python and do your best to produce perfect code.
allow_delegation: False
verbose: True
tools:
- serper_tool
llm: mini_llm
qa_engineer_agent:
role: >
Software Quality Control Engineer
goal: >
Create Perfect code, by analyzing the code that is given for errors
backstory: >
You are a software engineer that specializes in checking code
for errors. You have an eye for detail and a knack for finding
hidden bugs.
You check for missing imports, variable declarations, mismatched
brackets and syntax errors.
You also check for security vulnerabilities, and logic errors
allow_delegation: False
verbose: True
tools:
- serper_tool
chief_qa_engineer_agent:
role: >
Chief Software Quality Control Engineer
goal: >
Ensure that the code does the job that it is supposed to do
backstory: >
You feel that programmers always do only half the job, so you are
super dedicated to make high quality code.
allow_delegation: True
verbose: True
tools:
- serper_tool
"""This file contains the crew definition for the GameBuilder crew"""
from typing import List
from crewai import Agent, Crew, Process, Task, LLM
from crewai.project import CrewBase, agent, crew, task, tool, llm
from crewai_tools import SerperDevTool, BaseTool
@CrewBase
class GameBuilderCrew:
"""GameBuilder crew"""
agents_config = 'config/agents.yaml'
tasks_config = 'config/tasks.yaml'
@agent
def senior_engineer_agent(self) -> Agent:
"""Creates the Senior Engineer Agent"""
return Agent(config=self.agents_config['senior_engineer_agent'])
@agent
def qa_engineer_agent(self) -> Agent:
"""Creates the QA Engineer Agent"""
return Agent(config=self.agents_config['qa_engineer_agent'])
@agent
def chief_qa_engineer_agent(self) -> Agent:
"""Creates the Chief QA Engineer Agent"""
return Agent(config=self.agents_config['chief_qa_engineer_agent'])
@task
def code_task(self) -> Task:
"""Creates the Code Task"""
return Task(
config=self.tasks_config['code_task'],
agent=self.senior_engineer_agent()
)
@task
def review_task(self) -> Task:
"""Creates the Review Task"""
return Task(
config=self.tasks_config['review_task'],
agent=self.qa_engineer_agent(),
#### output_json=ResearchRoleRequirements
)
@task
def evaluate_task(self) -> Task:
"""Creates the Evaluate Task"""
return Task(
config=self.tasks_config['evaluate_task'],
agent=self.chief_qa_engineer_agent()
)
@tool
def serper_tool(self) -> BaseTool:
return SerperDevTool()
@llm
def mini_llm(self) -> LLM:
return LLM(
model='openai/gpt-4o',
temperature=0.7,
timeout=90,
max_tokens=8192,
)
@crew
def crew(self) -> Crew:
"""Creates the GameBuilderCrew"""
return Crew(
agents=self.agents,
tasks=self.tasks,
process=Process.sequential,
verbose=True,
)