feat: Railway deployment support with one-click deploy (#106)

* feat: add Railway deployment support with agent auto-discovery

- Add railway.toml for build/deploy config with health checks
- Skip config file requirement when RAILWAY_ENVIRONMENT detected
- Auto-discover existing agent by name on container deploys
- Add findAgentByName() API function for agent lookup
- Add setAgentId() method to LettaBot class
- Add comprehensive Railway deployment docs

One-click deploy flow:
1. Set LETTA_API_KEY + channel tokens
2. LettaBot finds existing agent by AGENT_NAME (default: "LettaBot")
3. If not found, creates on first message
4. Subsequent deploys auto-reconnect to same agent

Written by Cameron ◯ Letta Code

"The best way to predict the future is to deploy it." - Railway, probably

* fix: specify Node 22 for Railway deployment

* fix: fail fast if LETTA_API_KEY is missing

* fix: don't await Telegram bot.start() - it never resolves

* fix: extract message from send_message tool call

* Revert "fix: extract message from send_message tool call"

This reverts commit 370306e49de3728434352d2df1b78c744e888833.

* fix: clear LETTA_AGENT_ID env var when agent doesn't exist

* docs: add Railway deploy button to README and docs

* fix: .nvmrc newline and correct MODEL default in docs
This commit is contained in:
Cameron
2026-02-03 14:46:37 -08:00
committed by GitHub
parent ed0d406a9d
commit 75f65049bc
8 changed files with 208 additions and 7 deletions

20
railway.toml Normal file
View File

@@ -0,0 +1,20 @@
# Railway deployment configuration
# https://docs.railway.app/reference/config-as-code
[build]
builder = "NIXPACKS"
[build.nixpacks]
nixPkgs = ["nodejs_22"]
[deploy]
# Build TypeScript before starting
buildCommand = "npm run build"
# Start the server
startCommand = "npm start"
# Health check endpoint
healthcheckPath = "/health"
healthcheckTimeout = 30
# Restart policy
restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 3