This project implements a command-line sales agent that can interact with users, collect their information, store it in a CSV file, and automatically follow up with leads. It leverages the Google ADK (Agent Development Kit) for building the conversational agent and includes robust state management and thread-safe file operations.
The Sales Agent guides users through a simple information-gathering process, including their name, consent to be asked questions, age, country, and product/service interest. This information is persisted in a CSV file. A background follow-up mechanism periodically checks for inactive leads and sends them a follow-up message to re-engage.
- Interactive Command-Line Interface: Engage with the sales agent directly from your terminal.
- State Management: The agent maintains the conversation flow and user information using session states.
- Lead Tracking: User interactions and collected data are stored in a CSV file (
leads.csvby default). - Automatic Follow-Up: A background thread automatically sends follow-up messages to active leads after a defined period of inactivity.
- Configurable: Settings like the CSV filename, follow-up intervals, and logging levels can be configured via a
.envfile. - Thread-Safe Data Management: The
DataManagerclass ensures safe reading and writing to the CSV file, even with the background follow-up process. - Logging: Comprehensive logging helps in monitoring and debugging the application.
- Python 3.6 or higher
- pip (Python package installer)
- Google Cloud Credentials (Optional): If you plan to integrate with more advanced Google Cloud services in the future, you might need to set up Google Cloud credentials. The application currently looks for a
sales-agents-458107-640159d1d5a2.jsonfile or theGOOGLE_APPLICATION_CREDENTIALSenvironment variable.
-
Install dependencies:
pip install -r requirements.txt
(Note: You might need to create a
requirements.txtfile listing dependencies likepython-dotenvandgoogle-generativeaiorgoogle-adkif you haven't already.) -
Configure environment variables (optional): Create a
.envfile in the project root to customize settings. Example:CSV_FILENAME=sales_leads.csv APP_NAME=my_sales_app SIMULATED_DELAY_SECONDS=5 FOLLOW_UP_CHECK_INTERVAL_SECONDS=120 GOOGLE_CREDENTIALS_PATH=/path/to/your/credentials.json LOG_LEVEL=DEBUG LOG_FILE=agent.logIf you don't create a
.envfile, the application will use the default values defined inconfig.py.
Run the main.py script from your terminal:
python main.py