Skip to main content

aiogram-fsm-inspector (aiogram-devtools)

Python 3.10+ aiogram 3.x FastAPI License: MIT

aiogram-fsm-inspector is an in-process real-time debugging suite and web dashboard for Telegram bots powered by aiogram 3.x (aiogram >= 3.10).

It launches an embedded FastAPI ASGI server inside the identical asyncio event loop running your bot, intercepts state transitions via a transparent BaseStorage proxy, and serves a reactive single-file SPA web dashboard with zero Node.js/npm dependencies.


⚡ Features

  • One-Line Integration: Add setup_devtools(dp) to your bot, and the web panel is instantly available.
  • In-Process ASGI Sidecar: Uvicorn runs directly inside the bot's event loop via @dp.startup() and @dp.shutdown(), sharing memory directly with MemoryStorage and RedisStorage.
  • Live User Inspector: Monitor active user sessions in real time via WebSockets. Visual pulse indicator highlights when a user triggers a Telegram update.
  • State Jumper (Autocomplete): Dynamically reflects all StatesGroup subclasses declared in your Python runtime. Switch a user to any step with one click.
  • Interactive JSON Data Editor: Hot-edit FSMContext data dictionary with real-time JSON validation, key/byte counters, and Ctrl+S / Cmd+S keyboard shortcuts.
  • Safe Object Serialization: Handles datetime, Decimal, UUID, Enum, dataclass, and Pydantic models without crashing with TypeError. Unchanged complex objects in memory are protected from destructive overwrites.
  • Multi-Bot Unified Hub: Auto-discovers and connects multiple bot processes across ports 8080..8086. Switch between bots in the header or monitor all bots simultaneously in a consolidated view.
  • Auto-Port Fallback: If port 8080 is busy, the inspector automatically binds to the next free port (8081, 8082, etc.) without crashing.
  • Bilingual Interface: One-click toggle between English and Russian with full localization.
  • State Presets & Bookmarks: Save complex multi-step state and data combinations to local JSON bookmarks (.aiogram_devtools_snapshots.json) and apply them to any user session in one click.
  • Time-Travel Rollback: Step backwards through recent state and data snapshots before a user interaction occurred.
  • Redis Cold-Start Discovery: Discovers existing sessions non-blockingly via redis.scan_iter(match="fsm:*") instead of blocking KEYS *.
  • Zero-Build Web UI: Pre-built responsive dark/light SPA styled with Tailwind CSS, embedded directly inside Python package data.

📦 Installation

pip install aiogram-fsm-inspector

Or using uv:

uv add aiogram-fsm-inspector

🚀 Quickstart

Connect the inspector in one line of code inside your bot's entry point:

import asyncio
from aiogram import Bot, Dispatcher
from aiogram.fsm.storage.memory import MemoryStorage
from aiogram_fsm_inspector import setup_devtools  # or: from aiogram_devtools import setup_devtools

bot = Bot(token="YOUR_TELEGRAM_BOT_TOKEN")
dp = Dispatcher(storage=MemoryStorage())

# Connect inspector on http://127.0.0.1:8080
setup_devtools(dp, host="127.0.0.1", port=8080)

async def main():
    await dp.start_polling(bot)

if __name__ == "__main__":
    asyncio.run(main())

Open your browser at http://127.0.0.1:8080 to view the live dashboard.


🛡️ Production Guard & Security

  1. Loopback by Default: The inspector binds exclusively to 127.0.0.1, blocking access from external network interfaces.
  2. Public Binding Protection: If configured to bind to 0.0.0.0 or a public interface, an auth_token is strictly required:
    setup_devtools(dp, host="0.0.0.0", port=8080, auth_token="super_secret_token")
    
    Or explicitly allow unsafe local container access via environment variable:
    export AIOGRAM_DEVTOOLS_UNSAFE=1
    
  3. Authentication: Pass the token via:
    • Header: Authorization: Bearer <auth_token>
    • Query param: http://localhost:8080/?token=<auth_token>

🔌 REST & WebSocket API Reference

The embedded FastAPI app provides endpoints at /api/v1:

Method Path Description
GET /api/v1/info Inspector metadata, port, bot username, and active session count
GET /api/v1/sessions List all discovered active sessions
GET /api/v1/sessions/{chat_id}/{user_id} Fetch detailed session state, data, and history
PATCH /api/v1/sessions/{chat_id}/{user_id}/state Force change user FSM step ({"state": "Group:step"})
PUT /api/v1/sessions/{chat_id}/{user_id}/data Hot-edit user FSM data dictionary
POST /api/v1/sessions/{chat_id}/{user_id}/clear Clear state and data for session
POST /api/v1/sessions/{chat_id}/{user_id}/rollback Rollback session to previous snapshot
GET /api/v1/states-tree Get reflected StatesGroup class tree
GET /api/v1/snapshots List saved state presets
POST /api/v1/snapshots Save new state preset
POST /api/v1/snapshots/{id}/apply Apply preset to a session
DELETE /api/v1/snapshots/{id} Delete preset
WS /api/v1/ws Real-time WebSocket pub/sub

📄 License

MIT License. Designed with precision for the aiogram ecosystem.

Metadata

Release files for aiogram-fsm-inspector 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiogram-fsm-inspector 0.1.0
File Size Uploaded Provenance
aiogram_fsm_inspector-0.1.0.tar.gz 43.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aiogram-fsm-inspector 0.1.0
File Interpreter ABI Platform
aiogram_fsm_inspector-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 92.9 kB

Release files / aiogram_fsm_inspector-0.1.0.tar.gz

Download URL aiogram_fsm_inspector-0.1.0.tar.gz
Size 43.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4dd85956b9362a0d3e7ec52396597328a0f44ec98da07e10b516753152a6e472
BLAKE2b-256 checksum
How to use checksums
fc956ddfd3e78dd775673f25cb56e8990876da781fb16d57ee1a8851f4541527
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / aiogram_fsm_inspector-0.1.0-py3-none-any.whl

Download URL aiogram_fsm_inspector-0.1.0-py3-none-any.whl
Size 49.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2523d97326e6f26a076bc94b48a4d7a686a6b3282c1be818622f437f0dff7cee
BLAKE2b-256 checksum
How to use checksums
35aa2f769a48348864985ee97e169193aea8105af5980dee2d2e7db702a5c7da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Security for aiogram-fsm-inspector 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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aiogram_fsm_inspector-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page