OpsAI
OpsAI reduces the time spent debugging production issues by identifying problems across APM, RUM, and Kubernetes and helping resolve them with minimal human intervention. Apparently, you can also automate the implementation of the proposed fixes as you see fit. This way, OpsAI truly automates the debugging and remediation process.
What OpsAI Does#
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, Vercel Integration, 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.
Detects production issues automatically: OpsAI monitors your application through APM traces, Real User Monitoring, and Kubernetes. It continuously surfaces backend, frontend, and infrastructure issues without requiring manual triage.
Find the root cause and prepare a fix: For RUM and APM issues, OpsAI correlates stack traces, error metadata, logs, historical context, and relevant files from your connected repository. It identifies the file and line likely responsible for the failure, explains the cause, and generates a candidate fix for review. For Kubernetes issues, OpsAI can recommend and apply infrastructure-level fixes without creating a pull request.
Open a pull request with the proposed code change: When an issue requires a code change, OpsAI generates a proposed solution, provides a side-by-side diff, and can open a pull request in your repository with the suggested changes and context needed for review.
Fix Kubernetes issues: When an instrumented application running on Kubernetes produces an error, OpsAI can detect it from the available telemetry. You can run root cause analysis (RCA) to identify the issue and, where supported, apply the proposed fix with a single click.
Investigate Middleware alerts: OpsAI supports deep investigation of Middleware alerts. Alerts appear directly in the OpsAI listing, where you can investigate their root cause and review suggested fixes.
Auto Investigation for Kubernetes, APM, and RUM: OpsAI can automatically investigate issues across Kubernetes, APM, and RUM using the available telemetry and context. You control the monitoring scope for each source, including clusters for Kubernetes, services for APM, and applications for RUM.
When Auto Investigation is enabled, OpsAI can also post its root cause analysis directly in the corresponding Slack alert thread. Mention
@Middlewarein the thread to ask follow-up questions and continue the investigation without leaving Slack.
Privacy note: OpsAI reads only the files relevant to an error through the MCP integration and does not store your source code or error context.
Read more about OpsAI use cases in the linked guide.
Getting Started with OpsAI#
The fastest way to get started is with Kubernetes. If you are not using Kubernetes, install the APM and RUM agents and connect your code repository.
1. Talk to OpsAI#
No additional setup is required to start a conversation with OpsAI. Open the OpsAI panel and ask questions about your observability data, query metrics from integrations such as Grafana or Datadog, or investigate RUM, APM, and Kubernetes issues using natural language.

2. Kubernetes Quick Start#
Install the Middleware Kube Agent, enable OpsAI, and turn on auto-instrumentation. Use your Middleware API key, target URL, and cluster name. For detailed setup instructions, see the OpsAI for Kubernetes documentation.
1# Add the Middleware Helm repo
2helm repo add middleware-labs https://helm.middleware.io
3
4# Install the agent with OpsAI and auto-instrumentation enabled
5helm install mw-agent middleware-labs/mw-kube-agent-v3 \
6 --set global.mw.apiKey=<MW_API_KEY> \
7 --set global.mw.target=<MW_TARGET_URL> \
8 --set opsai.enabled=true \
9 --set global.clusterMetadata.name=<CLUSTER_NAME> \
10 --set mw-autoinstrumentation.enabled=true \
11 -n mw-agent-ns --create-namespacePlaceholders:
<MW_API_KEY>: your Middleware API key<MW_TARGET_URL>: your region endpoint, for examplehttps://<your-uid>.middleware.io:443<CLUSTER_NAME>: the cluster name you want to see in Infrastructure
Verify the rollout:
1kubectl get daemonset/mw-kube-agent -n mw-agent-ns
2kubectl get deployment/mw-kube-agent -n mw-agent-nsFor Kubernetes workloads, you can continue using manual SDK instrumentation or use auto-instrumentation with the OpenTelemetry Operator and language-specific injection annotations.
3. Install APM and RUM and Connect Your Repository#
Step 1: Install APM and RUM
APM:
- The first step is to add an appropriate SDK to the backend service. Once complete, use our latest SDK to maximize OpsAI's capabilities.
Supported setup guides include:
- Python SDK setup
- Go SDK setup
- Node.js SDK setup
- Next.js SDK setup
- Java SDK setup
RUM:
- Add the JavaScript snippet to capture frontend issues and connect them to the broader user journey.
Step 2: Connect Your Repository
Connect your GitHub or Bitbucket repository so OpsAI can access the files relevant to an error through the MCP server.
For accurate repository and commit targeting, set these build-time variables in your CI environment or
.envfile:
1MW_VCS_REPOSITORY_URL=<your repository URL>
2MW_VCS_COMMIT_SHA=<commit SHA> # optional but recommendedWhere:
MW_VCS_REPOSITORY_URLtells OpsAI which repo produced the error.MW_VCS_COMMIT_SHAhelps OpsAI open the PR on the right branch.
4. Fix Your Vercel Issues#
Once you configure the Vercel integration, OpsAI starts picking up Error and Fatal issues from your Vercel logs and automatically grouping them.
Open an incident and run RCA to investigate the problem. OpsAI uses the correlated telemetry and code context to identify the root cause and, where applicable, generate a pull request with a proposed fix.

Check out the Fix Issues with OpsAI section in the Vercel integration documentation for complete setup and usage details.
5. Investigate Alerts With OpsAI#
OpsAI allows you to ingest and centralize alerts from Middleware, Grafana, and Datadog. Once configured, relevant alerts appear in the OpsAI alerts listing, where you can open an alert and start an investigation.
OpsAI analyzes the available telemetry, performs root cause analysis (RCA), and suggests a fix when possible.

For configuration instructions, see OpsAI Settings.
How OpsAI Works#
Telemetry arrives: APM traces, RUM data, logs, Kubernetes telemetry, and alerts from Middleware or supported integrations provide the context for investigation.
Issues are detected: Errors, latency spikes, regressions, and other problems are identified and grouped for investigation.
Relevant code is retrieved: When code context is required, OpsAI requests only the files relevant to the incident through the connected repository integration.
Root cause is analyzed: OpsAI correlates telemetry, stack frames, metadata, code context, and available historical information to determine the likely cause.
A fix is proposed: Depending on the issue, OpsAI can recommend a fix, apply an approved Kubernetes remediation, or generate a code change for review through a pull request.
📺 Refer to this video guide to walk through the installation and setup process:
Privacy and Security#
- OpsAI accesses only the files relevant to the issue being investigated
- Repository access is handled through the configured MCP integration
- Middleware does not store your source code or error context
- For Kubernetes auto-fix, OpsAI applies changes only when you explicitly grant access to the required write tools
Need assistance or want to learn more about Middleware? Get in touch with us via our Contact Us or join our Slack channel.
What did you think of this content?