from crewai import Agent, Task, Crew, LLM
# Configure Adaptive LLM
llm = LLM(
model="", # Empty string enables intelligent routing
api_key="your-adaptive-api-key",
base_url="https://api.llmadaptive.uk/v1"
)
# Create agents
researcher = Agent(
role='Researcher',
goal='Research and gather information',
backstory='A thorough researcher with attention to detail',
llm=llm
)
writer = Agent(
role='Writer',
goal='Create engaging content based on research',
backstory='A creative writer who transforms data into stories',
llm=llm
)
# Define tasks
research_task = Task(
description='Research the latest trends in AI technology',
agent=researcher,
expected_output='A comprehensive report on AI trends'
)
writing_task = Task(
description='Write an article based on the research findings',
agent=writer,
expected_output='A well-written article about AI trends'
)
# Create and run the crew
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, writing_task],
verbose=True
)
result = crew.kickoff()
print(result)