Aria is a small full-stack AI assistant for qualifying real-estate leads. It combines a FastAPI backend, a Streamlit chat frontend, optional Gemini-powered responses, and a local fallback flow so the assistant can still respond when the LLM is disabled or unavailable.
- Runs a chat-based real-estate intake assistant
- Qualifies buyer and seller leads
- Tracks lead details such as intent, location, budget, timeline, email, and phone
- Falls back to local rule-based logic when Gemini is disabled or fails
- Stores completed leads in CSV
- Stores conversation history in JSON
- Can send email notifications for completed leads
- Python
- FastAPI
- Streamlit
- Gemini API via
google-generativeai - SMTP for notifications
Real_Estate_AI_Agent/
├── README.md
└── ai-agent/
├── .env
├── .env.example
├── .gitignore
├── Procfile
├── render.yaml
├── runtime.txt
├── backend/
│ ├── booking.py
│ ├── emailer.py
│ ├── llm.py
│ ├── logic.py
│ └── main.py
├── frontend/
│ └── app.py
├── utils/
│ ├── config.py
│ └── sheets.py
└── data/
└── conversations.json
- The Streamlit frontend sends the conversation to the FastAPI backend.
- The backend tries Gemini first when
ENABLE_GEMINI=true. - If Gemini is disabled, unavailable, or returns an invalid result, the backend uses local qualification logic.
- When the lead is complete enough, the backend marks it as
completed. - Completed leads are written to
ai-agent/data/leads.csv. - Conversation history is written to
ai-agent/data/conversations.json.
The app currently loads configuration from ai-agent/.env.
Create your local config:
cd ai-agent
cp .env.example .envExample:
BACKEND_URL=http://localhost:8000
CORS_ORIGINS=http://localhost:8501
ENABLE_GEMINI=true
GEMINI_API_KEY=your_gemini_api_key
GEMINI_MODEL=gemini-3-flash-preview
GEMINI_TIMEOUT_SECONDS=30
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=your_email@example.com
SMTP_PASSWORD=your_app_password
NOTIFICATION_EMAIL=sales@example.com- Create a virtual environment:
cd ai-agent
python -m venv .venv
source .venv/bin/activate- Install dependencies:
pip install fastapi uvicorn streamlit requests pydantic python-dotenv google-generativeai-
Create the
.envfile from.env.example. -
Start the backend:
uvicorn backend.main:app --host 127.0.0.1 --port 8000- In a second terminal, start the frontend:
cd ai-agent
source .venv/bin/activate
streamlit run frontend/app.py --server.address 127.0.0.1 --server.port 8501- Open:
http://127.0.0.1:8501
Basic health check:
curl http://127.0.0.1:8000/healthExpected response:
{"status":"ok"}Send a conversation to the assistant:
curl -X POST http://127.0.0.1:8000/chat \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "assistant", "content": "Hi, it is lovely to connect."},
{"role": "user", "content": "I want to buy an apartment in Miami."}
]
}'Example response:
{
"status": "ongoing",
"intent": "buy",
"name": null,
"budget": null,
"location": "Miami",
"timeline": null,
"email": null,
"phone": null,
"preferred_contact_method": null,
"preferred_contact_time": null,
"action": "none",
"reply": "That sounds exciting. Which area are you hoping to focus on?"
}Completed leads are saved to:
ai-agent/data/leads.csv
Conversation history is saved to:
ai-agent/data/conversations.json
- The backend entrypoint is
ai-agent/backend/main.py. - Gemini integration lives in
ai-agent/backend/llm.py. - Local fallback logic lives in
ai-agent/backend/logic.py. - Frontend UI lives in
ai-agent/frontend/app.py. - Settings are loaded from
ai-agent/.envbyai-agent/utils/config.py.
- The repository currently references
requirements.txtinrender.yaml, but that file is not present in the repo. - The current backend exposes
/healthand/chatonly. - The existing code includes email support, but not a live SMS webhook endpoint.
No license is currently defined in this repository.