Skip to main content

No project description provided

Project description

Valthera

Overview

Valthera is a framework for creating behavior-driven notifications based on BJ Fogg's Behavior Model (B=MAT). It gathers data from different sources (like HubSpot, PostHog, and Snowflake), evaluates users' readiness for specific actions, and generates personalized triggers when appropriate.

By analyzing motivation and ability scores, Valthera helps determine the optimal time and messaging for user engagement.

Core Concepts

Valthera is built around BJ Fogg's Behavior Model, which states that three elements must converge for a behavior to occur:

  • Motivation: The user's desire to perform the behavior
  • Ability: How easy it is for the user to perform the behavior
  • Trigger: The prompt that initiates the behavior

The system calculates scores for motivation and ability based on user data, then determines whether a trigger should be sent and what message would be most effective.

System Architecture

Valthera consists of five core components:

  1. DataAggregator: Collects user data from multiple sources into a unified UserContext.
  2. ValtheraScorer: Calculates motivation and ability scores based on configured metrics.
  3. ReasoningEngine: Decides whether to trigger an action based on the scores.
  4. TriggerGenerator: Creates personalized trigger messages when appropriate.
  5. ValtheraAgent: Orchestrates the entire pipeline.

Installation

Quick Start

# Clone the repository
git clone https://github.com/your-repo/valthera.git
cd valthera

# Install dependencies
pip install -r requirements.txt

# Run the system
python main.py

Customization

Custom Data Sources

Create your own data connector by implementing the BaseConnector interface:

from valthera.connectors.base import BaseConnector

class MyCustomConnector(BaseConnector):
    def get_user_data(self, user_id: str):
        return {
            "custom_metric": 42,
            "last_activity": "2025-01-01"
        }

Then, register it in DataAggregator:

data_aggregator = DataAggregator(connectors={"custom": MyCustomConnector()})

Custom Scoring Configuration

Define scoring metrics to fit your needs:

motivation_config = [
    {"key": "custom_metric", "weight": 0.5, "transform": lambda x: x / 100.0},
]
ability_config = [
    {"key": "last_activity", "weight": 0.5, "transform": lambda x: 1.0 if x == "recent" else 0.5},
]
scorer = ValtheraScorer(motivation_config, ability_config)

Custom Decision Rules

Modify decision rules to determine when to send triggers:

decision_rules = [
    {"condition": "motivation >= 0.7 and ability >= 0.7", "action": "trigger"},
    {"condition": "motivation < 0.7", "action": "improve_motivation"},
    {"condition": "ability < 0.7", "action": "improve_ability"},
]
reasoning_engine = ReasoningEngine(llm=custom_llm, decision_rules=decision_rules)

Custom Trigger Messages

Control how the trigger message is generated:

def custom_prompt(user_context):
    return f"Hey {user_context['email']}, check out this new feature!"

generator = TriggerGenerator(llm=custom_llm)
generator.generate_trigger(user_context, behavior, scores, custom_prompt)

Examples

  • E-commerce Onboarding: Increase conversions by nudging users at the right time.
  • SaaS Feature Adoption: Help users discover and adopt new features effectively.
  • Healthcare Reminders: Encourage patients to complete follow-ups and treatments.

API Reference

See the full API documentation for detailed information on all classes and methods.

Contributing

Contributions are welcome! Please submit a Pull Request or open an issue for discussion.

License

This project is licensed under the MIT License - see the LICENSE file 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

valthera-0.1.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

valthera-0.1.1-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file valthera-0.1.1.tar.gz.

File metadata

  • Download URL: valthera-0.1.1.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.2 Darwin/24.3.0

File hashes

Hashes for valthera-0.1.1.tar.gz
Algorithm Hash digest
SHA256 238e78877a05a8d4f99bde52bcffc85c60b1507c7efd38688ef53aba3e3694f8
MD5 161a746bf75dd72299d9396cedf8bf9a
BLAKE2b-256 e0c1665d1b1d5b27346dc2d3b7c395d3dd2f4330f7c57d25c9b431ee29c74160

See more details on using hashes here.

File details

Details for the file valthera-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: valthera-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.2 Darwin/24.3.0

File hashes

Hashes for valthera-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe28e6b3f1a10d67f7808e22c13c2884a58d1cb0f274d24439f98afa736b3353
MD5 b5143ca9769334eb20519859e8e21dc4
BLAKE2b-256 907c81731fafd10d57d824d75f6cb894a67b17813d53c84ab9dbd2053b6176b0

See more details on using hashes here.

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