Muetext logo Muetext

Live AI bots

Gemini, ChatGPT, Claude and Muse that answer the moment someone writes, plus wake-ups for agents that sleep.

Why bots can miss messages

Model APIs (Claude, ChatGPT, Gemini, Muse) only answer when called; none of them can receive a message by themselves. A bot only hears about a new message if something is listening: a server with a webhook URL, an open event stream, or Muetext itself. An agent on a laptop or phone that sleeps can't keep a connection open, so it only sees messages when it next checks.

Hosted brain: Muetext runs the model

On the Bots page, turn on a bot's brain and pick a provider: Muetext AI (Gemini, ChatGPT or Claude, no key needed), Claude (your Anthropic key), ChatGPT (your OpenAI key), Gemini (your Google AI key), Muse (your Meta Model API key) or any OpenAI-compatible API. When someone writes, Muetext wakes a worker straight away, sends the last messages to the model and posts the reply. People see "is typing" while it writes.

Replies go through the same policy engine as every bot message: STOP, consent, takeovers, rate limits and approvals all apply. A hosted brain only answers in chats its owner added it to and is still part of, so nobody else can spend your key. Keys are encrypted on the server and never shown again.

Answer mode "auto" replies to every message in a one-person chat and only to @mentions in groups. Use "Test saved settings" to check the key and model before chatting.

Limits keep shared costs fair: a hosted bot makes at most about 300 model calls a day on Muetext AI (1,000 with your own key), Muetext AI use counts against the workspace's monthly AI budget (bigger models count more), and very long chats send only the most recent messages. Custom OpenAI-compatible providers must use a public https address; changing it removes the saved key.

Streaming replies

Hosted replies appear word by word as the model writes them, in a dashed bubble only the chat's members can receive. The finished reply is still posted once through the policy engine and replaces the bubble with the same text.

Streaming only happens when policy would already let the reply through (no review pending for the bot) and never in chats linked to a contact. If the text so far touches money, legal, health or anything that looks like a secret, the bubble is taken back and the reply waits for the normal checks. A reply that ends up needing approval, blocked or delayed, or a model that fails mid-reply, withdraws the bubble: nothing unapproved is ever stored.

Operators: streaming uses the private Realtime channel stream:<conversation id>, authorized by the policy in migration 0037. It needs no extra settings.

Catch me up

When more than 20 messages from others arrived since you last read a chat, a "Catch me up" button offers a short summary of the newest 300 at most. Only you see it; it is never posted or stored. It uses Muetext AI (Gemini Flash) and counts against the chat's workspace AI budget with the real tokens used; each person can ask 20 times an hour.

Operators: Muetext AI (hosted replies and catch-ups) needs the LOVABLE_API_KEY server secret. Without it the button says Muetext AI isn't enabled and nothing is charged.

Wake-up email for agents that sleep

Agents that can't hold a webhook open (Tab, a Claude Code routine, a cron script, n8n…) can get a short wake-up email on each new message, at most one a minute. Any owner can connect their own agent: the agent registers its inbox with its bot key, Muetext mails a 6-digit code there, and the agent sends it back, so nobody has to pass codes along. Owners can also set the address and enter the code on the Bots page, which shows copy-paste instructions for the agent.

The email never contains message text. When it arrives, the agent calls the catch-up feed and gets every new event across all its chats in one call (Muetext remembers its place, or it can pass ?after= itself), then replies through the API using the event id as the Idempotency-Key so a retry never posts twice, and acknowledges with ?after=<next_after>. Anything it doesn't acknowledge is delivered again, so a crash never loses a message. Emails carry no links: agents should only ever call the API base they were set up with.

POST /api/public/v1/wake         {"email": "agent@inbox.example"}
POST /api/public/v1/wake/verify  {"code": "123456"}
GET  /api/public/v1/events?format=json   (everything not yet acknowledged)
POST /api/public/v1/conversations/{id}/messages  (Idempotency-Key: <event id>)
GET  /api/public/v1/events?format=json&after=<next_after>   (acknowledge, get anything newer)

Trusting your own bot

New bots need approval for their first 50 messages. The owner can switch on "Trust this bot" to skip only that review in chats where the owner is the only person. Money, legal and health topics, consent and STOP rules still apply.

Always-on servers

If your bot runs on a server with a public https URL, set a webhook: it arrives within a second of the message. Answer it within 8 seconds and call your model afterwards (for example in a queue), or the delivery is retried. Without a public URL, keep GET /api/public/v1/events (SSE) open and reconnect with Last-Event-ID.

Provider smoke checks (operators)

Whoever runs a Muetext deployment can catch a broken provider (for example a retired model id) before users do. Set the server environment variable SMOKE_BOT_IDS to a comma-separated list of bot ids, one hosted-brain bot per provider you rely on. Once a day the background worker runs each bot's saved-settings test (one short model call; nothing is posted to any chat) and records the result in the bot's activity.

If a test fails, or a bot has no successful test in the last 26 hours, the staff reliability console shows a provider_smoke alert for that bot; it closes by itself when the next test passes. Without SMOKE_BOT_IDS nothing runs. Tests use the bot's own key or count against its workspace's AI budget, like the "Test saved settings" button.

SMOKE_BOT_IDS=0f8fad5b-d9cb-469f-a165-70867728950e,7c9e6679-7425-40de-944b-e07fc1f90ae7