railway agent
Interact with the Railway Agent directly from the CLI. Ask questions about your project, create resources, debug issues, and more using natural language. Starts an interactive session by default, or send a single prompt with the -p flag.
Usage
Options
| Flag | Description |
|---|---|
-p, --prompt <MESSAGE> | Send a single prompt (omit for interactive mode) |
--json | Output response as JSON |
--thread-id <ID> | Continue an existing chat thread |
-s, --service <SERVICE> | Service to scope the conversation to (name or ID) |
-e, --environment <ENV> | Environment to use (defaults to linked environment) |
Examples
Start an interactive session
Show logs for your project
Create a database
Debug a failing service
Check deployment status
Investigate resource usage
Scope to a specific service
Get configuration help
JSON output for scripting
Continue a previous conversation
Interactive mode
When run without -p, the agent starts an interactive session where you can have a back-and-forth conversation:
The agent maintains context within the session, so follow-up questions understand previous messages.
JSON output
Use --json to get a structured response for scripting and automation:
Returns a JSON object with:
Authentication
The agent command requires user authentication via railway login. Project access tokens (RAILWAY_TOKEN) are not supported.