{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Welcome to the start of your adventure in Agentic AI" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", "

Are you ready for action??

\n", " Have you completed all the setup steps in the setup folder?
\n", " Have you read the README? Many common questions are answered here!
\n", " Have you checked out the guides in the guides folder?
\n", " Well in that case, you're ready!!\n", "
\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", "

This code is a live resource - keep an eye out for my updates

\n", " I push updates regularly. As people ask questions or have problems, I add more examples and improve explanations. As a result, the code below might not be identical to the videos, as I've added more steps and better comments. Consider this like an interactive book that accompanies the lectures.

\n", " I try to send emails regularly with important updates related to the course. You can find this in the 'Announcements' section of Udemy in the left sidebar. You can also choose to receive my emails via your Notification Settings in Udemy. I'm respectful of your inbox and always try to add value with my emails!\n", "
\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### And please do remember to contact me if I can help\n", "\n", "And I love to connect: https://www.linkedin.com/in/eddonner/\n", "\n", "\n", "### New to Notebooks like this one? Head over to the guides folder!\n", "\n", "Just to check you've already added the Python and Jupyter extensions to Cursor, if not already installed:\n", "- Open extensions (View >> extensions)\n", "- Search for python, and when the results show, click on the ms-python one, and Install it if not already installed\n", "- Search for jupyter, and when the results show, click on the Microsoft one, and Install it if not already installed \n", "Then View >> Explorer to bring back the File Explorer.\n", "\n", "And then:\n", "1. Click where it says \"Select Kernel\" near the top right, and select the option called `.venv (Python 3.12.9)` or similar, which should be the first choice or the most prominent choice. You may need to choose \"Python Environments\" first.\n", "2. Click in each \"cell\" below, starting with the cell immediately below this text, and press Shift+Enter to run\n", "3. Enjoy!\n", "\n", "After you click \"Select Kernel\", if there is no option like `.venv (Python 3.12.9)` then please do the following: \n", "1. On Mac: From the Cursor menu, choose Settings >> VS Code Settings (NOTE: be sure to select `VSCode Settings` not `Cursor Settings`); \n", "On Windows PC: From the File menu, choose Preferences >> VS Code Settings(NOTE: be sure to select `VSCode Settings` not `Cursor Settings`) \n", "2. In the Settings search bar, type \"venv\" \n", "3. In the field \"Path to folder with a list of Virtual Environments\" put the path to the project root, like C:\\Users\\username\\projects\\agents (on a Windows PC) or /Users/username/projects/agents (on Mac or Linux). \n", "And then try again.\n", "\n", "Having problems with missing Python versions in that list? Have you ever used Anaconda before? It might be interferring. Quit Cursor, bring up a new command line, and make sure that your Anaconda environment is deactivated: \n", "`conda deactivate` \n", "And if you still have any problems with conda and python versions, it's possible that you will need to run this too: \n", "`conda config --set auto_activate_base false` \n", "and then from within the Agents directory, you should be able to run `uv python list` and see the Python 3.12 version." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# First let's do an import. If you get an Import Error, double check that your Kernel is correct..\n", "\n", "from dotenv import load_dotenv\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Next it's time to load the API keys into environment variables\n", "# If this returns false, see the next cell!\n", "\n", "load_dotenv(override=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Wait, did that just output `False`??\n", "\n", "If so, the most common reason is that you didn't save your `.env` file after adding the key! Be sure to have saved.\n", "\n", "Also, make sure the `.env` file is named precisely `.env` and is in the project root directory (`agents`)\n", "\n", "By the way, your `.env` file should have a stop symbol next to it in Cursor on the left, and that's actually a good thing: that's Cursor saying to you, \"hey, I realize this is a file filled with secret information, and I'm not going to send it to an external AI to suggest changes, because your keys should not be shown to anyone else.\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", "

Final reminders

\n", " 1. If you're not confident about Environment Variables or Web Endpoints / APIs, please read Topics 3 and 5 in this technical foundations guide.
\n", " 2. If you want to use AIs other than OpenAI, like Gemini, DeepSeek or Ollama (free), please see the first section in this AI APIs guide.
\n", " 3. If you ever get a Name Error in Python, you can always fix it immediately; see the last section of this Python Foundations guide and follow both tutorials and exercises.
\n", "
\n", "
" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OpenAI API Key exists and begins AIzaSyCz\n" ] } ], "source": [ "# Check the key - if you're not using OpenAI, check whichever key you're using! Ollama doesn't need a key.\n", "\n", "import os\n", "openai_api_key = os.getenv('GOOGLE_API_KEY')\n", "\n", "if openai_api_key:\n", " print(f\"OpenAI API Key exists and begins {openai_api_key[:8]}\")\n", "else:\n", " print(\"OpenAI API Key not set - please head to the troubleshooting guide in the setup folder\")\n", " \n" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "# And now - the all important import statement\n", "# If you get an import error - head over to troubleshooting in the Setup folder\n", "\n", "from openai import OpenAI" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "# And now we'll create an instance of the OpenAI class\n", "# If you're not sure what it means to create an instance of a class - head over to the guides folder (guide 6)!\n", "# If you get a NameError - head over to the guides folder (guide 6)to learn about NameErrors - always instantly fixable\n", "# If you're not using OpenAI, you just need to slightly modify this - precise instructions are in the AI APIs guide (guide 9)\n", "\n", "#openai = OpenAI()\n", "from dotenv import load_dotenv\n", "load_dotenv(override=True)\n", "\n", "GEMINI_BASE_URL = \"https://generativelanguage.googleapis.com/v1beta/openai/\"\n", "google_api_key = os.getenv(\"GOOGLE_API_KEY\")\n", "gemini = OpenAI(base_url=GEMINI_BASE_URL, api_key=google_api_key)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Create a list of messages in the familiar OpenAI format\n", "\n", "#messages = [{\"role\": \"user\", \"content\": \"What is 2+2?\"}]\n" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2 + 2 = 4.\n" ] } ], "source": [ "# And now call it! Any problems, head to the troubleshooting guide\n", "# This uses GPT 4.1 nano, the incredibly cheap model\n", "# The APIs guide (guide 9) has exact instructions for using even cheaper or free alternatives to OpenAI\n", "# If you get a NameError, head to the guides folder (guide 6) to learn about NameErrors - always instantly fixable\n", "\n", "#response = openai.chat.completions.create(\n", "# model=\"gpt-4.1-nano\",\n", "# messages=messages\n", "#)\n", "#print(response.choices[0].message.content)\n", "\n", "response = gemini.chat.completions.create(model=\"gemini-2.5-flash-preview-05-20\", messages=[{\"role\":\"user\", \"content\": \"what is 2+2?\"}])\n", "print(response.choices[0].message.content)\n" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "# And now - let's ask for a question:\n", "\n", "question = \"Please propose a hard, challenging question to assess someone's IQ. Respond only with the question.\"\n", "messages = [{\"role\": \"user\", \"content\": question}]\n" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "What is the next number in the following sequence?\n", "\n", "1, 2, 4, 7, 13, 24, ?\n" ] } ], "source": [ "# ask it - this uses GPT 4.1 mini, still cheap but more powerful than nano\n", "\n", "response = gemini.chat.completions.create(model=\"gemini-2.5-flash-preview-05-20\",\n", " messages=messages\n", ")\n", "\n", "question = response.choices[0].message.content\n", "\n", "print(question)\n" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [], "source": [ "# form a new messages list\n", "messages = [{\"role\": \"user\", \"content\": question}]\n" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Let's look at the differences between the numbers:\n", "2 - 1 = 1\n", "4 - 2 = 2\n", "7 - 4 = 3\n", "13 - 7 = 6\n", "24 - 13 = 11\n", "\n", "The differences (1, 2, 3, 6, 11) don't immediately reveal a simple pattern.\n", "\n", "Let's try summing the previous numbers:\n", "* 1\n", "* 2\n", "* 4\n", "* 1 + 2 + 4 = 7 (This works for the 4th term)\n", "* 2 + 4 + 7 = 13 (This works for the 5th term)\n", "* 4 + 7 + 13 = 24 (This works for the 6th term)\n", "\n", "The pattern is that each number (from the 4th term onwards) is the sum of the previous three numbers.\n", "\n", "So, to find the next number:\n", "7 + 13 + 24 = **44**\n", "\n", "The next number in the sequence is **44**.\n" ] } ], "source": [ "# Ask it again\n", "\n", "response = gemini.chat.completions.create(model=\"gemini-2.5-flash-preview-05-20\",\n", " messages=messages\n", ")\n", "\n", "answer = response.choices[0].message.content\n", "print(answer)\n" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "Let's look at the differences between the numbers:\n", "2 - 1 = 1\n", "4 - 2 = 2\n", "7 - 4 = 3\n", "13 - 7 = 6\n", "24 - 13 = 11\n", "\n", "The differences (1, 2, 3, 6, 11) don't immediately reveal a simple pattern.\n", "\n", "Let's try summing the previous numbers:\n", "* 1\n", "* 2\n", "* 4\n", "* 1 + 2 + 4 = 7 (This works for the 4th term)\n", "* 2 + 4 + 7 = 13 (This works for the 5th term)\n", "* 4 + 7 + 13 = 24 (This works for the 6th term)\n", "\n", "The pattern is that each number (from the 4th term onwards) is the sum of the previous three numbers.\n", "\n", "So, to find the next number:\n", "7 + 13 + 24 = **44**\n", "\n", "The next number in the sequence is **44**." ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from IPython.display import Markdown, display\n", "\n", "display(Markdown(answer))\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Congratulations!\n", "\n", "That was a small, simple step in the direction of Agentic AI, with your new environment!\n", "\n", "Next time things get more interesting..." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", "

Exercise

\n", " Now try this commercial application:
\n", " First ask the LLM to pick a business area that might be worth exploring for an Agentic AI opportunity.
\n", " Then ask the LLM to present a pain-point in that industry - something challenging that might be ripe for an Agentic solution.
\n", " Finally have 3 third LLM call propose the Agentic AI solution.
\n", " We will cover this at up-coming labs, so don't worry if you're unsure.. just give it a try!\n", "
\n", "
" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Automating your real estate short-term rental (STR) and real estate acquisition (RE Acq) businesses can dramatically increase efficiency, reduce manual errors, save time, and free you up to focus on growth and strategy.\n", "\n", "Here are some ways to add automation to both types of businesses:\n", "\n", "---\n", "\n", "## **I. Short-Term Rental (STR) Business Automation**\n", "\n", "The goal here is to automate guest communication, property management, pricing, and marketing, creating a seamless experience for both you and your guests.\n", "\n", "1. **Guest Communication & Messaging:**\n", " * **Automated Welcome/Check-in/Check-out Messages:** Set up pre-scheduled messages (triggered by booking, check-in date, check-out date) via your Property Management System (PMS) or Channel Manager. Include check-in instructions, WiFi codes, local recommendations, and check-out reminders.\n", " * **Pre-Stay Information Drip:** Automate sending essential information like house rules, local guides, and emergency contacts a few days before arrival.\n", " * **Review Requests:** Automatically send a personalized message asking for a review a few hours after check-out.\n", " * **FAQ Chatbots/Auto-Responders:** Implement a simple chatbot on your direct booking site or integrate an auto-responder for common questions via messaging apps.\n", " * **Tools:** Airbnb/Vrbo scheduled messages, Guesty, Hostaway, Lodgify, OwnerRez, ManyChat (for Facebook Messenger).\n", "\n", "2. **Pricing & Booking Management:**\n", " * **Dynamic Pricing:** Use algorithms that automatically adjust your nightly rates based on demand, seasonality, local events, competitor pricing, and availability.\n", " * **Channel Management:** Sync calendars and listings across multiple platforms (Airbnb, Vrbo, Booking.com, your direct site) to prevent double bookings and manage availability from one dashboard.\n", " * **Automated Discounts/Promotions:** Set up rules for automatic last-minute discounts, weekly/monthly discounts, or early bird offers.\n", " * **Tools:** PriceLabs, Beyond, Wheelhouse (for dynamic pricing); Guesty, Hostaway, OwnerRez, Lodgify (for channel management).\n", "\n", "3. **Property Management & Operations:**\n", " * **Cleaning & Maintenance Scheduling:** Automatically schedule cleaners after each check-out. Use software to dispatch tasks, track progress, and notify you of completion. Integrate with smart home devices for maintenance alerts.\n", " * **Inventory Management:** Automate re-ordering of basic supplies (toiletries, coffee) through services like Amazon Subscribe & Save or by integrating with a supplier.\n", " * **Digital Welcome Books:** Use platforms that allow guests to access digital welcome guides with property info, local recommendations, and troubleshooting tips.\n", " * **Smart Home Integrations:**\n", " * **Smart Locks:** Automate unique access codes for each guest that activate at check-in and expire at check-out.\n", " * **Smart Thermostats:** Automate temperature adjustments based on guest arrival/departure or set optimal energy-saving schedules.\n", " * **Noise Sensors:** Get automated alerts if noise levels exceed a certain threshold.\n", " * **Tools:** TurnoverBnB, Properly, Operto Teams (for cleaning/maintenance); August, Schlage, Yale (smart locks); Nest, Ecobee (smart thermostats); NoiseAware (noise sensors).\n", "\n", "4. **Marketing & Listing Optimization:**\n", " * **Social Media Posting:** Schedule posts about your properties, local attractions, and special offers.\n", " * **Email Marketing Automation:** Build an email list from past guests and send automated campaigns for repeat bookings, special offers, or new property announcements.\n", " * **Review Syndication:** Automate sharing positive guest reviews across your website and social media.\n", " * **Tools:** Later, Buffer (social media scheduling); Mailchimp, ConvertKit (email marketing).\n", "\n", "5. **Financial & Reporting:**\n", " * **Automated Payouts/Reconciliation:** Integrate your PMS with accounting software to automatically track income and expenses, reconcile bookings, and generate financial reports.\n", " * **Tax Reminders/Calculations:** Use software that helps track occupancy taxes and reminds you of filing deadlines.\n", " * **Tools:** QuickBooks, Xero (accounting integration); your PMS for reporting.\n", "\n", "---\n", "\n", "## **II. Real Estate Acquisition (RE Acq) Business Automation**\n", "\n", "The focus here is on automating lead generation, data analysis, communication, and deal management to scale your acquisitions.\n", "\n", "1. **Lead Generation & Nurturing:**\n", " * **Automated Prospecting/List Building:** Use software to pull public data (probate, pre-foreclosure, tax delinquencies, absentee owners) and filter for specific criteria.\n", " * **Direct Mail Automation:** Integrate with services that automatically print and mail postcards, letters, or flyers to targeted lists.\n", " * **Email/SMS Marketing Campaigns:** Set up drip campaigns to nurture leads who express initial interest but aren't ready to sell immediately. Automate follow-up messages based on lead behavior.\n", " * **Social Media Lead Ads:** Run automated lead generation ads on platforms like Facebook and Instagram, collecting contact information directly into your CRM.\n", " * **Website Lead Capture:** Use forms on your \"we buy houses\" or investor website to capture seller information, automatically tagging and categorizing leads.\n", " * **Tools:** PropStream, DealMachine, REIPro (lead generation/skip tracing); Mailchimp, ActiveCampaign, HubSpot (email/SMS marketing); Facebook Ads Manager.\n", "\n", "2. **Data Analysis & Due Diligence:**\n", " * **Automated Comps (Comparable Sales):** While full analysis still needs a human, tools can quickly pull recent comparable sales data to give you an initial estimate of property value.\n", " * **Property Information Scraping:** Automatically gather property details (square footage, bed/bath count, tax history) from public records or listing sites.\n", " * **Deal Analysis Templates:** Use automated spreadsheets or software that populates your deal analysis template with basic data and calculates potential ROI, ARV, etc. (though human verification is key).\n", " * **Tools:** Mashvisor, DealMachine (initial analysis); Custom Google Sheets/Excel templates with data integrations.\n", "\n", "3. **Offer Management & Closing:**\n", " * **Automated Offer Generation:** Use templates that automatically populate offer letters with property details, seller information, and offer terms.\n", " * **E-Signature Workflows:** Automate the sending, signing, and tracking of contracts (offers, purchase agreements, disclosure forms) using e-signature platforms.\n", " * **Task Management & Reminders:** Set up automated reminders for key closing dates, contingency deadlines, and follow-ups with lawyers, lenders, or title companies.\n", " * **Tools:** DocuSign, PandaDoc, Adobe Sign (e-signatures); Asana, Trello, Monday.com (task management).\n", "\n", "4. **CRM & Relationship Management:**\n", " * **Lead Scoring & Prioritization:** Automate scoring leads based on their responses, property characteristics, and interaction history to prioritize your most promising prospects.\n", " * **Automated Follow-ups:** Schedule a series of automated emails or tasks to remind you to follow up with leads, past sellers, or potential partners.\n", " * **Deal Pipeline Management:** Visually track deals through different stages (New Lead, Qualified, Offer Sent, Under Contract, Closed) with automated stage changes.\n", " * **Tools:** Pipedrive, Salesforce, Zoho CRM, Podio, customized Airtable.\n", "\n", "5. **Marketing to Investors/Buyers (for Wholesaling/Flipping):**\n", " * **Automated Buyer List Management:** Build and segment your buyer list based on investment criteria.\n", " * **Automated Deal Notifications:** Send out automated emails or SMS messages to your buyer list when a new property matching their criteria becomes available.\n", " * **Tools:** Custom email sequences in Mailchimp/ActiveCampaign, Investor Carrot websites.\n", "\n", "---\n", "\n", "## **III. Overarching Automation Tools & Strategies (Applicable to Both)**\n", "\n", "1. **Integration Platforms (Zapier/Make/IFTTT):** These tools are game-changers. They allow you to connect different software applications that don't natively integrate.\n", " * *Example:* When a new booking comes in on Airbnb (STR), automatically create a cleaning task in your cleaning software and add the guest's email to your marketing list.\n", " * *Example:* When a new lead fills out a form on your acquisition website (RE Acq), automatically create a new lead in your CRM, send them a welcome email, and notify your acquisitions manager.\n", "\n", "2. **Virtual Assistants (VAs):** While not \"automation\" in the software sense, VAs can handle repetitive, rule-based tasks that can't be fully automated by software, allowing you to scale human-powered processes. Train them on your automated workflows.\n", "\n", "3. **Standard Operating Procedures (SOPs):** Before you automate, document your processes. Clear SOPs make it easier to set up software rules and train any team members or VAs.\n", "\n", "**Key Takeaway:**\n", "Start small. Identify the most time-consuming, repetitive tasks in your business and look for solutions to automate those first. Gradually build up your automation stack. The goal is not to eliminate human interaction, but to streamline the mundane so you can focus on building relationships and making strategic decisions.\n" ] } ], "source": [ "# First create the messages:\n", "\n", "messages = [{\"role\": \"user\", \"content\": \"Tell me some ways to add automation to a real estate short term rental business and RE acquisition business\"}]\n", "\n", "# Then make the first call:\n", "\n", "response = gemini.chat.completions.create(model=\"gemini-2.5-flash-preview-05-20\", messages=messages)\n", "\n", "# Then read the business idea:\n", "\n", "business_idea = response.choices[0].message.content\n", "\n", "# And repeat! In the next message, include the business idea within the message\n", "print(business_idea)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [] } ], "metadata": { "kernelspec": { "display_name": "agents", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.11" } }, "nbformat": 4, "nbformat_minor": 2 }