---
title: Instrumented Python packages
source: https://docs.newrelic.com/docs/apm/agents/python-agent/getting-started/instrumented-python-packages
---

This document lists the packages and modules automatically instrumented by the [Python agent](https://docs.newrelic.com/docs/agents/python-agent/getting-started/new-relic-python) after you [install](https://docs.newrelic.com/docs/agents/python-agent/getting-started/python-agent-quick-start) it. You can also use [custom instrumentation](https://docs.newrelic.com/docs/agents/python-agent/supported-features/python-custom-instrumentation) if you want to:

-   Disable instrumentation for specific packages or modules if the instrumentation interferes with your app.
-   Instrument a-third party package or module that is not instrumented automatically by the agent.
-   Add more specific instrumentation for your own code, such as to track the time spent in additional functions.

To request built-in instrumentation for additional packages, get support at [support.newrelic.com](https://support.newrelic.com).

## Web frameworks

**aiohttp**

Support for versions 2.2.x or higher.

Function timing in transactions traces for slow transactions is provided for:

-   View functions (coroutines).

-   Application middleware.

    Exception logging is provided for:

-   Uncaught exceptions resulting in a non-200 HTTP response.

    The web transaction is named after the view function.

**Bottle**

Function timing in transactions traces for slow transactions is provided for:

-   View function.

-   Template rendering via SimpleTemplate, MakoTemplate, CheetahTemplate, Jinja2Template and SimpleTalTemplate interfaces.

    Exception logging is provided for:

-   Uncaught exceptions which would otherwise generate 500 responses from Bottle.

    The web transaction is named after the view function.

    As Bottle uses external template libraries, see also which of those packages may be supported for additional detail.

**CherryPy**

Function timing in transactions traces for slow transactions is provided for:

-   Handler function.

    Exception logging is provided for:

-   Uncaught exceptions which would otherwise generate 500 responses from CherryPy.

    The web transaction is named after the handler function.

    As CherryPy relies upon external template libraries, see also which of those packages may be supported for additional detail.

**Django**

Function timing in transactions traces for slow transactions is provided for:

-   Request middleware.

-   View middleware.

-   Template response middleware.

-   Response middleware.

-   Exception middleware.

-   Template rendering.

    > #### 💡 TIP
    >
    > Starting in v10.17.0, the Python agent is able to filter which Django middleware should be monitored.  See the [Django Middleware Filtering page](https://docs.newrelic.com/docs/apm/agents/python-agent/supported-features/django-middleware-filtering/) for more information and examples.

    Exception logging is provided for:

-   Exceptions occurring during loading of view handlers by URL resolver.

-   Exceptions occurring within the execution of the view handler.

-   Uncaught exceptions which would otherwise generate 500 responses from Django.

    Page load timing (sometimes referred to as real user monitoring or RUM) support consists of:

-   Optional automatic insertion of JavaScript header/footer via response middleware.

-   Provision of template tag library to enable manual insertion of the JavaScript header/footer into templates.

    The web transaction is named after the view handler, unless a request or view middleware returns a response object prior to the view handler being invoked.

    Instrumentation is also implemented to provide better web transaction naming or additional functional tracing when using:

-   [django-REST-framework](http://www.django-rest-framework.org/)

-   [django-piston](https://bitbucket.org/jespern/django-piston/wiki/Home)

-   [django-tastypie](http://tastypieapi.org/)

-   [daphne](https://github.com/django/daphne)

-   [graphene-django](https://docs.graphene-python.org/projects/django/)

**Falcon**

Function timing in transactions traces for slow transactions is provided for:

-   Handler function.

    Exception logging is provided for:

-   Uncaught exceptions which would otherwise generate error responses from Falcon.

    The web transaction is named after the handler function.

**FastAPI**

Function timing in transactions traces for slow transactions is provided for:

-   Route functions (coroutines).

-   Application middleware.

-   Exception handlers.

-   Background Tasks

    Exception logging is provided for:

-   Exceptions occurring inside middleware.

-   Exceptions occurring inside an exception handler.

-   Uncaught exceptions which would otherwise generate 500 responses from FastAPI.

    The web transaction is named after the route handler.

**Flask**

Function timing in transactions traces for slow transactions is provided for:

-   View function.

-   Template rendering via render_template() and render_template_string().

    Exception logging is provided for:

-   Uncaught exceptions which would otherwise generate 500 responses from Flask.

    The web transaction is named after the view function.

    As Flask uses Jinja2 for templates, see also details of Jinja2 instrumentation listed below.

**gRPC**

Supported for versions 1.4 or higher.

Function timing in transaction traces for slow transactions is provided for:

-   `_stream_response_in_pool`

-   `_unary_response_in_pool`

    Exception logging is provided for:

-   grpc server aborts

**Hypercorn**

Supported for versions 0.14.4 or higher.

**Pylons**

Function timing in transactions traces for slow transactions is provided for:

-   Controller function, before and after methods.

-   Template rendering via render_genshi(), render_jinja2() and render_mako().

    Exception logging is provided for:

-   Uncaught exceptions which would otherwise generate 500 responses from Pylons.

    The web transaction is named after the controller/action.

    As Pylons can use Genshi, Jinja2 or Mako for templates see also details of instrumentation for those modules listed below.

**Pyramid**

Function timing in transactions traces for slow transactions is provided for:

-   View handler functions.

    Exception logging is provided for:

-   Uncaught exceptions which would otherwise generate 500 responses from Pyramid.

    The web transaction is named after the view handler.

**Sanic**

Function timing in transactions traces for slow transactions is provided for:

-   View functions (coroutines).

-   Application middleware.

    Exception logging is provided for:

-   Exceptions occurring inside of a request middleware.

-   Exceptions occurring inside of a response middleware.

-   Exceptions occurring inside a request handler.

-   Exceptions occurring inside an exception handler.

-   Uncaught exceptions which would otherwise generate 500 responses from Sanic.

    The web transaction is named after the view handler.

**Starlette**

Function timing in transactions traces for slow transactions is provided for:

-   Route functions (coroutines).

-   Application middleware.

-   Exception handlers.

-   Background Tasks

    Exception logging is provided for:

-   Exceptions occurring inside middleware.

-   Exceptions occurring inside an exception handler.

-   Uncaught exceptions which would otherwise generate 500 responses from Starlette.

    The web transaction is named after the route handler.

**Tornado**

You can use the Python agent with an app that uses [Tornado 6](https://docs.newrelic.com/docs/agents/python-agent/web-frameworks-servers/python-agent-tornado-6-web-framework).

**Web2py**

Function timing in transactions traces for slow transactions is provided for:

-   Overall time in models phase.

-   Overall time in controller phase.

-   Overall time in view phase.

-   Execution time for specific scripts executed within models, controller and view phases.

    Exception logging is provided for:

-   Uncaught exceptions which would otherwise generate 500 responses from Web2py.

    The web transaction is named after the view script.

## Backend services [#backend-services]

**gearman**

Timing of task execution performed in a gearman worker recorded as background tasks against designated web application. Timing as a web external any client side calls to a gearman server to queue up or wait for the execution of queued tasks.

**Celery**

Timing of task execution recorded as background tasks against designated web application.

## Template rendering

**Genshi**

Function timing in transactions traces for slow transactions is provided for:

-   Template rendering.

**Jinja2**

Function timing in transactions traces for slow transactions is provided for:

-   Template compilation.
-   Template rendering.

**Mako**

Function timing in transactions traces for slow transactions is provided for:

-   Template rendering.

## GraphQL Frameworks

The Python agent provides insight into your GraphQL application's operations and resolvers and reports GraphQL-specific metrics and span attributes. For more information on transaction naming and other features, please view our [GraphQL documentation](https://docs.newrelic.com/docs/agents/python-agent/supported-features/python-graphQL). The Python agent version 6.6.0.162 and higher supports the following GraphQL frameworks:

| Framework                                                            | Python package name                                                | Minimum package version | Minimum agent version |
| -------------------------------------------------------------------- | ------------------------------------------------------------------ | ----------------------- | --------------------- |
| [Graphene](https://docs.graphene-python.org/en/latest/)              | [graphene](https://pypi.org/project/graphene/)                     | 3.0                     | 6.6.0.162             |
| [Ariadne](https://ariadnegraphql.org/docs/intro)                     | [ariadne](https://pypi.python.org/pypi/ariadne)                    | 0.14.0                  | 6.10.0.165            |
| [Strawberry](https://strawberry.rocks/)                              | [strawberry-graphql](https://pypi.org/project/strawberry-graphql/) | 0.77.10                 | 6.10.0.165            |
| [Starlette GraphQL](https://www.starlette.io/graphql/)               | [starlette-graphql](https://pypi.org/project/starlette-graphql)    | 0.2.1                   | 6.6.0.162             |
| [GraphQL Server](https://github.com/graphql-python/graphql-server)   | [graphql-server](https://pypi.org/project/graphql-server/)         | 3.0.0                   | 7.8.0.174             |
| [Graphene-Django](https://docs.graphene-python.org/projects/django/) | [graphene-django](https://pypi.org/project/graphene-django/)       | 3.2.3                   | 10.17.0               |

## Instance details

The agent collects [instance details for a variety of databases and database drivers](https://docs.newrelic.com/docs/apm/applications-menu/features/analyze-database-instance-level-performance-issues). The ability to view specific instances and the types of database information depends on your Python agent version.

Python agent [version 2.72.0.52 or higher](https://docs.newrelic.com/docs/release-notes/agent-release-notes/python-release-notes) supports the following:

| Database                                                       | Python package name                                               | Minimum package version | Minimum agent version |
| -------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------- | --------------------- |
| [PostgreSQL](https://www.postgresql.org/)                      | [psycopg](https://pypi.python.org/pypi/psycopg)                   | 3.0                     | 9.11.0                |
| [PostgreSQL](https://www.postgresql.org/)                      | [psycopg2](https://pypi.python.org/pypi/psycopg2)                 | 2.0.14                  | 2.72.0.52             |
| [MySQL](http://www.mysql.com/)                                 | [MySQLdb](https://pypi.python.org/pypi/MySQL-python/)             | 1.2.5                   | 2.74.0.54             |
| [Redis](http://redis.io/)                                      | [redis](https://pypi.python.org/pypi/redis)                       | 2.6.2                   | 2.74.0.54             |
| [Redis](http://redis.io/)                                      | [aredis](https://pypi.org/project/aredis/)                        | 1.1.4                   | 7.6.0.173             |
| [Redis](http://redis.io/)                                      | [aioredis](https://pypi.org/project/aioredis/)                    | 1.3.1                   | 7.14.0.177            |
| [Memcached](https://memcached.org/)                            | [python-memcached](https://pypi.python.org/pypi/python-memcached) | 1.51                    | 2.76.0.55             |
| [aiomcache](https://github.com/aio-libs/aiomcache)             | [aiomcache](https://pypi.org/project/aiomcache/)                  | 0.8.2                   | 9.12.0                |
| [Elasticsearch](https://www.elastic.co/products/elasticsearch) | [elasticsearch](https://pypi.python.org/pypi/elasticsearch)       | 0.45                    | 2.78.0.56             |

To request instance-level information from datastores currently not listed for your agent, get support at [support.newrelic.com](https://support.newrelic.com).

## SQL database adapters

For Python DB-API 2.0 compliant modules listed in this section, the Python agent supports:

-   Timing of database queries
-   Capturing SQL for the database query
-   Capturing a stack trace for long database queries
-   MySQL and PostgreSQ only: Capturing explain plans for slow database queries

The Python agent should be able to track database queries for any Python DB-API 2.0 compliant modules. However, the Python agent only officially supports the modules listed in this section.

-   [cx_Oracle](http://cx-oracle.sourceforge.net/)
-   [MySQLdb](http://mysql-python.sourceforge.net/)
-   [oursql](https://launchpad.net/oursql)
-   [proboscis](https://pypi.python.org/pypi/proboscis)
-   [psycopg2](https://pypi.org/project/psycopg2/)
-   [psycopg2ct](http://pypi.python.org/pypi/psycopg2ct)
-   [psycopg2cffi](http://pypi.python.org/pypi/psycopg2cffi)
-   [pymysql](https://github.com/petehunt/PyMySQL)
-   [pyodbc](https://pypi.org/project/pyodbc/)
-   [ibm_db_dbi](https://pypi.python.org/pypi/ibm_db)
-   [mysql-connector-python](http://dev.mysql.com/doc/connector-python/en/index.html)
-   [py-postgresql](https://www.postgresql.org/ftp/projects/pgFoundry/python/)
-   [pymssql](http://www.pymssql.org/)

For the following database adapters, we provides additional instrumentation for functionality outside of the DB-API 2.0 specification, such as shortcut methods to execute queries without creating cursors:

-   [pysqlite2](http://pypi.python.org/pypi/pysqlite/)
-   [sqlite3](http://docs.python.org/library/sqlite3.html)

If your database client module is not listed in this section, get support at [support.newrelic.com](https://support.newrelic.com). New Relic Support may be able to suggest a temporary change to your config file to get it working.

## NoSQL database clients

Timing of calls made against NoSQL databases are provided for the following client modules.

-   [pymongo](http://pypi.python.org/pypi/pymongo/)
-   [redis](http://pypi.python.org/pypi/redis/)

## Elasticsearch clients

Time spent in calls made to Elasticsearch will be listed in both the main overview chart, as well as in the Databases tab in the UI.

-   [elasticsearch](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/index.html)
-   [pyelasticsearch](http://pyelasticsearch.readthedocs.org/)

## Memcache clients

Timing of memcache requests and capture of type of request is provided for the following memcache client modules.

-   [memcache](https://pypi.org/project/python-memcached/)
-   [pylibmc](http://sendapatch.se/projects/pylibmc/)
-   [bmemcached](https://github.com/jaysonsantos/python-binary-memcached)
-   [pymemcache](https://github.com/Pinterest/pymemcache)
-   [umemcache](https://github.com/esnme/ultramemcache)

## Solr service clients

Timing of Solr service requests and type of request is provided for the following Solr client modules.

-   [pysolr](http://pypi.python.org/pypi/pysolr/)
-   [solrpy](https://pypi.org/project/solrpy/)

## Message broker clients

Timing of message broker transactions is provided for the following modules.

-   [pika](https://pypi.python.org/pypi/pika)
-   [kafka-python](https://pypi.org/project/kafka-python/)
-   [confluent-kafka](https://pypi.org/project/confluent-kafka/)

## External web services

Timing of external web service requests is carried out via the following modules.

-   [aiobotocore](https://aiobotocore.readthedocs.io/en/stable/)
-   [aiohttp](http://aiohttp.readthedocs.io)
-   [botocore](https://botocore.amazonaws.com/v1/documentation/api/latest/index.html)
-   [dropbox](https://www.dropbox.com/developers/start/setup#python)
-   [facepy](http://facepy.readthedocs.org/)
-   [feedparser](https://pypi.python.org/pypi/feedparser)
-   [gRPC](https://grpc.github.io/grpc/python/)
-   [httplib](http://docs.python.org/library/httplib.html)
-   [httplib2](https://pypi.org/project/httplib2/)
-   [httpx](https://www.python-httpx.org/)
-   [pywapi](https://code.google.com/archive/p/python-weather-api/)
-   [requests](http://docs.python-requests.org)
-   [urllib](http://docs.python.org/library/urllib.html)
-   [urllib2](http://docs.python.org/library/urllib2.html)
-   [urllib3](https://urllib3.readthedocs.org/en/latest/)
-   [xmlrpclib](http://docs.python.org/library/xmlrpclib.html)

## Machine learning models, LLMs, and agentic AI frameworks

-   [Scikit Learn](https://pypi.org/project/scikit-learn/)
-   [OpenAI](https://pypi.org/project/openai/)
-   [Google Gen AI SDK](https://pypi.org/project/google-genai/)
-   [Google ADK](https://pypi.org/project/google-adk/)
-   [LangChain](https://pypi.org/project/langchain/)
-   [LangGraph](https://pypi.org/project/langgraph/)
-   [Model Context Protocol (MCP)](https://pypi.org/project/mcp/)
-   [Autogen](https://github.com/microsoft/autogen)
-   [Strands Agents](https://pypi.org/project/strands-agents/)
-   [Amazon Bedrock Converse API and invoke_model](https://aws.amazon.com/bedrock/)
    -   [Amazon Titan](https://aws.amazon.com/bedrock/titan/)
    -   [Cohere Command and Embed](https://aws.amazon.com/bedrock/cohere-command-embed/)
    -   [AI21 Labs Jurassic](https://aws.amazon.com/bedrock/jurassic/)
    -   [Anthropic's Claude](https://aws.amazon.com/bedrock/claude/)
    -   [Meta Llama2](https://aws.amazon.com/bedrock/llama/)
    -   [Meta Llama3](https://aws.amazon.com/bedrock/llama/)
    -   [Mistral AI](https://aws.amazon.com/bedrock/mistral/)
