Hi all,
I’m failing at my first try, just intent routing, pretty basic code:
import crewai
import textwrap
import os
from langchain_litellm.chat_models import ChatLiteLLM
router_agent = crewai.Agent(
role='Intent routing specialist',
goal='Identify whether the user wants to debug code, write code, or configure a system.',
backstory=textwrap.dedent('''
You are a master orchestrator responsible for understanding user input
and selecting the correct workflow. You do not perform the task, you
only classify the intent.
'''),
llm=ChatLiteLLM(model=os.getenv('MODEL')),
verbose=True,
memory=False,
)
router_task = crewai.Task(
description=textwrap.dedent('''
Analyze the user query and determine which workflow it should trigger.
If the query involves fixing or analyzing code issues → output 'debug'.
If it asks for editing code → output 'code'.
If it involves environment setup, configuration, or credentials → output 'configure'.
Your final answer MUST be exactly one of these lowercase words: debug, code, configure.
'''),
expected_output="A single lowercase word: debug, code, or configure.",
agent=router_agent,
)
router_crew = crewai.Crew(
agents=[router_agent],
tasks=[router_task],
process=crewai.Process.sequential
)
result = router_crew.kickoff(inputs={'user_query': 'rewrite proc.py so that it also collects stdout and sterr in order into a new output variable'})
assert result == 'code'
No matter what LLM I use, I always get debug as result.
Any clue please?