How AI Agents Debug Their Own Deployments: Starfire + PipeStreamr + Claude Code
You just shipped a feature. Your AI coding agent helped you write it, committed it, and pushed it. Then Railway tries to deploy — and it fails.
Normally, you'd alt-tab to a dashboard, dig through logs, copy the error, and paste it back into your editor. But what if the agent that wrote the code could also see the deployment failure and fix it?
That's what happens when you combine Starfire, PipeStreamr, and Claude Code.
The Stack
PipeStreamr is a unified events API. It collects messages and logs from platforms like Railway, Discord, GitHub, Gmail, and others into a single queryable stream. When a Railway deployment fails, PipeStreamr captures it as an event — the commit, the error, the environment, all of it.
Starfire is a CLI credential manager. It stores API keys for developer tools and injects them automatically at runtime. No more exporting environment variables or hunting for tokens.
Claude Code is Anthropic's CLI agent for software engineering. It reads your codebase, writes code, runs commands, and — crucially — can use any CLI tool installed on your system.
What This Looks Like in Practice
Here's a real session. We'd just pushed a CORS fix and wanted to check if there were any recent Railway deployment errors:
> use starfire and pipestreamr to look for recent railway errors
Claude Code runs:
starfire run pipestreamr events --search "railway" --limit 10
And gets back structured JSON with the deployment failure — including the commit message, branch, author, and failure status. No dashboard. No context switching. The agent that wrote the code is now looking at the deployment result of that code.
From there, the agent can:
- Read the error and identify the root cause
- Fix the code
- Commit, push, and check the next deployment
The entire debug loop stays inside one terminal session.
Setting It Up
1. Install the tools:
cargo install pipestreamr
cargo install starfire
2. Register your PipeStreamr API key with Starfire:
starfire register pipestreamr ps_your_api_key
3. Connect Railway to PipeStreamr.
Add a Railway webhook pointing at your PipeStreamr instance. Deployment events (success, failed, crashed) flow in automatically.
4. Use it from Claude Code.
That's it. Claude Code can run any shell command, so starfire run pipestreamr events ... just works. The agent discovers available flags via --help and builds the right query.
Why This Matters
Most AI coding agents operate in a vacuum. They can read and write code, but they're blind to what happens after git push. They don't know if the build passed, if the deployment crashed, or if users are reporting errors.
Giving agents access to operational data closes that loop. The agent becomes aware of the consequences of its changes — not just the code, but whether it actually works in production.
This isn't a custom integration or a plugin. It's just CLI tools that an agent can call. The same pattern works with any tool Starfire supports: check DNS records with cf-dns, query databases with neonctl, or inspect infrastructure with flyctl.
The best debugging workflow is the one your agent can run without asking you to open another tab.
Links
- PipeStreamr — Unified events API
- Starfire — CLI credential manager
- Claude Code — AI coding agent