Skip to content


Switch branches/tags


GitHub Actions badge PyPI Code style: black Typechecking: Mypy

Client library for ActivityWatch in Python.

Please see the documentation for usage, and take a look at examples/.

How to install

Install from pip: pip install aw-client

Install the latest version directly from github without cloning: pip install git+

To install from a cloned version:

  • clone repo: git clone
  • cd into the directory: cd aw-client
  • run poetry install (will create a virtualenv, if none activated)
    • If you don't want to use poetry you can also use pip install ., but that might not get the exact version of the dependencies (due to not reading the poetry.lock file).


For the CLI:

$ aw-client --help
Usage: aw-client [OPTIONS] COMMAND [ARGS]...

  CLI utility for aw-client to aid in interacting with the ActivityWatch

  --host TEXT     Address of host
  --port INTEGER  Port to use
  -v, --verbose   Verbosity
  --testing       Set to use testing ports by default
  --help          Show this message and exit.

  buckets    List all buckets
  canonical  Query 'canonical events' for a single host (filtered,...
  events     Query events from bucket with ID `bucket_id`
  heartbeat  Send a heartbeat to bucket with ID `bucket_id` with JSON `data`
  query      Run a query in file at `path` on the server
  report     Generate an activity report


  • Run python with LOG_LEVEL=debug to get additional debugging output
  • If invalid events have been queued for submission, you may need to delete the file-based queues generated by this library
  • To use the development version of this library use aw-client = {path = "../aw-client" } in pyproject.toml


The examples/ directory contains a couple of example scripts, including:

  • - fetches all non-afk events and sums their duration to get the total active time for the day.
  • - computes hours worked per day (matching a "work" category rule), and exports matching events to a JSON file (for auditing).
  • - loads events from a host using a categorizing & AFK-filtering query, put result in a pandas dataframe, and export as CSV.
  • - merges two buckets with non-intersecting events by moving all events from one into the other.
  • - redact sensitive events.