Skip to content

Plugin Development ​

Preview SDK

The plugin SDK ab_sdk has a 0.x version during 4.0. Incompatible changes can occur. From 4.1 the SDK is frozen at 1.0 and follows semantic versioning. The sdk field in the manifest gives the version range your plugin needs. AB refuses to load an incompatible plugin.

A plugin is a Python package, with optional frontend components. It runs inside the AutoBangumi process. A plugin can add downloaders, notification channels, search sites and rename methods. It can also add hooks to the pipeline, subscribe to events, and provide REST routes, MCP tools and settings-page UI.

Five-minute start ​

  1. Install the SDK and the command line. The wheel is an attachment of each 4.0 beta and stable release on GitHub Releases. The file name is autobangumi_sdk-<SDK version>-py3-none-any.whl. The wheel is not on PyPI. Refer to Get the SDK.

    bash
    uv tool install ./autobangumi_sdk-0.6.0-py3-none-any.whl
  2. Create a skeleton and run its tests. The pyproject.toml of the skeleton needs autobangumi-sdk. This package is not on PyPI. Thus, first use uv add to point the dependency to the wheel that you downloaded:

    bash
    ab-plugin new my-rename --kind rename   # or notifier, search
    cd my-rename
    uv add ../autobangumi_sdk-0.6.0-py3-none-any.whl   # use the real path of the wheel
    uv run pytest                                      # the skeleton includes a contract test
  3. Link the plugin to your local AutoBangumi and enable hot reload. Start AB one time first, so that a config file exists in its config directory. Set --config-dir to this directory (backend/src/config when you run AB from source):

    bash
    ab-plugin dev . --config-dir /path/to/autobangumi/config

    Restart AB one time. After that, AB reloads the plugin when you change its files.

  4. Pack the plugin: ab-plugin pack . creates dist/my-rename-0.1.0.zip.

Documentation map ​

Basics

Extension points

Extension pointTypePurpose
Downloader downloaderProviderA new downloader backend
Notifier notifierProviderA new notification channel
LLM provider llm_providerProviderA new LLM parsing provider
Search site search_siteProviderA site in the search box
Scheduled task scheduled_taskProviderA periodic task
Metadata provider metadata_providerProviderThe "parser" of an RSS subscription
Rename strategy rename_strategyProviderThe rule that makes file names
Media files media_filesProviderClassify torrent files as media, subtitle or ignore
Conflict policy conflict_policyProviderA new torrent version and an old torrent want the same file name
REST routes api_routerProviderHTTP endpoints of the plugin
MCP tools and resources mcp_tool mcp_resourceProviderItems for MCP clients
Torrent filter torrent.filterfilter hookDecide if a torrent is downloaded
Parsed title title.parsedtransform hookCorrect the title parse result
Adding request torrent.addingtransform hookChange save path, category and tags
HTTP request http.requesttransform hookAdd a Cookie to the GET requests of AB
Message template message_templatetransform hookRewrite push messages

A plugin can also subscribe to events (@subscribe) and use a private key-value store and a data directory.

AutoBangumi is released under the MIT License. (latest: v3.3.2)