> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Bot Typing Indicators

> Show a typing indicator while the agent is working, with keepalive and circuit breaker

<Note>
  Bot platform adapters now ship in the `praisonai-bot` package. `praisonai bot serve` still works exactly as documented here; for a standalone install see [praisonai-bot Migration](/docs/guides/praisonai-bot-migration).
</Note>

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.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    A[Agent Run Start] --> T[TypingManager]
    T --> K[Keepalive Resend]
    T --> C[Circuit Breaker]
    T --> TTL[Safety TTL]
    K --> Channel[Channel API]

    classDef agent fill:#8B0000,color:#fff
    classDef tool fill:#189AB4,color:#fff

    class A agent
    class T,K,C,TTL,Channel tool
```

## Quick Start

<Steps>
  <Step title="Enable typing on a Telegram bot">
    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    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()
    ```
  </Step>

  <Step title="Use as async context manager">
    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    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.
  </Step>
</Steps>

## How It Works

A user sends a message, the indicator appears while the agent works, and stops once the reply is sent.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
sequenceDiagram
    participant User
    participant Agent
    participant TypingManager
    participant Channel

    User->>Agent: Send message
    Agent->>TypingManager: Run started
    TypingManager->>Channel: Show typing
    loop Every keepalive interval
        TypingManager->>Channel: Resend typing
    end
    Agent-->>TypingManager: Run finished
    TypingManager->>Channel: Stop typing
    Agent-->>User: Reply
```

`TypingManager` checks `capabilities["typing"]` before sending. On supported channels (Telegram, Discord):

1. Sends typing action when the agent run starts
2. Resends on a keepalive interval to prevent expiry
3. Opens a circuit breaker after consecutive failures
4. Enforces a safety TTL so typing never persists indefinitely

Slack, WhatsApp, and Email skip typing automatically (`typing=False`).

## Best Practices

<AccordionGroup>
  <Accordion title="Combine with status reactions for rich feedback">
    Reactions show state on the user's message; typing shows activity in the input area.
  </Accordion>

  <Accordion title="Pair with streaming replies on Telegram">
    Streaming reduces the need for typing on long answers — use both for tool-heavy agents.
  </Accordion>

  <Accordion title="Trust the safety TTL in production">
    The TTL prevents stuck typing indicators if a run hangs or the channel API fails silently.
  </Accordion>
</AccordionGroup>

## Related

<CardGroup cols={2}>
  <Card title="Channel Capabilities" icon="list-check" href="/docs/features/channel-capabilities">
    Which channels support typing
  </Card>

  <Card title="Streaming Replies" icon="message-pen" href="/docs/features/bot-streaming-replies">
    Live draft edits as alternative feedback
  </Card>
</CardGroup>
