Skip to main content

Voice AI safety monitoring through multimodal biomarker analysis

Project description

Thymia Sentinel

Voice AI safety monitoring through multimodal biomarker analysis.

Sentinel streams voice conversations to Thymia's Lyra server for real-time extraction of clinical speech biomarkers, combined with policy-based safety reasoning to detect mental health concerns that text-only systems miss.

Why Multimodal?

Text-only safety moderation has two fundamental failure modes:

  1. False negatives (minimization): Users experiencing mental health crises frequently downplay their distress verbally. "I'm fine, just tired" may be spoken with voice biomarkers indicating severe depression.

  2. False positives (alarm fatigue): Phrases like "I'm dying of embarrassment" trigger crisis pathways despite no clinical concern, leading to desensitization and wasted resources.

Both failures stem from the same limitation: reliance on semantic content without physiological ground truth. Sentinel addresses this by combining speech biomarkers with conversation analysis through explicit concordance checking.

Installation

pip install thymia-sentinel

Quick Start

from thymia_sentinel import SentinelClient

async def handle_result(result):
    policy = result["policy"]
    policy_name = result.get("policy_name", policy)
    if policy_name == "demo_wellbeing_awareness":
        classification = result["result"]["classification"]
        level = classification["level"]  # 0-3
        alert = classification["alert"]  # none, aware, supportive, mindful

        if level >= 2:
            print(f"Risk level {level}: {alert}")
            print(f"Recommended: {result['result']['recommended_actions']['for_agent']}")

sentinel = SentinelClient(
    user_label="user-123",
    policies=["demo_wellbeing_awareness"],
    biomarkers=["helios", "apollo"],
    on_policy_result=handle_result,
)

await sentinel.connect()

# In your voice AI audio loop:
await sentinel.send_user_audio(user_audio_bytes)      # PCM16 @ 16kHz
await sentinel.send_agent_audio(agent_audio_bytes)
await sentinel.send_user_transcript("I've been feeling okay lately")
await sentinel.send_agent_transcript("That's good to hear. How has your sleep been?")

# When done:
await sentinel.close()

Configuration

Parameter Type Default Description
user_label str None Unique user identifier
date_of_birth str None YYYY-MM-DD format (improves accuracy, imputed from voice if omitted)
birth_sex str None "MALE" or "FEMALE" (improves accuracy, imputed from voice if omitted)
language str "en-GB" Language code
policies list[str] required Policies to execute
biomarkers list[str] ["helios"] Biomarkers to extract
sample_rate int 16000 Audio sample rate in Hz
on_policy_result callable None Callback for policy results
on_progress_result callable None Callback for progress updates
api_key str env THYMIA_API_KEY Your Thymia API key

Demo Policies

  • demo_wellbeing_awareness: Wellbeing awareness analysis with risk classification and recommended actions
  • demo_field_extraction: Extracts basic user fields (name, age) from conversation

Biomarkers

  • helios: Wellness indicators (distress, stress, burnout, fatigue, low self-esteem)
  • apollo: Clinical disorder probabilities (depression, anxiety) and symptom-level severities
  • psyche: Real-time affect detection (happy, sad, angry, fearful, etc.)

Awareness Levels

The wellbeing awareness policy returns a 4-level classification:

Level Alert Description
0 none All clear, no concerns
1 aware Be attentive, mild indicators
2 supportive Be supportive and mindful, moderate indicators
3 mindful Be very mindful, notably elevated signals

Framework Integrations

For framework-specific examples, see the examples directory:

  • LiveKit Agents - Automatic audio capture from LiveKit rooms
  • Pipecat - Integration with Pipecat pipelines
  • VAPI - WebSocket integration for VAPI
  • Gemini Live - Google Gemini Live API integration

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thymia_sentinel-1.2.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thymia_sentinel-1.2.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file thymia_sentinel-1.2.0.tar.gz.

File metadata

  • Download URL: thymia_sentinel-1.2.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for thymia_sentinel-1.2.0.tar.gz
Algorithm Hash digest
SHA256 76dd3e5ca850780ba8d6826b9f0e696c80712ce60351e7adfe6529e40a85c414
MD5 521344fff6e7452cd8c31feccab99960
BLAKE2b-256 93ba0c4dc23e89d554ba9e69f1e07f210b03315029c64a47b04315af5cc930b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for thymia_sentinel-1.2.0.tar.gz:

Publisher: publish.yml on thymia-ai/thymia-sentinel-integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thymia_sentinel-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: thymia_sentinel-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for thymia_sentinel-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9303bc6a0429e970a255ccf02f85337aeb1508ebf07f85e61721a2d2f7d33c16
MD5 3d34bf6590174f4e3c01a41a2f42e530
BLAKE2b-256 2a4a90ece939bf79b768b052cb120803dec6496a9ea8f5a29e8d3341131aa89b

See more details on using hashes here.

Provenance

The following attestation bundles were made for thymia_sentinel-1.2.0-py3-none-any.whl:

Publisher: publish.yml on thymia-ai/thymia-sentinel-integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page