AI-Powered Autonomous Infrastructure Monitoring and Self-Healing System

railway · Tech · 2025 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Infrastructure monitoring and automated remediation

The Railway demo explores how deployed services with memory leaks, slow queries, high error rates, and latency spikes could be diagnosed and turned into code-fix pull requests by an AI coding agent.

Constraints:

Architecture

The Railway demo combines scheduled monitoring, observability context, durable workflow retries, a diagnostic plan, and an OpenCode server that turns infrastructure findings into a GitHub pull request for human review.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  scheduled-monitoring-workflow["Scheduled monitoring workflow"]
  metrics-and-logs-collection["Metrics and logs collection"]
  architecture-context-fetcher["Architecture context fetcher"]
  durable-workflow-engine["Durable workflow engine"]
  diagnostic-plan["Diagnostic plan"]
  opencode-server["OpenCode server"]
  github-pull-request["GitHub pull request"]
  human-reviewer["Human reviewer"]
  scheduled-monitoring-workflow --> metrics-and-logs-collection
  scheduled-monitoring-workflow --> durable-workflow-engine
  architecture-context-fetcher --> diagnostic-plan
  metrics-and-logs-collection --> diagnostic-plan
  durable-workflow-engine --> metrics-and-logs-collection
  durable-workflow-engine --> opencode-server
  diagnostic-plan --> opencode-server
  opencode-server --> github-pull-request
  github-pull-request --> human-reviewer
  human-reviewer --> scheduled-monitoring-workflow
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Scheduled monitoring workflow Periodically starts infrastructure analysis or could be replaced by alert triggers. Metrics and logs collection, Durable workflow engine
Metrics and logs collection Fetches CPU, memory, HTTP metrics, logs, and threshold analysis. Diagnostic plan
Architecture context fetcher Adds service topology and project architecture to the diagnosis. Diagnostic plan
Durable workflow engine Retries long-running monitoring and remediation steps that may fail. Metrics and logs collection, OpenCode server
Diagnostic plan Summarizes anomalies, likely root causes, and a code-fix plan. OpenCode server
OpenCode server Runs an agent with repo tools, git configuration, and PR-opening capability. GitHub pull request
GitHub pull request Presents generated remediation changes for human review. Human reviewer
Human reviewer Approves or rejects infrastructure remediation before merge. Scheduled monitoring workflow

Data flow

The workflow fetches service metrics, logs, thresholds, and architecture context, writes a diagnostic plan, then gives that plan to an agent server that can open a pull request.

“I then want to fetch each services resource metrics, so CPU and memory utilization. And I also want to fetch each services HTTP metrics.”transcript, stated
“we can just have this server have all the tools that the agent would need. So we'd install all of the necessary you know tools we can configure git and then the agent will be able to open pull requests”transcript, stated

Why this architecture

Durable execution and human PR review are necessary because multi-step remediation can fail and autonomous code changes should remain reviewable.

“what I want to do is actually use what is known as durable execution.”transcript, stated
“you just review a pull request and you're like, uh, looks good to me. You ship it and then everything is good and crisis averted.”transcript, stated

Models used: LLM provider behind OpenCode · coding agent

Scale

Alternatives considered (roads not taken)

Threshold-only alerting with human investigation

Rejected because: The workflow analyzes slices of metrics, logs, traces, and architecture context because thresholds alone are noisy and incomplete.

“it's probably better to be able to analyze a slice of time rather than just having a threshold being met because it can get pretty noisy.”transcript, stated
“you still have to do the investigation yourself. You have to dig through logs, metrics, and traces to try to paint a picture in your head”transcript, stated

Fully automatic remediation deployment

Rejected because: The agent opens a pull request so humans still review and merge the code fix.

“And here we go. We have a pull request that is open with all of our changes.”transcript, implied

Threshold crossing as the only diagnostic signal

Rejected because: The source argues slice-of-time analysis is better because threshold alerts can be noisy.

“it's probably better to be able to analyze a slice of time rather than just having a threshold being met because it can get pretty noisy.”transcript, stated

Human-only reconstruction of logs, metrics, and traces

Rejected because: The workflow gives an agent the observability and architecture context needed to write a diagnostic plan.

“you still have to do the investigation yourself. You have to dig through logs, metrics, and traces to try to paint a picture in your head”transcript, stated
“I then want to fetch each services resource metrics, so CPU and memory utilization. And I also want to fetch each services HTTP metrics.”transcript, stated

Patterns

observability-tracing (operations)

The workflow collects service architecture, CPU/memory metrics, HTTP metrics, errors, and logs before asking the agent to reason about fixes.

“I then want to fetch each services resource metrics, so CPU and memory utilization. And I also want to fetch each services HTTP metrics.”transcript, stated

durable-execution (orchestration)

The demo uses durable workflows so multi-step monitoring and remediation logic can retry failed steps and cache successful step outputs.

“what I want to do is actually use what is known as durable execution.”transcript, stated

tool-use-orchestration (orchestration)

The OpenCode agent is run headlessly with server-side tools so it can inspect a repository, implement fixes, and open PRs.

“we can just have this server have all the tools that the agent would need. So we'd install all of the necessary you know tools we can configure git and then the agent will be able to open pull requests”transcript, stated

human-in-the-loop-gate (safety)

The agent opens a pull request for review rather than directly deploying the fix.

“you just review a pull request and you're like, uh, looks good to me. You ship it and then everything is good and crisis averted.”transcript, stated

Tradeoffs

How to trigger remediation analysis.

Chose scheduled workflow analyzing a time slice over webhook-driven alert threshold triggers only.

Rationale: The speaker argues time-slice analysis can reduce alert noise and better account for bigger-picture service behavior.

“why not make this an alertbased system? So maybe we configure something like web hooks for alerts and then that would kick off uh essentially this workflow instead.”transcript, stated

How autonomous remediation should be in the demo.

Chose agent-authored pull requests over direct autonomous production changes.

Rationale: Pull requests keep human review and merge approval in the path while still automating diagnosis and code changes.

“And here we go. We have a pull request that is open with all of our changes.”transcript, stated

Gotchas (what bit them)

Threshold alerts alone can be noisy and insufficient for diagnosis.

Root cause: A spiky workload can cross a CPU or memory threshold without indicating a real incident.

Resolution: Analyze a slice of time and combine threshold breaches with broader project health and service context.

“it's probably better to be able to analyze a slice of time rather than just having a threshold being met because it can get pretty noisy.”transcript, stated

Traditional alerting still leaves humans to reconstruct the incident story.

Root cause: Alerts identify a symptom, but engineers must still inspect logs, metrics, and traces manually.

Resolution: Have the system collect context and produce a detailed plan for a coding agent.

“you still have to do the investigation yourself. You have to dig through logs, metrics, and traces to try to paint a picture in your head”transcript, stated

Multi-step remediation workflows have many failure points.

Root cause: External API calls, LLM calls, repository operations, and database writes can fail independently.

Resolution: Use durable workflow execution with retries and cached successful step results.

“all of these steps, they are not 100% guaranteed to work. Uh they are prone to failure. And what's neat about this pattern is by default, these steps will be automatically retried.”transcript, stated

Evaluation

The source is a demo walkthrough showing issue detection, plan generation, and PR creation rather than a measured production evaluation.

Metrics: 94% request error rate in demo memory-leak service

“We have a high request error rate of 94%. And we also have an extremely high response time of like multiple seconds”transcript, stated

Outcomes

YouTube demo/proof of concept; no production reliability or adoption metrics are provided.

“we have a summary of all the changes, uh, an analysis summary, the root causes, what was fixed.”transcript, stated