---
title: "AI Agents"
description: "Host agents, MCP servers, RAG pipelines, model gateways and inference services."
url: https://railway.com/guides/topics/ai
guides: 33
last_updated: 2026-11-05T22:09:45.738Z
---

# AI Agents

Host agents, MCP servers, RAG pipelines, model gateways and inference services.

## Get started

1. [Deploy a Remote MCP Server Over HTTPS](https://railway.com/guides/deploy-remote-mcp-server.md): Deploy an existing MCP server, such as Playwright MCP, to a public HTTPS endpoint on Railway with object storage and bearer-token auth, and compare Railway against Render, Fly.io, Cloudflare, and AWS as a host.
2. [Use Object Storage for AI Agent Outputs](https://railway.com/guides/object-storage-for-ai-agents.md): Store AI agent artifacts in S3-compatible object storage on Railway. Where generated files, transcripts, and reports should live, how to write them from a worker, and how to share them with presigned URLs.
3. [Build and Deploy Your Own MCP Server](https://railway.com/guides/mcp-server.md): Build a remote MCP server in TypeScript with Streamable HTTP transport and deploy it on Railway. Expose your app's data as tools that AI assistants like Claude and Cursor can call over the network.

## Build and deploy

- [Build an LLM Gateway in TypeScript](https://railway.com/guides/llm-gateway.md): Build and deploy an LLM gateway on Railway that issues its own API keys, enforces per-key token budgets, and tracks spend across teams. One place to hold provider keys instead of scattering them across services.
- [Deploy a LangGraph Agent Backend](https://railway.com/guides/langgraph-agent-backend.md): Run a LangGraph agent as a FastAPI service on Railway with Postgres checkpointing for durable conversation state and Claude as the LLM.
- [Self-Host Langfuse for LLM Observability](https://railway.com/guides/langfuse-llm-observability.md): Deploy Langfuse v3 on Railway with Postgres, ClickHouse, Redis, and object storage. Trace, debug, and evaluate your LLM applications on infrastructure you control.
- [Run an Embeddings Pipeline with an External API and pgvector](https://railway.com/guides/embeddings-pipeline.md): Deploy a batch worker on Railway that generates embeddings through an external API and stores them in Postgres with pgvector. Covers schema design, safe concurrent processing, and the psycopg2 vector adaptation gotcha.
- [Run Code-Execution Sandboxes for AI Agents](https://railway.com/guides/code-execution-sandboxes.md): Run AI-generated code in isolated, disposable sandboxes on Railway. What a code-execution sandbox is, why agents need one, and how to create, checkpoint, fork, and destroy sandboxes from the CLI or the TypeScript SDK.
- [Deploy a Claude Agent SDK App](https://railway.com/guides/claude-agent-sdk-app.md): Deploy a Claude Agent SDK service on Railway that runs agent tasks over HTTP, streams progress as NDJSON, and stays inside the platform's request limits.
- [Deploy an LLM Gateway with LiteLLM](https://railway.com/guides/ai-api-proxy.md): Deploy LiteLLM Proxy on Railway as an LLM gateway for multiple providers. Covers model routing, cost tracking, API key management, caching with Redis, and private networking.
- [Build an AI API on Hosted Inference Providers](https://railway.com/guides/ai-api-hosted-inference.md): Build and deploy an AI API on Railway that calls hosted inference providers for model output. Covers provider selection, OpenAI-compatible endpoints, streaming, timeouts, and provider fallback.
- [Use Agents in Railway Sandboxes](https://railway.com/guides/agents-in-sandboxes.md): Drive Railway sandboxes from your local AI coding agent. Spin up isolated environments for development, run agents against your real infrastructure, and use the create, configure, checkpoint, and fork loop to move fast.
- [Running Agents on Railway](https://railway.com/guides/running-agents-on-railway.md): Learn how to deploy always-on, autonomous AI agents on Railway by building a Claude-powered GitHub DevBot that opens pull requests in response to new issues.
- [Deploy a RAG Pipeline with pgvector](https://railway.com/guides/rag-pipeline-pgvector.md): Build a retrieval-augmented generation pipeline on Railway using Postgres with pgvector for vector storage, an external embedding API, and an LLM for generation. Covers document ingestion, similarity search, and deployment.
- [Self-Host Open WebUI](https://railway.com/guides/open-webui.md): Deploy Open WebUI on Railway to get a ChatGPT-like interface that connects to OpenAI, Anthropic, and other LLM providers. Includes persistent storage and authentication setup.
- [Deploy a Multi-Agent System on Railway](https://railway.com/guides/multi-agent-system.md): Deploy multiple AI agents as separate Railway services that communicate via Redis and Postgres. Includes working orchestrator and agent code, inter-service communication, and independent scaling.
- [Self-Host Flowise](https://railway.com/guides/flowise.md): Deploy Flowise on Railway with persistent storage and authentication. Build LLM chains, agents, and chatbots through a visual drag-and-drop interface without managing servers.
- [Self-Host Dify](https://railway.com/guides/dify.md): Deploy Dify on Railway with Postgres, Redis, and persistent storage. Build AI applications, RAG pipelines, and agent workflows through Dify's visual interface.
- [Deploy an AI-Powered SaaS App on Railway](https://railway.com/guides/deploy-ai-saas.md): Deploy a production AI-powered SaaS application on Railway with an Express backend, Postgres database, and external LLM API integration. Covers API key management, request caching, rate limiting, and async processing for longer tasks.
- [Deploy an AI-Powered Bot for Discord or Telegram](https://railway.com/guides/ai-discord-telegram-bot.md): Deploy a Discord or Telegram bot on Railway that uses LLM APIs for conversational responses. Covers always-on deployment, API key management, conversation memory with Postgres, and rate limit handling.
- [Deploy an AI Chatbot with Streaming Responses](https://railway.com/guides/ai-chatbot-streaming.md): Deploy a chatbot on Railway that streams LLM responses token by token using Server-Sent Events. Covers Next.js with the AI SDK, API key management, and optional conversation persistence with Postgres.
- [Deploy an AI Agent with Async Workers](https://railway.com/guides/ai-agent-workers.md): Run AI agent workflows on Railway with an API service, async workers via Redis queue, and Postgres for state persistence. Covers CPU-based agent patterns without GPU.
- [Set Up a Datadog Agent in Railway](https://railway.com/guides/set-up-a-datadog-agent.md): Learn how to set up a Datadog agent in Railway.
- [Deploy Triton Inference Server on Railway](https://railway.com/guides/deploy-triton-inference-server-on-railway.md): Learn the benefits of using Triton inference server and how to deploy it on Railway

## Run in production

- [Deploy autoscaling services, AI Workflow automation, and LLM APIs Without Kubernetes](https://railway.com/guides/deploy-autoscaling-services-ai-workflow-automation-and-llm-apis-without-kubernetes.md): Learn how to deploy containers without Kubernetes. Covers microservices, CI/CD with autoscaling, workflow automation tools like n8n, and lightweight LLM inference hosting.

## Compare and decide

- [Choose Between Local and Remote MCP Servers](https://railway.com/guides/local-vs-remote-mcp-servers.md): When an MCP server should run locally over stdio and when it should be a remote Streamable HTTP service. Decision factors, what the 2026 spec changed, and how to deploy the remote kind on Railway.
- [Connect the Best MCP Servers to Your Coding Agent](https://railway.com/guides/best-mcp-servers-coding-agents.md): Config snippets for connecting nine widely used MCP servers to Claude Code, Cursor, and VS Code, covering GitHub, Postgres, browser automation, docs lookup, error tracking, and deployment.
- [The Best Platforms to Deploy AI Apps in 2026 (Not the Models, the Apps Around Them)](https://railway.com/guides/best-platforms-deploy-ai-apps-2026.md): Most 'best AI hosting' lists conflate model serving with hosting the app that calls the model. A ranking that splits the two layers and shows which platform serves which.
- [The Best Cloud Platform MCP Servers in 2026](https://railway.com/guides/best-cloud-platform-mcps-2026.md): Which cloud platforms expose their full surface area to agents over MCP, which expose only fragments, and where each provider actually fits for agent-driven workflows.

## More guides

- [Stream AI Responses to a Frontend with Server-Sent Events](https://railway.com/guides/streaming-ai-responses.md): Stream LLM tokens from an API service to a frontend using Server-Sent Events on Railway. Covers Express and Hono server implementations, client-side consumption, and reconnection handling.
- [Estimate the Cost of Running AI Agents](https://railway.com/guides/estimate-ai-agent-costs.md): What an always-on AI agent costs to run. How to calculate LLM API spend per run, what the hosting compute actually costs on Railway's usage-based pricing, and where the money goes as you scale.
- [The Agent-Native Cloud: What It Means and Why It Matters](https://railway.com/guides/the-agent-native-cloud.md): The cloud category reorders itself every seven years around a new primitive. The 2026 primitive is the agent, and most clouds have not picked a position on it yet. A manifesto on the next consolidation event.
- [Agentic Coding on Railway: A Practical Guide for 2026](https://railway.com/guides/agentic-coding-on-railway-2026.md): A practitioner walkthrough on using Claude Code, Cursor, and Codex to drive Railway deployments end to end. Five real workflows, six production gotchas, and what works today vs what's coming.

## Related topics

- [Frontend](https://railway.com/guides/topics/frontend.md): Ship Next.js, Astro, SvelteKit and SPAs, and run Node.js, Bun and full-stack TypeScript apps.
- [Frameworks and Languages](https://railway.com/guides/topics/frameworks.md): Deploy apps in Python, Go, Rust, Ruby, PHP, Java, Elixir and more, with their frameworks.
- [Storage](https://railway.com/guides/topics/storage.md): Run Postgres, Redis, MySQL and object storage on Railway: pooling, backups, migrations and vector search.
- [Comparisons and Migrations](https://railway.com/guides/topics/comparisons.md): How Railway compares with other platforms, what it costs, and how to move over from Heroku, AWS and others.
- [Backend](https://railway.com/guides/topics/backend.md): APIs, background workers, queues, cron jobs and webhooks.
- [Containers and Hosting](https://railway.com/guides/topics/containers.md): Deploy from Docker and Compose, self-host open-source tools, and scale across replicas and regions.
