(03)Start

Ostra Bot, an agent in Telegram

Ostra Bot is an Ostra agent in Telegram: it runs around the clock in Ostra Cloud, inside a TDX enclave, works from the owner's own vault, and spends only what the policy the owner signs allows.

Chain Robinhood Chain · 4663Code 77da16aOstra Swap 6d5a05cOstrapad 61d8485

3.1What Ostra Bot is#

Ostra Bot (@OstraAgentBot) is a chat with an agent of the owner's vault. The agent is the same MCP server an agent runs on its own machine (agents and the MCP server), run by Ostra Cloud: Ostra's gateway inside an Intel TDX enclave on Phala Cloud. The model that reads the messages and calls the agent's tools is Ostra AI's text task, paid from the vault, within an AI budget the owner sets for each message remote-telegram.ts:1-39.

The vault stays the owner's: it is made and kept in the Ostra web app, in the owner's browser, never in Telegram. The agent works with an agent key of that vault: a key of its own that the vault accepts only within a policy, which says what actions it may take, the most one spend may move, a budget for each day, the only recipients it may pay, and the day the key ends. The owner signs all of it in the web app and can stop the key at any time.

3.2What is needed#

WhatWhy
A Telegram accountOstra Bot answers in a private chat with the account that connected the vault
A browser with the Ostra web appThe vault lives there: a new one is made in a minute, or an existing one is restored from its backup file (keys and backup)
A few USDG on Robinhood ChainConnecting is up to four vault transactions, plus creating the vault if it is new, each paid in USDG from the vault; the agent and its model are then paid from the same vault
A free placeOstra Cloud serves a limited number of agents at once during early access; the Mini App shows how many places are taken

3.31. Open Ostra Bot#

  1. Open t.me/OstraAgentBot in Telegram and press Start.
  2. Press Open Ostra. The Mini App opens inside Telegram.

The Mini App first asks the enclave for an attestation over a nonce it makes on the spot, and checks that the answer is for that nonce. It shows quote received with the nonce and the size of the TDX quote. The Mini App does not check the quote itself; anyone can, with dstack-verifier (below).

Under it, the Mini App shows the Telegram account it was opened by: its username and its id. Telegram signs them, and Ostra Cloud checks that signature with the bot's token before it answers remote-telegram.ts:124-156. The next step shows the same two: compare them.

3.42. Connect a vault#

Press Connect a vault. The Mini App makes a one-time link to the web app's connect page, app.ostraagent.xyz/connect, and opens it in the browser.

  • The vault has to be in that browser. If another browser holds it, copy the link the Mini App shows and open it there.
  • The link works once, for 30 minutes, and only for the Telegram account that asked for it. Never send it to anyone: it would give that account an agent key of the vault.
  • The page shows the Telegram username and id that asked. Go on only after pressing Connect in Ostra Bot oneself, and only when both are one's own, as the Mini App showed them. The name proves nothing: anyone can choose any name.
  • With no vault in this browser yet, the page offers to create one, or to restore one from its backup file. A new vault asks for a passphrase and opens only once its backup file is downloaded and kept off the device; then the page goes on with the connection.
  • An empty vault asks for USDG first, with its address to send to. Send a few USDG on Robinhood Chain (chain 4663); the page sees them arrive by itself. USDG sent on another network does not arrive.

3.53. Set the limits and sign#

SettingWhat it means
Pay the relayer and x402 sellers through channelsAlways on: how the agent pays the relayer for its own transactions, and Ostra AI for the bot’s model
Send USDG to recipients on the allowlistOptional. The agent can pay only addresses the owner adds, one by one, in the vault page’s Agent tab
At most per spendIn USDG, at least 1. A vault with no policy yet is proposed 5
At most per dayIn USDG, at least one spend. A vault with no policy yet is proposed 20; what was spent comes back gradually over 24 hours
Agent key lasts1 to 90 days, 30 by default. After that the chat is no longer connected until the owner connects again

Sign and connect has the vault sign, one after the other: the policy (when it changes), the relayer's channel on the allowlist, Ostra AI's channel on the allowlist (so the agent pays the bot's model in USDG), and the agent key of Ostra Bot. The Ostra relayer sends each one, paid in USDG from the vault; one already in place is skipped. If one cannot be paid, it is not signed; what was done stays done, and pressing again goes on from there.

Ostra Cloud then checks on chain that the vault installed the very key it handed out, and only then ties the Telegram account to the vault. Ostra Bot says so in the chat: Connected: your vault … now has an agent in Ostra Cloud.

3.64. Talk with the agent#

Send a message in the chat, in any language. For example:

What does my vault hold, and how much may you
still spend today?
Find research agents on Ostrapad and show
their offers and prices.

The agent answers with the tools of the MCP server: balances and history, payments, swaps and Ostrapad, within what the policy allows. Before a spend, a trade or anything that cannot be undone, it acts only when the owner asked for it in the chat, and gives the transaction's hash remote-telegram.ts:444-458. Every spend is checked before it is signed, and a spend the policy does not allow is refused on chain.

  • The agent cannot change its own limits. The policy, the allowlist and the agent key are the owner's, in the web app; the agent says so and changes nothing remote-telegram.ts:389-396.
  • Ostra Bot reads text messages, one at a time per chat: a message sent while the agent works gets Still working on your previous message. At most 20 messages a minute are read.
  • The agent keeps the last 10 messages and its 10 answers in memory as its context, never on disk; disconnecting, or a restart of Ostra Cloud, starts it afresh.
  • Never send a seed phrase, a private key or a password in the chat. The agent never asks for one.

3.7The AI budget of a message#

Every message costs the model calls it takes to answer, paid from the vault to Ostra AI (Ostra AI). The owner sets the most one message may cost in the Mini App: AI budget of a message, from 0.001 to 5 USDG, 0.05 until the owner sets another amount.

  • One message takes at most 6 model calls. Each call's price cap is at most half of the budget, or what is left of it remote-telegram.ts:399-403.
  • A call pays what the task cost; what it did not cost stays as the vault's credit with Ostra AI.
  • The agent knows what the chat's model calls have cost since the vault was connected, and over how many messages: ask it.

3.8Disconnect, or stop the agent#

WhereWhat it does
Mini App: Disconnect this vaultThe chat stops talking to the vault, and its place is free again. The agent key stays installed in the vault until the owner revokes it
Web app: the vault page’s Agent tab, Stop the agent key nowThe key signs nothing more, at once, for Ostra Bot and every app connected with it. The chat says it is no longer connected at the next message
The key’s endOn the day set when connecting, the key signs nothing more; connect again for a new one

3.9Where it runs, and what to trust#

Ostra Cloud is one app on Phala Cloud, in an Intel TDX enclave, its keys from the dstack KMS on Base compose.yml:1-19. Inside it:

  • signer holds the agents' seeds, sealed with the enclave's own key, and has no network at all.
  • gateway runs one MCP server for each connected vault, each in a sandbox of its own, and Ostra Bot itself.
  • egress is the only way out: HTTPS to public hosts only.
WhoSees or canCannot
Ostra Cloud’s codeSign with each connected vault’s agent key, and see the chat and every tool call with its answerChange a policy or an allowlist, install a key, or sign for the owner
Phala, the hostRun, stop or restart the enclave; the OS image under it is one Phala’s KMS contract on Base allowsRead its memory or its encrypted disk, or run a compose its app contract does not allow
Phala’s dstack gatewayWhere HTTPS to Ostra Cloud ends, in front of the enclave: it carries the calls of the Mini App and of the connect page. The chat does not pass through it: the bot reads Telegram over its own HTTPSSign anything: it holds no key of a vault
Ostra, the operatorPropose a new compose (new code) on the app’s contract, public for 72 hours before it can count. Replace the enclave’s encrypted settings at once (the chain’s RPC endpoint, the operators’ own users, the bot’s token), and stop or restart itRead the enclave’s container logs, which are off; read a seed; change a policy or sign for an owner
TelegramThe messages of the chat, as for any botSign anything: Telegram never holds a key
Ostra AIThe conversation it is asked to answer. Its gateway passes it to the model and does not log or store it; the model’s provider is one that does not train on it (Ostra AI’s default), under that provider’s own retention termsSpend from the vault beyond what each call’s price cap allows

The 72-hour notice#

Which code may run in the enclave is decided by its app contract on Base, 0xC045C2d562F7e2D77A7484dDDBeDEdDA34110759: the dstack KMS hands the enclave its keys only for a compose hash and a machine that contract allows, on an OS image Phala's KMS contract allows. Since 13 November 2026 that contract is owned by a TimelockController, 0x010f9aC8b29a4cb0d0722E046fA9327e835e2D3b, with a delay of 72 hours: a new compose hash, a new machine or an upgrade of the contract is scheduled in public, and runs 72 hours later at the earliest. The notice covers the compose, which is Ostra's code; the encrypted settings named above and the OS image are not under it.

Checking the enclave oneself#

/attestation answers a TDX quote whose report data is SHA-256 of OSTRA/CLOUD/ATTEST/v1 and the caller's nonce. With Docker and Node, this asks for one and has dstack-verifier check it: Intel's signature, the event log, the OS image, the app id and the compose hash the enclave was started with.

export NONCE=$(openssl rand -hex 32)
curl -s "https://c045c2d562f7e2d77a7484dddbededda34110759-8080.dstack-base-prod5.phala.network/attestation?nonce=$NONCE" -o answer.json
docker run -d --name dstack-verifier -p 127.0.0.1:8090:8080 ghcr.io/dstack-tee/dstack-verifier:0.6.3
for i in $(seq 30); do curl -s -o /dev/null http://127.0.0.1:8090/ && break; sleep 1; done
node -e 'const a = require("./answer.json"); const want = require("crypto").createHash("sha256").update("OSTRA/CLOUD/ATTEST/v1").update(Buffer.from(process.env.NONCE, "hex")).digest("hex"); fetch("http://127.0.0.1:8090/verify", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ attestation: a.attestation }) }).then((r) => r.json()).then((v) => console.log(v.is_valid, v.details?.app_info?.app_id, v.details?.app_info?.compose_hash, String(v.details?.report_data ?? "").startsWith(want)))'

It prints true, the app id c045c2d562f7e2d77a7484dddbededda34110759, the compose hash, and true again when the quote's report data is SHA-256 of the domain and this nonce. The compose hash is the SHA-256 of the app compose, which names the images by digest; the app contract above shows whether it is allowed (allowedComposeHashes).

3.10Good to know#

  • On chain, connecting is the vault's own transactions: its policy, its allowlist and the agent key's public root. The Telegram account is tied to the vault only inside Ostra Cloud, never on chain.
  • Ostra Bot is free. The vault pays what it always pays: the relayer's fee in USDG for each transaction, the model calls of each message, and the fees of what the agent uses.
  • Keep some USDG in the vault: each transaction and each message is paid from it.
  • During early access the number of places is limited. A place is held from the moment the key is handed out; one not installed within 15 minutes is freed, and a key installed later still connects while a place is free.