• /
  • EnglishEspañolFrançais日本語한국어Português
  • ログイン今すぐ開始

Install New Relic with an AI coding agent

|View as Markdown (English)

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

  • New Relic account — If you don't have one, sign up for a New Relic account.
  • License key — You'll need your . To find it, see License keys.

重要

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

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

ヒント

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

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 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, 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. 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

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

Check the agent is 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

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:

Install guides

Apps and services

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

Containers and serverless

The following guides cover containerized workloads and serverless functions.

Technology

Install guide

Docker

Node.js, Java, PHP, Ruby

Kubernetes cluster

Install the Kubernetes integration

Apps on Kubernetes

Install Kubernetes APM auto-attach

AWS Lambda

Install Lambda monitoring

Frontends

The following guides cover browser and mobile application monitoring.

Hosts

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

For anything not listed here, see New Relic manual installation.

Copyright © 2026 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.