mirror of
https://github.com/crewAIInc/crewAI-examples.git
synced 2026-01-07 21:13:52 -05:00
* Reorganize repo structure and upgrade to CrewAI 0.152.0 * chore(gitignore): ignore Python bytecode and __pycache__ across templates * chore(gitignore): ignore Python bytecode and __pycache__ across templates; clean tracked artifacts * Update crews/instagram_post/pyproject.toml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
82 lines
2.0 KiB
Python
82 lines
2.0 KiB
Python
from crewai import Crew
|
|
from textwrap import dedent
|
|
from trip_agents import TripAgents
|
|
from trip_tasks import TripTasks
|
|
|
|
from dotenv import load_dotenv
|
|
load_dotenv()
|
|
|
|
class TripCrew:
|
|
|
|
def __init__(self, origin, cities, date_range, interests):
|
|
self.cities = cities
|
|
self.origin = origin
|
|
self.interests = interests
|
|
self.date_range = date_range
|
|
|
|
def run(self):
|
|
agents = TripAgents()
|
|
tasks = TripTasks()
|
|
|
|
city_selector_agent = agents.city_selection_agent()
|
|
local_expert_agent = agents.local_expert()
|
|
travel_concierge_agent = agents.travel_concierge()
|
|
|
|
identify_task = tasks.identify_task(
|
|
city_selector_agent,
|
|
self.origin,
|
|
self.cities,
|
|
self.interests,
|
|
self.date_range
|
|
)
|
|
gather_task = tasks.gather_task(
|
|
local_expert_agent,
|
|
self.origin,
|
|
self.interests,
|
|
self.date_range
|
|
)
|
|
plan_task = tasks.plan_task(
|
|
travel_concierge_agent,
|
|
self.origin,
|
|
self.interests,
|
|
self.date_range
|
|
)
|
|
|
|
crew = Crew(
|
|
agents=[
|
|
city_selector_agent, local_expert_agent, travel_concierge_agent
|
|
],
|
|
tasks=[identify_task, gather_task, plan_task],
|
|
verbose=True
|
|
)
|
|
|
|
result = crew.kickoff()
|
|
return result
|
|
|
|
if __name__ == "__main__":
|
|
print("## Welcome to Trip Planner Crew")
|
|
print('-------------------------------')
|
|
location = input(
|
|
dedent("""
|
|
From where will you be traveling from?
|
|
"""))
|
|
cities = input(
|
|
dedent("""
|
|
What are the cities options you are interested in visiting?
|
|
"""))
|
|
date_range = input(
|
|
dedent("""
|
|
What is the date range you are interested in traveling?
|
|
"""))
|
|
interests = input(
|
|
dedent("""
|
|
What are some of your high level interests and hobbies?
|
|
"""))
|
|
|
|
trip_crew = TripCrew(location, cities, date_range, interests)
|
|
result = trip_crew.run()
|
|
print("\n\n########################")
|
|
print("## Here is you Trip Plan")
|
|
print("########################\n")
|
|
print(result)
|