Give your AI agent a cloud browser on Railway (CDP)

By Tracklayer · Updated 2026-11-20

Short answer: deploy a headless browser template on Railway and connect to it from your agent over the Chrome DevTools Protocol (CDP). Tracklayer’s Obscura template runs Obscura 0.2.6, an open-source headless browser written in Rust, always on behind a token. Playwright, Puppeteer and other CDP clients connect to it like a remote Chrome, with no database and no volume.

Deploy Obscura on Railway

Why give an agent a remote browser

Running Chrome next to your agent code is heavy, and many agent hosts have no room for it. A remote browser runs as its own service. Your agent connects over a WebSocket, loads pages, and gets back text, HTML, Markdown, screenshots or PDFs. Uses named in the template:

Which headless browser templates people deploy on Railway

TemplateCreatorDeploymentsServices
DirectusMedim's Projects3,2943
Browserless v1Brody's Projects1,5701
Strapi 5Szilard Koppel's Projects9002
Browserless v2Brody's Projects3821
Crawl4AIbeau's Projects2981
Browserless V2 w/ Chrome not ChromiumTracklayer1051
Firecrawl v2 Web Data API for AITracklayer48
Medusa v2 Commerce Store (Backend + Storefront)Tracklayer47

Railway marketplace data as of 2026-11-19. Full ranking: Best headless browser templates on Railway.

Templates in this table differ in the engine they run, whether a token protects the public URL, and whether anything is persisted. Check those on the template page before pointing an agent at one.

Deploy Obscura on Railway, step by step

These steps use Tracklayer’s Obscura headless browser template.

  1. Deploy the template. It creates one service. Obscura listens on loopback only, and a Node.js gate sits on the Railway domain.
  2. Copy the endpoint. On the service’s Variables tab, copy BROWSER_WS_ENDPOINT. It looks like wss://{your-domain}?token={OBSCURA_TOKEN}. The token was generated at deploy.
  3. Connect from your code. With Playwright, use chromium.connectOverCDP(process.env.BROWSER_WS_ENDPOINT). Playwright’s connect speaks a different protocol and will not work. With Puppeteer, use puppeteer.connect({ browserWSEndpoint }). Use one browser context per job so cookies and storage stay apart.
  4. Use the private endpoint when you can. From another service in the same project, reference ${{Obscura.BROWSER_WS_ENDPOINT_PRIVATE}}. It is faster and adds no egress.
  5. Keep the token out of URLs if you prefer. Send it as an Authorization: Bearer header or as the Basic auth password instead.

To rotate the token, change OBSCURA_TOKEN and redeploy.

Security defaults

The gate requires the token on every path except /health and /robots.txt. It refuses requests from browser pages on other sites unless you list them in OBSCURA_ALLOWED_ORIGINS. It caps open connections at 10 by default (OBSCURA_MAX_SESSIONS) and closes idle ones after 1,800 seconds (OBSCURA_IDLE_TIMEOUT). Pages cannot reach private networks, including *.railway.internal, unless you set OBSCURA_BLOCK_PRIVATE_NETWORKS=false.

Costs

Railway bills usage. This is measured, not estimated: on Railway the template used about 0.11 GB of RAM idle and at most 0.33 GB with 10 parallel connections, and it ran under a 0.5 GB limit. Memory is small, so egress for responses sent over the public domain can matter more than compute. The template’s own estimate is about $1 to $2 per month idle and $3 to $8 per month for an agent working a few hours a day.

Keep one replica: each replica is a separate browser. For more throughput raise OBSCURA_WORKERS and give the service more CPU and memory.

Limits to know

Other options

For the full ranking, see headless browser templates on Railway. You can also browse web scraping templates and all guides.

FAQ

How do I connect Playwright to the Obscura template?

Copy BROWSER_WS_ENDPOINT from the service Variables tab; it looks like wss://your-domain?token=.... From another service in the same Railway project use BROWSER_WS_ENDPOINT_PRIVATE. In Playwright use connectOverCDP, not connect. The token can also be sent as a Bearer header or Basic auth password.

Is the browser protected from strangers?

In the Obscura and Moli templates, yes. A small gate on the public domain requires a token generated at deploy on every request and WebSocket, and pages cannot reach your Railway private network by default. An exposed browser is otherwise a free proxy for anyone who finds it.

How much memory does it need?

Measured on Railway, the Obscura template used about 0.11 GB of RAM idle and at most 0.33 GB with 10 parallel connections loading real pages. It also ran under a 0.5 GB limit with stealth mode on, so every plan works, including Free.

Does it solve CAPTCHAs or bot detection?

No. Obscura's stealth mode helps against basic bot detection but does not solve CAPTCHAs, Cloudflare interactive challenges or IP-based limits. Respect each site's terms and robots.txt, and note that Railway's Fair Use Policy applies to your deployment.

Is the headless browser real Chrome?

Not in the Obscura and Moli templates. Each is its own engine, not Chromium, so long-tail CSS, some Web APIs, WebGL and media playback can differ from Chrome. For a full Chromium that you drive by hand from a tab, use a cloud browser template instead.