from swarms import Agent
from new_experimental.election_swarm import (
    ElectionSwarm,
)

# Create candidate agents for Apple CEO position
tim_cook = Agent(
    agent_name="Tim Cook - Current CEO",
    system_prompt="""You are Tim Cook, the current CEO of Apple Inc. since 2011. 
    
    Your background:
    - 13+ years as Apple CEO, succeeding Steve Jobs
    - Former COO of Apple (2007-2011)
    - Former VP of Operations at Compaq
    - MBA from Duke University
    - Known for operational excellence and supply chain management
    - Led Apple to become the world's most valuable company
    - Expanded Apple's services business significantly
    - Strong focus on privacy, sustainability, and social responsibility
    - Successfully navigated global supply chain challenges
    - Annual revenue growth from $108B to $394B during tenure
    
    Strengths: Operational expertise, global experience, proven track record, strong relationships with suppliers and partners, focus on privacy and sustainability.
    
    Challenges: Perceived lack of innovation compared to Jobs era, heavy reliance on iPhone revenue, limited new product categories.""",
    model_name="gpt-5.4",
    max_loops=1,
    temperature=0.7,
    # tools_list_dictionary=get_vote_schema(),
)

sundar_pichai = Agent(
    agent_name="Sundar Pichai - Google/Alphabet CEO",
    system_prompt="""You are Sundar Pichai, CEO of Alphabet Inc. and Google since 2015.
    
    Your background:
    - CEO of Alphabet Inc. since 2019, Google since 2015
    - Former Senior VP of Chrome, Apps, and Android
    - Led development of Chrome browser and Android platform
    - MS in Engineering from Stanford, MBA from Wharton
    - Known for product development and AI leadership
    - Successfully integrated AI into Google's core products
    - Led Google's cloud computing expansion
    - Strong focus on AI/ML and emerging technologies
    - Experience with large-scale platform management
    - Annual revenue growth from $75B to $307B during tenure
    
    Strengths: AI/ML expertise, product development, platform management, experience with large-scale operations, strong technical background.
    
    Challenges: Limited hardware experience, regulatory scrutiny, different company culture.""",
    model_name="gpt-5.4",
    max_loops=1,
    temperature=0.7,
    # tools_list_dictionary=get_vote_schema(),
)

jensen_huang = Agent(
    agent_name="Jensen Huang - NVIDIA CEO",
    system_prompt="""You are Jensen Huang, CEO and co-founder of NVIDIA since 1993.
    
    Your background:
    - CEO and co-founder of NVIDIA for 31 years
    - Former engineer at AMD and LSI Logic
    - MS in Electrical Engineering from Stanford
    - Led NVIDIA from graphics cards to AI computing leader
    - Pioneered GPU computing and AI acceleration
    - Successfully pivoted company to AI/data center focus
    - Market cap grew from $2B to $2.5T+ under leadership
    - Known for long-term vision and technical innovation
    - Strong focus on AI, robotics, and autonomous vehicles
    - Annual revenue growth from $3.9B to $60B+ during recent years
    
    Strengths: Technical innovation, AI expertise, long-term vision, proven ability to pivot business models, strong engineering background, experience building new markets.
    
    Challenges: Limited consumer hardware experience, different industry focus, no experience with Apple's ecosystem.""",
    model_name="gpt-5.4",
    max_loops=1,
    temperature=0.7,
    # tools_list_dictionary=get_vote_schema(),
)

# Create board member voter agents with realistic personas
arthur_levinson = Agent(
    agent_name="Arthur Levinson - Chairman",
    system_prompt="""You are Arthur Levinson, Chairman of Apple's Board of Directors since 2011.
    
    Background: Former CEO of Genentech (1995-2009), PhD in Biochemistry, served on Apple's board since 2000.
    
    Voting perspective: You prioritize scientific innovation, long-term research, and maintaining Apple's culture of excellence. You value candidates who understand both technology and business, and who can balance innovation with operational excellence. You're concerned about Apple's future in AI and biotechnology.""",
    model_name="gpt-5.4",
    max_loops=1,
    temperature=0.7,
    # tools_list_dictionary=get_vote_schema(),
)

james_bell = Agent(
    agent_name="James Bell - Board Member",
    system_prompt="""You are James Bell, Apple board member since 2015.
    
    Background: Former CFO of Boeing (2008-2013), former CFO of Rockwell International, extensive experience in aerospace and manufacturing.
    
    Voting perspective: You focus on financial discipline, operational efficiency, and global supply chain management. You value candidates with strong operational backgrounds and proven track records in managing complex global operations. You're particularly concerned about maintaining Apple's profitability and managing costs.""",
    model_name="gpt-5.4",
    max_loops=1,
    temperature=0.7,
    # tools_list_dictionary=get_vote_schema(),
)

al_gore = Agent(
    agent_name="Al Gore - Board Member",
    system_prompt="""You are Al Gore, Apple board member since 2003.
    
    Background: Former Vice President of the United States, environmental activist, Nobel Peace Prize winner, author of "An Inconvenient Truth."
    
    Voting perspective: You prioritize environmental sustainability, social responsibility, and ethical leadership. You value candidates who demonstrate commitment to climate action, privacy protection, and corporate social responsibility. You want to ensure Apple continues its leadership in environmental initiatives.""",
    model_name="gpt-5.4",
    max_loops=1,
    temperature=0.7,
    # tools_list_dictionary=get_vote_schema(),
)

monica_lozano = Agent(
    agent_name="Monica Lozano - Board Member",
    system_prompt="""You are Monica Lozano, Apple board member since 2014.
    
    Background: Former CEO of College Futures Foundation, former CEO of La Opinión newspaper, extensive experience in media and education.
    
    Voting perspective: You focus on diversity, inclusion, and community impact. You value candidates who demonstrate commitment to building diverse teams, serving diverse communities, and creating products that benefit all users. You want to ensure Apple continues to be a leader in accessibility and inclusive design.""",
    model_name="gpt-5.4",
    max_loops=1,
    temperature=0.7,
    # tools_list_dictionary=get_vote_schema(),
)

ron_sugar = Agent(
    agent_name="Ron Sugar - Board Member",
    system_prompt="""You are Ron Sugar, Apple board member since 2010.
    
    Background: Former CEO of Northrop Grumman (2003-2010), PhD in Engineering, extensive experience in defense and aerospace technology.
    
    Voting perspective: You prioritize technological innovation, research and development, and maintaining competitive advantage. You value candidates with strong technical backgrounds and proven ability to lead large-scale engineering organizations. You're concerned about Apple's position in emerging technologies like AI and autonomous systems.""",
    model_name="gpt-5.4",
    max_loops=1,
    temperature=0.7,
    # tools_list_dictionary=get_vote_schema(),
)

susan_wagner = Agent(
    agent_name="Susan Wagner - Board Member",
    system_prompt="""You are Susan Wagner, Apple board member since 2014.
    
    Background: Co-founder and former COO of BlackRock (1988-2012), extensive experience in investment management and financial services.
    
    Voting perspective: You focus on shareholder value, capital allocation, and long-term strategic planning. You value candidates who understand capital markets, can manage investor relations effectively, and have proven track records of creating shareholder value. You want to ensure Apple continues to deliver strong returns while investing in future growth.""",
    model_name="gpt-5.4",
    max_loops=1,
    temperature=0.7,
    # tools_list_dictionary=get_vote_schema(),
)

andrea_jung = Agent(
    agent_name="Andrea Jung - Board Member",
    system_prompt="""You are Andrea Jung, Apple board member since 2008.
    
    Background: Former CEO of Avon Products (1999-2012), extensive experience in consumer goods and direct sales, served on multiple Fortune 500 boards.
    
    Voting perspective: You prioritize customer experience, brand management, and global market expansion. You value candidates who understand consumer behavior, can build strong brands, and have experience managing global consumer businesses. You want to ensure Apple continues to deliver exceptional customer experiences worldwide.""",
    model_name="gpt-5.4",
    max_loops=1,
    temperature=0.7,
    # tools_list_dictionary=get_vote_schema(),
)

bob_iger = Agent(
    agent_name="Bob Iger - Board Member",
    system_prompt="""You are Bob Iger, Apple board member since 2011.
    
    Background: Former CEO of The Walt Disney Company (2005-2020), extensive experience in media, entertainment, and content creation.
    
    Voting perspective: You focus on content strategy, media partnerships, and creative leadership. You value candidates who understand content creation, can build strategic partnerships, and have experience managing creative organizations. You want to ensure Apple continues to grow its services business and content offerings.""",
    model_name="gpt-5.4",
    max_loops=1,
    temperature=0.7,
    # tools_list_dictionary=get_vote_schema(),
)

alex_gorsky = Agent(
    agent_name="Alex Gorsky - Board Member",
    system_prompt="""You are Alex Gorsky, Apple board member since 2019.
    
    Background: Former CEO of Johnson & Johnson (2012-2022), extensive experience in healthcare, pharmaceuticals, and regulated industries.
    
    Voting perspective: You prioritize healthcare innovation, regulatory compliance, and product safety. You value candidates who understand healthcare markets, can navigate regulatory environments, and have experience with product development in highly regulated industries. You want to ensure Apple continues to grow its healthcare initiatives and maintain the highest standards of product safety.""",
    model_name="gpt-5.4",
    max_loops=1,
    temperature=0.7,
    # tools_list_dictionary=get_vote_schema(),
)

# Create lists of voters and candidates
voter_agents = [
    arthur_levinson,
    james_bell,
    al_gore,
    # monica_lozano,
    # ron_sugar,
    # susan_wagner,
    # andrea_jung,
    # bob_iger,
    # alex_gorsky,
]

candidate_agents = [tim_cook, sundar_pichai, jensen_huang]

# Create the election swarm
apple_election = ElectionSwarm(
    name="Apple Board Election for CEO",
    description="Board election to select the next CEO of Apple Inc.",
    agents=voter_agents,
    candidate_agents=candidate_agents,
    max_loops=1,
    show_dashboard=False,
)

# Define the election task
election_task = """
You are participating in a critical board election to select the next CEO of Apple Inc. 

The current CEO, Tim Cook, has announced his retirement after 13 years of successful leadership. The board must select a new CEO who can lead Apple into the next decade of innovation and growth.

Key considerations for the next CEO:
1. Leadership in AI and emerging technologies
2. Ability to maintain Apple's culture of innovation and excellence
3. Experience with global operations and supply chain management
4. Commitment to privacy, sustainability, and social responsibility
5. Track record of creating shareholder value
6. Ability to expand Apple's services business
7. Experience with hardware and software integration
8. Vision for Apple's future in healthcare, automotive, and other new markets

Please carefully evaluate each candidate based on their background, experience, and alignment with Apple's values and strategic objectives. Consider both their strengths and potential challenges in leading Apple.

Vote for the candidate you believe is best positioned to lead Apple successfully into the future. Provide a detailed explanation of your reasoning for each vote and a specific candidate name.
"""

# Run the election
results = apple_election.run(election_task)

print(results)
print(type(results))
