---
title: "huey"
description: "Learn how to import and use the huey integration."
url: https://docs.sentry.io/platforms/python/integrations/huey/
---

# huey for Python

The huey integration adds support for the [huey task queue library](https://huey.readthedocs.io/en/latest/).

If you're using stream mode, this page's references to "transaction" should be applied to service spans instead. See [Streamed Spans](https://docs.sentry.io/platforms/python/tracing/streamed-spans.md) for more information.

## [Install](https://docs.sentry.io/platforms/python/integrations/huey.md#install)

To get started, install `sentry-sdk` from PyPI.

```bash
pip install "sentry-sdk"
```

*Other available variations of the above snippet: uv*

## [Configure](https://docs.sentry.io/platforms/python/integrations/huey.md#configure)

The huey integration is enabled automatically if you have the `huey` package installed.

Error Monitoring\[ ]Tracing\[ ]Profiling

```python
import sentry_sdk

sentry_sdk.init(
    dsn="https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
    # Add data like request headers and IP for users, if applicable;
    # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
    send_default_pii=True,
    # ___PRODUCT_OPTION_START___ performance
    # Set traces_sample_rate to 1.0 to capture 100%
    # of transactions for tracing.
    traces_sample_rate=1.0,
    # ___PRODUCT_OPTION_END___ performance
    # ___PRODUCT_OPTION_START___ profiling
    # To collect profiles for all profile sessions,
    # set `profile_session_sample_rate` to 1.0.
    profile_session_sample_rate=1.0,
    # Profiles will be automatically collected while
    # there is an active span.
    profile_lifecycle="trace",
    # ___PRODUCT_OPTION_END___ profiling
)
```

## [Verify](https://docs.sentry.io/platforms/python/integrations/huey.md#verify)

```python
from huey import SqliteHuey

sentry_sdk.init(...)  # same as above

huey = SqliteHuey(filename='demo.db')

@huey.task()
def add(a, b):
    return a + b

# or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_huey"):
    result = add(1, 2)
```

Running this will create a new transaction called `testing_huey` in the Performance section of [sentry.io](https://sentry.io). It may take a couple of moments for the transaction to show up.

## [Supported Versions](https://docs.sentry.io/platforms/python/integrations/huey.md#supported-versions)

* huey: 2.0+

* Python:

  * 3.6+ (SDK <3.0)
  * 3.7+ (SDK 3.0+)

If you're looking to use Sentry with older Python or framework versions, consider using an older major version of the SDK. The minimum versions for each major version are listed above.
