Odysseus

Deploy guide

Run your own Odysseus

From nothing to a bot that answers you in Telegram, first on your own computer and then on a small server that stays awake. These steps were followed for real, and where something went wrong, the page says so. They were run on Windows; the macOS and Linux forms shown beside them are the standard equivalents.

What you will need

Three accounts are required. Five more are optional, and each one switches on a capability. You can start with the three and add the rest later by adding a line to one file.

SettingWhere it comes fromWhat it is for
TELEGRAM_BOT_TOKENIn Telegram, message @BotFather and send /newbotThe bot you will talk toRequired
OWNER_TELEGRAM_IDYour own numeric Telegram ID; @userinfobot will tell youThe one account the bot answers. Everyone else is ignored.Required
ANTHROPIC_API_KEYThe Claude ConsoleThe model that does the thinkingRequired
EXA_API_KEYexa.aiWeb searchRequired
COMPOSIO_API_KEYThe Composio dashboardMail, calendar, and any other app you connect from the chatOptional
BROWSER_USE_API_KEYBrowser Use CloudThe browserOptional
MISTRAL_API_KEYThe Mistral consoleReading photos and PDFs you sendOptional
LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEYA Langfuse project, with LANGFUSE_BASE_URL set to its regionA readable record of every task. Keys are removed, and mail text is replaced by its length.Optional

You also need Python 3.13 (the version it is tested on) and, for the server step, a card on a hosting account.

What it costs to run. The model and the other services bill you directly, by use. In single measurements made here a question with one web search cost about 1.5 cents and a browser run about 4 cents. The program enforces a limit per task (50 cents by default) and per day (3 dollars by default), and you can change both. A small server is a few dollars a month on top.

1

Get the code and install it

git clone https://github.com/odysseyvc/odysseus.git odysseus
cd odysseus

The code is at https://github.com/odysseyvc/odysseus.

macOS and Linux
python3.13 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Windows (PowerShell)
py -3.13 -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt
2

Fill in your keys

Copy the example settings file and put your values after each =.

macOS and Linux
cp .env.example .env
Windows (PowerShell)
Copy-Item .env.example .env

The file .env is ignored by git, is never put into the server image, and is never shown to the model. Fill in the four required lines. Leave the optional ones commented out until you want them.

Use your own numeric ID, exactly. OWNER_TELEGRAM_ID is the only thing that decides who the bot obeys. A message from any other account gets no reply at all and costs you nothing.

3

Start it and say hello

python -m odysseus

Open Telegram, find your bot by the username you gave BotFather, and send it a message. It should answer within a few seconds. Then try these:

SendWhat it does
stopEnds whatever it is doing. Handled by the program, never shown to the model.
/statusWhether it is busy, and what it has spent today
/memory and /forget a1b2See what it remembers about you, and remove an entry
/schedule and /cancel a1b2See reminders and routines, and cancel one
/appsWhether mail and calendar are connected, with a link for any that is not
/browser and /browser doneOpen its browser yourself to sign in to sites; then save the sign-ins

To connect mail and calendar, add COMPOSIO_API_KEY, restart, and send /apps. To connect any other app, just ask for work in it: the reply will carry a link.

Run only one copy. Telegram hands each message to one program. If two copies run with the same bot token, on your laptop and a server for instance, they take messages from each other. Stop one before starting the other.

4

Give it a server

On a laptop, reminders only fire while the laptop is awake. A small always-on server fixes that. These steps use Fly.io, which is what this project used; any host that can run a container with a persistent disk will do.

Add a payment card first. Skipping it cost two failed deployments. On a new Fly.io account with no card, every machine was stopped five minutes after it started. Nothing in the deploy output said so. The bot started, answered for five minutes and went silent. The only trace was one line in the machine's log: "Trial machine stopping". The host's published terms for accounts without a card have changed since; the advice has not.

What the server costs. One always-on shared machine with 1 GB of memory in Singapore is listed at about $8.50 a month, the 1 GB disk at 15 cents, and the shared address at nothing. Prices differ by region and change; read the host's own list.

Create the app and its disk

Install the fly command from Fly.io, then:

fly auth login
fly apps create your-app-name
fly volumes create odysseus_data --app your-app-name --region sin --size 1

Open fly.toml and change four things: app to the name you just chose, primary_region to a region near you (fly platform regions lists them), ODYSSEUS_TZ to your own time zone, for example Europe/London, and ODYSSEUS_PUBLIC_URL to https://your-app-name.fly.dev.

Then give the app its public addresses. An app made with fly apps create has none, and the deployment will look healthy from the host's side while its address does not exist for anyone else:

fly ips allocate-v4 --shared --app your-app-name
fly ips allocate-v6 --app your-app-name

Do not skip the time zone. A server's clock is UTC. Without ODYSSEUS_TZ, "remind me at 7am" fires at 7am UTC, and nothing reports an error.

Send your keys as secrets

Every filled-in line of .env except the data folder, which on the server is set by fly.toml. A path from your own computer sent along with the rest would override it.

macOS and Linux
grep -E '^[A-Z_0-9]+=.+' .env | grep -v '^ODYSSEUS_DATA_DIR=' | fly secrets import --app your-app-name --stage
Windows (PowerShell)
Get-Content .env | Where-Object { $_ -match '^[A-Z_0-9]+=.+' -and $_ -notmatch '^ODYSSEUS_DATA_DIR=' } | fly secrets import --app your-app-name --stage

Deploy

Stop the copy on your laptop first. Then:

fly deploy --ha=false

--ha=false matters: it asks for one machine. Two machines would be two copies of the bot.

Check that it stayed up

fly status
fly logs

You should see a line reading odysseus start, then one line per step as you use it: statuses and numbers, never the contents of your messages. Message the bot. Then check again after ten minutes. The first deployment was reported as working thirty seconds after launch, and it was switched off four and a half minutes later.

The host asks the program's /health address every thirty seconds and shows the answer under CHECKS in fly status. That check runs inside the host's network. Ask from outside as well:

curl -i https://your-app-name.fly.dev/health

It should answer 200 and ok. Every other address answers 404, apart from the sign-in page and WhatsApp's.

Memory. Measured on this machine size: about 770 MB with one person's agents connected, of 1 GB. fly.toml switches on swap, which costs nothing and keeps the program alive when memory runs short. Before you invite anyone, change memory to "2gb".

If your copy is already in use: moving its data

A copy that has been running on your computer has a conversation, memory, a schedule and sign-ins in its data folder. To take them along, the server must be built without the bot starting, because a started bot polls Telegram and yours is still running. These are the steps that were run.

  1. Add two lines above [env] in fly.toml, and processes = ["app"] under [http_service], so that the machine sleeps:
    [processes]
      app = "sleep infinity"
    Take the [[http_service.checks]] section out for now, deploy, and start the machine: fly deploy --ha=false, then fly machine start with the id that fly status shows.
  2. Wait until your bot is doing nothing, then stop it, and make sure it has stopped.
  3. Pack the data folder and send it. Leave out the token of any service that runs on your own computer; a server cannot reach it.
    tar -czf data.tgz -C /path/to/the/folder/above your-data-folder
    fly ssh sftp put data.tgz /tmp/data.tgz
  4. Unpack it on the server, and rename the folder the conversation is filed under. The agent library names that folder after the directory the program was started in, which on the server is /app:
    fly ssh console
    tar -xzf /tmp/data.tgz -C /data --strip-components=1
    find /data -type d -path '*/agent/projects/*' -prune    # shows the folder; rename each one to -app with mv
    chown -R app:app /data
  5. Take the three lines out of fly.toml again, put the checks back, and run fly deploy --ha=false.

Do not start the old copy again. Its folder still holds the sign-in renewals as they were when you moved. Each is good for one use; the old copy would spend them, and the server's sign-ins would stop at their next renewal. Keep the folder as a backup and leave it alone.

Optional: WhatsApp as a second channel

Read Meta's terms first. Section 4.7 of the Meta Terms for WhatsApp Business Platform bars general-purpose AI assistants from the platform where the assistant is the primary thing being offered, as Meta alone determines, directly or through a provider. Some countries have exceptions. Whether an assistant that answers only the person who runs it is covered is not settled by the text, and Meta may suspend access at once. Do not let anything depend on this channel, and do not pay for a number until you have decided what that risk is worth.

Telegram needs nothing to reach your server. WhatsApp does: Meta calls an address you own each time a message arrives. Chapter 16 of the book explains what that changes. These steps have been run: a message from the owner's phone was received on the server and answered. A button tap, a file and a voice note have not been tried.

  1. At developers.facebook.com, create an app and add the WhatsApp product. It gives you a test number, a phone number id, a messaging account id, and under the app's basic settings an app secret. In the business settings, add a system user, assign it the app and the WhatsApp account, and generate a token for it with the two WhatsApp permissions (whatsapp_business_messaging and whatsapp_business_management). Meta may ask you to accept a policy and to confirm your account by an emailed code on the way. The token the set-up page shows lasts a couple of hours: a bot left with that one sends nothing by the next day and does not say so.
  2. Add your own WhatsApp number as an allowed recipient of the test number.
  3. Set WHATSAPP_TOKEN, WHATSAPP_PHONE_ID, WHATSAPP_APP_SECRET, OWNER_WHATSAPP (your number with country code) and WHATSAPP_VERIFY_TOKEN (any phrase you choose) as secrets.
  4. The [http_service] section at the end of fly.toml opens the port; it is already on if you kept it for sign-ins. Deploy.
  5. In the Meta app, register the webhook address https://your-app-name.fly.dev/whatsapp with the same phrase, and subscribe to messages. Meta calls the address at once and accepts it only if the phrase comes back.
  6. Subscribe the WhatsApp account to your app. Without this the address shows as active and no message is ever forwarded. Use the messaging account id from the app's own WhatsApp page, not the number the business settings show for the account:
    curl -X POST -H "Authorization: Bearer $WHATSAPP_TOKEN" https://graph.facebook.com/v27.0/YOUR_MESSAGING_ACCOUNT_ID/subscribed_apps
    The same address with GET lists the apps the account is subscribed to; yours should be among them.
  7. Send the test number a message from your own WhatsApp. If nothing answers, read the journal: a delivery that arrived and was refused leaves a line, and one that never arrived leaves none.

WhatsApp's 24-hour rule. The bot can write to you freely only for 24 hours after you last wrote to it. A reminder that falls outside that window is refused by WhatsApp. Reminders and routines are therefore sent on Telegram unless you set ODYSSEUS_NOTIFY_ON=whatsapp.

Optional: the group's assistant in a WhatsApp group

This needs the direct WhatsApp route above, and it needs Meta to have given the number Official Business Account status: a verified business, thirty days on the platform, two-step verification, an approved display name, and Meta's agreement. Without that standing Meta refuses every call (error 131215) and these steps do nothing. They are written from Meta's documentation and have not been run.

  1. Put the number's id in .env as WHATSAPP_GROUP_PHONE_ID. It may be the direct route's own number or another number of yours. If it is on another WhatsApp account, run python scripts/whatsapp_group.py subscribe ACCOUNT_ID so that Meta delivers that account to your app.
  2. Where you registered the /whatsapp address, add the four group fields to the app's subscription: group_lifecycle_update, group_participants_update, group_settings_update, group_status_update.
  3. For each colleague who should be heard, write their WhatsApp number against their id on this copy: WHATSAPP_GROUP_MEMBERS=919800000000=123456789, separated by commas. You need no entry. Restart.
  4. Run python scripts/whatsapp_group.py create "Deal room". Meta reports the new group to the running program, which sends you its invite link on Telegram. Up to eight people can join.
  5. Join the group yourself and send /firm on in it. From then on a message that begins with the assistant's name (ODYSSEUS_GROUP_NAME, "odysseus" unless you change it) is answered in the group.

The assistant cannot be added to a group you already have, there is one group assistant across Telegram and WhatsApp, and an approval question in the group is answered by typing YES or NO. ODYSSEUS_WHATSAPP_GROUP=off switches it off.

Optional: iMessage as a third channel

iMessage is bought from Linq (linqapp.com), which runs the lines. It uses the same door, at /linq. These steps are written from Linq's documentation and have not been run.

  1. Create a Linq account. It gives you an API token and a Linq number. On the free line you can write only to a number that has written to yours first, so send your Linq number a message from your own phone.
  2. Put LINQ_API_TOKEN, LINQ_NUMBER and OWNER_IMESSAGE (your own number with country code) in .env.
  3. Run python scripts/connect_linq.py. It registers https://your-app-name.fly.dev/linq with Linq and writes the signing secret, which Linq shows once, into .env as LINQ_WEBHOOK_SECRET.
  4. Send those four lines to the server as secrets, and deploy.

To switch the channel off and keep its settings, set ODYSSEUS_IMESSAGE=off; remove that line, or set it to on, to switch it back. The channel only answers: reminders and routines stay on Telegram. A question that needs your approval arrives as a poll with Approve and Decline; if the poll cannot be made, you are asked to reply YES or NO.

Optional: WhatsApp on a number rented from Vobiz

In place of, or beside, the direct route above: Vobiz (vobiz.ai) rents the number and passes messages between Meta and this program. Your WhatsApp account at Meta is still your own. Vobiz keeps a copy of every message on this route. These steps have been run once, for one text each way.

  1. Create a Vobiz account, complete its identity check, and add money. In its console, rent a WhatsApp-capable number and make a WhatsApp channel for it on your own WhatsApp account (choose "Connect with Provider", which signs you in to Meta in a window of its own). Leave the Vobiz page exactly where it is until that window closes: the window reports back to that page, and if the page has moved the channel is not made and you must run the sign-up again. Meta's code for the number comes by a phone call, since a rented number receives no text messages. To hear it, first make a voice application in Vobiz with the answer address https://audio.vobiz.ai/record-inbound.xml and the method GET, attach the number to it, and play the recording in a second tab. Detach the number afterwards, or every call to it is recorded.
  2. Put VOBIZ_AUTH_ID, VOBIZ_AUTH_TOKEN, VOBIZ_CHANNEL_ID, VOBIZ_NUMBER and OWNER_WHATSAPP in .env.
  3. Run python scripts/connect_vobiz.py. It registers https://your-app-name.fly.dev/vobiz with Vobiz under a secret it makes, and writes that secret into .env as VOBIZ_WEBHOOK_SECRET.
  4. Send those lines to the server as secrets, and deploy. Then message the number from your own WhatsApp.

ODYSSEUS_VOBIZ=off switches the route off and keeps its settings. Vobiz cannot send Approve and Decline buttons, so a question that needs your approval ends with "Reply YES to approve or NO to decline", and only that exact one-word reply, within ten minutes, answers it.

Updating later

Pull the new code and run fly deploy --ha=false again. Your memory, schedule and log live on the disk and are not touched by an update. The bot is away for under a minute; a task it was in the middle of is announced when it returns, not carried on.

Going back

To go back to the code as it was, list the earlier images and deploy one:

fly releases --image
fly deploy --ha=false --image registry.fly.io/your-app-name:deployment-XXXX

The host keeps earlier images for a while and does not promise to. The data does not go back with the code. The host photographs the disk once a day (fly volumes snapshots list with the volume's id), and restoring one means creating a new volume from it. The disk is on one physical machine and nothing else copies it; that is not yet built. Neither of these two steps has been run here.

Settings worth knowing

All optional. Put them in .env locally, or set them with fly secrets set on a server.

SettingDefaultWhat it changes
ODYSSEUS_TASK_USD0.50The most one task may spend before it is ended
ODYSSEUS_DAILY_USD3.00The most one day may spend. After that, new tasks are refused until tomorrow.
ODYSSEUS_MAX_TURNS25The most steps one task may take
ODYSSEUS_MODELclaude-sonnet-5-5The model for conversations
ODYSSEUS_BACKGROUND_MODELclaude-haiku-5-5The model for unattended routines
ODYSSEUS_TZthe machine's clockYour time zone, for reminders and message times. Set it on any server.
ODYSSEUS_BROWSER_ASK_SIGNED_INonYou are asked before every browser run that is signed in as you. Set to 0 to let such runs start without asking

Think before turning that last one off. You are asked before a browser run signed in as you starts, but nothing asks before a click inside it. With the setting at 0 such a run starts without asking and is only reported afterwards. If you sign the browser in to anything that can spend money or speak for you, leave it on. Chapter 11 explains what is at stake.

What you are trusting

Running Odysseus yourself means nobody stands between you and your data except the services you choose to connect. Each one sees something:

ServiceWhat it sees
The model makerYour conversations, and whatever the tools return into them
The search serviceThe searches the model makes
The connector (optional)It holds the access to your mail, calendar and connected apps, and your mail passes through it
The browser vendor (optional)The tasks you browse, and the sign-ins you save there
The text-recognition service (optional)Every file you send the bot, in full
The iMessage vendor (optional)Every message on that channel, both ways
The WhatsApp reseller (optional)Every message on its number, both ways, kept in readable form, and a token for your WhatsApp account
Your hostThe disk holding your memory, schedule and log

If something goes wrong

What you seeLikely cause
The bot answers for five minutes after a deploy, then nothingNo payment card on a new Fly.io account. Look for "Trial machine stopping" in fly logs.
fly status shows the check passing, and the app's address does not loadThe app has no public address. Run the two fly ips allocate commands above.
After a move, "I was restarted and could not pick up our earlier conversation"The conversation's folder under /data/agent/projects still has the name it had on your computer. Rename it to -app.
The machine restarts by itself under loadOut of memory. Raise memory in fly.toml.
No reply at all, and you are sure it is runningOWNER_TELEGRAM_ID is not your ID, or a second copy is running somewhere and taking the messages
"Missing settings: …" at start-upA required line in .env is empty. The message names which.
Reminders arrive hours offODYSSEUS_TZ is not set on the server
"Today's budget … is used up"The daily limit was reached. Raise ODYSSEUS_DAILY_USD or wait for tomorrow.
It says an app is not connectedOpen the link in its reply and approve, then tell it you have

To see what it actually did, read journal.jsonl in its data folder: one line per step, including every reply sent or lost. On Fly.io:

fly ssh console -C "tail -n 20 /data/journal.jsonl"

Checking your copy

The tests run in under a minute and call no outside service.

pip install -r requirements-dev.txt
pytest

They prove what the code around the model does. They do not prove that it works with real services; three faults in the first day were found only by running it for real. The scripts in scripts/ are the live checks used here, and each one spends a few cents.