Common utilities and base functionalities for all skills in the Private Assistant ecosystem.
Project description
Private Assistant Commons
Owner: stkr22
Common utilities and base classes for building distributed voice assistant skills in a Private Assistant ecosystem. This library provides the foundation for creating modular, MQTT-based skills that process voice commands for home automation.
Key Features
- BaseSkill Framework: Abstract base class with distributed processing, certainty-based filtering, and task management
- MQTT Communication: Structured message handling using Pydantic models with automatic reconnection
- Location Awareness: Support for room-based command routing and targeting
- Audio Integration: Configurable alerts and responses through voice bridge system
- Performance Metrics: Built-in monitoring with Prometheus export and health checking for production deployments
- Optional Persistence: PostgreSQL integration for skills requiring state storage
Quick Start
Installation
pip install private-assistant-commons
Basic Skill Example
from private_assistant_commons import BaseSkill, IntentRequest, IntentType
class LightControlSkill(BaseSkill):
async def calculate_certainty(self, intent_request: IntentRequest) -> float:
intent = intent_request.classified_intent
if intent.intent_type in (IntentType.DEVICE_ON, IntentType.DEVICE_OFF):
return intent.confidence
return 0.0
async def process_request(self, intent_request: IntentRequest) -> None:
await self.send_response("Lights controlled!", intent_request.client_request)
async def skill_preparations(self) -> None:
self.logger.info("Light skill ready")
Documentation
- Architecture Guide - System design, components, and data flow
- Usage Guide - Examples, patterns, and best practices
- API Reference - Complete API documentation
System Overview
Private Assistant Commons enables building a distributed voice assistant system where:
- Skills run independently and decide whether to handle requests based on confidence scores
- Communication via MQTT using structured Pydantic messages
- No central coordinator - skills compete based on certainty thresholds
- Room-based targeting distinguishes command origin from target locations
- Local deployment typically on Kubernetes with STT/TTS APIs
Architecture
User Voice → Local Client → Voice Bridge → STT API → MQTT Broker
↓
Intent Analysis Engine ← MQTT Broker ← Skills (distributed processing)
↓
Voice Bridge ← TTS API ← MQTT Broker ← Skill Responses
↓
Local Client → Audio Output
Skills inherit from BaseSkill and implement:
calculate_certainty()- Confidence scoring for requestsprocess_request()- Main skill logicskill_preparations()- Initialization setup
Development
Prerequisites
- Python 3.12+
- UV package manager
Setup
# Clone and setup environment
git clone <repository-url>
cd private-assistant-commons-py
uv sync --group dev
# Run tests
uv run pytest
# Format and lint
uv run ruff format .
uv run ruff check .
# Type checking
uv run mypy src/
Essential Commands
uv sync --group dev- Install/update dependenciesuv run pytest- Run tests with coverageuv run ruff check .- Lint codeuv run mypy src/- Type checkpre-commit run --all-files- Run all pre-commit hooks
License
GNU General Public License v3.0 - see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file private_assistant_commons-4.3.0.tar.gz.
File metadata
- Download URL: private_assistant_commons-4.3.0.tar.gz
- Upload date:
- Size: 35.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f115cb938103dbc114bbdbe80921193ee90ef9e62e790d84f5704e5c5a1e4c8
|
|
| MD5 |
37c46442be2b3b015dd5c43103733c32
|
|
| BLAKE2b-256 |
54c44d654acf4b2270cd10b5dad5f016d6c6456fdd9aa52dcb5401249e418038
|
Provenance
The following attestation bundles were made for private_assistant_commons-4.3.0.tar.gz:
Publisher:
release-to-pypi.yml on stkr22/private-assistant-commons-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
private_assistant_commons-4.3.0.tar.gz -
Subject digest:
5f115cb938103dbc114bbdbe80921193ee90ef9e62e790d84f5704e5c5a1e4c8 - Sigstore transparency entry: 584254150
- Sigstore integration time:
-
Permalink:
stkr22/private-assistant-commons-py@96ff9d45d5ae132c1282410b991054f661260df5 -
Branch / Tag:
refs/tags/v4.3.0 - Owner: https://github.com/stkr22
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-to-pypi.yml@96ff9d45d5ae132c1282410b991054f661260df5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file private_assistant_commons-4.3.0-py3-none-any.whl.
File metadata
- Download URL: private_assistant_commons-4.3.0-py3-none-any.whl
- Upload date:
- Size: 38.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
481514120ea3c7d7bdc08344812eaf438cbe4919750835e6e7053de0392a69b6
|
|
| MD5 |
11aadbccf6fd539911debc729d5dbf9b
|
|
| BLAKE2b-256 |
8fdd77cba99ec025570556601e95f01c0027b3527f959671514568e1f31a9e25
|
Provenance
The following attestation bundles were made for private_assistant_commons-4.3.0-py3-none-any.whl:
Publisher:
release-to-pypi.yml on stkr22/private-assistant-commons-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
private_assistant_commons-4.3.0-py3-none-any.whl -
Subject digest:
481514120ea3c7d7bdc08344812eaf438cbe4919750835e6e7053de0392a69b6 - Sigstore transparency entry: 584254152
- Sigstore integration time:
-
Permalink:
stkr22/private-assistant-commons-py@96ff9d45d5ae132c1282410b991054f661260df5 -
Branch / Tag:
refs/tags/v4.3.0 - Owner: https://github.com/stkr22
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-to-pypi.yml@96ff9d45d5ae132c1282410b991054f661260df5 -
Trigger Event:
release
-
Statement type: