Skip to main content

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

  1. Clone the repository:
git clone https://github.com/esakrissa/agents-sdk-telegram.git
cd agents-sdk-telegram
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Create a .env file in the project root:
TELEGRAM_BOT_TOKEN=your_bot_token_here
OPENAI_API_KEY=your_openai_api_key_here
  1. 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_esakrissa_weather-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iflow_mcp_esakrissa_weather-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file iflow_mcp_esakrissa_weather-0.1.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_esakrissa_weather-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for iflow_mcp_esakrissa_weather-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bb0f622e780a36c6805322a0ea342a1c72cd755ed525956855a77f3af56e3319
MD5 e39568c2ffb690caf25b0d7e2620e8b9
BLAKE2b-256 46863cfd478bab7b1e975aa7e5eff919b52b0d3cd0c10e44a20fe64437ad4e12

See more details on using hashes here.

File details

Details for the file iflow_mcp_esakrissa_weather-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_esakrissa_weather-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for iflow_mcp_esakrissa_weather-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a4acc947c0e0ff9c45c43576a20add3e1ddb947907e038357dc395e75278e20
MD5 6069f95d53f6cb52b7fdf16f32518d9b
BLAKE2b-256 98097ca1d45b4586ac587a31fd98923de4c463f888fff61bf1d3f622e9ea7da8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page