---
title: Install New Relic with an AI coding agent
source: https://docs.newrelic.com/docs/new-relic-solutions/get-started/install-with-ai
---

You can ask an AI coding agent, such as Claude Code, Cursor, GitHub Copilot, or Codex, to add New Relic to your project. The agent reads our install docs, determines which New Relic agent your project needs, and makes the changes for you.

## Before you begin [#before-you-begin]

-   **New Relic account** — If you don't have one, [sign up for a New Relic account](https://newrelic.com/signup).
-   **License key** — You'll need your license key. To find it, see [License keys](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys#license-key).

> #### ⚠️ IMPORTANT
>
> Keep your license key out of the agent's context. Don't paste it into the chat. Set it yourself as the `NEW_RELIC_LICENSE_KEY` environment variable where your app runs.

## Copy this prompt [#prompt]

Open your AI coding agent in your project's folder and paste this prompt:

> #### 💡 TIP
>
> Follow the instructions at <https://docs.newrelic.com/docs/new-relic-solutions/get-started/install-with-ai.md> to add New Relic to this project.

After the agent runs, check what files it changed and verify that data is reaching New Relic.

## Instructions for AI agents [#agent-instructions]

If you're an AI agent installing New Relic, follow these steps:

1.  **Find the stack:** Look at the project's files, such as `package.json`, `pom.xml`, `build.gradle`, `requirements.txt`, `pyproject.toml`, `go.mod`, `*.csproj`, `composer.json`, `Gemfile`, `Dockerfile`, Kubernetes manifests, or Helm charts. If the stack is unclear, ask the user what to monitor.
2.  **Pick the install guide:** Choose the matching guide from the [install guides](#install-guides) below. For a URL under `/docs/`, add `.md` to the end to get a markdown version.
3.  **Keep the license key out of your context:** The key is a secret. You never need its value.
    -   Don't ask the user for the key. If they paste it into the chat, tell them to revoke it and create a new one.
    -   Refer to the key only by the name `NEW_RELIC_LICENSE_KEY`. Where a guide puts the key in a config file, read it from that environment variable instead.
    -   Don't run commands or read files that would show the key, such as `env`, `printenv`, `echo $NEW_RELIC_LICENSE_KEY`, `.env` files, or secret stores.
    -   Run `test -n "$NEW_RELIC_LICENSE_KEY" && echo set || echo missing` to check that the key is set without exposing it.
4.  **Follow the guide:**
    -   Ask the user for an app name, or suggest one based on the project name.
    -   If the user's account is in the EU or JP [data center region](https://docs.newrelic.com/docs/accounts/accounts-billing/account-setup/choose-your-data-center), use the endpoints the guide gives for that region.
5.  **Verify:** Ask the user to set `NEW_RELIC_LICENSE_KEY` and restart the app, then follow [Verify the install](#verify). If no data appears, see the troubleshooting page listed for that technology.
6.  **Summarize:** Tell the user which files you changed and where to find their app in New Relic: **APM & Services** for apps, **Browser** or **Mobile** for frontends, and **Infrastructure** for hosts.

## Verify the install [#verify]

Check in two stages: first that the agent is running, then that its data has reached New Relic.

### Check the agent is running [#check-running]

These checks don't need access to the user's New Relic account. When reading logs, search for specific lines rather than printing whole files.

| **Technology** | **Check**                                                                                                                                                                                        |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| APM agents     | Search the agent log for errors. The Java and Ruby agents log `Reporting to:` followed by a link to the app once they connect.                                                                   |
| Python         | Run `newrelic-admin validate-config - stdout` to test the connection using the environment variable. This creates an app named `Python Agent Test` in the account. The user can delete it later. |
| Kubernetes     | Run `kubectl get pods -n newrelic` and check that every pod is `Running`.                                                                                                                        |
| Linux hosts    | Run `sudo systemctl status newrelic-infra` and check that the service is active.                                                                                                                 |
| Web browser    | Load a page and check that its source contains the `NREUM` snippet.                                                                                                                              |

### Check data reached New Relic [#check-data]

Run the query for the technology you installed, replacing each placeholder with the value you configured. Data can take a few minutes to appear, and some queries only return results after the app has handled traffic.

| **Technology**                 | **Query**                                                                                                                                                                                                        |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| APM agents                     | `SELECT count(*) FROM ApplicationAgentContext WHERE agent.language = 'LANGUAGE' AND appName = 'APP_NAME' SINCE 30 minutes ago`, where `LANGUAGE` is `nodejs`, `java`, `python`, `dotnet`, `go`, `php`, or `ruby` |
| Any APM app, after traffic     | `SELECT count(*) FROM Transaction WHERE appName = 'APP_NAME' SINCE 30 minutes ago`                                                                                                                               |
| Docker                         | `SELECT count(*) FROM ContainerSample WHERE name = 'CONTAINER_NAME' SINCE 10 minutes ago`                                                                                                                        |
| Kubernetes                     | `SELECT count(*) FROM K8sClusterSample WHERE clusterName = 'CLUSTER_NAME' SINCE 10 minutes ago`                                                                                                                  |
| Hosts                          | `SELECT count(*) FROM SystemSample WHERE hostname = 'HOST_NAME' SINCE 10 minutes ago`                                                                                                                            |
| Web browser, after a page load | `SELECT count(*) FROM PageView WHERE appName = 'APP_NAME' SINCE 30 minutes ago`                                                                                                                                  |
| Mobile, after a session        | `SELECT count(*) FROM MobileSession WHERE appName = 'APP_NAME' SINCE 30 minutes ago`                                                                                                                             |

A count above zero means data is flowing. There are two ways to run a query, and neither exposes a secret to you:

-   **Ask the user** to paste it into the [query builder](https://docs.newrelic.com/docs/query-your-data/explore-query-data/query-builder/introduction-query-builder) in New Relic and tell you the result.
-   **Use the [New Relic CLI](https://github.com/newrelic/newrelic-cli)** if the user has installed it and set a user key as the `NEW_RELIC_API_KEY` environment variable. Run `newrelic nrql query --accountId ACCOUNT_ID --query 'QUERY'`. The user API key is also a secret, so handle it the same way as the license key.

## Install guides [#install-guides]

### Apps and services [#apm]

Each entry links to the install guide for that language, with a troubleshooting link if no data appears.

| **Technology** | **Install guide**                                                                                                                   | **If no data appears**                                                                                                       |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Node.js        | [Install the Node.js agent](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/install-nodejs-agent) | [Troubleshoot](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/troubleshooting/troubleshoot-your-nodejs-installation) |
| Java           | [Install the Java agent](https://docs.newrelic.com/docs/apm/agents/java-agent/installation/java-agent-installation-overview)        | [Troubleshoot](https://docs.newrelic.com/docs/apm/agents/java-agent/troubleshooting/no-data-appears-java)                    |
| Python         | [Install the Python agent](https://docs.newrelic.com/install/python)                                                                | [Troubleshoot](https://docs.newrelic.com/docs/apm/agents/python-agent/troubleshooting/no-data-appears-python)                |
| .NET           | [Install the .NET agent](https://docs.newrelic.com/install/dotnet)                                                                  | [Troubleshoot](https://docs.newrelic.com/docs/apm/agents/net-agent/troubleshooting/no-data-appears-net)                      |
| Go             | [Install New Relic for Go](https://docs.newrelic.com/docs/apm/agents/go-agent/installation/install-new-relic-go)                    | [Troubleshoot](https://docs.newrelic.com/docs/apm/agents/go-agent/troubleshooting/no-data-appears-go)                        |
| PHP            | [Install the PHP agent](https://docs.newrelic.com/docs/apm/agents/php-agent/installation/php-agent-installation-overview)           | [Troubleshoot](https://docs.newrelic.com/docs/apm/agents/php-agent/troubleshooting/no-data-appears-php)                      |
| Ruby           | [Install the Ruby agent](https://docs.newrelic.com/docs/apm/agents/ruby-agent/installation/install-new-relic-ruby-agent)            | [Troubleshoot](https://docs.newrelic.com/docs/apm/agents/ruby-agent/troubleshooting/no-data-appears-ruby)                    |
| C and C++      | [Install the C SDK](https://docs.newrelic.com/docs/apm/agents/c-sdk/install-configure/install-c-sdk-compile-link-your-code)         | [Troubleshoot](https://docs.newrelic.com/docs/apm/agents/c-sdk/troubleshooting/no-data-appears-c-sdk)                        |
| OpenTelemetry  | [Monitor apps with OpenTelemetry](https://docs.newrelic.com/docs/opentelemetry/get-started/apm-monitoring/opentelemetry-apm-intro)  |                                                                                                                              |

### Containers and serverless [#containers]

The following guides cover containerized workloads and serverless functions.

| **Technology**     | **Install guide**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Docker             | [Node.js](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/install-nodejs-agent-docker), [Java](https://docs.newrelic.com/docs/apm/agents/java-agent/additional-installation/install-new-relic-java-agent-docker), [PHP](https://docs.newrelic.com/docs/apm/agents/php-agent/advanced-installation/docker-other-container-environments-install-php-agent), [Ruby](https://docs.newrelic.com/docs/apm/agents/ruby-agent/installation/ruby-agent-installation-docker) |
| Kubernetes cluster | [Install the Kubernetes integration](https://docs.newrelic.com/install/kubernetes)                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Apps on Kubernetes | [Install Kubernetes APM auto-attach](https://docs.newrelic.com/docs/kubernetes-pixie/kubernetes-integration/installation/k8s-agent-operator)                                                                                                                                                                                                                                                                                                                                                         |
| AWS Lambda         | [Install Lambda monitoring](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/configure-serverless-aws-monitoring)                                                                                                                                                                                                                                                                                                                      |

### Frontends [#frontends]

The following guides cover browser and mobile application monitoring.

| **Technology** | **Install guide**                                                                                                                                         |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Web browser    | [Install the browser agent](https://docs.newrelic.com/docs/browser/browser-monitoring/installation/install-browser-monitoring-agent)                      |
| iOS            | [Install iOS monitoring](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-ios/get-started/introduction-new-relic-mobile-ios)             |
| Android        | [Install Android monitoring](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-android/get-started/introduction-new-relic-mobile-android) |

### Hosts [#hosts]

The following guides cover the infrastructure agent for Linux and Windows hosts.

| **Technology** | **Install guide**                                                                                                                                                        |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Linux          | [Install the infrastructure agent with a package manager](https://docs.newrelic.com/docs/infrastructure/infrastructure-agent/linux-installation/package-manager-install) |
| Windows        | [Install the infrastructure agent with the MSI installer](https://docs.newrelic.com/docs/infrastructure/infrastructure-agent/windows-installation/windows-msi-installer) |

For anything not listed here, see [New Relic manual installation](https://docs.newrelic.com/docs/new-relic-solutions/get-started/manual-installation).
