Official APM agent for Python applications. Auto-instruments web frameworks (FastAPI, Django, Flask), databases (SQLAlchemy, psycopg, asyncpg), Redis, external HTTP calls, and AI/LLM libraries. Current version is 11.4.0 (Jan 2026). v12.0.0 released March 2026 with breaking removals.
pip install newrelicVerified import paths — ran on the pinned version, not inferred.
Agent initialization patterns. CLI wrapper is preferred. Manual init requires initialize() before all other imports.
Use newrelic-admin run-program wrapper, or place initialize() as the first two lines of your entry point before any other import.
Use Distributed Tracing (DT) instead. Remove cross_application_tracer settings from newrelic.ini.
Pin to newrelic<12.0.0 if still on Python 3.8, or upgrade Python.
Use redis>=4.2 with redis.asyncio submodule. New Relic auto-instruments redis.asyncio.
Use environment variables (NEW_RELIC_LICENSE_KEY, NEW_RELIC_APP_NAME, etc.) or newrelic.ini config file.
pip install newrelic[certificates]
Ensure the configuration file is present in the current working directory, specified by an absolute path, or use environment variables for configuration (NEW_RELIC_LICENSE_KEY, NEW_RELIC_APP_NAME, etc.) or a newrelic.ini config file managed by the deployment.
Ensure the 'newrelic.ini' configuration file is present in the application's working directory, or provide its absolute path to `newrelic.agent.initialize()`.