clarifai-protocol
Clarifai Python Runner Protocol
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-protocoluv
uv add clarifai-protocolpoetry
poetry add clarifai-protocolInstalling 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
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
clarifai-grpcA gRPC client library for the Clarifai AI…
permissive · top 15,000 on PyPI
clarifaiOfficial Python client for Clarifai's AI…
permissive · top 15,000 on PyPI
azure-ai-agentserver-responsesProvides the Responses protocol endpoints for…
permissive · top 15,000 on PyPI
wait-for2Provides an alternate implementation of…
permissive · top 15,000 on PyPI
aiorunProvides a simplified entry point for asyncio…
permissive · top 15,000 on PyPI
livekit-plugins-noise-cancellationApplies real-time noise cancellation to inbound…
unclear · top 5,000 on PyPI
runwareClient library for the Runware inference API,…
permissive · top 5,000 on PyPI
livekit-protocolProvides Python protocol stubs and type…
permissive · top 5,000 on PyPI
jupyter-ai-routerProvides the core message routing layer for…
permissive · top 15,000 on PyPI
tb-paho-mqtt-clientProvides an MQTT client library implementing…
copyleft · top 15,000 on PyPI