Migrating production infrastructure? Get up to $10K in migration credits.

Apply now

Photon iMessage Codex Agent on Render

Deploy the iMessage Codex Agent on Render for a private AI agent that handles your messages, with a PostgreSQL-backed queue and persistent storage.

Why deploy Photon iMessage codex agent on Render?

Photon iMessage Codex Agent on Render is a deployment template that runs a private AI agent accessible through iMessage, using Photon Spectrum for message transport, Codex for task execution, PostgreSQL for the job queue, and a persistent disk for credentials. It solves the problem of setting up and hosting an iMessage-based agent by packaging the Photon iMessage template as a one-click Render deployment, where you interact with the agent directly in iMessage rather than a browser.

This template wires the full iMessage agent stack together on Render—a Node web service running the Photon runtime, a managed Postgres instance backing the pg-boss queue, and a 1 GB persistent disk mounted at /var/data for Codex credentials and workspaces—all provisioned from a single render.yaml with database migrations and the /healthz check already configured. Instead of manually provisioning Postgres, setting up disk persistence for credentials, and hand-wiring queue and environment variables, one click forks the repo and stands up every service pre-connected. Render's managed Postgres and persistent disks are exactly the primitives this agent needs to keep its queue durable and its Codex sessions authenticated across restarts, so you go from deploy to a live setup dashboard without touching infrastructure plumbing.

Architecture

What you can build

After deploying, you'll have a private iMessage agent running on your own Render account that answers only to your phone number. You text an assigned Photon number and Codex handles the work in a persistent workspace, with a Postgres-backed queue holding requests and your credentials stored on disk so state survives restarts. Once you finish the one-time browser setup (owner phone, Photon, and ChatGPT or OpenAI), messages from unauthorized senders are rejected before any model runs.

Key features

  • pg-boss durable queue: Inbound iMessage work is queued in PostgreSQL via pg-boss rather than processed inline on the Spectrum stream, preventing message loss on restarts.
  • Owner-only E.164 authorization: Only one authorized phone number can reach Codex; unknown senders are rejected before any model work is triggered.
  • Persistent disk credentials: ChatGPT device credentials and agent workspaces persist across deploys at /var/data/codex and /var/data/workspaces on a mounted 1 GB disk.
  • Auto-generated encryption key: A 256-bit APP_ENCRYPTION_KEY is created at provision time to encrypt owner identity at rest, requiring no manual secret setup.
  • Dual Codex auth modes: Supports ChatGPT device login by default and can switch to OpenAI API-key mode via CODEX_AUTH_MODE, passing the key only to the Codex child process.

Use cases

  • Solo founder texts Codex to fix bugs from their iPhone
  • DevOps engineer triggers deploys via owner-only iMessage from anywhere
  • Indie developer runs private coding assistant without exposing a browser
  • Consultant queues client code tasks through durable Postgres-backed iMessage agent

What's included

Service
Type
Purpose
codex-data
Web Service
Application service
imessage-agent-db
PostgreSQL
Primary database

Next steps

  1. Open the *.onrender.com public URL and save your owner phone number, then authenticate Photon and connect ChatGPT — The dashboard should confirm each step, and /readyz should flip from 503 to 200 once owner identity, Postgres, queue, Codex, and Spectrum are all ready
  2. Curl https://.onrender.com/readyz after finishing dashboard setup — You should get a 200 response with a JSON snapshot showing owner, storage, Postgres, queue, Codex, and Spectrum all reporting ready
  3. Text the Photon-assigned iMessage number from your saved owner phone — Codex should reply within seconds, while any message sent from a non-owner number is rejected before reaching the model

Resources

Stack

express
postgresql

Tags

ai-agent
openai
ai

For AI agents

Drop into your coding agent to explore and deploy this template.