Skip to content

Sending messages ​

The agent can send a message out of your machine when you ask it to: "tell the ops channel the deploy is done", "email Minji the summary". The tool is send_message. It exists only when config.json has at least one channel.

Configuring channels ​

json
{
  "messaging": {
    "channels": {
      "ops": { "kind": "telegram", "tokenEnv": "TELEGRAM_BOT_TOKEN", "chatId": "-1001234567890" }
    }
  }
}
  • A channel id is 1-40 letters, digits, _ or -. The model passes it back verbatim.
  • kind selects the transport; the other fields belong to that kind. Unknown fields are rejected.
  • Secrets never go in the config. Fields named ...Env hold the name of an environment variable. A value that is not an upper-case variable name (A-Z, 0-9, _) is refused, because a pasted key is mixed case; the error never echoes it.
  • Secrets are read when a message is sent, not at startup.

Channel kinds each document their own fields in their own section below as they ship.

gmail: your own Gmail, with Google's login ​

The agent sends email from your Gmail after you log in with Google in your browser (OAuth). There is no app password and AutoRAG never sees your Google password: Google's own page asks for one permission, sending email, and nothing else (no reading, no deleting).

bash
autorag connect gmail --email you@gmail.com   # opens Google in your browser
json
{ "kind": "gmail", "account": "you@gmail.com" }
Field
accountThe Gmail address you logged in with.
modesend (default) sends the message. draft only saves it to your Gmail Drafts and sends nothing.

There is no secret in the config. The login (a refresh token) is kept in the OS's protected store under the address (macOS Keychain, Linux libsecret, and on Windows a file under %LOCALAPPDATA%\AutoRAG\secrets encrypted with DPAPI for your user), and is traded for a short-lived access token when a message is sent. autorag connect gmail --logout --email you@gmail.com revokes it at Google and forgets it. You can also remove AutoRAG any time at https://myaccount.google.com/permissions.

The login uses a Google Desktop app OAuth client. Until Google has verified the app, its login page says "Google hasn't verified this app": choose Advanced, then continue. A client you made yourself works the same way: --client-json <file> takes the JSON Google lets you download, or set AUTORAG_GOOGLE_CLIENT_ID and AUTORAG_GOOGLE_CLIENT_SECRET.

Each send takes to (1-10 addresses) and a one-line subject, shown to you in full before it goes. A send counts only when Gmail answers that the message is in your Sent mail; a failed or unclear answer is reported and never retried (the one exception is a rejected access token, where Gmail has not looked at the message, so one retry cannot send it twice).

Approval ​

Every send is shown to you before it goes, one message at a time, with the channel, where it goes and from whom, the recipients, the subject, and the whole text. Nothing is sent until you say yes. This is the same in every permission mode: full lets the agent change files, it is not consent to send. There is no "allow all", no setting that skips the question, and no decision model (Jev) judging it.

Where you are asked depends on where the agent runs, and each surface asks the way it can:

WhereHow you are asked
autorag tuiA dialog: Allow once, Deny, or Deny and tell the model what to do instead.
autorag searchThe draft is printed to the terminal and you answer: y sends; n or Enter does not; any other text is what the assistant should do instead. The prompt goes to stderr, so --json output stays clean.
MCP (autorag.ask)The MCP client asks you (elicitation): a yes/no form holding the whole draft and an optional note. A client that does not support elicitation cannot ask you, so the agent cannot send through it.
Dazzi desktop appA card with the draft, from the app.

When nobody can be asked (autorag search piped or run from cron, or an MCP client without elicitation) the send is refused and the model is told so; the message is not queued and is not sent later.

  • A refusal, a dismissed question, and a failed send are never retried within the request: a send cannot be undone.
  • In the TUI dialog a message too long to show whole (over 8000 characters) is not sent and the model is told to shorten it; the other surfaces show the text in full.
  • A host that embeds the library supplies its own approveSend (it must show the whole text).

Out of scope ​

Automation agents (manage_automations) never get send_message, and the chat bridges (--telegram, --discord, --whatsapp) do not ask for a send yet, so a send from a bridged chat is refused.

Released under the Apache-2.0 license.