Chat platform bridges for AI agent supervision
Project description
agent-tether
Connect AI coding agents to human oversight through Telegram, Slack, and Discord.
Status: Beta. APIs are stable and open to feedback.
A Python library that provides chat platform bridges for supervising AI agents. Each bridge handles platform-specific formatting, thread management, approval flows with inline buttons, auto-approve timers, and command handling.
Use Cases:
- Monitor Claude Code or Codex sessions from your phone while agents run locally
- Get approval requests as Telegram notifications with one-tap approve/deny
- Set auto-approve timers (per-session, per-tool, per-directory)
- Send additional input or stop agents remotely
Looking for a ready-made solution for connecting your agents? Check out Tether.
Install
pip install agent-tether[telegram] # Telegram support
pip install agent-tether[slack] # Slack support (experimental)
pip install agent-tether[discord] # Discord support
pip install agent-tether[all] # All platforms
Architecture
Your Application
│
├── BridgeCallbacks → You implement these to wire up your backend
│
├── agent-tether bridges
│ ├── TelegramBridge → Telegram forum topics
│ ├── SlackBridge → Slack threads (experimental)
│ └── DiscordBridge → Discord threads
│
├── BridgeManager → Routes events to the right bridge
└── BridgeSubscriber → Consumes store events, forwards to bridges
Core Components
BridgeCallbacks: Dataclass of async callbacks that you provide, connecting bridges to your session backendBridgeInterface: Abstract base class with shared logic for auto-approve, approval parsing, error debouncing, and formattingBridgeManager: Routes output, approvals, and status changes to the correct platform bridgeBridgeSubscriber: Consumes events from a store subscriber queue and forwards them to bridgesBridgeConfig: Configuration (data directory, default adapter, error debounce)
Quick Start
from agent_tether import (
BridgeCallbacks,
BridgeConfig,
BridgeManager,
TelegramBridge,
)
# Implement callbacks to wire bridges to your backend
callbacks = BridgeCallbacks(
create_session=my_create_session,
send_input=my_send_input,
stop_session=my_stop_session,
respond_to_permission=my_respond_to_permission,
list_sessions=my_list_sessions,
get_usage=my_get_usage,
check_directory=my_check_directory,
list_external_sessions=my_list_external,
get_external_history=my_get_history,
attach_external=my_attach_external,
)
# Configure
config = BridgeConfig(data_dir="/tmp/agent-tether")
# Create a Telegram bridge
telegram = TelegramBridge(
bot_token="BOT_TOKEN",
forum_group_id=123456,
config=config,
callbacks=callbacks,
get_session_directory=lambda sid: "/home/user/project",
)
# Register with manager
manager = BridgeManager()
manager.register_bridge("telegram", telegram)
# Route events from your backend
await manager.route_output("sess_1", "Starting work...", "telegram")
await manager.route_status("sess_1", "running", "telegram")
BridgeCallbacks
The BridgeCallbacks dataclass defines 10 async functions that connect agent-tether to your session backend:
| Callback | Signature | Purpose |
|---|---|---|
create_session |
(**kwargs) -> dict |
Create a new agent session |
send_input |
(session_id, text) -> None |
Send human input to a session |
stop_session |
(session_id) -> None |
Interrupt/stop a running session |
respond_to_permission |
(session_id, request_id, allow, message?) -> bool |
Approve or deny a permission request |
list_sessions |
() -> list[dict] |
List all active sessions |
get_usage |
(session_id) -> dict |
Get token/cost usage for a session |
check_directory |
(path) -> dict |
Validate a directory path |
list_external_sessions |
(**kwargs) -> list[dict] |
Discover running external sessions |
get_external_history |
(external_id, runner_type, limit) -> dict? |
Fetch history for an external session |
attach_external |
(**kwargs) -> dict |
Attach to an external session |
All callbacks default to no-ops, so you only need to implement the ones your application uses.
Approval Parsing
Bridges parse human text into approval responses:
from agent_tether import BridgeInterface
# These are parsed by bridges when users reply in chat
bridge.parse_approval_text("allow") # → {"allow": True, "timer": None}
bridge.parse_approval_text("deny: risky") # → {"allow": False, "reason": "risky"}
bridge.parse_approval_text("allow all") # → {"allow": True, "timer": "all"}
bridge.parse_approval_text("allow Bash") # → {"allow": True, "timer": "Bash"}
Auto-Approve Timers
# Auto-approve all tools for this session (30 min)
bridge.set_allow_all("sess_1")
# Auto-approve only Bash for this session (30 min)
bridge.set_allow_tool("sess_1", "Bash")
# Auto-approve all sessions in a directory (30 min)
bridge.set_allow_directory("/home/user/project")
# Check if a request should be auto-approved
reason = bridge.check_auto_approve("sess_1", "Bash")
# Returns "Allow All", "Allow Bash", "Allow dir project", or None
Features
Chat Platform Bridges
- Telegram: Forum topics, inline keyboard approval buttons, typing indicators, HTML formatting
- Slack (experimental): Socket mode, threaded conversations, text-based approval commands
- Discord: Channel threads, pairing/authorization system, text-based approvals
Shared Bridge Logic
- Auto-approve engine: Per-session, per-tool, and per-directory timers (30 min default)
- Approval parsing: Text commands (allow/deny/proceed/cancel) with tool and directory timers
- Choice parsing: Numeric or label-based selection for multi-option prompts
- Error debouncing: Suppress rapid-fire error notifications
- Notification batching: Collapse rapid auto-approvals into single messages
- External session pagination: Browse and attach to running Claude Code/Codex sessions
- Formatting: Tool input JSON to readable markdown, message chunking
Commands (available in all bridges)
/helpor!help: Show available commands/statusor!status: List all sessions/listor!list: List external sessions (Claude Code, Codex)/attachor!attach: Attach to an external session/newor!new: Start a new session/stopor!stop: Interrupt the current session/usageor!usage: Show token usage and cost
Documentation
- CHANGELOG.md: Version history and changes
Contributing
Contributions welcome! Please feel free to submit a Pull Request.
License
MIT. See LICENSE for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_tether-0.4.1.tar.gz.
File metadata
- Download URL: agent_tether-0.4.1.tar.gz
- Upload date:
- Size: 59.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ab1d4eea2553a82b49c16fe0632502e698802a96b83da63ea9b3059281fb2e5
|
|
| MD5 |
3dc7153e8d337e42c24eb01550e6ba6a
|
|
| BLAKE2b-256 |
3889cea16f45569fae24aa39680529fc71fa77bca846ae4c4342fd0ceb14cf34
|
Provenance
The following attestation bundles were made for agent_tether-0.4.1.tar.gz:
Publisher:
publish.yml on larsderidder/agent-tether
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_tether-0.4.1.tar.gz -
Subject digest:
2ab1d4eea2553a82b49c16fe0632502e698802a96b83da63ea9b3059281fb2e5 - Sigstore transparency entry: 950903127
- Sigstore integration time:
-
Permalink:
larsderidder/agent-tether@aea7c965e8dde482f6ac4e0eaf87ed2dd18f9adb -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/larsderidder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aea7c965e8dde482f6ac4e0eaf87ed2dd18f9adb -
Trigger Event:
release
-
Statement type:
File details
Details for the file agent_tether-0.4.1-py3-none-any.whl.
File metadata
- Download URL: agent_tether-0.4.1-py3-none-any.whl
- Upload date:
- Size: 53.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03e05f6553ff950cb2fa407cc559ef62bb4aa7011892a9e881b62e0b4ff82da0
|
|
| MD5 |
d6ab195fb848ab507e68c5b733b5c35e
|
|
| BLAKE2b-256 |
5698d6ac98076a2f50e34e0aeb31b424cee3237e9f32bd3fdc9c3bfa4bf55026
|
Provenance
The following attestation bundles were made for agent_tether-0.4.1-py3-none-any.whl:
Publisher:
publish.yml on larsderidder/agent-tether
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_tether-0.4.1-py3-none-any.whl -
Subject digest:
03e05f6553ff950cb2fa407cc559ef62bb4aa7011892a9e881b62e0b4ff82da0 - Sigstore transparency entry: 950903200
- Sigstore integration time:
-
Permalink:
larsderidder/agent-tether@aea7c965e8dde482f6ac4e0eaf87ed2dd18f9adb -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/larsderidder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aea7c965e8dde482f6ac4e0eaf87ed2dd18f9adb -
Trigger Event:
release
-
Statement type: