Agent Frameworks
How do you set Claude as the LLM in CrewAI?
QUICK ANSWER
To configure CrewAI to use Claude, initialize an LLM class instance using CrewAI's library, passing the model identifier 'anthropic/claude-3-5-sonnet-20241022', and assign it to your agents.
Python Setup Configuration
from crewai import Agent, Crew, LLM
# Initialize Claude LLM using CrewAI's wrapper
claude_llm = LLM(
model="anthropic/claude-3-5-sonnet-20241022",
temperature=0.2,
api_key="your-api-key"
)
research_agent = Agent(
role="Senior Analyst",
goal="Analyze market statistics.",
backstory="Expert researcher.",
llm=claude_llm,
verbose=True
)
Verified against: CrewAI v0.100.0