Bot Typing Indicators
Show a typing indicator while the agent is working, with keepalive and circuit breaker
Typing indicators tell users the bot is working — with automatic keepalive resends, a circuit breaker on failures, and a safety TTL so a stuck indicator never hangs forever.
from praisonaiagents import Agent
agent = Agent(name="assistant", instructions="You are a helpful assistant.")
agent.start("Look up today weather for London.")The user sends a message; a typing indicator shows while the agent works, with keepalive and automatic timeout.
Quick Start
- Enable typing on a Telegram bot
python from praisonaiagents import Agent from praisonai.bots import TelegramBot agent = Agent(name="assistant", instructions="Helpful assistant") bot = TelegramBot(token="...", agent=agent, typing_indicator=True) bot.start() - Use as async context manager
python async with bot.typing_manager(channel_id="123456"): result = await agent.astart("Long research task")The indicator starts on entry and stops on exit — even if the agent raises an error.
How It Works
A user sends a message, the indicator appears while the agent works, and stops once the reply is sent.
TypingManager checks capabilities["typing"] before sending. On supported channels (Telegram, Discord):
- Sends typing action when the agent run starts
- Resends on a keepalive interval to prevent expiry
- Opens a circuit breaker after consecutive failures
- Enforces a safety TTL so typing never persists indefinitely
Slack, WhatsApp, and Email skip typing automatically (typing=False).
Best Practices
Combine with status reactions for rich feedback
Reactions show state on the user’s message; typing shows activity in the input area.
Pair with streaming replies on Telegram
Streaming reduces the need for typing on long answers — use both for tool-heavy agents.
Trust the safety TTL in production
The TTL prevents stuck typing indicators if a run hangs or the channel API fails silently.