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:
- 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. - Pick the install guide: Choose the matching guide from the install guides below. For a URL under
/docs/, add.mdto the end to get a markdown version. - 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,.envfiles, or secret stores. - Run
test -n "$NEW_RELIC_LICENSE_KEY" && echo set || echo missingto check that the key is set without exposing it.
- 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.
- Verify: Ask the user to set
NEW_RELIC_LICENSE_KEYand restart the app, then follow Verify the install. If no data appears, see the troubleshooting page listed for that technology. - 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 |
Python | Run |
Kubernetes | Run |
Linux hosts | Run |
Web browser | Load a page and check that its source contains the |
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 |
|
Any APM app, after traffic |
|
Docker |
|
Kubernetes |
|
Hosts |
|
Web browser, after a page load |
|
Mobile, after a session |
|
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 in New Relic and tell you the result.
- Use the New Relic CLI if the user has installed it and set a as the
NEW_RELIC_API_KEYenvironment variable. Runnewrelic 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
Apps and services
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 | ||
Java | ||
Python | ||
.NET | ||
Go | ||
PHP | ||
Ruby | ||
C and C++ | ||
OpenTelemetry |
Containers and serverless
The following guides cover containerized workloads and serverless functions.
Technology | Install guide |
|---|---|
Docker | |
Kubernetes cluster | |
Apps on Kubernetes | |
AWS Lambda |
Frontends
The following guides cover browser and mobile application monitoring.
Technology | Install guide |
|---|---|
Web browser | |
iOS | |
Android |
Hosts
The following guides cover the infrastructure agent for Linux and Windows hosts.
Technology | Install guide |
|---|---|
Linux | |
Windows |
For anything not listed here, see New Relic manual installation.