skillfed

clarifai-protocol

Clarifai Python Runner Protocol

clarifai-protocol v0.0.62 135.6K downloads/30d#11,425 on PyPI
Permissive license Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) Active released

What it is and what it does

clarifai-protocol is the internal communication protocol layer for Clarifai's Python runner infrastructure. It handles serialization and deserialization of requests and responses between runner models and the Clarifai API, built on gRPC foundations. The package also provides request lifecycle management, including the ability to track and cancel in-flight requests when users abort operations.

The protocol supports request ID tracking and abort callbacks, allowing custom models to register handlers that fire when requests are cancelled or connections drop. This is particularly useful when models call external inference servers—they can pass the request ID to those servers and abort them cleanly when the user cancels. The package is designed to be thread-safe and runs abort callbacks in background threads to avoid blocking the main protocol flow.

Use it for:

  • Building custom Clarifai models that need to handle request cancellation when calling external inference servers
  • Integrating with Clarifai runners to enable graceful abort of long-running inference tasks
  • Tracking request IDs for debugging and monitoring model execution within the Clarifai platform
  • Implementing idempotent cleanup logic when requests are cancelled or connections are lost
  • Coordinating cancellation between Clarifai and downstream inference services like sglang or similar

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides the protocol layer for Clarifai's Python runners to communicate with the Clarifai API, including request cancellation support and optional auto-annotation features.

Yes, if you are building models for the Clarifai platform or using clarifai SDK. The package is actively maintained, carries no known vulnerabilities, and uses a permissive Apache 2.0 license. Install friction is moderate due to compiled wheels, but platform coverage is broad. If you are not building Clarifai runners, this is likely a transitive dependency and not a direct choice.

Install

clarifai-protocol on PyPI

pip

pip install clarifai-protocol

uv

uv add clarifai-protocol

poetry

poetry add clarifai-protocol

Installing clarifai-protocol

Before you install

Medium install friction due to compiled wheels across multiple Python versions and platforms. Actively maintained with recent release activity. Depends on clarifai, clarifai-grpc, and psutil.

License in practice

Apache License 2.0 (permissive) allows free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

Quickstart

pip install clarifai-protocol

from clarifai_protocol import get_request_id, register_abort_callback

register_abort_callback(lambda req_id: print(f"Cancelled: {req_id}"))
req_id = get_request_id()

Requires Python 3.9 or later. Optional auto-annotation extra requires av and shapely dependencies.

Verify before relying

  • Whether the package is intended for direct use or only as a transitive dependency of clarifai SDK
  • Performance characteristics and latency overhead of request cancellation callbacks
  • Thread-safety guarantees under high-concurrency workloads

Package facts

License Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies 3 — clarifai, clarifai-grpc, psutil
Maintenance actively maintained — 101 days since the last release
First released
Downloads 135,647/month — #11,425 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: clarifai_protocol-0.0.62-cp310-cp310-macosx_11_0_universal2.whl; clarifai_protocol-0.0.62-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; clarifai_protocol-0.0.62-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; clarifai_protocol-0.0.62-cp310-cp310-musllinux_1_2_aarch64.whl; clarifai_protocol-0.0.62-cp310-cp310-musllinux_1_2_x86_64.whl; clarifai_protocol-0.0.62-cp310-cp310-win_amd64.whl; clarifai_protocol-0.0.62-cp311-cp311-macosx_11_0_universal2.whl; clarifai_protocol-0.0.62-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; clarifai_protocol-0.0.62-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; clarifai_protocol-0.0.62-cp311-cp311-musllinux_1_2_aarch64.whl; clarifai_protocol-0.0.62-cp311-cp311-musllinux_1_2_x86_64.whl; clarifai_protocol-0.0.62-cp311-cp311-win_amd64.whl; clarifai_protocol-0.0.62-cp312-cp312-macosx_11_0_universal2.whl; clarifai_protocol-0.0.62-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; clarifai_protocol-0.0.62-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; clarifai_protocol-0.0.62-cp312-cp312-musllinux_1_2_aarch64.whl; clarifai_protocol-0.0.62-cp312-cp312-musllinux_1_2_x86_64.whl; clarifai_protocol-0.0.62-cp312-cp312-win_amd64.whl; clarifai_protocol-0.0.62-cp313-cp313-macosx_11_0_universal2.whl; clarifai_protocol-0.0.62-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Keywords: clarifai, runners, python

License :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Scientific/Engineering :: Artificial Intelligence

Tags

clarifai runner protocolclarifai api communicationrequest cancellation callbacksclarifai inference servermodel request handlingclarifai grpc protocolabort request handling
grpc-protocolrequest-cancellationclarifai-ecosystem

More Artificial Intelligence packages