feat: add railway agent subcommand for natural-language chat#841
Merged
feat: add railway agent subcommand for natural-language chat#841
railway agent subcommand for natural-language chat#841Conversation
Adds a top-level `-p` / `--prompt` flag that sends natural language prompts to the Railway AI chat API via SSE streaming. Supports single-shot mode (`railway -p "message"`) and interactive REPL (`railway -p`). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add "Thinking..." spinner on initial request - Add "Railway AI:" header before response text - Dim tool call spinners and suppress them in non-TTY mode - Use get_or_prompt_service() for interactive service selection - Add --json root flag that outputs accumulated response as a single JSON object with threadId, response text, and toolCalls - Add telemetry tracking for the -p flag path - Improve non-interactive error message with flag hint Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Skip project access tokens in build_chat_client() — the chat API requires user OAuth tokens and rejects RAILWAY_TOKEN - Fix error event parsing: API sends `error` field, not `message` - Handle `aborted` events from the agent stream - Add fallback for both `error` and `message` field names for forward compatibility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Move from root-level `-p` flag to `railway agent` subcommand - `railway agent` enters interactive REPL - `railway agent -p "message"` sends a single prompt - Rename "Railway AI" to "Railway Agent" throughout - Add train-themed randomized thinking messages - Add git-tree style connector (╰─) linking thinking to tool calls - Tool calls render in grey box with white text - Reset "Railway Agent:" prefix for each new response block - Telemetry now handled automatically via commands! macro Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
railway -p)railway agent subcommand for natural-language chat
jaredLunde
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
railway agentsubcommand that sends natural language prompts to the Railway AI chat API via SSE streamingrailway agententers an interactive REPL with thread continuityrailway agent -p "message"sends a single-shot prompt and exits--jsonflag emits a single machine-parseable JSON object (response text, thread id, tool calls)--thread-id,--service, and--environmentflags scope and continue chats╰─) from thinking to tool calls, and grey-box tool-call renderingget_or_prompt_service()for interactive service selection when no service is linkedTest plan
railway agent -p "what services do I have?"— streams a response with tool call indicatorsrailway agent— enters interactive REPL;exit/quit/Ctrl+C ends itrailway agent -p "status" --json— outputs a single JSON objectrailway agent -p "..." | cat— no spinner artifacts in outputrailway agent --thread-id <id> -p "follow up"— continues an existing threadNoLinkedProjecterror🤖 Generated with Claude Code