import os from swarms import Agent, ConcurrentWorkflow, OpenAIChat # Initialize agents model = OpenAIChat( api_key=os.getenv("OPENAI_API_KEY"), model_name="gpt-4o-mini", temperature=0.1, ) # Define custom system prompts for each social media platform TWITTER_AGENT_SYS_PROMPT = """ You are a Twitter marketing expert specializing in real estate. Your task is to create engaging, concise tweets to promote properties, analyze trends to maximize engagement, and use appropriate hashtags and timing to reach potential buyers. """ INSTAGRAM_AGENT_SYS_PROMPT = """ You are an Instagram marketing expert focusing on real estate. Your task is to create visually appealing posts with engaging captions and hashtags to showcase properties, targeting specific demographics interested in real estate. """ FACEBOOK_AGENT_SYS_PROMPT = """ You are a Facebook marketing expert for real estate. Your task is to craft posts optimized for engagement and reach on Facebook, including using images, links, and targeted messaging to attract potential property buyers. """ LINKEDIN_AGENT_SYS_PROMPT = """ You are a LinkedIn marketing expert for the real estate industry. Your task is to create professional and informative posts, highlighting property features, market trends, and investment opportunities, tailored to professionals and investors. """ EMAIL_AGENT_SYS_PROMPT = """ You are an Email marketing expert specializing in real estate. Your task is to write compelling email campaigns to promote properties, focusing on personalization, subject lines, and effective call-to-action strategies to drive conversions. """ # Initialize your agents for different social media platforms agents = [ Agent( agent_name="Twitter-RealEstate-Agent", system_prompt=TWITTER_AGENT_SYS_PROMPT, llm=model, max_loops=1, dynamic_temperature_enabled=True, saved_state_path="twitter_realestate_agent.json", user_name="swarm_corp", retry_attempts=1, ), Agent( agent_name="Instagram-RealEstate-Agent", system_prompt=INSTAGRAM_AGENT_SYS_PROMPT, llm=model, max_loops=1, dynamic_temperature_enabled=True, saved_state_path="instagram_realestate_agent.json", user_name="swarm_corp", retry_attempts=1, ), Agent( agent_name="Facebook-RealEstate-Agent", system_prompt=FACEBOOK_AGENT_SYS_PROMPT, llm=model, max_loops=1, dynamic_temperature_enabled=True, saved_state_path="facebook_realestate_agent.json", user_name="swarm_corp", retry_attempts=1, ), Agent( agent_name="LinkedIn-RealEstate-Agent", system_prompt=LINKEDIN_AGENT_SYS_PROMPT, llm=model, max_loops=1, dynamic_temperature_enabled=True, saved_state_path="linkedin_realestate_agent.json", user_name="swarm_corp", retry_attempts=1, ), Agent( agent_name="Email-RealEstate-Agent", system_prompt=EMAIL_AGENT_SYS_PROMPT, llm=model, max_loops=1, dynamic_temperature_enabled=True, saved_state_path="email_realestate_agent.json", user_name="swarm_corp", retry_attempts=1, ), ] # Initialize workflow workflow = ConcurrentWorkflow( name="Real Estate Marketing Swarm", agents=agents, metadata_output_path="metadata.json", description="Concurrent swarm of content generators for real estate!", auto_save=True, ) # Run workflow task = "Analyze the financial impact of a new product launch." metadata = workflow.run(task) print(metadata)