Remote access and iOS

Reach your host from your phone through a relay you deploy yourself. All of this is optional: the host, the CLI and the desktop app work without it.

Deploy the relay

The relay is a Cloudflare Worker that pairs WebSockets from your host and your phones and forwards encrypted frames between them. It has no accounts and stores no transcripts. The Workers Free plan is enough.

$ cd relay
$ npm ci
$ npx wrangler login    # once, in a browser
$ npx wrangler deploy

Wrangler prints the relay's address, for example https://agenthost-relay.<subdomain>.workers.dev. The host uses the WebSocket form of it:

$ scripts/install.sh --relay wss://agenthost-relay.<subdomain>.workers.dev

The address is remembered, so later runs of scripts/install.sh keep it.

No Cloudflare account? agenthostd dev-relay runs a relay locally for testing; start the host with --relay-url ws://127.0.0.1:8787.

Pair a device

$ agenthost device pair    # shows a QR code

Or use Settings → Devices → Pair iPhone in the desktop app. Scan the code in the iPhone app and confirm the short code shown on both screens. A pairing code works once and expires after 2 minutes.

Paired devices are listed under Settings → Devices, where you can rename or revoke them. A revoked phone deletes its keys and cached transcripts.

Build the iPhone app

There is no App Store build. You need an Apple Silicon Mac with Xcode 15 or newer, rustup and XcodeGen (brew install xcodegen).

$ cd ios
$ ./build-rust.sh    # builds the shared protocol code for iOS
$ xcodegen generate
$ open AgentHost.xcodeproj

Pick your team under Signing & Capabilities, then run on your iPhone. The app needs iOS 17 or later.

The iPhone app has had the least testing of any part of the project. See ios/README.md for the details and known limits.

What the app does

Notifications

The app can notify you when a session needs your approval and, if you ask, when an agent finishes its turn or a session fails. Turn them on while pairing or under Settings → Notifications.

What a notification says is encrypted to the phone. Apple and the relay see only "A session needs you".

Notifications need the Push Notifications capability, which needs a paid Apple Developer account. Apple accepts notifications for an app only with the key of the team that signs it, so:

  1. Create an APNs key at developer.apple.com (Certificates, Identifiers & Profiles → Keys) and download the .p8 file. It can be downloaded only once.
  2. Give it to your relay:
    $ cd relay
    $ npx wrangler secret put APNS_KEY < AuthKey_XXXXXXXXXX.p8
    $ echo XXXXXXXXXX | npx wrangler secret put APNS_KEY_ID    # from the file name
    $ echo YOURTEAMID | npx wrangler secret put APNS_TEAM_ID
    $ echo dev.agenthost.ios | npx wrangler secret put APNS_TOPIC    # the app's bundle id
    $ npx wrangler deploy
  3. Phones paired through that relay then get notifications with nothing to set up on the host.

Without such a relay, the host can send to Apple itself with your team's key; the app asks for it once per host. Check the setup with agenthost push status and agenthost push test.

What the relay can see

Everything between your phones and the host is end-to-end encrypted, so the relay forwards frames it cannot read. The one exception is webhooks: services like Sentry send plain HTTPS requests, which the relay seals to your host in memory as they arrive. The security model and the relay protocol have the details.