Give your AI agent a cloud browser on Railway (CDP)
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 RailwayWhy 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:
- a remote browser for agents built with browser-use, Stagehand, LangChain tools or your own Playwright or Puppeteer code,
- scraping JavaScript-rendered pages,
- fetching sites that block plain HTTP clients, using stealth mode and your own proxy,
- replacing a Browserless-style
BROWSER_WS_ENDPOINTin existing CDP client code.
Which headless browser templates people deploy on Railway
| Template | Creator | Deployments | Services |
|---|---|---|---|
| Directus | Medim's Projects | 3,294 | 3 |
| Browserless v1 | Brody's Projects | 1,570 | 1 |
| Strapi 5 | Szilard Koppel's Projects | 900 | 2 |
| Browserless v2 | Brody's Projects | 382 | 1 |
| Crawl4AI | beau's Projects | 298 | 1 |
| Browserless V2 w/ Chrome not Chromium | Tracklayer | 105 | 1 |
| Firecrawl v2 Web Data API for AI | Tracklayer | 4 | 8 |
| Medusa v2 Commerce Store (Backend + Storefront) | Tracklayer | 4 | 7 |
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.
- Deploy the template. It creates one service. Obscura listens on loopback only, and a Node.js gate sits on the Railway domain.
- Copy the endpoint. On the service’s Variables tab, copy
BROWSER_WS_ENDPOINT. It looks likewss://{your-domain}?token={OBSCURA_TOKEN}. The token was generated at deploy. - Connect from your code. With Playwright, use
chromium.connectOverCDP(process.env.BROWSER_WS_ENDPOINT). Playwright’sconnectspeaks a different protocol and will not work. With Puppeteer, usepuppeteer.connect({ browserWSEndpoint }). Use one browser context per job so cookies and storage stay apart. - 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. - Keep the token out of URLs if you prefer. Send it as an
Authorization: Bearerheader 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
- Not Chromium. Obscura is its own engine. Long-tail CSS, some Web APIs, WebGL and media playback differ from Chrome, and unsupported protocol calls return explicit errors.
- Nothing is persisted. Cookies and site storage reset when Obscura restarts. Log in from your script on each run.
- Stealth is limited.
OBSCURA_STEALTH=truehelps against basic bot detection. It does not solve CAPTCHAs, Cloudflare interactive challenges or IP-based limits. - Young project. Obscura releases every few weeks. Read its release notes before changing the pinned version.
- Fair use. Respect the terms and robots.txt of sites you visit. Railway’s Fair Use Policy applies. This is a community template, not affiliated with the Obscura authors, and Obscura is Apache-2.0.
Other options
- Moli headless browser from Tracklayer: Moli 1.1.22 behind the same kind of token gate, with one endpoint for CDP, WebDriver Classic and WebDriver BiDi, so Selenium also works. The template’s cost figures are estimates, not Railway measurements.
- Chromium cloud browser from Tracklayer: a full Chromium 156 you use from a tab of your own browser, behind a login, with the profile kept on a volume. It is aimed at browsing and testing by hand.
- Browserless V2 with Chrome: listed on the marketplace under a different creator and described as a Browserless V2 server that uses Chrome. Check its Variables tab for the token setting before exposing it publicly.
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.