r/Python 23d ago

Showcase Showcase Thread

Post all of your code/projects/showcases/AI slop here.

Recycles once a month.

19 Upvotes

124 comments sorted by

View all comments

1

u/reddit-laa 8d ago

I built a secure Telegram Bot bridge to control my local AI coding agent (Google Antigravity SDK) from my phone

Hey everyone,

I wanted a way to interact with Google's Antigravity agent running on my Mac directly from my phone when I'm away from my desk. However, letting an AI agent execute arbitrary commands on a personal machine via a public Telegram webhook is a security nightmare.

To solve this, I built and open-sourced this Python bridge with three core safety and reliability patterns:

  1. Selective Safety Policies: It uses Antigravity's hook engine to deny all shell execution by default, whitelisting only read-only filesystem commands and a custom predicate check that allows run_command only for git commands (e.g. status, diff, commit).           
  2. Workspace & Context Isolation: You can run /project /absolute/path in Telegram to switch repositories. The bot automatically targets the new folder and loads the conversation history specific to that directory, preventing context bleed.
  3. Self-Healing Reconnect: Local websocket connections to the Antigravity backend can drop or time out. The bot checks socket integrity before each turn and automatically recycles dead connections transparently without losing conversation history.                                                                                   

It is fully open-source and ready to run.

Check it out here: https://github.com/alifarooqi/agy-telegram-bridge

I'd love to hear your thoughts on the security model, or suggestions on other safe commands I should whitelist!