Skip to content

Wake an agent with a message

Four sources wake a sleeping VM for work: email, Telegram, a schedule and an HTTP request. The VM wakes, the work starts, and an agent you start in the VM answers the message.

  • A VM. Create one as shown in From your terminal, and keep its id in VM.
  • Your API key in SI_API_KEY, for step 4.
  • A Telegram account and a bot token from @BotFather, for step 2.
Terminal window
VM=wake-example
si create --name "$VM"
si svm inbox enable "$VM"
si svm inbox "$VM"
Output
address: 0zs0pshr3x@slashinfra.dev
enabled: yes
webhook: -

Send a mail from your mail app to the address. The VM wakes, and the mail is saved on its disk. Read it inside the VM:

Terminal window
si exec "$VM" -- inbox ls --unread

Every email wakes the VM. An enabled inbox with no sender rule accepts mail from anyone. Limit the senders in a profile, or run si svm inbox disable "$VM" when you do not need it.

Connect the bot. Use a file for the token, so it does not appear in your shell history:

Terminal window
si svm inbox telegram "$VM" connect --token-file ~/.telegram-token
Output
bot: @build_1_bot
pair code: k3m9q2x7
send /start k3m9q2x7 to the bot within ten minutes

Send /start k3m9q2x7 to the bot in Telegram. The code is single use. Only paired users reach the inbox.

Let the VM sleep: leave it with nothing running for at least 60 seconds. Then send the bot a message. The message wakes the VM and lands in its inbox.

Start an agent in the VM to answer it. The agent replies with inbox reply, which works only for Telegram messages:

Terminal window
si agent run "$VM" --agent claude --cwd /home/user -- 'Answer the unread Telegram message with inbox reply.'
Terminal window
si svm schedule add "$VM" --name nightly --cron '0 3 * * *' --tz Europe/Berlin -- 'hc run claude "Read the inbox and answer what needs an answer."'
Output
nightly
next fire: 2026-11-14 02:00:00Z

A due schedule wakes the VM and starts within about 90 seconds. A cron job inside the VM cannot wake it, so use a schedule for work at a set time.

An HTTP request to the VM wakes it and runs the command in the request:

Terminal window
curl -sS -i -H "Authorization: Bearer $SI_API_KEY" --data-binary 'inbox ls --unread' "https://$VM.slashinfra.dev/bin/bash"
Output
X-Exit-Code: 0
...

Check X-Exit-Code. An HTTP 200 alone does not mean the command succeeded.

You should now see the agent’s reply in your Telegram chat. The VM had nothing to do for a minute before your message, so it was asleep when the message arrived.

Symptom Cause Fix
The bot connect command answers inbox_disabled The inbox is off Run si svm inbox enable "$VM".
The bot gives no answer to /start The pairing code expired after ten minutes Make a new code with si svm inbox telegram "$VM" pair.
Mail never arrives The inbox is off, so the mail is rejected Run si svm inbox "$VM" and check that enabled says yes.

Scroll horizontally to see all columns.

Remove the bot and its webhook with si svm inbox telegram "$VM" disconnect. Then remove the schedule with si svm schedule rm "$VM" <schedule-id>, using the id that si svm schedule ls shows. Messages already saved stay on the VM until you delete it.

  • Email: addresses, plus tags and the inbox limits.
  • Schedules: commands and messages at a cron time.
  • Sleep and wake: what keeps a VM awake and what wakes it.