An intelligent application that uses an AI agent to fetch relevant GIFs based on your descriptions and sends them to your friends via email. Built with the Application SDK, Langchain, and Temporal.
Screen.Recording.2025-05-06.at.6.57.08.PM.mov
- Python 3.11+
- uv package manager
- Dapr CLI
- Temporal CLI
- Giphy API key
- SMTP credentials (e.g., SendGrid)
- OpenAI API key
-
Download required components:
uv run poe download-components
-
Set up environment variables (see below)
-
Start dependencies (in separate terminal):
uv run poe start-deps
-
Run the application:
uv run main.py
Access the application:
- Web Interface: http://localhost:8000
- Temporal UI: http://localhost:8233
Tip
Want to containerize this app? See the Build Docker images section in the repository root README for unified build and run instructions.
- AI-Powered GIF Selection: Describe the GIF you want (e.g., "a happy cat dancing") and the AI agent will find a suitable one.
- Automated Emailing: Automatically sends the selected GIF to specified recipients.
- Workflow Management: Leverages Temporal for robust workflow orchestration.
- Extensible Agent: Utilizes Langchain for building the AI agent, allowing for easy extension of its capabilities.
- Clear UI: Simple web interface to interact with the AI agent.
Create a .env file in the ai_giphy root directory and populate it with the following variables. Obtain the necessary API keys from their respective services.
# Giphy API Key
GIPHY_API_KEY=your_giphy_api_key
# SMTP Configuration (e.g., SendGrid)
SMTP_HOST=your_smtp_host (e.g., smtp.sendgrid.net)
SMTP_PORT=your_smtp_port (e.g., 587)
SMTP_USERNAME=your_smtp_username (e.g., apikey for SendGrid)
SMTP_PASSWORD=your_smtp_password_or_api_key
SMTP_SENDER=your_sender_email (e.g., support@yourdomain.com)
# OpenAI Configuration (used by the AI agent)
OPENAI_API_KEY=your_openai_api_key
OPENAI_MODEL_NAME=your_model_name (optional, defaults to gpt-4.1-mini)
OPENAI_BASE_URL=your_custom_base_url (optional, for custom gateways)
uv run poe stop-depsuv run pytestai_giphy/
├── app/ # Core application logic
│ ├── activities.py # Temporal activities (AI agent execution)
│ ├── ai_agent.py # Core AI agent logic (Langchain tools, LLM interaction)
│ └── workflow.py # Temporal workflow definition
├── frontend/ # Frontend assets
│ ├── static/ # Static files (CSS, JS)
│ └── templates/ # HTML templates
├── local/ # Local data storage
├── deploy/ # Installation and deployment files
├── main.py # Application entry point
├── pyproject.toml # Dependencies and config
└── README.md # This file
Note
Make sure you have a .env file that matches the .env.example file in this directory.
- Temporal Documentation
- Atlan Application SDK Documentation (Refer to the SDK version you are using)
- Langchain Python Documentation
- FastAPI Documentation
- Giphy API Documentation