This project is an AI-powered assistant designed for a real estate agency. The assistant helps potential buyers and renters find their ideal property by engaging them in a conversation. It gathers user preferences such as location, budget, property type, and other criteria, and provides relevant property options from the agency's database.
It leverages the functionality of the Google Agent Development Kit (ADK). The data the agent currently works with is scraped from Hepsiemlak, a Turkish real estate portal.
Currently, it supports rental searches for apartments only.
- Interactive Conversations: The assistant engages users in natural language conversations to understand their preferences.
- Property Search: Supports filtering properties based on location, budget, property type, and other attributes.
- SQL Query Generation: Converts user queries into SQL statements to fetch data from the database.
- Agent System: Includes specialized agents for renting and sales processes.
- Session Management: Maintains session state to track user interactions and preferences.
The project is organized as follows:
real_estate_agent/
├── pyproject.toml # Project dependencies and metadata
├── README.md # Project documentation
├── sql/ # SQL scripts and views
│ ├── v_emlak_by_disticts.sql
│ └── v_emlak_data_mart.sql
├── src/ # Source code
│ ├── settings.py # Configuration settings
│ ├── utils/ # Utility functions
│ │ ├── utils.py
│ │ └── sql_communicator.py
│ ├── agents/ # AI agents
── receptionist/ # Receptionist agent
│ ├── agent.py
│ ├── sub_agents
│ │ ├── rent_agent
│ │ │ └── agent.py
│ │ └── sales_agent
│ │ └── agent.py
│ │ ├── text2SQL/ # Text-to-SQL agent
│ │ └── shared_agent_tools.py
│ ├── tests/ # Unit tests
│ │ ├── test_utils.py
│ │ ├── test_sql.py
│ │ └── test_agents.py
- Receptionist Agent: Acts as the first point of contact for clients. Delegates tasks to specialized agents.
- Rent Agent: Assists clients in finding rental properties based on their preferences.
- Sales Agent: Handles payment calculations and provides detailed information about selected properties.
- Text-to-SQL Agent: Converts natural language queries into SQL statements for database interaction.
Below is a mermaid diagram illustrating the relationships between the agents:
graph TD
ReceptionistAgent[Receptionist Agent] --> RentAgent[Rent Agent]
ReceptionistAgent --> SalesAgent[Sales Agent]
RentAgent --> Text2SQLAgent[Text-to-SQL Agent]
utils.py: Contains helper functions likemake_json_serializableandsafe_format.sql_communicator.py: Handles database interactions using SQLAlchemy.
v_emlak_data_mart.sql: Defines a view for detailed property data.v_emlak_by_disticts.sql: Aggregates property data by districts.
- Comprehensive unit tests are provided for utilities, SQL interactions, and agents.
- In addition to the agents described above, the project includes a
Text2SQLAgent, a specialized agent used by other agents as a tool for generating SQL queries from natural language. - The
text2SQLandrent_agentcomponents pull metadata from the database to inject it into the system prompt. To make this work, it is crucial to have comments on the columns of the views and tables used by the agents. Example for Postgres:COMMENT ON COLUMN v_emlak_data_mart.district_name IS 'Name of the local district (mahalle in Turkey), like "Liman" for Konyaaltı district, where the property is located'; COMMENT ON COLUMN v_emlak_data_mart.room IS 'Number of bedrooms in the property';
- The system retrieves a distinct set of geographical attributes (province, sub-province, district) and injects them into the prompt for the rent agent. This facilitates communication with the user regarding their desired property location.
- Python 3.12 or higher
- PostgreSQL database
- Clone the repository:
git clone <repository-url> cd real_estate_agent
- Install dependencies:
uv create source .venv/bin/activate uv install - Configure the database connection, LLM model name (currently it is using gemini-2.0-flash)in
src/settings.py.
- Launch the web UI for agents:
(this should be launched when you have src/agents as current folder)
adk web
- Open ADK Web in browser, choose agent from the list and start conversation. Note: each folder under "Agents" folder here will show up in ADK web as agent
- Interact with the agents through the web interface.
- In order to understand what is going on 'under the hood', explore events, state in the adk UI,

Run unit tests using the following command:
python -m unittest discover -s ./src/tests -p "*test*.py"- Google ADK: Used for building AI agents.
- SQLAlchemy: For database interactions.
- SQLGlot: For SQL parsing and validation.
- DEZC-FinalProject: my DE project, where I have ETL for the population of DB, and where SQL schema is defined.
- search does not work for the words with specific Turkish symbols, like 'ş, ı'
- payment agent for some reason provide data as json, not tabular, at least under Gemini
- Add RAG semanitic search using vector fields in Postgres
- Teach it to use IDs columns to filter out data, not names only as it is now.
- Persist user data between sessions
- Leverage geo data to search by distnanse to sea or whatever
- Integrate to Telegram agent