OpsAI

OpsAI reduces the time spent debugging errors by identifying production issues in APM, RUM, and Kubernetes and resolving them with the least human intervention possible. Apparently, you can also automate the implementation of the proposed solution as you see fit. This way, OpsAI truly automates the debugging process.

What OpsAI Does#

  1. Talk to OpsAI: You can directly converse with OpsAI to query and explore your observability data. Ask questions about your APM traces, RUM data, Kubernetes workloads, or third-party integrations such as Grafana and Datadog. OpsAI understands the context of your stack and can help you investigate and fix RUM, APM, and Kubernetes issues through a natural conversation.

  2. Detects production issues automatically: OpsAI watches your application through APM traces, Real User Monitoring and Kubernetes. It continuously surfaces production issues across backend and frontend without manual triage.

  3. Finds the root cause and prepares a fix for RUM and APM: After detection, OpsAI pulls together stack traces, error metadata, logs, historical context and your GitHub-linked code files. Using these inputs, it pinpoints the file and line that likely caused the failure, explains why it broke, and generates a candidate fix you can review. Meanwhile, for Kubernetes, it gives a fix directly without creating a PR.

  4. Opens a pull request with a code change: If the problem needs a code change, OpsAI creates a code-level solution, shows a side-by-side diff, and opens a pull request in your repository with the suggested edits and enough context for a quick review and deployment.

  5. Fix issue for Kubernetes: Once any instrumented application that is instrumented with Kubernetes produces any error, it gets detected via logs. Once the issue has been identified via OpsAI, you can do RCA to pinpoint the issue and later on fix it in a single click.

  6. Middleware Alerts Investigation: OpsAI now supports deep investigation on Middleware alerts. These alerts appear directly in the OpsAI listing and can be investigated and resolved using OpsAI.

  7. Auto Investigation (Kubernetes, APM, and RUM): OpsAI uses Auto Investigation across Kubernetes, APM, and RUM to analyze problems using available data and propose a fix, which developers can review and apply themselves. You define the monitoring scope per source (clusters for Kubernetes, services for APM, and apps for RUM) and toggle Auto-Investigate on or off for each. See OpsAI Settings to configure it.

Privacy note: OpsAI reads only the files related to the error through the MCP integration and does not store your source code or error context.

Read more about Ops AI use cases here.

Getting Started with OpsAI#

The fastest path is Kubernetes. If you are not on Kubernetes, install the APM and RUM agents, then connect your code host.

1. Talk to OpsAI#

No setup required to get started. You can converse directly with OpsAI from the OpsAI panel. Ask it about your observability data, query metrics from third-party integrations like Grafana or Datadog, or get help investigating and resolving RUM, APM, and Kubernetes issues — all through a natural conversation.

Talk to OpsAI

2. Kubernetes Quick Start#

Install the Middleware Kube Agent, enable OpsAI, and turn on auto-instrumentation. Use your own API key, target and cluster name. For detailed Kubernetes setup, see OpsAI for Kubernetes.

# Add the Middleware Helm repo
helm repo add middleware-labs https://helm.middleware.io

# Install the agent with OpsAI and auto-instrumentation enabled
helm install mw-agent middleware-labs/mw-kube-agent-v3 \
  --set global.mw.apiKey=<MW_API_KEY> \
  --set global.mw.target=<MW_TARGET_URL> \
  --set opsai.enabled=true \
  --set global.clusterMetadata.name=<CLUSTER_NAME> \
  --set mw-autoinstrumentation.enabled=true \
  -n mw-agent-ns --create-namespace

Placeholders:

  • <MW_API_KEY>: your Middleware API key
  • <MW_TARGET_URL>: your region endpoint, for example https://<your-uid>.middleware.io:443
  • <CLUSTER_NAME>: the cluster name you want to see in Infrastructure

Verify the rollout:

kubectl get daemonset/mw-kube-agent -n mw-agent-ns
kubectl get deployment/mw-kube-agent -n mw-agent-ns

For Kubernetes workloads, you can either keep manual SDKs or use auto-instrumentation with OTel Operator and language-specific inject annotations.

3. Install APM and RUM and Connect Your Repository#

Step 1: Install APM and RUM

APM:

RUM:

  • Include the JavaScript snippet to capture frontend issues and connect the full user journey.

Step 2: Connect Your Repository

  • Link your GitHub or Bitbucket repository so OpsAI can read only the files related to an error through the MCP server.

  • For accurate PR targeting, set these build-time variables in your CI or .env file:

MW_VCS_REPOSITORY_URL=<your repository URL>
MW_VCS_COMMIT_SHA=<commit SHA>   # optional but recommended

Where:

  • MW_VCS_REPOSITORY_URL tells OpsAI which repo produced the error.
  • MW_VCS_COMMIT_SHA helps OpsAI open the PR on the right branch.

3. Native Alerts into OpsAI#

OpsAI allows you to ingest and centralize alerts from Middleware, Grafana, and Datadog. Once enabled, OpsAI automatically ingests recent Middleware alerts (from the last minute) and displays critical alerts in the OpsAI alerts listing. From there, you can open any alert and run an investigation. OpsAI will perform root cause analysis (RCA) and suggest fixes when possible.

OpsAI alerts listing with critical alerts

For setup instructions, see OpsAI Settings.

How OpsAI Works#

  1. Telemetry in: traces from APM, user events from RUM and logs, and alerts (native Middleware alerts, or from Grafana and Datadog) arrive in Middleware.

  2. Issue detection: errors, latency spikes and regressions are grouped and ranked.

  3. Code context: OpsAI requests only the files needed for the incident through GitHub's MCP server.

  4. Root cause analysis: stack frames and metadata are matched to code lines and past incidents.

  5. Proposed fix: a pull request with a minimal change is created for review in your repository.

📺 Refer to this video guide to walk through the installation and setup process:

Privacy and Security#

  • OpsAI reads only the files that relate to the error it is fixing
  • Access goes through GitHub MCP for security
  • Middleware does not store your source code or error context
  • For Kubernetes auto-fix, OpsAI only implements fixes if you explicitly grant access to write tools

Need assistance or want to learn more about Middleware? Contact our support team at [email protected] or join our Slack channel.