Weather Bot with OpenAI Agents SDK
A Telegram bot that provides real-time weather information using OpenAI's Agents SDK and Model Context Protocol (MCP). The bot can fetch current weather conditions for cities worldwide using natural language queries, powered by GPT-4o-mini model.
Features
- Real-time weather data using Open-Meteo API
- Natural language processing with OpenAI Agents SDK (GPT-4o-mini)
- Simple MCP server implementation for weather data retrieval
- Telegram-native message formatting
- Easy-to-use interface with simple weather queries
Technology Stack
- Python 3.11+
- OpenAI Agents SDK
- Model Context Protocol (MCP)
- python-telegram-bot
- Open-Meteo API (no API key required)
Quick Start
- Clone the repository:
git clone https://github.com/esakrissa/agents-sdk-telegram.git
cd agents-sdk-telegram
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Create a .env file in the project root:
TELEGRAM_BOT_TOKEN=your_bot_token_here
OPENAI_API_KEY=your_openai_api_key_here
- Run the bot:
python main.py
Usage
Simply send a message to the bot asking about weather in any city:
what's the weather in Ubud?
The bot will respond with current weather conditions including:
- Temperature
- Weather conditions
- Wind speed
Architecture
OpenAI Agents SDK Integration
The bot uses OpenAI's Agents SDK with GPT-4o-mini model to process natural language queries and generate human-like responses. The Agent is configured with specific instructions for handling weather-related queries and maintaining conversation context.
Model Context Protocol (MCP)
The project implements a simple MCP server (weather_mcp.py) that provides the get_weather tool. This demonstrates how to:
- Create custom MCP tools
- Handle tool requests and responses
- Integrate external APIs (Open-Meteo) with MCP
License
MIT © Esa Krissa
Metadata
Release files for iflow-mcp_esakrissa-weather 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iflow_mcp_esakrissa_weather-0.1.0.tar.gz | 3.0 kB | Without provenance | Details for iflow_mcp_esakrissa_weather-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iflow_mcp_esakrissa_weather-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for iflow_mcp_esakrissa_weather-0.1.0-py3-none-any.whl |
Total release size: 10.0 kB
Release files / iflow_mcp_esakrissa_weather-0.1.0.tar.gz
| Download URL | iflow_mcp_esakrissa_weather-0.1.0.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb0f622e780a36c6805322a0ea342a1c72cd755ed525956855a77f3af56e3319
|
|
BLAKE2b-256 checksum How to use checksums |
46863cfd478bab7b1e975aa7e5eff919b52b0d3cd0c10e44a20fe64437ad4e12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / iflow_mcp_esakrissa_weather-0.1.0-py3-none-any.whl
| Download URL | iflow_mcp_esakrissa_weather-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a4acc947c0e0ff9c45c43576a20add3e1ddb947907e038357dc395e75278e20
|
|
BLAKE2b-256 checksum How to use checksums |
98097ca1d45b4586ac587a31fd98923de4c463f888fff61bf1d3f622e9ea7da8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for iflow-mcp_esakrissa-weather 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.