From a84ea0cd63928473baa82e31e0de156d5baae1eb Mon Sep 17 00:00:00 2001 From: Aksh Parekh Date: Sun, 28 Sep 2025 14:52:37 -0700 Subject: [PATCH 1/9] [DEMO][DOCS] Real Estate Swarm --- docs/examples/realestate_swarm.md | 555 ++++++++++++++++++ docs/mkdocs.yml | 1 + .../demos/real_estate/realestate_swarm.py | 474 +++++++++++++++ 3 files changed, 1030 insertions(+) create mode 100644 docs/examples/realestate_swarm.md create mode 100644 examples/demos/real_estate/realestate_swarm.py diff --git a/docs/examples/realestate_swarm.md b/docs/examples/realestate_swarm.md new file mode 100644 index 00000000..4d9494b0 --- /dev/null +++ b/docs/examples/realestate_swarm.md @@ -0,0 +1,555 @@ +# Real Estate Swarm + +The Real Estate Swarm is a multi-agent system designed to automate and streamline the entire real estate transaction workflow. From lead generation to property maintenance, this swarm orchestrates a series of specialized AI agents to handle various aspects of buying, selling, and managing properties. + +## What it Does + +The `RealEstateSwarm` operates as a **sequential workflow**, where each agent's output feeds into the next, ensuring a cohesive and comprehensive process. The swarm consists of the following agents: + +1. **Lead Generation Agent (Alex)**: Identifies and qualifies potential real estate clients by gathering their property requirements, budget, preferred locations, and investment goals. This agent also uses the `exa_search` tool for initial lead information. +2. **Property Research Agent (Emma)**: Conducts in-depth research on properties matching client criteria and market trends. It leverages the `exa_search` tool to gather up-to-date information on local market trends, property values, investment potential, and neighborhood insights. +3. **Marketing Agent (Jack)**: Develops and executes marketing strategies to promote properties. This includes creating compelling listings, implementing digital marketing campaigns, and managing client interactions. +4. **Transaction Management Agent (Sophia)**: Handles all documentation, legal, and financial aspects of property transactions, ensuring compliance and smooth closing processes. +5. **Property Maintenance Agent (Michael)**: Manages property condition, oversees maintenance and repairs, and prepares properties for sale or rental, including staging and enhancing curb appeal. + +## How to Set Up + +To set up and run the Real Estate Swarm, follow these steps: + +### Prerequisites + +* Python 3.8+ +* Poetry (or pip) for dependency management +* An Exa API Key (for the `exa_search` tool) + +### Installation + +1. **Clone the Swarms repository:** + ```bash + git clone https://github.com/kyegomez/swarms.git + cd swarms + ``` +2. **Install dependencies:** + If using Poetry: + ```bash + poetry install + ``` + If using pip: + ```bash + pip install -r requirements.txt + ``` +3. **Set up Exa API Key:** + The `Property Research Agent` utilizes the `exa_search` tool, which requires an `EXA_API_KEY`. + Create a `.env` file in the root directory of your project (or wherever your application loads environment variables) and add your Exa API key: + ``` + EXA_API_KEY="YOUR_EXA_API_KEY" + ``` + Replace `"YOUR_EXA_API_KEY"` with your actual Exa API key. + +## How to Run + +Navigate to the `examples/demos/real_estate/` directory and run the `realestate_swarm.py` script. + +OR run the following code + +```python + +from typing import List + +from swarms.structs.agent import Agent +from swarms.structs.conversation import Conversation +from swarms.utils.history_output_formatter import history_output_formatter + +# --- Exa Search Tool Integration --- +# Import and define exa_search as a callable tool for property research. +import os +from dotenv import load_dotenv +from loguru import logger +import httpx +from swarms.utils.any_to_str import any_to_str + +def exa_search( + query: str, + characters: int = 100, + sources: int = 1, +) -> str: + """ + Perform a highly summarized Exa web search. + + Args: + query (str): Search query. + characters (int): Max characters for summary. + sources (int): Number of sources. + + Returns: + str: Most concise summary of search results. + """ + api_key = os.getenv("EXA_API_KEY") + if not api_key: + raise ValueError("EXA_API_KEY environment variable is not set") + + headers = { + "x-api-key": api_key, + "content-type": "application/json", + } + + payload = { + "query": query, + "type": "auto", + "numResults": sources, + "contents": { + "text": True, + "summary": { + "schema": { + "type": "object", + "required": ["answer"], + "additionalProperties": False, + "properties": { + "answer": { + "type": "string", + "description": "Highly condensed summary of the search result", + } + }, + } + }, + "context": {"maxCharacters": characters}, + }, + } + + try: + logger.info(f"[SEARCH] Exa summarized search: {query[:50]}...") + response = httpx.post( + "https://api.exa.ai/search", + json=payload, + headers=headers, + timeout=30, + ) + response.raise_for_status() + json_data = response.json() + return any_to_str(json_data) + except Exception as e: + logger.error(f"Exa search failed: {e}") + return f"Search failed: {str(e)}. Please try again." + +# Load environment variables for Exa API key +load_dotenv() + +# System prompts for each agent + +LEAD_GENERATION_PROMPT = """ +You are the Lead Generation Agent for Real Estate. + +ROLE: +Collect potential leads for real estate transactions by identifying buyers, sellers, and investors through various channels. + +RESPONSIBILITIES: +- Identify potential clients through: + * Real estate websites + * Social media platforms + * Referral networks + * Local community events +- Conduct initial consultations to understand: + * Client's property requirements + * Budget constraints + * Preferred locations + * Investment goals +- Qualify leads by assessing: + * Financial readiness + * Specific property needs + * Urgency of transaction + +OUTPUT FORMAT: +Provide a comprehensive lead report that includes: +1. Client profile and contact information +2. Detailed requirements and preferences +3. Initial assessment of client's real estate goals +4. Qualification status +5. Recommended next steps + +IMPORTANT CONTEXT SHARING: +When preparing the lead report, clearly summarize and include all answers and information provided by the user. Integrate these user responses directly into your analysis and the lead report. This ensures that when your report is sent to the next agent, it contains all relevant user preferences, requirements, and context needed for further research and decision-making. + +REMEMBER: +- Ensure the user's answers are explicitly included in your report so the next agent can use them for property research and analysis. +""" + +PROPERTY_RESEARCH_PROMPT = """ +You are the Property Research Agent for Real Estate. +ROLE: +Conduct in-depth research on properties that match client criteria and market trends. + +TOOLS: +You have access to the exa_search tool. Use exa_search to find up-to-date and relevant information about properties, market trends, and neighborhood data. Leverage the answers provided by the user and the outputs from previous agents to formulate your search queries. Always use exa_search to supplement your research and validate your findings. + +RESPONSIBILITIES: +- Perform comprehensive property market analysis using exa_search: + * Local market trends + * Property value assessments + * Investment potential + * Neighborhood evaluations +- Research properties matching client specifications (using both user answers and previous agent outputs): + * Price range + * Location preferences + * Property type + * Specific amenities +- Compile detailed property reports including: + * Comparative market analysis (use exa_search for recent comps) + * Property history + * Potential appreciation + * Neighborhood insights (gathered via exa_search) + +INSTRUCTIONS: +- Always use exa_search to find the most current and relevant information for your analysis. +- Formulate your exa_search queries based on the user's answers and the outputs from previous agents. +- Clearly indicate in your report where exa_search was used to obtain information. + +OUTPUT FORMAT: +Provide a structured property research report: +1. Shortlist of matching properties (include sources from exa_search) +2. Detailed property analysis for each option (cite exa_search findings) +3. Market trend insights (supported by exa_search data) +4. Investment potential assessment +5. Recommendations for client consideration + +REMEMBER: +Do not rely solely on prior knowledge. Always use exa_search to verify and enhance your research with the latest available data. +""" + +MARKETING_PROMPT = """ +You are the Marketing Agent for Real Estate. +ROLE: +Develop and execute marketing strategies to promote properties and attract potential buyers. +RESPONSIBILITIES: +- Create compelling property listings: + * Professional photography + * Detailed property descriptions + * Highlight unique selling points +- Implement digital marketing strategies: + * Social media campaigns + * Email marketing + * Online property platforms + * Targeted advertising +- Manage client interactions: + * Respond to property inquiries + * Schedule property viewings + * Facilitate initial negotiations +OUTPUT FORMAT: +Provide a comprehensive marketing report: +1. Marketing strategy overview +2. Property listing details +3. Marketing channel performance +4. Client inquiry and viewing logs +5. Initial negotiation summaries +""" + +TRANSACTION_MANAGEMENT_PROMPT = """ +You are the Transaction Management Agent for Real Estate. +ROLE: +Handle all documentation, legal, and financial aspects of property transactions. +RESPONSIBILITIES: +- Manage transaction documentation: + * Prepare purchase agreements + * Coordinate legal paperwork + * Ensure compliance with real estate regulations +- Facilitate transaction process: + * Coordinate with attorneys + * Liaise with lenders + * Manage escrow processes + * Coordinate property inspections +- Ensure smooth closing: + * Verify all financial requirements + * Coordinate final document signings + * Manage fund transfers +OUTPUT FORMAT: +Provide a detailed transaction management report: +1. Transaction document status +2. Legal and financial coordination details +3. Inspection and verification logs +4. Closing process timeline +5. Recommendations for transaction completion +""" + +PROPERTY_MAINTENANCE_PROMPT = """ +You are the Property Maintenance Agent for Real Estate. +ROLE: +Manage property condition, maintenance, and preparation for sale or rental. +RESPONSIBILITIES: +- Conduct regular property inspections: + * Assess property condition + * Identify maintenance needs + * Ensure safety standards +- Coordinate maintenance and repairs: + * Hire and manage contractors + * Oversee repair and renovation work + * Manage landscaping and cleaning +- Prepare properties for market: + * Stage properties + * Enhance curb appeal + * Recommend cost-effective improvements +OUTPUT FORMAT: +Provide a comprehensive property maintenance report: +1. Inspection findings +2. Maintenance and repair logs +3. Improvement recommendations +4. Property readiness status +5. Contractor and service provider details +""" + +class RealEstateSwarm: + def __init__( + self, + name: str = "Real Estate Swarm", + description: str = "A comprehensive AI-driven real estate transaction workflow", + max_loops: int = 1, + user_name: str = "Real Estate Manager", + property_type: str = "Residential", + output_type: str = "json", + user_lead_info: str = "", + ): + self.max_loops = max_loops + self.name = name + self.description = description + self.user_name = user_name + self.property_type = property_type + self.output_type = output_type + self.user_lead_info = user_lead_info + + self.agents = self._initialize_agents() + self.conversation = Conversation() + self.handle_initial_processing() + self.exa_search_results = [] # Store exa_search results for property research + + def handle_initial_processing(self): + self.conversation.add( + role=self.user_name, + content=f"Company: {self.name}\n" + f"Description: {self.description}\n" + f"Property Type: {self.property_type}" + ) + + def _initialize_agents(self) -> List[Agent]: + return [ + Agent( + agent_name="Alex-Lead-Generation", + agent_description="Identifies and qualifies potential real estate clients across various channels.", + system_prompt=LEAD_GENERATION_PROMPT, + max_loops=self.max_loops, + dynamic_temperature_enabled=True, + output_type="final", + ), + Agent( + agent_name="Emma-Property-Research", + agent_description="Conducts comprehensive property research and market analysis.", + system_prompt=PROPERTY_RESEARCH_PROMPT, + max_loops=self.max_loops, + dynamic_temperature_enabled=True, + output_type="final", + ), + Agent( + agent_name="Jack-Marketing", + agent_description="Develops and executes marketing strategies for properties.", + system_prompt=MARKETING_PROMPT, + max_loops=self.max_loops, + dynamic_temperature_enabled=True, + output_type="final", + ), + Agent( + agent_name="Sophia-Transaction-Management", + agent_description="Manages legal and financial aspects of real estate transactions.", + system_prompt=TRANSACTION_MANAGEMENT_PROMPT, + max_loops=self.max_loops, + dynamic_temperature_enabled=True, + output_type="final", + ), + Agent( + agent_name="Michael-Property-Maintenance", + agent_description="Oversees property condition, maintenance, and market preparation.", + system_prompt=PROPERTY_MAINTENANCE_PROMPT, + max_loops=self.max_loops, + dynamic_temperature_enabled=True, + output_type="final", + ), + ] + + def find_agent_by_name(self, name: str) -> Agent: + for agent in self.agents: + if name in agent.agent_name: + return agent + return None + + def lead_generation(self): + alex_agent = self.find_agent_by_name("Lead-Generation") + # Directly inject the user_lead_info into the prompt for the first agent + alex_output = alex_agent.run( + f"User Lead Information:\n{self.user_lead_info}\n\n" + f"History: {self.conversation.get_str()}\n" + f"Generate leads for {self.property_type} real estate transactions. Identify potential clients and their specific requirements." + ) + self.conversation.add( + role="Lead-Generation", content=alex_output + ) + + # --- After lead generation, use user_lead_info as queries for exa_search --- + queries = [] + if isinstance(self.user_lead_info, list): + queries = [str(q) for q in self.user_lead_info if str(q).strip()] + elif isinstance(self.user_lead_info, str): + if "\n" in self.user_lead_info: + queries = [q.strip() for q in self.user_lead_info.split("\n") if q.strip()] + else: + queries = [self.user_lead_info.strip()] if self.user_lead_info.strip() else [] + + self.exa_search_results = [] + for q in queries: + result = exa_search(q) + self.exa_search_results.append({ + "query": q, + "exa_result": result + }) + + def property_research(self): + emma_agent = self.find_agent_by_name("Property-Research") + # Pass ALL exa_search results as direct context to the property research agent + exa_context = "" + if hasattr(self, "exa_search_results") and self.exa_search_results: + # Directly inject all exa_search results as context + exa_context = "\n\n[Exa Search Results]\n" + for item in self.exa_search_results: + exa_context += f"Query: {item['query']}\nExa Search Result: {item['exa_result']}\n" + + emma_output = emma_agent.run( + f"History: {self.conversation.get_str()}\n" + f"{exa_context}" + f"Conduct research on {self.property_type} properties, analyze market trends, and prepare a comprehensive property report." + ) + self.conversation.add( + role="Property-Research", content=emma_output + ) + + def property_marketing(self): + jack_agent = self.find_agent_by_name("Marketing") + jack_output = jack_agent.run( + f"History: {self.conversation.get_str()}\n" + f"Develop marketing strategies for {self.property_type} properties, create listings, and manage client interactions." + ) + self.conversation.add( + role="Marketing", content=jack_output + ) + + def transaction_management(self): + sophia_agent = self.find_agent_by_name("Transaction-Management") + sophia_output = sophia_agent.run( + f"History: {self.conversation.get_str()}\n" + f"Manage legal and financial aspects of the {self.property_type} property transaction." + ) + self.conversation.add( + role="Transaction-Management", content=sophia_output + ) + + def property_maintenance(self): + michael_agent = self.find_agent_by_name("Property-Maintenance") + michael_output = michael_agent.run( + f"History: {self.conversation.get_str()}\n" + f"Assess and manage maintenance for the {self.property_type} property to prepare it for market." + ) + self.conversation.add( + role="Property-Maintenance", content=michael_output + ) + + def run(self, task: str): + """ + Process the real estate workflow through the swarm, coordinating tasks among agents. + """ + self.conversation.add(role=self.user_name, content=task) + + # Execute workflow stages + self.lead_generation() + self.property_research() + self.property_marketing() + self.transaction_management() + self.property_maintenance() + + return history_output_formatter( + self.conversation, type=self.output_type + ) + +def main(): + """FOR ACTUAL INPUT FROM USER""" + # # Collect user lead information at the beginning + # print("Please provide the following information for lead generation:") + # questions = [ + # "What are the client's property requirements?", + # "What is the client's budget range or constraints?", + # "What are the client's preferred locations?", + # "What are the client's investment goals?", + # "What is the client's contact information?", + # "What is the urgency of the transaction?", + # "Is the client financially ready to proceed?" + # ] + + # user_lead_info = "" + # for q in questions: + # answer = input(f"{q}\n> ").strip() + # user_lead_info += f"Q: {q}\nA: {answer if answer else '[No answer provided]'}\n\n" + # Pre-filled placeholder answers for each question + user_lead_info = [ + "Spacious 3-bedroom apartment with modern amenities", + "$1,000,000 - $1,500,000", + "Downtown Manhattan, Upper East Side", + "Long-term investment with high ROI", + "john.doe@email.com, +1-555-123-4567", + "Within the next 3 months", + "Yes, pre-approved for mortgage" + ] + + + # Initialize the swarm + real_estate_swarm = RealEstateSwarm( + max_loops=1, + name="Global Real Estate Solutions", + description="Comprehensive AI-driven real estate transaction workflow", + user_name="Real Estate Director", + property_type="Luxury Residential", + output_type="json", + user_lead_info=user_lead_info, + ) + + # Sample real estate task + sample_task = """ + We have a high-end luxury residential property in downtown Manhattan. + Client requirements: + - Sell the property quickly + - Target high-net-worth individuals + - Maximize property value + - Ensure smooth and discreet transaction + """ + # Run the swarm + real_estate_swarm.run(task=sample_task) + +if __name__ == "__main__": + main() + +``` + +## How it Can Be Used for Real Estate + +The Real Estate Swarm can be utilized for a variety of real estate tasks, providing an automated and efficient approach to complex workflows: + +* **Automated Lead Qualification**: Automatically gather and assess potential client needs and financial readiness. +* **Comprehensive Property Analysis**: Rapidly research and generate detailed reports on properties and market trends using real-time web search capabilities. +* **Streamlined Marketing**: Develop and execute marketing strategies, including listing creation and social media campaigns. +* **Efficient Transaction Management**: Automate the handling of legal documents, financial coordination, and closing processes. +* **Proactive Property Maintenance**: Manage property upkeep and prepare assets for optimal market presentation. + +By chaining these specialized agents, the Real Estate Swarm provides an end-to-end solution for real estate professionals, reducing manual effort and increasing operational efficiency. + +## Contributing to Swarms +| Platform | Link | Description | +|----------|------|-------------| +| 📚 Documentation | [docs.swarms.world](https://docs.swarms.world) | Official documentation and guides | +| 📝 Blog | [Medium](https://medium.com/@kyeg) | Latest updates and technical articles | +| 💬 Discord | [Join Discord](https://discord.gg/EamjgSaEQf) | Live chat and community support | +| 🐦 Twitter | [@kyegomez](https://twitter.com/kyegomez) | Latest news and announcements | +| 👥 LinkedIn | [The Swarm Corporation](https://www.linkedin.com/company/the-swarm-corporation) | Professional network and updates | +| 📺 YouTube | [Swarms Channel](https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ) | Tutorials and demos | +| 🎫 Events | [Sign up here](https://lu.ma/5p2jnc2v) | Join our community events | \ No newline at end of file diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 944e8a03..f7dcb7ed 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -417,6 +417,7 @@ nav: - Hiearchical Marketing Team: "examples/marketing_team.md" - Gold ETF Research with HeavySwarm: "examples/gold_etf_research.md" - Hiring Swarm: "examples/hiring_swarm.md" + - Real Estate Swarm: "examples/realestate_swarm.md" - Tools & Integrations: - Web Search with Exa: "examples/exa_search.md" diff --git a/examples/demos/real_estate/realestate_swarm.py b/examples/demos/real_estate/realestate_swarm.py new file mode 100644 index 00000000..ff88b023 --- /dev/null +++ b/examples/demos/real_estate/realestate_swarm.py @@ -0,0 +1,474 @@ +from typing import List + +from swarms.structs.agent import Agent +from swarms.structs.conversation import Conversation +from swarms.utils.history_output_formatter import history_output_formatter + +# --- Exa Search Tool Integration --- +# Import and define exa_search as a callable tool for property research. +import os +from dotenv import load_dotenv +from loguru import logger +import httpx +from swarms.utils.any_to_str import any_to_str + +def exa_search( + query: str, + characters: int = 100, + sources: int = 1, +) -> str: + """ + Perform a highly summarized Exa web search. + + Args: + query (str): Search query. + characters (int): Max characters for summary. + sources (int): Number of sources. + + Returns: + str: Most concise summary of search results. + """ + api_key = os.getenv("EXA_API_KEY") + if not api_key: + raise ValueError("EXA_API_KEY environment variable is not set") + + headers = { + "x-api-key": api_key, + "content-type": "application/json", + } + + payload = { + "query": query, + "type": "auto", + "numResults": sources, + "contents": { + "text": True, + "summary": { + "schema": { + "type": "object", + "required": ["answer"], + "additionalProperties": False, + "properties": { + "answer": { + "type": "string", + "description": "Highly condensed summary of the search result", + } + }, + } + }, + "context": {"maxCharacters": characters}, + }, + } + + try: + logger.info(f"[SEARCH] Exa summarized search: {query[:50]}...") + response = httpx.post( + "https://api.exa.ai/search", + json=payload, + headers=headers, + timeout=30, + ) + response.raise_for_status() + json_data = response.json() + return any_to_str(json_data) + except Exception as e: + logger.error(f"Exa search failed: {e}") + return f"Search failed: {str(e)}. Please try again." + +# Load environment variables for Exa API key +load_dotenv() + +# System prompts for each agent + +LEAD_GENERATION_PROMPT = """ +You are the Lead Generation Agent for Real Estate. + +ROLE: +Collect potential leads for real estate transactions by identifying buyers, sellers, and investors through various channels. + +RESPONSIBILITIES: +- Identify potential clients through: + * Real estate websites + * Social media platforms + * Referral networks + * Local community events +- Conduct initial consultations to understand: + * Client's property requirements + * Budget constraints + * Preferred locations + * Investment goals +- Qualify leads by assessing: + * Financial readiness + * Specific property needs + * Urgency of transaction + +OUTPUT FORMAT: +Provide a comprehensive lead report that includes: +1. Client profile and contact information +2. Detailed requirements and preferences +3. Initial assessment of client's real estate goals +4. Qualification status +5. Recommended next steps + +IMPORTANT CONTEXT SHARING: +When preparing the lead report, clearly summarize and include all answers and information provided by the user. Integrate these user responses directly into your analysis and the lead report. This ensures that when your report is sent to the next agent, it contains all relevant user preferences, requirements, and context needed for further research and decision-making. + +REMEMBER: +- Ensure the user's answers are explicitly included in your report so the next agent can use them for property research and analysis. +""" + +PROPERTY_RESEARCH_PROMPT = """ +You are the Property Research Agent for Real Estate. +ROLE: +Conduct in-depth research on properties that match client criteria and market trends. + +TOOLS: +You have access to the exa_search tool. Use exa_search to find up-to-date and relevant information about properties, market trends, and neighborhood data. Leverage the answers provided by the user and the outputs from previous agents to formulate your search queries. Always use exa_search to supplement your research and validate your findings. + +RESPONSIBILITIES: +- Perform comprehensive property market analysis using exa_search: + * Local market trends + * Property value assessments + * Investment potential + * Neighborhood evaluations +- Research properties matching client specifications (using both user answers and previous agent outputs): + * Price range + * Location preferences + * Property type + * Specific amenities +- Compile detailed property reports including: + * Comparative market analysis (use exa_search for recent comps) + * Property history + * Potential appreciation + * Neighborhood insights (gathered via exa_search) + +INSTRUCTIONS: +- Always use exa_search to find the most current and relevant information for your analysis. +- Formulate your exa_search queries based on the user's answers and the outputs from previous agents. +- Clearly indicate in your report where exa_search was used to obtain information. + +OUTPUT FORMAT: +Provide a structured property research report: +1. Shortlist of matching properties (include sources from exa_search) +2. Detailed property analysis for each option (cite exa_search findings) +3. Market trend insights (supported by exa_search data) +4. Investment potential assessment +5. Recommendations for client consideration + +REMEMBER: +Do not rely solely on prior knowledge. Always use exa_search to verify and enhance your research with the latest available data. +""" + +MARKETING_PROMPT = """ +You are the Marketing Agent for Real Estate. +ROLE: +Develop and execute marketing strategies to promote properties and attract potential buyers. +RESPONSIBILITIES: +- Create compelling property listings: + * Professional photography + * Detailed property descriptions + * Highlight unique selling points +- Implement digital marketing strategies: + * Social media campaigns + * Email marketing + * Online property platforms + * Targeted advertising +- Manage client interactions: + * Respond to property inquiries + * Schedule property viewings + * Facilitate initial negotiations +OUTPUT FORMAT: +Provide a comprehensive marketing report: +1. Marketing strategy overview +2. Property listing details +3. Marketing channel performance +4. Client inquiry and viewing logs +5. Initial negotiation summaries +""" + +TRANSACTION_MANAGEMENT_PROMPT = """ +You are the Transaction Management Agent for Real Estate. +ROLE: +Handle all documentation, legal, and financial aspects of property transactions. +RESPONSIBILITIES: +- Manage transaction documentation: + * Prepare purchase agreements + * Coordinate legal paperwork + * Ensure compliance with real estate regulations +- Facilitate transaction process: + * Coordinate with attorneys + * Liaise with lenders + * Manage escrow processes + * Coordinate property inspections +- Ensure smooth closing: + * Verify all financial requirements + * Coordinate final document signings + * Manage fund transfers +OUTPUT FORMAT: +Provide a detailed transaction management report: +1. Transaction document status +2. Legal and financial coordination details +3. Inspection and verification logs +4. Closing process timeline +5. Recommendations for transaction completion +""" + +PROPERTY_MAINTENANCE_PROMPT = """ +You are the Property Maintenance Agent for Real Estate. +ROLE: +Manage property condition, maintenance, and preparation for sale or rental. +RESPONSIBILITIES: +- Conduct regular property inspections: + * Assess property condition + * Identify maintenance needs + * Ensure safety standards +- Coordinate maintenance and repairs: + * Hire and manage contractors + * Oversee repair and renovation work + * Manage landscaping and cleaning +- Prepare properties for market: + * Stage properties + * Enhance curb appeal + * Recommend cost-effective improvements +OUTPUT FORMAT: +Provide a comprehensive property maintenance report: +1. Inspection findings +2. Maintenance and repair logs +3. Improvement recommendations +4. Property readiness status +5. Contractor and service provider details +""" + +class RealEstateSwarm: + def __init__( + self, + name: str = "Real Estate Swarm", + description: str = "A comprehensive AI-driven real estate transaction workflow", + max_loops: int = 1, + user_name: str = "Real Estate Manager", + property_type: str = "Residential", + output_type: str = "json", + user_lead_info: str = "", + ): + self.max_loops = max_loops + self.name = name + self.description = description + self.user_name = user_name + self.property_type = property_type + self.output_type = output_type + self.user_lead_info = user_lead_info + + self.agents = self._initialize_agents() + self.conversation = Conversation() + self.handle_initial_processing() + self.exa_search_results = [] # Store exa_search results for property research + + def handle_initial_processing(self): + self.conversation.add( + role=self.user_name, + content=f"Company: {self.name}\n" + f"Description: {self.description}\n" + f"Property Type: {self.property_type}" + ) + + def _initialize_agents(self) -> List[Agent]: + return [ + Agent( + agent_name="Alex-Lead-Generation", + agent_description="Identifies and qualifies potential real estate clients across various channels.", + system_prompt=LEAD_GENERATION_PROMPT, + max_loops=self.max_loops, + dynamic_temperature_enabled=True, + output_type="final", + ), + Agent( + agent_name="Emma-Property-Research", + agent_description="Conducts comprehensive property research and market analysis.", + system_prompt=PROPERTY_RESEARCH_PROMPT, + max_loops=self.max_loops, + dynamic_temperature_enabled=True, + output_type="final", + ), + Agent( + agent_name="Jack-Marketing", + agent_description="Develops and executes marketing strategies for properties.", + system_prompt=MARKETING_PROMPT, + max_loops=self.max_loops, + dynamic_temperature_enabled=True, + output_type="final", + ), + Agent( + agent_name="Sophia-Transaction-Management", + agent_description="Manages legal and financial aspects of real estate transactions.", + system_prompt=TRANSACTION_MANAGEMENT_PROMPT, + max_loops=self.max_loops, + dynamic_temperature_enabled=True, + output_type="final", + ), + Agent( + agent_name="Michael-Property-Maintenance", + agent_description="Oversees property condition, maintenance, and market preparation.", + system_prompt=PROPERTY_MAINTENANCE_PROMPT, + max_loops=self.max_loops, + dynamic_temperature_enabled=True, + output_type="final", + ), + ] + + def find_agent_by_name(self, name: str) -> Agent: + for agent in self.agents: + if name in agent.agent_name: + return agent + return None + + def lead_generation(self): + alex_agent = self.find_agent_by_name("Lead-Generation") + # Directly inject the user_lead_info into the prompt for the first agent + alex_output = alex_agent.run( + f"User Lead Information:\n{self.user_lead_info}\n\n" + f"History: {self.conversation.get_str()}\n" + f"Generate leads for {self.property_type} real estate transactions. Identify potential clients and their specific requirements." + ) + self.conversation.add( + role="Lead-Generation", content=alex_output + ) + + # --- After lead generation, use user_lead_info as queries for exa_search --- + queries = [] + if isinstance(self.user_lead_info, list): + queries = [str(q) for q in self.user_lead_info if str(q).strip()] + elif isinstance(self.user_lead_info, str): + if "\n" in self.user_lead_info: + queries = [q.strip() for q in self.user_lead_info.split("\n") if q.strip()] + else: + queries = [self.user_lead_info.strip()] if self.user_lead_info.strip() else [] + + self.exa_search_results = [] + for q in queries: + result = exa_search(q) + self.exa_search_results.append({ + "query": q, + "exa_result": result + }) + + def property_research(self): + emma_agent = self.find_agent_by_name("Property-Research") + # Pass ALL exa_search results as direct context to the property research agent + exa_context = "" + if hasattr(self, "exa_search_results") and self.exa_search_results: + # Directly inject all exa_search results as context + exa_context = "\n\n[Exa Search Results]\n" + for item in self.exa_search_results: + exa_context += f"Query: {item['query']}\nExa Search Result: {item['exa_result']}\n" + + emma_output = emma_agent.run( + f"History: {self.conversation.get_str()}\n" + f"{exa_context}" + f"Conduct research on {self.property_type} properties, analyze market trends, and prepare a comprehensive property report." + ) + self.conversation.add( + role="Property-Research", content=emma_output + ) + + def property_marketing(self): + jack_agent = self.find_agent_by_name("Marketing") + jack_output = jack_agent.run( + f"History: {self.conversation.get_str()}\n" + f"Develop marketing strategies for {self.property_type} properties, create listings, and manage client interactions." + ) + self.conversation.add( + role="Marketing", content=jack_output + ) + + def transaction_management(self): + sophia_agent = self.find_agent_by_name("Transaction-Management") + sophia_output = sophia_agent.run( + f"History: {self.conversation.get_str()}\n" + f"Manage legal and financial aspects of the {self.property_type} property transaction." + ) + self.conversation.add( + role="Transaction-Management", content=sophia_output + ) + + def property_maintenance(self): + michael_agent = self.find_agent_by_name("Property-Maintenance") + michael_output = michael_agent.run( + f"History: {self.conversation.get_str()}\n" + f"Assess and manage maintenance for the {self.property_type} property to prepare it for market." + ) + self.conversation.add( + role="Property-Maintenance", content=michael_output + ) + + def run(self, task: str): + """ + Process the real estate workflow through the swarm, coordinating tasks among agents. + """ + self.conversation.add(role=self.user_name, content=task) + + # Execute workflow stages + self.lead_generation() + self.property_research() + self.property_marketing() + self.transaction_management() + self.property_maintenance() + + return history_output_formatter( + self.conversation, type=self.output_type + ) + +def main(): + """FOR ACTUAL INPUT FROM USER""" + # # Collect user lead information at the beginning + # print("Please provide the following information for lead generation:") + # questions = [ + # "What are the client's property requirements?", + # "What is the client's budget range or constraints?", + # "What are the client's preferred locations?", + # "What are the client's investment goals?", + # "What is the client's contact information?", + # "What is the urgency of the transaction?", + # "Is the client financially ready to proceed?" + # ] + + # user_lead_info = "" + # for q in questions: + # answer = input(f"{q}\n> ").strip() + # user_lead_info += f"Q: {q}\nA: {answer if answer else '[No answer provided]'}\n\n" + # Pre-filled placeholder answers for each question + user_lead_info = [ + "Spacious 3-bedroom apartment with modern amenities", + "$1,000,000 - $1,500,000", + "Downtown Manhattan, Upper East Side", + "Long-term investment with high ROI", + "john.doe@email.com, +1-555-123-4567", + "Within the next 3 months", + "Yes, pre-approved for mortgage" + ] + + + # Initialize the swarm + real_estate_swarm = RealEstateSwarm( + max_loops=1, + name="Global Real Estate Solutions", + description="Comprehensive AI-driven real estate transaction workflow", + user_name="Real Estate Director", + property_type="Luxury Residential", + output_type="json", + user_lead_info=user_lead_info, + ) + + # Sample real estate task + sample_task = """ + We have a high-end luxury residential property in downtown Manhattan. + Client requirements: + - Sell the property quickly + - Target high-net-worth individuals + - Maximize property value + - Ensure smooth and discreet transaction + """ + # Run the swarm + real_estate_swarm.run(task=sample_task) + +if __name__ == "__main__": + main() \ No newline at end of file From e40a1f73a739db65a8a325d5ac6c4a1cbba78fe6 Mon Sep 17 00:00:00 2001 From: Aksh Parekh Date: Wed, 1 Oct 2025 21:38:46 -0700 Subject: [PATCH 2/9] [FIX] Docs & EXA --- docs/examples/realestate_swarm.md | 89 +------------------ .../demos/real_estate/realestate_swarm.py | 73 +-------------- 2 files changed, 5 insertions(+), 157 deletions(-) diff --git a/docs/examples/realestate_swarm.md b/docs/examples/realestate_swarm.md index 4d9494b0..8d83cae5 100644 --- a/docs/examples/realestate_swarm.md +++ b/docs/examples/realestate_swarm.md @@ -23,22 +23,12 @@ To set up and run the Real Estate Swarm, follow these steps: * An Exa API Key (for the `exa_search` tool) ### Installation - -1. **Clone the Swarms repository:** - ```bash - git clone https://github.com/kyegomez/swarms.git - cd swarms - ``` -2. **Install dependencies:** - If using Poetry: - ```bash - poetry install - ``` - If using pip: +1. **Install dependencies:** + Use the following command to download all dependencies. ```bash pip install -r requirements.txt ``` -3. **Set up Exa API Key:** +2. **Set up Exa API Key:** The `Property Research Agent` utilizes the `exa_search` tool, which requires an `EXA_API_KEY`. Create a `.env` file in the root directory of your project (or wherever your application loads environment variables) and add your Exa API key: ``` @@ -62,78 +52,7 @@ from swarms.utils.history_output_formatter import history_output_formatter # --- Exa Search Tool Integration --- # Import and define exa_search as a callable tool for property research. -import os -from dotenv import load_dotenv -from loguru import logger -import httpx -from swarms.utils.any_to_str import any_to_str - -def exa_search( - query: str, - characters: int = 100, - sources: int = 1, -) -> str: - """ - Perform a highly summarized Exa web search. - - Args: - query (str): Search query. - characters (int): Max characters for summary. - sources (int): Number of sources. - - Returns: - str: Most concise summary of search results. - """ - api_key = os.getenv("EXA_API_KEY") - if not api_key: - raise ValueError("EXA_API_KEY environment variable is not set") - - headers = { - "x-api-key": api_key, - "content-type": "application/json", - } - - payload = { - "query": query, - "type": "auto", - "numResults": sources, - "contents": { - "text": True, - "summary": { - "schema": { - "type": "object", - "required": ["answer"], - "additionalProperties": False, - "properties": { - "answer": { - "type": "string", - "description": "Highly condensed summary of the search result", - } - }, - } - }, - "context": {"maxCharacters": characters}, - }, - } - - try: - logger.info(f"[SEARCH] Exa summarized search: {query[:50]}...") - response = httpx.post( - "https://api.exa.ai/search", - json=payload, - headers=headers, - timeout=30, - ) - response.raise_for_status() - json_data = response.json() - return any_to_str(json_data) - except Exception as e: - logger.error(f"Exa search failed: {e}") - return f"Search failed: {str(e)}. Please try again." - -# Load environment variables for Exa API key -load_dotenv() - +from swarms_tools import exa_search # System prompts for each agent LEAD_GENERATION_PROMPT = """ diff --git a/examples/demos/real_estate/realestate_swarm.py b/examples/demos/real_estate/realestate_swarm.py index ff88b023..bbd9a789 100644 --- a/examples/demos/real_estate/realestate_swarm.py +++ b/examples/demos/real_estate/realestate_swarm.py @@ -6,78 +6,7 @@ from swarms.utils.history_output_formatter import history_output_formatter # --- Exa Search Tool Integration --- # Import and define exa_search as a callable tool for property research. -import os -from dotenv import load_dotenv -from loguru import logger -import httpx -from swarms.utils.any_to_str import any_to_str - -def exa_search( - query: str, - characters: int = 100, - sources: int = 1, -) -> str: - """ - Perform a highly summarized Exa web search. - - Args: - query (str): Search query. - characters (int): Max characters for summary. - sources (int): Number of sources. - - Returns: - str: Most concise summary of search results. - """ - api_key = os.getenv("EXA_API_KEY") - if not api_key: - raise ValueError("EXA_API_KEY environment variable is not set") - - headers = { - "x-api-key": api_key, - "content-type": "application/json", - } - - payload = { - "query": query, - "type": "auto", - "numResults": sources, - "contents": { - "text": True, - "summary": { - "schema": { - "type": "object", - "required": ["answer"], - "additionalProperties": False, - "properties": { - "answer": { - "type": "string", - "description": "Highly condensed summary of the search result", - } - }, - } - }, - "context": {"maxCharacters": characters}, - }, - } - - try: - logger.info(f"[SEARCH] Exa summarized search: {query[:50]}...") - response = httpx.post( - "https://api.exa.ai/search", - json=payload, - headers=headers, - timeout=30, - ) - response.raise_for_status() - json_data = response.json() - return any_to_str(json_data) - except Exception as e: - logger.error(f"Exa search failed: {e}") - return f"Search failed: {str(e)}. Please try again." - -# Load environment variables for Exa API key -load_dotenv() - +from swarms_tools import exa_search # System prompts for each agent LEAD_GENERATION_PROMPT = """ From 73ccb819cb47e09d50e61ed6b3732937f0f68c7e Mon Sep 17 00:00:00 2001 From: Aksh Parekh Date: Thu, 2 Oct 2025 18:19:04 -0700 Subject: [PATCH 3/9] Update realestate_swarm.md --- docs/examples/realestate_swarm.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/docs/examples/realestate_swarm.md b/docs/examples/realestate_swarm.md index 8d83cae5..18d27ad0 100644 --- a/docs/examples/realestate_swarm.md +++ b/docs/examples/realestate_swarm.md @@ -22,13 +22,8 @@ To set up and run the Real Estate Swarm, follow these steps: * Poetry (or pip) for dependency management * An Exa API Key (for the `exa_search` tool) -### Installation -1. **Install dependencies:** - Use the following command to download all dependencies. - ```bash - pip install -r requirements.txt - ``` -2. **Set up Exa API Key:** +### Setup + **Set up Exa API Key:** The `Property Research Agent` utilizes the `exa_search` tool, which requires an `EXA_API_KEY`. Create a `.env` file in the root directory of your project (or wherever your application loads environment variables) and add your Exa API key: ``` @@ -471,4 +466,4 @@ By chaining these specialized agents, the Real Estate Swarm provides an end-to-e | 🐦 Twitter | [@kyegomez](https://twitter.com/kyegomez) | Latest news and announcements | | 👥 LinkedIn | [The Swarm Corporation](https://www.linkedin.com/company/the-swarm-corporation) | Professional network and updates | | 📺 YouTube | [Swarms Channel](https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ) | Tutorials and demos | -| 🎫 Events | [Sign up here](https://lu.ma/5p2jnc2v) | Join our community events | \ No newline at end of file +| 🎫 Events | [Sign up here](https://lu.ma/5p2jnc2v) | Join our community events | From ba7ab4032d2348bd887aede7743f6348c00c559c Mon Sep 17 00:00:00 2001 From: Aksh Parekh Date: Thu, 2 Oct 2025 18:21:23 -0700 Subject: [PATCH 4/9] Update realestate_swarm.md --- docs/examples/realestate_swarm.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/examples/realestate_swarm.md b/docs/examples/realestate_swarm.md index 18d27ad0..b77ca0f9 100644 --- a/docs/examples/realestate_swarm.md +++ b/docs/examples/realestate_swarm.md @@ -19,7 +19,6 @@ To set up and run the Real Estate Swarm, follow these steps: ### Prerequisites * Python 3.8+ -* Poetry (or pip) for dependency management * An Exa API Key (for the `exa_search` tool) ### Setup From 68895eea7db753ab2c5ceca16a471ffb3e55d611 Mon Sep 17 00:00:00 2001 From: Aksh Parekh Date: Fri, 3 Oct 2025 19:31:20 -0700 Subject: [PATCH 5/9] Update hiring_swarm.md --- docs/examples/hiring_swarm.md | 510 +++++++++++++++++++++------------- 1 file changed, 310 insertions(+), 200 deletions(-) diff --git a/docs/examples/hiring_swarm.md b/docs/examples/hiring_swarm.md index 93eace38..0a2498fb 100644 --- a/docs/examples/hiring_swarm.md +++ b/docs/examples/hiring_swarm.md @@ -1,223 +1,295 @@ -# Hiring Swarm: Multi-Agent Automated Hiring Workflow +# Real Estate Swarm -## Overview +The Real Estate Swarm is a multi-agent system designed to automate and streamline the entire real estate transaction workflow. From lead generation to property maintenance, this swarm orchestrates a series of specialized AI agents to handle various aspects of buying, selling, and managing properties. -The Hiring Swarm is a sophisticated multi-agent system designed to automate and streamline the entire recruitment process using the Swarms framework. By leveraging specialized AI agents, this workflow transforms traditional hiring practices into an intelligent, collaborative process. +## What it Does -## Key Components +The `RealEstateSwarm` operates as a **sequential workflow**, where each agent's output feeds into the next, ensuring a cohesive and comprehensive process. The swarm consists of the following agents: -The Hiring Swarm consists of five specialized agents, each responsible for a critical stage of the recruitment process: +1. **Lead Generation Agent (Alex)**: Identifies and qualifies potential real estate clients by gathering their property requirements, budget, preferred locations, and investment goals. This agent also uses the `exa_search` tool for initial lead information. +2. **Property Research Agent (Emma)**: Conducts in-depth research on properties matching client criteria and market trends. It leverages the `exa_search` tool to gather up-to-date information on local market trends, property values, investment potential, and neighborhood insights. +3. **Marketing Agent (Jack)**: Develops and executes marketing strategies to promote properties. This includes creating compelling listings, implementing digital marketing campaigns, and managing client interactions. +4. **Transaction Management Agent (Sophia)**: Handles all documentation, legal, and financial aspects of property transactions, ensuring compliance and smooth closing processes. +5. **Property Maintenance Agent (Michael)**: Manages property condition, oversees maintenance and repairs, and prepares properties for sale or rental, including staging and enhancing curb appeal. -| Talent Acquisition Agent | Candidate Screening Agent | Interview Coordination Agent | Onboarding and Training Agent | Employee Engagement Agent | -|--------------------------|---------------------------|------------------------------|-------------------------------|----------------------------| -| Identifies staffing needs | Reviews resumes and application materials | Schedules and manages interviews | Prepares onboarding materials | Develops engagement strategies | -| Develops job descriptions | Conducts preliminary interviews | Coordinates logistics | Coordinates workspace and access setup | Organizes team-building activities | -| Sources candidates through multiple channels | Ranks and shortlists top candidates | Collects and organizes interviewer and candidate feedback | Organizes training sessions | Administers feedback surveys | -| Creates comprehensive recruitment strategies | Utilizes AI-based screening tools | Facilitates follow-up interviews | Monitors initial employee integration | Monitors and improves employee satisfaction | +## How to Set Up +To set up and run the Real Estate Swarm, follow these steps: -## Installation +## Step 1: Setup and Installation -Ensure you have the Swarms library installed: +### Prerequisites -```bash -pip install swarms -``` +| Requirement | +|-----------------------| +| Python 3.8 or higher | +| pip package manager | + +1. **Install dependencies:** + Use the following command to download all dependencies. + ```bash + # Install Swarms framework + pip install swarms + + # Install environment and logging dependencies + pip install python-dotenv loguru + + # Install HTTP client and tools + pip install httpx swarms_tools + ``` +2. **Set up API Keys:** + The `Property Research Agent` utilizes the `exa_search` tool, which requires an `EXA_API_KEY`. + Create a `.env` file in the root directory of your project (or wherever your application loads environment variables) and add your API keys: + ``` + EXA_API_KEY="YOUR_EXA_API_KEY" + OPENAI_API_KEY="OPENAI_API_KEY" + ``` + Replace `"YOUR_EXA_API_KEY"` & `"OPENAI_API_KEY"` with your actual API keys. + +## Step 2: Running the Real Estate Swarm -##Example Usage ```python from typing import List from swarms.structs.agent import Agent from swarms.structs.conversation import Conversation -from swarms.structs.ma_utils import set_random_models_for_agents from swarms.utils.history_output_formatter import history_output_formatter +# --- Exa Search Tool Integration --- +# Import and define exa_search as a callable tool for property research. +from swarms_tools import exa_search # System prompts for each agent -TALENT_ACQUISITION_PROMPT = """ -You are the Talent Acquisition Agent. +LEAD_GENERATION_PROMPT = """ +You are the Lead Generation Agent for Real Estate. ROLE: -Identify staffing needs and define job positions. Develop job descriptions and specifications. Utilize various channels like job boards, social media, and recruitment agencies to source potential candidates. Network at industry events and career fairs to attract talent. +Collect potential leads for real estate transactions by identifying buyers, sellers, and investors through various channels. RESPONSIBILITIES: -- Identify current and future staffing needs in collaboration with relevant departments. -- Define and document job positions, including required qualifications and responsibilities. -- Develop clear and compelling job descriptions and specifications. -- Source candidates using: - * Professional job boards +- Identify potential clients through: + * Real estate websites * Social media platforms - * Recruitment agencies - * Industry networking events and career fairs -- Maintain and update a talent pipeline for ongoing and future needs. + * Referral networks + * Local community events +- Conduct initial consultations to understand: + * Client's property requirements + * Budget constraints + * Preferred locations + * Investment goals +- Qualify leads by assessing: + * Financial readiness + * Specific property needs + * Urgency of transaction OUTPUT FORMAT: -Provide a report including: -1. Identified staffing requirements and job definitions -2. Developed job descriptions/specifications -3. Sourcing channels and strategies used -4. Summary of outreach/networking activities -5. Recommendations for next steps in the hiring process +Provide a comprehensive lead report that includes: +1. Client profile and contact information +2. Detailed requirements and preferences +3. Initial assessment of client's real estate goals +4. Qualification status +5. Recommended next steps + +IMPORTANT CONTEXT SHARING: +When preparing the lead report, clearly summarize and include all answers and information provided by the user. Integrate these user responses directly into your analysis and the lead report. This ensures that when your report is sent to the next agent, it contains all relevant user preferences, requirements, and context needed for further research and decision-making. + +REMEMBER: +- Ensure the user's answers are explicitly included in your report so the next agent can use them for property research and analysis. """ -CANDIDATE_SCREENING_PROMPT = """ -You are the Candidate Screening Agent. - +PROPERTY_RESEARCH_PROMPT = """ +You are the Property Research Agent for Real Estate. ROLE: -Review resumes and application materials to assess candidate suitability. Utilize AI-based tools for initial screening to identify top candidates. Conduct preliminary interviews (telephonic or video) to gauge candidate interest and qualifications. Coordinate with the Talent Acquisition Agent to shortlist candidates for further evaluation. +Conduct in-depth research on properties that match client criteria and market trends. + +TOOLS: +You have access to the exa_search tool. Use exa_search to find up-to-date and relevant information about properties, market trends, and neighborhood data. Leverage the answers provided by the user and the outputs from previous agents to formulate your search queries. Always use exa_search to supplement your research and validate your findings. RESPONSIBILITIES: -- Review and evaluate resumes and application materials for required qualifications and experience. -- Use AI-based screening tools to identify and rank top candidates. -- Conduct preliminary interviews (phone or video) to assess interest, communication, and basic qualifications. -- Document candidate strengths, concerns, and fit for the role. -- Coordinate with the Talent Acquisition Agent to finalize the shortlist for further interviews. +- Perform comprehensive property market analysis using exa_search: + * Local market trends + * Property value assessments + * Investment potential + * Neighborhood evaluations +- Research properties matching client specifications (using both user answers and previous agent outputs): + * Price range + * Location preferences + * Property type + * Specific amenities +- Compile detailed property reports including: + * Comparative market analysis (use exa_search for recent comps) + * Property history + * Potential appreciation + * Neighborhood insights (gathered via exa_search) + +INSTRUCTIONS: +- Always use exa_search to find the most current and relevant information for your analysis. +- Formulate your exa_search queries based on the user's answers and the outputs from previous agents. +- Clearly indicate in your report where exa_search was used to obtain information. OUTPUT FORMAT: -Provide a structured candidate screening report: -1. List and ranking of screened candidates -2. Summary of strengths and concerns for each candidate -3. Notes from preliminary interviews -4. Shortlist of recommended candidates for next stage -5. Suggestions for further evaluation if needed +Provide a structured property research report: +1. Shortlist of matching properties (include sources from exa_search) +2. Detailed property analysis for each option (cite exa_search findings) +3. Market trend insights (supported by exa_search data) +4. Investment potential assessment +5. Recommendations for client consideration + +REMEMBER: +Do not rely solely on prior knowledge. Always use exa_search to verify and enhance your research with the latest available data. """ -INTERVIEW_COORDINATION_PROMPT = """ -You are the Interview Coordination Agent. - +MARKETING_PROMPT = """ +You are the Marketing Agent for Real Estate. ROLE: -Schedule and coordinate interviews between candidates and hiring managers. Manage interview logistics, including virtual platform setup or physical meeting arrangements. Collect feedback from interviewers and candidates to improve the interview process. Facilitate any necessary follow-up interviews or assessments. - +Develop and execute marketing strategies to promote properties and attract potential buyers. RESPONSIBILITIES: -- Schedule interviews between shortlisted candidates and relevant interviewers. -- Coordinate logistics: send calendar invites, set up virtual meeting links, or arrange physical meeting spaces. -- Communicate interview details and instructions to all participants. -- Collect and organize feedback from interviewers and candidates after each interview. -- Arrange follow-up interviews or assessments as needed. - +- Create compelling property listings: + * Professional photography + * Detailed property descriptions + * Highlight unique selling points +- Implement digital marketing strategies: + * Social media campaigns + * Email marketing + * Online property platforms + * Targeted advertising +- Manage client interactions: + * Respond to property inquiries + * Schedule property viewings + * Facilitate initial negotiations OUTPUT FORMAT: -Provide an interview coordination summary: -1. Interview schedule and logistics details -2. Communication logs with candidates and interviewers -3. Summary of feedback collected -4. Notes on any issues or improvements for the process -5. Recommendations for next steps +Provide a comprehensive marketing report: +1. Marketing strategy overview +2. Property listing details +3. Marketing channel performance +4. Client inquiry and viewing logs +5. Initial negotiation summaries """ -ONBOARDING_TRAINING_PROMPT = """ -You are the Onboarding and Training Agent. - +TRANSACTION_MANAGEMENT_PROMPT = """ +You are the Transaction Management Agent for Real Estate. ROLE: -Prepare and disseminate onboarding materials and schedules. Coordinate with IT, Admin, and other departments for workspace setup and access credentials. Organize training sessions and workshops for new hires. Monitor the onboarding process and gather feedback for improvement. - +Handle all documentation, legal, and financial aspects of property transactions. RESPONSIBILITIES: -- Prepare onboarding materials and a detailed onboarding schedule for new hires. -- Coordinate with IT, Admin, and other departments to ensure workspace, equipment, and access credentials are ready. -- Organize and schedule training sessions, workshops, and orientation meetings. -- Monitor the onboarding process, check in with new hires, and gather feedback. -- Identify and address any onboarding issues or gaps. - +- Manage transaction documentation: + * Prepare purchase agreements + * Coordinate legal paperwork + * Ensure compliance with real estate regulations +- Facilitate transaction process: + * Coordinate with attorneys + * Liaise with lenders + * Manage escrow processes + * Coordinate property inspections +- Ensure smooth closing: + * Verify all financial requirements + * Coordinate final document signings + * Manage fund transfers OUTPUT FORMAT: -Provide an onboarding and training report: -1. Onboarding schedule and checklist -2. List of prepared materials and resources -3. Training session/workshop plan -4. Summary of feedback from new hires -5. Recommendations for improving onboarding +Provide a detailed transaction management report: +1. Transaction document status +2. Legal and financial coordination details +3. Inspection and verification logs +4. Closing process timeline +5. Recommendations for transaction completion """ -EMPLOYEE_ENGAGEMENT_PROMPT = """ -You are the Employee Engagement Agent. - +PROPERTY_MAINTENANCE_PROMPT = """ +You are the Property Maintenance Agent for Real Estate. ROLE: -Develop and implement strategies to enhance employee engagement and satisfaction. Organize team-building activities and company events. Administer surveys and feedback tools to gauge employee morale. Collaborate with HR to address any concerns or issues impacting employee wellbeing. - +Manage property condition, maintenance, and preparation for sale or rental. RESPONSIBILITIES: -- Design and implement employee engagement initiatives and programs. -- Organize team-building activities, company events, and wellness programs. -- Develop and administer surveys or feedback tools to measure employee morale and satisfaction. -- Analyze feedback and identify trends or areas for improvement. -- Work with HR to address concerns or issues affecting employee wellbeing. - +- Conduct regular property inspections: + * Assess property condition + * Identify maintenance needs + * Ensure safety standards +- Coordinate maintenance and repairs: + * Hire and manage contractors + * Oversee repair and renovation work + * Manage landscaping and cleaning +- Prepare properties for market: + * Stage properties + * Enhance curb appeal + * Recommend cost-effective improvements OUTPUT FORMAT: -Provide an employee engagement report: -1. Summary of engagement initiatives and activities -2. Survey/feedback results and analysis -3. Identified issues or concerns -4. Recommendations for improving engagement and satisfaction -5. Plan for ongoing engagement efforts +Provide a comprehensive property maintenance report: +1. Inspection findings +2. Maintenance and repair logs +3. Improvement recommendations +4. Property readiness status +5. Contractor and service provider details """ -class HiringSwarm: +class RealEstateSwarm: def __init__( self, - name: str = "Hiring Swarm", - description: str = "A swarm of agents that can handle comprehensive hiring processes", + name: str = "Real Estate Swarm", + description: str = "A comprehensive AI-driven real estate transaction workflow", max_loops: int = 1, - user_name: str = "HR Manager", - job_role: str = "Software Engineer", - output_type: str = "list", + user_name: str = "Real Estate Manager", + property_type: str = "Residential", + output_type: str = "json", + user_lead_info: str = "", ): self.max_loops = max_loops self.name = name self.description = description self.user_name = user_name - self.job_role = job_role + self.property_type = property_type self.output_type = output_type + self.user_lead_info = user_lead_info self.agents = self._initialize_agents() - self.agents = set_random_models_for_agents(self.agents) self.conversation = Conversation() self.handle_initial_processing() + self.exa_search_results = [] # Store exa_search results for property research def handle_initial_processing(self): self.conversation.add( role=self.user_name, content=f"Company: {self.name}\n" f"Description: {self.description}\n" - f"Job Role: {self.job_role}" + f"Property Type: {self.property_type}" ) def _initialize_agents(self) -> List[Agent]: return [ Agent( - agent_name="Elena-Talent-Acquisition", - agent_description="Identifies staffing needs, defines job positions, and sources candidates through multiple channels.", - system_prompt=TALENT_ACQUISITION_PROMPT, + agent_name="Alex-Lead-Generation", + agent_description="Identifies and qualifies potential real estate clients across various channels.", + system_prompt=LEAD_GENERATION_PROMPT, max_loops=self.max_loops, dynamic_temperature_enabled=True, output_type="final", ), Agent( - agent_name="Marcus-Candidate-Screening", - agent_description="Screens resumes, conducts initial interviews, and shortlists candidates using AI tools.", - system_prompt=CANDIDATE_SCREENING_PROMPT, + agent_name="Emma-Property-Research", + agent_description="Conducts comprehensive property research and market analysis.", + system_prompt=PROPERTY_RESEARCH_PROMPT, max_loops=self.max_loops, dynamic_temperature_enabled=True, output_type="final", ), Agent( - agent_name="Olivia-Interview-Coordinator", - agent_description="Schedules and manages interviews, collects feedback, and coordinates logistics.", - system_prompt=INTERVIEW_COORDINATION_PROMPT, + agent_name="Jack-Marketing", + agent_description="Develops and executes marketing strategies for properties.", + system_prompt=MARKETING_PROMPT, max_loops=self.max_loops, dynamic_temperature_enabled=True, output_type="final", ), Agent( - agent_name="Nathan-Onboarding-Specialist", - agent_description="Prepares onboarding materials, coordinates setup, and organizes training for new hires.", - system_prompt=ONBOARDING_TRAINING_PROMPT, + agent_name="Sophia-Transaction-Management", + agent_description="Manages legal and financial aspects of real estate transactions.", + system_prompt=TRANSACTION_MANAGEMENT_PROMPT, max_loops=self.max_loops, dynamic_temperature_enabled=True, output_type="final", ), Agent( - agent_name="Sophia-Employee-Engagement", - agent_description="Develops engagement strategies, organizes activities, and gathers employee feedback.", - system_prompt=EMPLOYEE_ENGAGEMENT_PROMPT, + agent_name="Michael-Property-Maintenance", + agent_description="Oversees property condition, maintenance, and market preparation.", + system_prompt=PROPERTY_MAINTENANCE_PROMPT, max_loops=self.max_loops, dynamic_temperature_enabled=True, output_type="final", @@ -225,138 +297,176 @@ class HiringSwarm: ] def find_agent_by_name(self, name: str) -> Agent: - """Find an agent by their name.""" for agent in self.agents: - if agent.agent_name == name: + if name in agent.agent_name: return agent + return None - def initial_talent_acquisition(self): - elena_agent = self.find_agent_by_name("Talent-Acquisition") - elena_output = elena_agent.run( + def lead_generation(self): + alex_agent = self.find_agent_by_name("Lead-Generation") + # Directly inject the user_lead_info into the prompt for the first agent + alex_output = alex_agent.run( + f"User Lead Information:\n{self.user_lead_info}\n\n" f"History: {self.conversation.get_str()}\n" - f"Identify staffing needs, define the {self.job_role} position, develop job descriptions, and outline sourcing strategies." + f"Generate leads for {self.property_type} real estate transactions. Identify potential clients and their specific requirements." ) self.conversation.add( - role="Talent-Acquisition", content=elena_output + role="Lead-Generation", content=alex_output ) - def candidate_screening(self): - marcus_agent = self.find_agent_by_name("Candidate-Screening") - marcus_output = marcus_agent.run( + # --- After lead generation, use user_lead_info as queries for exa_search --- + queries = [] + if isinstance(self.user_lead_info, list): + queries = [str(q) for q in self.user_lead_info if str(q).strip()] + elif isinstance(self.user_lead_info, str): + if "\n" in self.user_lead_info: + queries = [q.strip() for q in self.user_lead_info.split("\n") if q.strip()] + else: + queries = [self.user_lead_info.strip()] if self.user_lead_info.strip() else [] + + self.exa_search_results = [] + for q in queries: + result = exa_search(q) + self.exa_search_results.append({ + "query": q, + "exa_result": result + }) + + def property_research(self): + emma_agent = self.find_agent_by_name("Property-Research") + # Pass ALL exa_search results as direct context to the property research agent + exa_context = "" + if hasattr(self, "exa_search_results") and self.exa_search_results: + # Directly inject all exa_search results as context + exa_context = "\n\n[Exa Search Results]\n" + for item in self.exa_search_results: + exa_context += f"Query: {item['query']}\nExa Search Result: {item['exa_result']}\n" + + emma_output = emma_agent.run( f"History: {self.conversation.get_str()}\n" - f"Screen resumes and applications for the {self.job_role} position, conduct preliminary interviews, and provide a shortlist of candidates." + f"{exa_context}" + f"Conduct research on {self.property_type} properties, analyze market trends, and prepare a comprehensive property report." ) self.conversation.add( - role="Candidate-Screening", content=marcus_output + role="Property-Research", content=emma_output ) - def interview_coordination(self): - olivia_agent = self.find_agent_by_name("Interview-Coordinator") - olivia_output = olivia_agent.run( + def property_marketing(self): + jack_agent = self.find_agent_by_name("Marketing") + jack_output = jack_agent.run( f"History: {self.conversation.get_str()}\n" - f"Schedule and coordinate interviews for shortlisted {self.job_role} candidates, manage logistics, and collect feedback." + f"Develop marketing strategies for {self.property_type} properties, create listings, and manage client interactions." ) self.conversation.add( - role="Interview-Coordinator", content=olivia_output + role="Marketing", content=jack_output ) - def onboarding_preparation(self): - nathan_agent = self.find_agent_by_name("Onboarding-Specialist") - nathan_output = nathan_agent.run( + def transaction_management(self): + sophia_agent = self.find_agent_by_name("Transaction-Management") + sophia_output = sophia_agent.run( f"History: {self.conversation.get_str()}\n" - f"Prepare onboarding materials and schedule, coordinate setup, and organize training for the new {self.job_role} hire." + f"Manage legal and financial aspects of the {self.property_type} property transaction." ) self.conversation.add( - role="Onboarding-Specialist", content=nathan_output + role="Transaction-Management", content=sophia_output ) - def employee_engagement_strategy(self): - sophia_agent = self.find_agent_by_name("Employee-Engagement") - sophia_output = sophia_agent.run( + def property_maintenance(self): + michael_agent = self.find_agent_by_name("Property-Maintenance") + michael_output = michael_agent.run( f"History: {self.conversation.get_str()}\n" - f"Develop and implement an employee engagement plan for the new {self.job_role} hire, including activities and feedback mechanisms." + f"Assess and manage maintenance for the {self.property_type} property to prepare it for market." ) self.conversation.add( - role="Employee-Engagement", content=sophia_output + role="Property-Maintenance", content=michael_output ) def run(self, task: str): """ - Process the hiring workflow through the swarm, coordinating tasks among agents. + Process the real estate workflow through the swarm, coordinating tasks among agents. """ self.conversation.add(role=self.user_name, content=task) # Execute workflow stages - self.initial_talent_acquisition() - self.candidate_screening() - self.interview_coordination() - self.onboarding_preparation() - self.employee_engagement_strategy() + self.lead_generation() + self.property_research() + self.property_marketing() + self.transaction_management() + self.property_maintenance() return history_output_formatter( self.conversation, type=self.output_type ) def main(): + """FOR ACTUAL INPUT FROM USER""" + # # Collect user lead information at the beginning + # print("Please provide the following information for lead generation:") + # questions = [ + # "What are the client's property requirements?", + # "What is the client's budget range or constraints?", + # "What are the client's preferred locations?", + # "What are the client's investment goals?", + # "What is the client's contact information?", + # "What is the urgency of the transaction?", + # "Is the client financially ready to proceed?" + # ] + + # user_lead_info = "" + # for q in questions: + # answer = input(f"{q}\n> ").strip() + # user_lead_info += f"Q: {q}\nA: {answer if answer else '[No answer provided]'}\n\n" + # Pre-filled placeholder answers for each question + user_lead_info = [ + "Spacious 3-bedroom apartment with modern amenities", + "$1,000,000 - $1,500,000", + "Downtown Manhattan, Upper East Side", + "Long-term investment with high ROI", + "john.doe@email.com, +1-555-123-4567", + "Within the next 3 months", + "Yes, pre-approved for mortgage" + ] + + # Initialize the swarm - hiring_swarm = HiringSwarm( + real_estate_swarm = RealEstateSwarm( max_loops=1, - name="TechCorp Hiring Solutions", - description="Comprehensive AI-driven hiring workflow", - user_name="HR Director", - job_role="Software Engineer", + name="Global Real Estate Solutions", + description="Comprehensive AI-driven real estate transaction workflow", + user_name="Real Estate Director", + property_type="Luxury Residential", output_type="json", + user_lead_info=user_lead_info, ) - # Sample hiring task + # Sample real estate task sample_task = """ - We are looking to hire a Software Engineer for our AI research team. - Key requirements: - - Advanced degree in Computer Science - - 3+ years of experience in machine learning - - Strong Python and PyTorch skills - - Experience with large language model development + We have a high-end luxury residential property in downtown Manhattan. + Client requirements: + - Sell the property quickly + - Target high-net-worth individuals + - Maximize property value + - Ensure smooth and discreet transaction """ - # Run the swarm - hiring_swarm.run(task=sample_task) + real_estate_swarm.run(task=sample_task) if __name__ == "__main__": main() ``` -## Workflow Stages - -The Hiring Swarm processes recruitment through five key stages: - -1. **Initial Talent Acquisition**: Defines job requirements and sourcing strategy -2. **Candidate Screening**: Reviews and ranks potential candidates -3. **Interview Coordination**: Schedules and manages interviews -4. **Onboarding Preparation**: Creates onboarding materials and training plan -5. **Employee Engagement Strategy**: Develops initial engagement approach - -## Customization - -You can customize the Hiring Swarm by: -- Adjusting `max_loops` to control agent interaction depth -- Modifying system prompts for each agent -- Changing output types (list, json, etc.) -- Specifying custom company and job details - -## Best Practices +## How it Can Be Used for Real Estate -- Provide clear, detailed job requirements -- Use specific job roles and company descriptions -- Review and refine agent outputs manually -- Integrate with existing HR systems for enhanced workflow +The Real Estate Swarm can be utilized for a variety of real estate tasks, providing an automated and efficient approach to complex workflows: -## Limitations +* **Automated Lead Qualification**: Automatically gather and assess potential client needs and financial readiness. +* **Comprehensive Property Analysis**: Rapidly research and generate detailed reports on properties and market trends using real-time web search capabilities. +* **Streamlined Marketing**: Develop and execute marketing strategies, including listing creation and social media campaigns. +* **Efficient Transaction Management**: Automate the handling of legal documents, financial coordination, and closing processes. +* **Proactive Property Maintenance**: Manage property upkeep and prepare assets for optimal market presentation. -- Requires careful prompt engineering -- Outputs are AI-generated and should be verified -- May need human oversight for nuanced decisions -- Performance depends on underlying language models +By chaining these specialized agents, the Real Estate Swarm provides an end-to-end solution for real estate professionals, reducing manual effort and increasing operational efficiency. ## Contributing to Swarms | Platform | Link | Description | From ad9d39e352dfa1bf3708c3e2f1c979b3e59d061e Mon Sep 17 00:00:00 2001 From: Aksh Parekh Date: Fri, 3 Oct 2025 19:35:52 -0700 Subject: [PATCH 6/9] Update hiring_swarm.md --- docs/examples/hiring_swarm.md | 510 +++++++++++++--------------------- 1 file changed, 200 insertions(+), 310 deletions(-) diff --git a/docs/examples/hiring_swarm.md b/docs/examples/hiring_swarm.md index 0a2498fb..93eace38 100644 --- a/docs/examples/hiring_swarm.md +++ b/docs/examples/hiring_swarm.md @@ -1,295 +1,223 @@ -# Real Estate Swarm +# Hiring Swarm: Multi-Agent Automated Hiring Workflow -The Real Estate Swarm is a multi-agent system designed to automate and streamline the entire real estate transaction workflow. From lead generation to property maintenance, this swarm orchestrates a series of specialized AI agents to handle various aspects of buying, selling, and managing properties. +## Overview -## What it Does +The Hiring Swarm is a sophisticated multi-agent system designed to automate and streamline the entire recruitment process using the Swarms framework. By leveraging specialized AI agents, this workflow transforms traditional hiring practices into an intelligent, collaborative process. -The `RealEstateSwarm` operates as a **sequential workflow**, where each agent's output feeds into the next, ensuring a cohesive and comprehensive process. The swarm consists of the following agents: +## Key Components -1. **Lead Generation Agent (Alex)**: Identifies and qualifies potential real estate clients by gathering their property requirements, budget, preferred locations, and investment goals. This agent also uses the `exa_search` tool for initial lead information. -2. **Property Research Agent (Emma)**: Conducts in-depth research on properties matching client criteria and market trends. It leverages the `exa_search` tool to gather up-to-date information on local market trends, property values, investment potential, and neighborhood insights. -3. **Marketing Agent (Jack)**: Develops and executes marketing strategies to promote properties. This includes creating compelling listings, implementing digital marketing campaigns, and managing client interactions. -4. **Transaction Management Agent (Sophia)**: Handles all documentation, legal, and financial aspects of property transactions, ensuring compliance and smooth closing processes. -5. **Property Maintenance Agent (Michael)**: Manages property condition, oversees maintenance and repairs, and prepares properties for sale or rental, including staging and enhancing curb appeal. +The Hiring Swarm consists of five specialized agents, each responsible for a critical stage of the recruitment process: -## How to Set Up +| Talent Acquisition Agent | Candidate Screening Agent | Interview Coordination Agent | Onboarding and Training Agent | Employee Engagement Agent | +|--------------------------|---------------------------|------------------------------|-------------------------------|----------------------------| +| Identifies staffing needs | Reviews resumes and application materials | Schedules and manages interviews | Prepares onboarding materials | Develops engagement strategies | +| Develops job descriptions | Conducts preliminary interviews | Coordinates logistics | Coordinates workspace and access setup | Organizes team-building activities | +| Sources candidates through multiple channels | Ranks and shortlists top candidates | Collects and organizes interviewer and candidate feedback | Organizes training sessions | Administers feedback surveys | +| Creates comprehensive recruitment strategies | Utilizes AI-based screening tools | Facilitates follow-up interviews | Monitors initial employee integration | Monitors and improves employee satisfaction | -To set up and run the Real Estate Swarm, follow these steps: -## Step 1: Setup and Installation +## Installation -### Prerequisites +Ensure you have the Swarms library installed: -| Requirement | -|-----------------------| -| Python 3.8 or higher | -| pip package manager | - -1. **Install dependencies:** - Use the following command to download all dependencies. - ```bash - # Install Swarms framework - pip install swarms - - # Install environment and logging dependencies - pip install python-dotenv loguru - - # Install HTTP client and tools - pip install httpx swarms_tools - ``` -2. **Set up API Keys:** - The `Property Research Agent` utilizes the `exa_search` tool, which requires an `EXA_API_KEY`. - Create a `.env` file in the root directory of your project (or wherever your application loads environment variables) and add your API keys: - ``` - EXA_API_KEY="YOUR_EXA_API_KEY" - OPENAI_API_KEY="OPENAI_API_KEY" - ``` - Replace `"YOUR_EXA_API_KEY"` & `"OPENAI_API_KEY"` with your actual API keys. - -## Step 2: Running the Real Estate Swarm +```bash +pip install swarms +``` +##Example Usage ```python from typing import List from swarms.structs.agent import Agent from swarms.structs.conversation import Conversation +from swarms.structs.ma_utils import set_random_models_for_agents from swarms.utils.history_output_formatter import history_output_formatter -# --- Exa Search Tool Integration --- -# Import and define exa_search as a callable tool for property research. -from swarms_tools import exa_search # System prompts for each agent -LEAD_GENERATION_PROMPT = """ -You are the Lead Generation Agent for Real Estate. +TALENT_ACQUISITION_PROMPT = """ +You are the Talent Acquisition Agent. ROLE: -Collect potential leads for real estate transactions by identifying buyers, sellers, and investors through various channels. +Identify staffing needs and define job positions. Develop job descriptions and specifications. Utilize various channels like job boards, social media, and recruitment agencies to source potential candidates. Network at industry events and career fairs to attract talent. RESPONSIBILITIES: -- Identify potential clients through: - * Real estate websites +- Identify current and future staffing needs in collaboration with relevant departments. +- Define and document job positions, including required qualifications and responsibilities. +- Develop clear and compelling job descriptions and specifications. +- Source candidates using: + * Professional job boards * Social media platforms - * Referral networks - * Local community events -- Conduct initial consultations to understand: - * Client's property requirements - * Budget constraints - * Preferred locations - * Investment goals -- Qualify leads by assessing: - * Financial readiness - * Specific property needs - * Urgency of transaction + * Recruitment agencies + * Industry networking events and career fairs +- Maintain and update a talent pipeline for ongoing and future needs. OUTPUT FORMAT: -Provide a comprehensive lead report that includes: -1. Client profile and contact information -2. Detailed requirements and preferences -3. Initial assessment of client's real estate goals -4. Qualification status -5. Recommended next steps - -IMPORTANT CONTEXT SHARING: -When preparing the lead report, clearly summarize and include all answers and information provided by the user. Integrate these user responses directly into your analysis and the lead report. This ensures that when your report is sent to the next agent, it contains all relevant user preferences, requirements, and context needed for further research and decision-making. - -REMEMBER: -- Ensure the user's answers are explicitly included in your report so the next agent can use them for property research and analysis. +Provide a report including: +1. Identified staffing requirements and job definitions +2. Developed job descriptions/specifications +3. Sourcing channels and strategies used +4. Summary of outreach/networking activities +5. Recommendations for next steps in the hiring process """ -PROPERTY_RESEARCH_PROMPT = """ -You are the Property Research Agent for Real Estate. -ROLE: -Conduct in-depth research on properties that match client criteria and market trends. +CANDIDATE_SCREENING_PROMPT = """ +You are the Candidate Screening Agent. -TOOLS: -You have access to the exa_search tool. Use exa_search to find up-to-date and relevant information about properties, market trends, and neighborhood data. Leverage the answers provided by the user and the outputs from previous agents to formulate your search queries. Always use exa_search to supplement your research and validate your findings. +ROLE: +Review resumes and application materials to assess candidate suitability. Utilize AI-based tools for initial screening to identify top candidates. Conduct preliminary interviews (telephonic or video) to gauge candidate interest and qualifications. Coordinate with the Talent Acquisition Agent to shortlist candidates for further evaluation. RESPONSIBILITIES: -- Perform comprehensive property market analysis using exa_search: - * Local market trends - * Property value assessments - * Investment potential - * Neighborhood evaluations -- Research properties matching client specifications (using both user answers and previous agent outputs): - * Price range - * Location preferences - * Property type - * Specific amenities -- Compile detailed property reports including: - * Comparative market analysis (use exa_search for recent comps) - * Property history - * Potential appreciation - * Neighborhood insights (gathered via exa_search) - -INSTRUCTIONS: -- Always use exa_search to find the most current and relevant information for your analysis. -- Formulate your exa_search queries based on the user's answers and the outputs from previous agents. -- Clearly indicate in your report where exa_search was used to obtain information. +- Review and evaluate resumes and application materials for required qualifications and experience. +- Use AI-based screening tools to identify and rank top candidates. +- Conduct preliminary interviews (phone or video) to assess interest, communication, and basic qualifications. +- Document candidate strengths, concerns, and fit for the role. +- Coordinate with the Talent Acquisition Agent to finalize the shortlist for further interviews. OUTPUT FORMAT: -Provide a structured property research report: -1. Shortlist of matching properties (include sources from exa_search) -2. Detailed property analysis for each option (cite exa_search findings) -3. Market trend insights (supported by exa_search data) -4. Investment potential assessment -5. Recommendations for client consideration - -REMEMBER: -Do not rely solely on prior knowledge. Always use exa_search to verify and enhance your research with the latest available data. +Provide a structured candidate screening report: +1. List and ranking of screened candidates +2. Summary of strengths and concerns for each candidate +3. Notes from preliminary interviews +4. Shortlist of recommended candidates for next stage +5. Suggestions for further evaluation if needed """ -MARKETING_PROMPT = """ -You are the Marketing Agent for Real Estate. +INTERVIEW_COORDINATION_PROMPT = """ +You are the Interview Coordination Agent. + ROLE: -Develop and execute marketing strategies to promote properties and attract potential buyers. +Schedule and coordinate interviews between candidates and hiring managers. Manage interview logistics, including virtual platform setup or physical meeting arrangements. Collect feedback from interviewers and candidates to improve the interview process. Facilitate any necessary follow-up interviews or assessments. + RESPONSIBILITIES: -- Create compelling property listings: - * Professional photography - * Detailed property descriptions - * Highlight unique selling points -- Implement digital marketing strategies: - * Social media campaigns - * Email marketing - * Online property platforms - * Targeted advertising -- Manage client interactions: - * Respond to property inquiries - * Schedule property viewings - * Facilitate initial negotiations +- Schedule interviews between shortlisted candidates and relevant interviewers. +- Coordinate logistics: send calendar invites, set up virtual meeting links, or arrange physical meeting spaces. +- Communicate interview details and instructions to all participants. +- Collect and organize feedback from interviewers and candidates after each interview. +- Arrange follow-up interviews or assessments as needed. + OUTPUT FORMAT: -Provide a comprehensive marketing report: -1. Marketing strategy overview -2. Property listing details -3. Marketing channel performance -4. Client inquiry and viewing logs -5. Initial negotiation summaries +Provide an interview coordination summary: +1. Interview schedule and logistics details +2. Communication logs with candidates and interviewers +3. Summary of feedback collected +4. Notes on any issues or improvements for the process +5. Recommendations for next steps """ -TRANSACTION_MANAGEMENT_PROMPT = """ -You are the Transaction Management Agent for Real Estate. +ONBOARDING_TRAINING_PROMPT = """ +You are the Onboarding and Training Agent. + ROLE: -Handle all documentation, legal, and financial aspects of property transactions. +Prepare and disseminate onboarding materials and schedules. Coordinate with IT, Admin, and other departments for workspace setup and access credentials. Organize training sessions and workshops for new hires. Monitor the onboarding process and gather feedback for improvement. + RESPONSIBILITIES: -- Manage transaction documentation: - * Prepare purchase agreements - * Coordinate legal paperwork - * Ensure compliance with real estate regulations -- Facilitate transaction process: - * Coordinate with attorneys - * Liaise with lenders - * Manage escrow processes - * Coordinate property inspections -- Ensure smooth closing: - * Verify all financial requirements - * Coordinate final document signings - * Manage fund transfers +- Prepare onboarding materials and a detailed onboarding schedule for new hires. +- Coordinate with IT, Admin, and other departments to ensure workspace, equipment, and access credentials are ready. +- Organize and schedule training sessions, workshops, and orientation meetings. +- Monitor the onboarding process, check in with new hires, and gather feedback. +- Identify and address any onboarding issues or gaps. + OUTPUT FORMAT: -Provide a detailed transaction management report: -1. Transaction document status -2. Legal and financial coordination details -3. Inspection and verification logs -4. Closing process timeline -5. Recommendations for transaction completion +Provide an onboarding and training report: +1. Onboarding schedule and checklist +2. List of prepared materials and resources +3. Training session/workshop plan +4. Summary of feedback from new hires +5. Recommendations for improving onboarding """ -PROPERTY_MAINTENANCE_PROMPT = """ -You are the Property Maintenance Agent for Real Estate. +EMPLOYEE_ENGAGEMENT_PROMPT = """ +You are the Employee Engagement Agent. + ROLE: -Manage property condition, maintenance, and preparation for sale or rental. +Develop and implement strategies to enhance employee engagement and satisfaction. Organize team-building activities and company events. Administer surveys and feedback tools to gauge employee morale. Collaborate with HR to address any concerns or issues impacting employee wellbeing. + RESPONSIBILITIES: -- Conduct regular property inspections: - * Assess property condition - * Identify maintenance needs - * Ensure safety standards -- Coordinate maintenance and repairs: - * Hire and manage contractors - * Oversee repair and renovation work - * Manage landscaping and cleaning -- Prepare properties for market: - * Stage properties - * Enhance curb appeal - * Recommend cost-effective improvements +- Design and implement employee engagement initiatives and programs. +- Organize team-building activities, company events, and wellness programs. +- Develop and administer surveys or feedback tools to measure employee morale and satisfaction. +- Analyze feedback and identify trends or areas for improvement. +- Work with HR to address concerns or issues affecting employee wellbeing. + OUTPUT FORMAT: -Provide a comprehensive property maintenance report: -1. Inspection findings -2. Maintenance and repair logs -3. Improvement recommendations -4. Property readiness status -5. Contractor and service provider details +Provide an employee engagement report: +1. Summary of engagement initiatives and activities +2. Survey/feedback results and analysis +3. Identified issues or concerns +4. Recommendations for improving engagement and satisfaction +5. Plan for ongoing engagement efforts """ -class RealEstateSwarm: +class HiringSwarm: def __init__( self, - name: str = "Real Estate Swarm", - description: str = "A comprehensive AI-driven real estate transaction workflow", + name: str = "Hiring Swarm", + description: str = "A swarm of agents that can handle comprehensive hiring processes", max_loops: int = 1, - user_name: str = "Real Estate Manager", - property_type: str = "Residential", - output_type: str = "json", - user_lead_info: str = "", + user_name: str = "HR Manager", + job_role: str = "Software Engineer", + output_type: str = "list", ): self.max_loops = max_loops self.name = name self.description = description self.user_name = user_name - self.property_type = property_type + self.job_role = job_role self.output_type = output_type - self.user_lead_info = user_lead_info self.agents = self._initialize_agents() + self.agents = set_random_models_for_agents(self.agents) self.conversation = Conversation() self.handle_initial_processing() - self.exa_search_results = [] # Store exa_search results for property research def handle_initial_processing(self): self.conversation.add( role=self.user_name, content=f"Company: {self.name}\n" f"Description: {self.description}\n" - f"Property Type: {self.property_type}" + f"Job Role: {self.job_role}" ) def _initialize_agents(self) -> List[Agent]: return [ Agent( - agent_name="Alex-Lead-Generation", - agent_description="Identifies and qualifies potential real estate clients across various channels.", - system_prompt=LEAD_GENERATION_PROMPT, + agent_name="Elena-Talent-Acquisition", + agent_description="Identifies staffing needs, defines job positions, and sources candidates through multiple channels.", + system_prompt=TALENT_ACQUISITION_PROMPT, max_loops=self.max_loops, dynamic_temperature_enabled=True, output_type="final", ), Agent( - agent_name="Emma-Property-Research", - agent_description="Conducts comprehensive property research and market analysis.", - system_prompt=PROPERTY_RESEARCH_PROMPT, + agent_name="Marcus-Candidate-Screening", + agent_description="Screens resumes, conducts initial interviews, and shortlists candidates using AI tools.", + system_prompt=CANDIDATE_SCREENING_PROMPT, max_loops=self.max_loops, dynamic_temperature_enabled=True, output_type="final", ), Agent( - agent_name="Jack-Marketing", - agent_description="Develops and executes marketing strategies for properties.", - system_prompt=MARKETING_PROMPT, + agent_name="Olivia-Interview-Coordinator", + agent_description="Schedules and manages interviews, collects feedback, and coordinates logistics.", + system_prompt=INTERVIEW_COORDINATION_PROMPT, max_loops=self.max_loops, dynamic_temperature_enabled=True, output_type="final", ), Agent( - agent_name="Sophia-Transaction-Management", - agent_description="Manages legal and financial aspects of real estate transactions.", - system_prompt=TRANSACTION_MANAGEMENT_PROMPT, + agent_name="Nathan-Onboarding-Specialist", + agent_description="Prepares onboarding materials, coordinates setup, and organizes training for new hires.", + system_prompt=ONBOARDING_TRAINING_PROMPT, max_loops=self.max_loops, dynamic_temperature_enabled=True, output_type="final", ), Agent( - agent_name="Michael-Property-Maintenance", - agent_description="Oversees property condition, maintenance, and market preparation.", - system_prompt=PROPERTY_MAINTENANCE_PROMPT, + agent_name="Sophia-Employee-Engagement", + agent_description="Develops engagement strategies, organizes activities, and gathers employee feedback.", + system_prompt=EMPLOYEE_ENGAGEMENT_PROMPT, max_loops=self.max_loops, dynamic_temperature_enabled=True, output_type="final", @@ -297,176 +225,138 @@ class RealEstateSwarm: ] def find_agent_by_name(self, name: str) -> Agent: + """Find an agent by their name.""" for agent in self.agents: - if name in agent.agent_name: + if agent.agent_name == name: return agent - return None - def lead_generation(self): - alex_agent = self.find_agent_by_name("Lead-Generation") - # Directly inject the user_lead_info into the prompt for the first agent - alex_output = alex_agent.run( - f"User Lead Information:\n{self.user_lead_info}\n\n" + def initial_talent_acquisition(self): + elena_agent = self.find_agent_by_name("Talent-Acquisition") + elena_output = elena_agent.run( f"History: {self.conversation.get_str()}\n" - f"Generate leads for {self.property_type} real estate transactions. Identify potential clients and their specific requirements." + f"Identify staffing needs, define the {self.job_role} position, develop job descriptions, and outline sourcing strategies." ) self.conversation.add( - role="Lead-Generation", content=alex_output + role="Talent-Acquisition", content=elena_output ) - # --- After lead generation, use user_lead_info as queries for exa_search --- - queries = [] - if isinstance(self.user_lead_info, list): - queries = [str(q) for q in self.user_lead_info if str(q).strip()] - elif isinstance(self.user_lead_info, str): - if "\n" in self.user_lead_info: - queries = [q.strip() for q in self.user_lead_info.split("\n") if q.strip()] - else: - queries = [self.user_lead_info.strip()] if self.user_lead_info.strip() else [] - - self.exa_search_results = [] - for q in queries: - result = exa_search(q) - self.exa_search_results.append({ - "query": q, - "exa_result": result - }) - - def property_research(self): - emma_agent = self.find_agent_by_name("Property-Research") - # Pass ALL exa_search results as direct context to the property research agent - exa_context = "" - if hasattr(self, "exa_search_results") and self.exa_search_results: - # Directly inject all exa_search results as context - exa_context = "\n\n[Exa Search Results]\n" - for item in self.exa_search_results: - exa_context += f"Query: {item['query']}\nExa Search Result: {item['exa_result']}\n" - - emma_output = emma_agent.run( + def candidate_screening(self): + marcus_agent = self.find_agent_by_name("Candidate-Screening") + marcus_output = marcus_agent.run( f"History: {self.conversation.get_str()}\n" - f"{exa_context}" - f"Conduct research on {self.property_type} properties, analyze market trends, and prepare a comprehensive property report." + f"Screen resumes and applications for the {self.job_role} position, conduct preliminary interviews, and provide a shortlist of candidates." ) self.conversation.add( - role="Property-Research", content=emma_output + role="Candidate-Screening", content=marcus_output ) - def property_marketing(self): - jack_agent = self.find_agent_by_name("Marketing") - jack_output = jack_agent.run( + def interview_coordination(self): + olivia_agent = self.find_agent_by_name("Interview-Coordinator") + olivia_output = olivia_agent.run( f"History: {self.conversation.get_str()}\n" - f"Develop marketing strategies for {self.property_type} properties, create listings, and manage client interactions." + f"Schedule and coordinate interviews for shortlisted {self.job_role} candidates, manage logistics, and collect feedback." ) self.conversation.add( - role="Marketing", content=jack_output + role="Interview-Coordinator", content=olivia_output ) - def transaction_management(self): - sophia_agent = self.find_agent_by_name("Transaction-Management") - sophia_output = sophia_agent.run( + def onboarding_preparation(self): + nathan_agent = self.find_agent_by_name("Onboarding-Specialist") + nathan_output = nathan_agent.run( f"History: {self.conversation.get_str()}\n" - f"Manage legal and financial aspects of the {self.property_type} property transaction." + f"Prepare onboarding materials and schedule, coordinate setup, and organize training for the new {self.job_role} hire." ) self.conversation.add( - role="Transaction-Management", content=sophia_output + role="Onboarding-Specialist", content=nathan_output ) - def property_maintenance(self): - michael_agent = self.find_agent_by_name("Property-Maintenance") - michael_output = michael_agent.run( + def employee_engagement_strategy(self): + sophia_agent = self.find_agent_by_name("Employee-Engagement") + sophia_output = sophia_agent.run( f"History: {self.conversation.get_str()}\n" - f"Assess and manage maintenance for the {self.property_type} property to prepare it for market." + f"Develop and implement an employee engagement plan for the new {self.job_role} hire, including activities and feedback mechanisms." ) self.conversation.add( - role="Property-Maintenance", content=michael_output + role="Employee-Engagement", content=sophia_output ) def run(self, task: str): """ - Process the real estate workflow through the swarm, coordinating tasks among agents. + Process the hiring workflow through the swarm, coordinating tasks among agents. """ self.conversation.add(role=self.user_name, content=task) # Execute workflow stages - self.lead_generation() - self.property_research() - self.property_marketing() - self.transaction_management() - self.property_maintenance() + self.initial_talent_acquisition() + self.candidate_screening() + self.interview_coordination() + self.onboarding_preparation() + self.employee_engagement_strategy() return history_output_formatter( self.conversation, type=self.output_type ) def main(): - """FOR ACTUAL INPUT FROM USER""" - # # Collect user lead information at the beginning - # print("Please provide the following information for lead generation:") - # questions = [ - # "What are the client's property requirements?", - # "What is the client's budget range or constraints?", - # "What are the client's preferred locations?", - # "What are the client's investment goals?", - # "What is the client's contact information?", - # "What is the urgency of the transaction?", - # "Is the client financially ready to proceed?" - # ] - - # user_lead_info = "" - # for q in questions: - # answer = input(f"{q}\n> ").strip() - # user_lead_info += f"Q: {q}\nA: {answer if answer else '[No answer provided]'}\n\n" - # Pre-filled placeholder answers for each question - user_lead_info = [ - "Spacious 3-bedroom apartment with modern amenities", - "$1,000,000 - $1,500,000", - "Downtown Manhattan, Upper East Side", - "Long-term investment with high ROI", - "john.doe@email.com, +1-555-123-4567", - "Within the next 3 months", - "Yes, pre-approved for mortgage" - ] - - # Initialize the swarm - real_estate_swarm = RealEstateSwarm( + hiring_swarm = HiringSwarm( max_loops=1, - name="Global Real Estate Solutions", - description="Comprehensive AI-driven real estate transaction workflow", - user_name="Real Estate Director", - property_type="Luxury Residential", + name="TechCorp Hiring Solutions", + description="Comprehensive AI-driven hiring workflow", + user_name="HR Director", + job_role="Software Engineer", output_type="json", - user_lead_info=user_lead_info, ) - # Sample real estate task + # Sample hiring task sample_task = """ - We have a high-end luxury residential property in downtown Manhattan. - Client requirements: - - Sell the property quickly - - Target high-net-worth individuals - - Maximize property value - - Ensure smooth and discreet transaction + We are looking to hire a Software Engineer for our AI research team. + Key requirements: + - Advanced degree in Computer Science + - 3+ years of experience in machine learning + - Strong Python and PyTorch skills + - Experience with large language model development """ + # Run the swarm - real_estate_swarm.run(task=sample_task) + hiring_swarm.run(task=sample_task) if __name__ == "__main__": main() ``` -## How it Can Be Used for Real Estate +## Workflow Stages + +The Hiring Swarm processes recruitment through five key stages: + +1. **Initial Talent Acquisition**: Defines job requirements and sourcing strategy +2. **Candidate Screening**: Reviews and ranks potential candidates +3. **Interview Coordination**: Schedules and manages interviews +4. **Onboarding Preparation**: Creates onboarding materials and training plan +5. **Employee Engagement Strategy**: Develops initial engagement approach + +## Customization + +You can customize the Hiring Swarm by: +- Adjusting `max_loops` to control agent interaction depth +- Modifying system prompts for each agent +- Changing output types (list, json, etc.) +- Specifying custom company and job details + +## Best Practices -The Real Estate Swarm can be utilized for a variety of real estate tasks, providing an automated and efficient approach to complex workflows: +- Provide clear, detailed job requirements +- Use specific job roles and company descriptions +- Review and refine agent outputs manually +- Integrate with existing HR systems for enhanced workflow -* **Automated Lead Qualification**: Automatically gather and assess potential client needs and financial readiness. -* **Comprehensive Property Analysis**: Rapidly research and generate detailed reports on properties and market trends using real-time web search capabilities. -* **Streamlined Marketing**: Develop and execute marketing strategies, including listing creation and social media campaigns. -* **Efficient Transaction Management**: Automate the handling of legal documents, financial coordination, and closing processes. -* **Proactive Property Maintenance**: Manage property upkeep and prepare assets for optimal market presentation. +## Limitations -By chaining these specialized agents, the Real Estate Swarm provides an end-to-end solution for real estate professionals, reducing manual effort and increasing operational efficiency. +- Requires careful prompt engineering +- Outputs are AI-generated and should be verified +- May need human oversight for nuanced decisions +- Performance depends on underlying language models ## Contributing to Swarms | Platform | Link | Description | From 85e2173545465b0585f2874fac7b37ef8634b845 Mon Sep 17 00:00:00 2001 From: Aksh Parekh Date: Fri, 3 Oct 2025 19:36:05 -0700 Subject: [PATCH 7/9] Update realestate_swarm.md --- docs/examples/realestate_swarm.md | 34 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/docs/examples/realestate_swarm.md b/docs/examples/realestate_swarm.md index b77ca0f9..0a2498fb 100644 --- a/docs/examples/realestate_swarm.md +++ b/docs/examples/realestate_swarm.md @@ -16,25 +16,37 @@ The `RealEstateSwarm` operates as a **sequential workflow**, where each agent's To set up and run the Real Estate Swarm, follow these steps: +## Step 1: Setup and Installation + ### Prerequisites -* Python 3.8+ -* An Exa API Key (for the `exa_search` tool) +| Requirement | +|-----------------------| +| Python 3.8 or higher | +| pip package manager | + +1. **Install dependencies:** + Use the following command to download all dependencies. + ```bash + # Install Swarms framework + pip install swarms + + # Install environment and logging dependencies + pip install python-dotenv loguru -### Setup - **Set up Exa API Key:** + # Install HTTP client and tools + pip install httpx swarms_tools + ``` +2. **Set up API Keys:** The `Property Research Agent` utilizes the `exa_search` tool, which requires an `EXA_API_KEY`. - Create a `.env` file in the root directory of your project (or wherever your application loads environment variables) and add your Exa API key: + Create a `.env` file in the root directory of your project (or wherever your application loads environment variables) and add your API keys: ``` EXA_API_KEY="YOUR_EXA_API_KEY" + OPENAI_API_KEY="OPENAI_API_KEY" ``` - Replace `"YOUR_EXA_API_KEY"` with your actual Exa API key. - -## How to Run - -Navigate to the `examples/demos/real_estate/` directory and run the `realestate_swarm.py` script. + Replace `"YOUR_EXA_API_KEY"` & `"OPENAI_API_KEY"` with your actual API keys. -OR run the following code +## Step 2: Running the Real Estate Swarm ```python From 489a9009d367938b097862745c748e56a543bf40 Mon Sep 17 00:00:00 2001 From: Aksh Parekh Date: Tue, 7 Oct 2025 18:02:07 -0700 Subject: [PATCH 8/9] Update mkdocs.yml --- docs/mkdocs.yml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index f7dcb7ed..7e849302 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -92,8 +92,6 @@ extra: "Tools": - title: "Tools and MCP" url: "https://docs.swarms.world/en/latest/swarms/tools/tools_examples/" - - title: "MCP (Model Context Protocol)" - url: "https://docs.swarms.world/en/latest/swarms/examples/agent_with_mcp/" - title: "OpenAI Tools & Function Calling" url: "https://docs.swarms.world/en/latest/swarms/examples/agent_structured_outputs/" - title: "Web Search (Exa, Serper)" @@ -114,8 +112,6 @@ extra: url: "https://docs.swarms.world/en/latest/examples/templates/" - title: "Financial Analysis Swarms" url: "https://docs.swarms.world/en/latest/swarms/examples/swarms_api_finance/" - - title: "Deep Research Swarm" - url: "https://docs.swarms.world/en/latest/swarms/structs/deep_research_swarm/" - title: "Medical Diagnosis Systems" url: "https://docs.swarms.world/en/latest/swarms/examples/swarms_api_medical/" - title: "DAO Governance" @@ -282,7 +278,6 @@ nav: - ForestSwarm: "swarms/structs/forest_swarm.md" - MALT: "swarms/structs/malt.md" - Multi-Agent Execution Utilities: "swarms/structs/various_execution_methods.md" - - Deep Research Swarm: "swarms/structs/deep_research_swarm.md" - Council of Judges: "swarms/structs/council_of_judges.md" - Heavy Swarm: "swarms/structs/heavy_swarm.md" @@ -290,7 +285,6 @@ nav: - Overview: "swarms/structs/multi_swarm_orchestration.md" - HierarchicalSwarm: "swarms/structs/hierarchical_swarm.md" - Hierarchical Structured Communication Framework: "swarms/structs/hierarchical_structured_communication_framework.md" - - Auto Agent Builder: "swarms/structs/auto_agent_builder.md" - Hybrid Hierarchical-Cluster Swarm: "swarms/structs/hhcs.md" - Auto Swarm Builder: "swarms/structs/auto_swarm_builder.md" - Swarm Matcher: "swarms/structs/swarm_matcher.md" @@ -302,6 +296,7 @@ nav: - MultiAgentRouter: "swarms/structs/multi_agent_router.md" - ModelRouter: "swarms/structs/model_router.md" + - Rearrangers: - SwarmRearrange: "swarms/structs/swarm_rearrange.md" - AgentRearrange: "swarms/structs/agent_rearrange.md" @@ -327,7 +322,6 @@ nav: - Overview: "swarms_tools/overview.md" - BaseTool Reference: "swarms/tools/base_tool.md" - MCP Client Utils: "swarms/tools/mcp_client_call.md" - - MCP Agent Tool: "swarms/tools/mcp_agent_tool.md" - Vertical Tools: - Finance: "swarms_tools/finance.md" @@ -345,6 +339,10 @@ nav: - Deploy on Google Cloud Run: "swarms_cloud/cloud_run.md" - Deploy on Phala: "swarms_cloud/phala_deploy.md" - Deploy on Cloudflare Workers: "swarms_cloud/cloudflare_workers.md" + - Agent Orchestration Protocol (AOP): + - AOP Reference: "swarms/structs/aop.md" + - AOP Server Setup: "swarms/examples/aop_server_example.md" + - AOP Cluster Example: "swarms/examples/aop_cluster_example.md" - Examples: @@ -373,7 +371,6 @@ nav: - Agent with Gemini Nano Banana: "swarms/examples/jarvis_agent.md" - LLM Providers: - Language Models: - - How to Create A Custom Language Model: "swarms/models/custom_model.md" - Overview: "swarms/examples/model_providers.md" - OpenAI: "swarms/examples/openai_example.md" - Anthropic: "swarms/examples/claude.md" @@ -387,10 +384,6 @@ nav: - VLLM: "swarms/examples/vllm_integration.md" - Llama4: "swarms/examples/llama4.md" - Custom Base URL & API Keys: "swarms/examples/custom_base_url_example.md" - - MultiModal Models: - - BaseMultiModalModel: "swarms/models/base_multimodal_model.md" - - Multi Modal Models Available: "swarms/models/multimodal_models.md" - - GPT4VisionAPI: "swarms/models/gpt4v.md" @@ -417,18 +410,16 @@ nav: - Hiearchical Marketing Team: "examples/marketing_team.md" - Gold ETF Research with HeavySwarm: "examples/gold_etf_research.md" - Hiring Swarm: "examples/hiring_swarm.md" - - Real Estate Swarm: "examples/realestate_swarm.md" + - Advanced Research: "examples/av.md" - Tools & Integrations: - Web Search with Exa: "examples/exa_search.md" - - Advanced Research: "examples/av.md" - Browser Use: "examples/browser_use.md" - Yahoo Finance: "swarms/examples/yahoo_finance.md" - Firecrawl: "developer_guides/firecrawl.md" - MCP: - Multi-MCP Agent Integration: "swarms/examples/multi_mcp_agent.md" - - Agent With MCP Integration: "swarms/examples/agent_with_mcp.md" - RAG: - RAG with Qdrant: "swarms/RAG/qdrant_rag.md" @@ -437,6 +428,9 @@ nav: - Web Scraper Agents: "developer_guides/web_scraper.md" - Smart Database: "examples/smart_database.md" + - AOP: + - Medical AOP Example: "examples/aop_medical.md" + - Swarms Cloud API: - Overview: "swarms_cloud/migration.md" From fe2913aefd60bacc56c3f3dfe8f51c6dd18edb8e Mon Sep 17 00:00:00 2001 From: Aksh Parekh Date: Tue, 7 Oct 2025 18:05:22 -0700 Subject: [PATCH 9/9] Delete docs/examples/realestate_swarm.md --- docs/examples/realestate_swarm.md | 480 ------------------------------ 1 file changed, 480 deletions(-) delete mode 100644 docs/examples/realestate_swarm.md diff --git a/docs/examples/realestate_swarm.md b/docs/examples/realestate_swarm.md deleted file mode 100644 index 0a2498fb..00000000 --- a/docs/examples/realestate_swarm.md +++ /dev/null @@ -1,480 +0,0 @@ -# Real Estate Swarm - -The Real Estate Swarm is a multi-agent system designed to automate and streamline the entire real estate transaction workflow. From lead generation to property maintenance, this swarm orchestrates a series of specialized AI agents to handle various aspects of buying, selling, and managing properties. - -## What it Does - -The `RealEstateSwarm` operates as a **sequential workflow**, where each agent's output feeds into the next, ensuring a cohesive and comprehensive process. The swarm consists of the following agents: - -1. **Lead Generation Agent (Alex)**: Identifies and qualifies potential real estate clients by gathering their property requirements, budget, preferred locations, and investment goals. This agent also uses the `exa_search` tool for initial lead information. -2. **Property Research Agent (Emma)**: Conducts in-depth research on properties matching client criteria and market trends. It leverages the `exa_search` tool to gather up-to-date information on local market trends, property values, investment potential, and neighborhood insights. -3. **Marketing Agent (Jack)**: Develops and executes marketing strategies to promote properties. This includes creating compelling listings, implementing digital marketing campaigns, and managing client interactions. -4. **Transaction Management Agent (Sophia)**: Handles all documentation, legal, and financial aspects of property transactions, ensuring compliance and smooth closing processes. -5. **Property Maintenance Agent (Michael)**: Manages property condition, oversees maintenance and repairs, and prepares properties for sale or rental, including staging and enhancing curb appeal. - -## How to Set Up - -To set up and run the Real Estate Swarm, follow these steps: - -## Step 1: Setup and Installation - -### Prerequisites - -| Requirement | -|-----------------------| -| Python 3.8 or higher | -| pip package manager | - -1. **Install dependencies:** - Use the following command to download all dependencies. - ```bash - # Install Swarms framework - pip install swarms - - # Install environment and logging dependencies - pip install python-dotenv loguru - - # Install HTTP client and tools - pip install httpx swarms_tools - ``` -2. **Set up API Keys:** - The `Property Research Agent` utilizes the `exa_search` tool, which requires an `EXA_API_KEY`. - Create a `.env` file in the root directory of your project (or wherever your application loads environment variables) and add your API keys: - ``` - EXA_API_KEY="YOUR_EXA_API_KEY" - OPENAI_API_KEY="OPENAI_API_KEY" - ``` - Replace `"YOUR_EXA_API_KEY"` & `"OPENAI_API_KEY"` with your actual API keys. - -## Step 2: Running the Real Estate Swarm - -```python - -from typing import List - -from swarms.structs.agent import Agent -from swarms.structs.conversation import Conversation -from swarms.utils.history_output_formatter import history_output_formatter - -# --- Exa Search Tool Integration --- -# Import and define exa_search as a callable tool for property research. -from swarms_tools import exa_search -# System prompts for each agent - -LEAD_GENERATION_PROMPT = """ -You are the Lead Generation Agent for Real Estate. - -ROLE: -Collect potential leads for real estate transactions by identifying buyers, sellers, and investors through various channels. - -RESPONSIBILITIES: -- Identify potential clients through: - * Real estate websites - * Social media platforms - * Referral networks - * Local community events -- Conduct initial consultations to understand: - * Client's property requirements - * Budget constraints - * Preferred locations - * Investment goals -- Qualify leads by assessing: - * Financial readiness - * Specific property needs - * Urgency of transaction - -OUTPUT FORMAT: -Provide a comprehensive lead report that includes: -1. Client profile and contact information -2. Detailed requirements and preferences -3. Initial assessment of client's real estate goals -4. Qualification status -5. Recommended next steps - -IMPORTANT CONTEXT SHARING: -When preparing the lead report, clearly summarize and include all answers and information provided by the user. Integrate these user responses directly into your analysis and the lead report. This ensures that when your report is sent to the next agent, it contains all relevant user preferences, requirements, and context needed for further research and decision-making. - -REMEMBER: -- Ensure the user's answers are explicitly included in your report so the next agent can use them for property research and analysis. -""" - -PROPERTY_RESEARCH_PROMPT = """ -You are the Property Research Agent for Real Estate. -ROLE: -Conduct in-depth research on properties that match client criteria and market trends. - -TOOLS: -You have access to the exa_search tool. Use exa_search to find up-to-date and relevant information about properties, market trends, and neighborhood data. Leverage the answers provided by the user and the outputs from previous agents to formulate your search queries. Always use exa_search to supplement your research and validate your findings. - -RESPONSIBILITIES: -- Perform comprehensive property market analysis using exa_search: - * Local market trends - * Property value assessments - * Investment potential - * Neighborhood evaluations -- Research properties matching client specifications (using both user answers and previous agent outputs): - * Price range - * Location preferences - * Property type - * Specific amenities -- Compile detailed property reports including: - * Comparative market analysis (use exa_search for recent comps) - * Property history - * Potential appreciation - * Neighborhood insights (gathered via exa_search) - -INSTRUCTIONS: -- Always use exa_search to find the most current and relevant information for your analysis. -- Formulate your exa_search queries based on the user's answers and the outputs from previous agents. -- Clearly indicate in your report where exa_search was used to obtain information. - -OUTPUT FORMAT: -Provide a structured property research report: -1. Shortlist of matching properties (include sources from exa_search) -2. Detailed property analysis for each option (cite exa_search findings) -3. Market trend insights (supported by exa_search data) -4. Investment potential assessment -5. Recommendations for client consideration - -REMEMBER: -Do not rely solely on prior knowledge. Always use exa_search to verify and enhance your research with the latest available data. -""" - -MARKETING_PROMPT = """ -You are the Marketing Agent for Real Estate. -ROLE: -Develop and execute marketing strategies to promote properties and attract potential buyers. -RESPONSIBILITIES: -- Create compelling property listings: - * Professional photography - * Detailed property descriptions - * Highlight unique selling points -- Implement digital marketing strategies: - * Social media campaigns - * Email marketing - * Online property platforms - * Targeted advertising -- Manage client interactions: - * Respond to property inquiries - * Schedule property viewings - * Facilitate initial negotiations -OUTPUT FORMAT: -Provide a comprehensive marketing report: -1. Marketing strategy overview -2. Property listing details -3. Marketing channel performance -4. Client inquiry and viewing logs -5. Initial negotiation summaries -""" - -TRANSACTION_MANAGEMENT_PROMPT = """ -You are the Transaction Management Agent for Real Estate. -ROLE: -Handle all documentation, legal, and financial aspects of property transactions. -RESPONSIBILITIES: -- Manage transaction documentation: - * Prepare purchase agreements - * Coordinate legal paperwork - * Ensure compliance with real estate regulations -- Facilitate transaction process: - * Coordinate with attorneys - * Liaise with lenders - * Manage escrow processes - * Coordinate property inspections -- Ensure smooth closing: - * Verify all financial requirements - * Coordinate final document signings - * Manage fund transfers -OUTPUT FORMAT: -Provide a detailed transaction management report: -1. Transaction document status -2. Legal and financial coordination details -3. Inspection and verification logs -4. Closing process timeline -5. Recommendations for transaction completion -""" - -PROPERTY_MAINTENANCE_PROMPT = """ -You are the Property Maintenance Agent for Real Estate. -ROLE: -Manage property condition, maintenance, and preparation for sale or rental. -RESPONSIBILITIES: -- Conduct regular property inspections: - * Assess property condition - * Identify maintenance needs - * Ensure safety standards -- Coordinate maintenance and repairs: - * Hire and manage contractors - * Oversee repair and renovation work - * Manage landscaping and cleaning -- Prepare properties for market: - * Stage properties - * Enhance curb appeal - * Recommend cost-effective improvements -OUTPUT FORMAT: -Provide a comprehensive property maintenance report: -1. Inspection findings -2. Maintenance and repair logs -3. Improvement recommendations -4. Property readiness status -5. Contractor and service provider details -""" - -class RealEstateSwarm: - def __init__( - self, - name: str = "Real Estate Swarm", - description: str = "A comprehensive AI-driven real estate transaction workflow", - max_loops: int = 1, - user_name: str = "Real Estate Manager", - property_type: str = "Residential", - output_type: str = "json", - user_lead_info: str = "", - ): - self.max_loops = max_loops - self.name = name - self.description = description - self.user_name = user_name - self.property_type = property_type - self.output_type = output_type - self.user_lead_info = user_lead_info - - self.agents = self._initialize_agents() - self.conversation = Conversation() - self.handle_initial_processing() - self.exa_search_results = [] # Store exa_search results for property research - - def handle_initial_processing(self): - self.conversation.add( - role=self.user_name, - content=f"Company: {self.name}\n" - f"Description: {self.description}\n" - f"Property Type: {self.property_type}" - ) - - def _initialize_agents(self) -> List[Agent]: - return [ - Agent( - agent_name="Alex-Lead-Generation", - agent_description="Identifies and qualifies potential real estate clients across various channels.", - system_prompt=LEAD_GENERATION_PROMPT, - max_loops=self.max_loops, - dynamic_temperature_enabled=True, - output_type="final", - ), - Agent( - agent_name="Emma-Property-Research", - agent_description="Conducts comprehensive property research and market analysis.", - system_prompt=PROPERTY_RESEARCH_PROMPT, - max_loops=self.max_loops, - dynamic_temperature_enabled=True, - output_type="final", - ), - Agent( - agent_name="Jack-Marketing", - agent_description="Develops and executes marketing strategies for properties.", - system_prompt=MARKETING_PROMPT, - max_loops=self.max_loops, - dynamic_temperature_enabled=True, - output_type="final", - ), - Agent( - agent_name="Sophia-Transaction-Management", - agent_description="Manages legal and financial aspects of real estate transactions.", - system_prompt=TRANSACTION_MANAGEMENT_PROMPT, - max_loops=self.max_loops, - dynamic_temperature_enabled=True, - output_type="final", - ), - Agent( - agent_name="Michael-Property-Maintenance", - agent_description="Oversees property condition, maintenance, and market preparation.", - system_prompt=PROPERTY_MAINTENANCE_PROMPT, - max_loops=self.max_loops, - dynamic_temperature_enabled=True, - output_type="final", - ), - ] - - def find_agent_by_name(self, name: str) -> Agent: - for agent in self.agents: - if name in agent.agent_name: - return agent - return None - - def lead_generation(self): - alex_agent = self.find_agent_by_name("Lead-Generation") - # Directly inject the user_lead_info into the prompt for the first agent - alex_output = alex_agent.run( - f"User Lead Information:\n{self.user_lead_info}\n\n" - f"History: {self.conversation.get_str()}\n" - f"Generate leads for {self.property_type} real estate transactions. Identify potential clients and their specific requirements." - ) - self.conversation.add( - role="Lead-Generation", content=alex_output - ) - - # --- After lead generation, use user_lead_info as queries for exa_search --- - queries = [] - if isinstance(self.user_lead_info, list): - queries = [str(q) for q in self.user_lead_info if str(q).strip()] - elif isinstance(self.user_lead_info, str): - if "\n" in self.user_lead_info: - queries = [q.strip() for q in self.user_lead_info.split("\n") if q.strip()] - else: - queries = [self.user_lead_info.strip()] if self.user_lead_info.strip() else [] - - self.exa_search_results = [] - for q in queries: - result = exa_search(q) - self.exa_search_results.append({ - "query": q, - "exa_result": result - }) - - def property_research(self): - emma_agent = self.find_agent_by_name("Property-Research") - # Pass ALL exa_search results as direct context to the property research agent - exa_context = "" - if hasattr(self, "exa_search_results") and self.exa_search_results: - # Directly inject all exa_search results as context - exa_context = "\n\n[Exa Search Results]\n" - for item in self.exa_search_results: - exa_context += f"Query: {item['query']}\nExa Search Result: {item['exa_result']}\n" - - emma_output = emma_agent.run( - f"History: {self.conversation.get_str()}\n" - f"{exa_context}" - f"Conduct research on {self.property_type} properties, analyze market trends, and prepare a comprehensive property report." - ) - self.conversation.add( - role="Property-Research", content=emma_output - ) - - def property_marketing(self): - jack_agent = self.find_agent_by_name("Marketing") - jack_output = jack_agent.run( - f"History: {self.conversation.get_str()}\n" - f"Develop marketing strategies for {self.property_type} properties, create listings, and manage client interactions." - ) - self.conversation.add( - role="Marketing", content=jack_output - ) - - def transaction_management(self): - sophia_agent = self.find_agent_by_name("Transaction-Management") - sophia_output = sophia_agent.run( - f"History: {self.conversation.get_str()}\n" - f"Manage legal and financial aspects of the {self.property_type} property transaction." - ) - self.conversation.add( - role="Transaction-Management", content=sophia_output - ) - - def property_maintenance(self): - michael_agent = self.find_agent_by_name("Property-Maintenance") - michael_output = michael_agent.run( - f"History: {self.conversation.get_str()}\n" - f"Assess and manage maintenance for the {self.property_type} property to prepare it for market." - ) - self.conversation.add( - role="Property-Maintenance", content=michael_output - ) - - def run(self, task: str): - """ - Process the real estate workflow through the swarm, coordinating tasks among agents. - """ - self.conversation.add(role=self.user_name, content=task) - - # Execute workflow stages - self.lead_generation() - self.property_research() - self.property_marketing() - self.transaction_management() - self.property_maintenance() - - return history_output_formatter( - self.conversation, type=self.output_type - ) - -def main(): - """FOR ACTUAL INPUT FROM USER""" - # # Collect user lead information at the beginning - # print("Please provide the following information for lead generation:") - # questions = [ - # "What are the client's property requirements?", - # "What is the client's budget range or constraints?", - # "What are the client's preferred locations?", - # "What are the client's investment goals?", - # "What is the client's contact information?", - # "What is the urgency of the transaction?", - # "Is the client financially ready to proceed?" - # ] - - # user_lead_info = "" - # for q in questions: - # answer = input(f"{q}\n> ").strip() - # user_lead_info += f"Q: {q}\nA: {answer if answer else '[No answer provided]'}\n\n" - # Pre-filled placeholder answers for each question - user_lead_info = [ - "Spacious 3-bedroom apartment with modern amenities", - "$1,000,000 - $1,500,000", - "Downtown Manhattan, Upper East Side", - "Long-term investment with high ROI", - "john.doe@email.com, +1-555-123-4567", - "Within the next 3 months", - "Yes, pre-approved for mortgage" - ] - - - # Initialize the swarm - real_estate_swarm = RealEstateSwarm( - max_loops=1, - name="Global Real Estate Solutions", - description="Comprehensive AI-driven real estate transaction workflow", - user_name="Real Estate Director", - property_type="Luxury Residential", - output_type="json", - user_lead_info=user_lead_info, - ) - - # Sample real estate task - sample_task = """ - We have a high-end luxury residential property in downtown Manhattan. - Client requirements: - - Sell the property quickly - - Target high-net-worth individuals - - Maximize property value - - Ensure smooth and discreet transaction - """ - # Run the swarm - real_estate_swarm.run(task=sample_task) - -if __name__ == "__main__": - main() - -``` - -## How it Can Be Used for Real Estate - -The Real Estate Swarm can be utilized for a variety of real estate tasks, providing an automated and efficient approach to complex workflows: - -* **Automated Lead Qualification**: Automatically gather and assess potential client needs and financial readiness. -* **Comprehensive Property Analysis**: Rapidly research and generate detailed reports on properties and market trends using real-time web search capabilities. -* **Streamlined Marketing**: Develop and execute marketing strategies, including listing creation and social media campaigns. -* **Efficient Transaction Management**: Automate the handling of legal documents, financial coordination, and closing processes. -* **Proactive Property Maintenance**: Manage property upkeep and prepare assets for optimal market presentation. - -By chaining these specialized agents, the Real Estate Swarm provides an end-to-end solution for real estate professionals, reducing manual effort and increasing operational efficiency. - -## Contributing to Swarms -| Platform | Link | Description | -|----------|------|-------------| -| 📚 Documentation | [docs.swarms.world](https://docs.swarms.world) | Official documentation and guides | -| 📝 Blog | [Medium](https://medium.com/@kyeg) | Latest updates and technical articles | -| 💬 Discord | [Join Discord](https://discord.gg/EamjgSaEQf) | Live chat and community support | -| 🐦 Twitter | [@kyegomez](https://twitter.com/kyegomez) | Latest news and announcements | -| 👥 LinkedIn | [The Swarm Corporation](https://www.linkedin.com/company/the-swarm-corporation) | Professional network and updates | -| 📺 YouTube | [Swarms Channel](https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ) | Tutorials and demos | -| 🎫 Events | [Sign up here](https://lu.ma/5p2jnc2v) | Join our community events |