Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

feat(backend): implement low balance and insufficient funds notifications (#10656)

Nicholas Tindle890bb3b8b4f5
diff --git a/autogpt_platform/backend/backend/data/notifications.py b/autogpt_platform/backend/backend/data/notifications.py
index bf8177af72..0be2fada98 100644
--- a/autogpt_platform/backend/backend/data/notifications.py
+++ b/autogpt_platform/backend/backend/data/notifications.py
@@ -54,25 +54,19 @@ class AgentRunData(BaseNotificationData):
class ZeroBalanceData(BaseNotificationData):
- last_transaction: float
- last_transaction_time: datetime
- top_up_link: str
-
- @field_validator("last_transaction_time")
- @classmethod
- def validate_timezone(cls, value: datetime):
- if value.tzinfo is None:
- raise ValueError("datetime must have timezone information")
- return value
+ agent_name: str = Field(..., description="Name of the agent")
+ current_balance: float = Field(
+ ..., description="Current balance in credits (100 = $1)"
+ )
+ billing_page_link: str = Field(..., description="Link to billing page")
+ shortfall: float = Field(..., description="Amount of credits needed to continue")
class LowBalanceData(BaseNotificationData):
- agent_name: str = Field(..., description="Name of the agent")
current_balance: float = Field(
..., description="Current balance in credits (100 = $1)"
)
billing_page_link: str = Field(..., description="Link to billing page")
- shortfall: float = Field(..., description="Amount of credits needed to continue")
class BlockExecutionFailedData(BaseNotificationData):
@@ -312,7 +306,7 @@ class NotificationTypeOverride:
# These are batched by the notification service
NotificationType.AGENT_RUN: QueueType.BATCH,
# These are batched by the notification service, but with a backoff strategy
- NotificationType.ZERO_BALANCE: QueueType.BACKOFF,
+ NotificationType.ZERO_BALANCE: QueueType.IMMEDIATE,
NotificationType.LOW_BALANCE: QueueType.IMMEDIATE,
NotificationType.BLOCK_EXECUTION_FAILED: QueueType.BACKOFF,
NotificationType.CONTINUOUS_AGENT_ERROR: QueueType.BACKOFF,
diff --git a/autogpt_platform/backend/backend/executor/database.py b/autogpt_platform/backend/backend/executor/database.py
index e7ee2dc661..2607b24843 100644
--- a/autogpt_platform/backend/backend/executor/database.py
+++ b/autogpt_platform/backend/backend/executor/database.py
@@ -183,12 +183,12 @@ class DatabaseManagerClient(AppServiceClient):
spend_credits = _(d.spend_credits)
get_credits = _(d.get_credits)
- # Summary data - async
- get_user_execution_summary_data = _(d.get_user_execution_summary_data)
-
# Block error monitoring
get_block_error_stats = _(d.get_block_error_stats)
+ # User Emails
+ get_user_email_by_id = _(d.get_user_email_by_id)
+
# Library
list_library_agents = _(d.list_library_agents)
add_store_agent_to_library = _(d.add_store_agent_to_library)
diff --git a/autogpt_platform/backend/backend/executor/manager.py b/autogpt_platform/backend/backend/executor/manager.py
index b4695043ea..3e51415b86 100644
--- a/autogpt_platform/backend/backend/executor/manager.py
+++ b/autogpt_platform/backend/backend/executor/manager.py
@@ -20,6 +20,7 @@ from backend.data.notifications import (
LowBalanceData,
NotificationEventModel,
NotificationType,
+ ZeroBalanceData,
)
from backend.data.rabbitmq import SyncRabbitMQ
from backend.executor.activity_status_generator import (
@@ -75,6 +76,7 @@ from backend.util.clients import (
get_database_manager_async_client,
get_database_manager_client,
get_execution_event_bus,
+ get_notification_manager_client,
)
from backend.util.decorator import (
async_error_logged,
@@ -84,6 +86,7 @@ from backend.util.decorator import (
)
from backend.util.file import clean_exec_files
from backend.util.logging import TruncatedLogger, configure_logging
+from backend.util.metrics import DiscordChannel
from backend.util.process import AppProcess, set_service_name
from backend.util.retry import continuous_retry, func_retry
from backend.util.settings import Settings
@@ -684,19 +687,20 @@ class ExecutionProcessor:
self,
node_exec: NodeExecutionEntry,
execution_count: int,
- ) -> int:
+ ) -> tuple[int, int]:
total_cost = 0
+ remaining_balance = 0
db_client = get_db_client()
block = get_block(node_exec.block_id)
if not block:
logger.error(f"Block {node_exec.block_id} not found.")
- return total_cost
+ return total_cost, 0
cost, matching_filter = block_usage_cost(
block=block, input_data=node_exec.inputs
)
if cost > 0:
- db_client.spend_credits(
+ remaining_balance = db_client.spend_credits(
user_id=node_exec.user_id,
cost=cost,
metadata=UsageTransactionMetadata(
@@ -714,7 +718,7 @@ class ExecutionProcessor:
cost, usage_count = execution_usage_cost(execution_count)
if cost > 0:
- db_client.spend_credits(
+ remaining_balance = db_client.spend_credits(
user_id=node_exec.user_id,
cost=cost,
metadata=UsageTransactionMetadata(
@@ -729,7 +733,7 @@ class ExecutionProcessor:
)
total_cost += cost
- return total_cost
+ return total_cost, remaining_balance
@time_measured
def _on_graph_execution(
@@ -812,12 +816,19 @@ class ExecutionProcessor:
# Charge usage (may raise) ------------------------------
try:
- cost = self._charge_usage(
+ cost, remaining_balance = self._charge_usage(
node_exec=queued_node_exec,
execution_count=increment_execution_count(graph_exec.user_id),
)
with execution_stats_lock:
execution_stats.cost += cost
+ # Check if we crossed the low balance threshold
+ self._handle_low_balance(
+ db_client=db_client,
+ user_id=graph_exec.user_id,
+ current_balance=remaining_balance,
+ transaction_cost=cost,
+ )
except InsufficientBalanceError as balance_error:
error = balance_error # Set error to trigger FAILED status
node_exec_id = queued_node_exec.node_exec_id
@@ -832,11 +843,10 @@ class ExecutionProcessor:
status=ExecutionStatus.FAILED,
)
- self._handle_low_balance_notif(
+ self._handle_insufficient_funds_notif(
db_client,
graph_exec.user_id,
graph_exec.graph_id,
- execution_stats,
error,
)
# Gracefully stop the execution loop
@@ -1110,25 +1120,25 @@ class ExecutionProcessor:
)
)
- def _handle_low_balance_notif(
+ def _handle_insufficient_funds_notif(
self,
db_client: "DatabaseManagerClient",
user_id: str,
graph_id: str,
- exec_stats: GraphExecutionStats,
e: InsufficientBalanceError,
):
- shortfall = e.balance - e.amount
+ shortfall = abs(e.amount) - e.balance
metadata = db_client.get_graph_metadata(graph_id)
base_url = (
settings.config.frontend_base_url or settings.config.platform_base_url
)
+
queue_notification(
NotificationEventModel(
user_id=user_id,
- type=NotificationType.LOW_BALANCE,
- data=LowBalanceData(
- current_balance=exec_stats.cost,
+ type=NotificationType.ZERO_BALANCE,
+ data=ZeroBalanceData(
+ current_balance=e.balance,
billing_page_link=f"{base_url}/profile/credits",
shortfall=shortfall,
agent_name=metadata.name if metadata else "Unknown Agent",
@@ -1136,6 +1146,73 @@ class ExecutionProcessor:
)
)
+ try:
+ user_email = db_client.get_user_email_by_id(user_id)
+
+ alert_message = (
+ f"❌ **Insufficient Funds Alert**\n"
+ f"User: {user_email or user_id}\n"
+ f"Agent: {metadata.name if metadata else 'Unknown Agent'}\n"
+ f"Current balance: ${e.balance/100:.2f}\n"
+ f"Attempted cost: ${abs(e.amount)/100:.2f}\n"
+ f"Shortfall: ${abs(shortfall)/100:.2f}\n"
+ f"[View User Details]({base_url}/admin/spending?search={user_email})"
+ )
+
+ get_notification_manager_client().discord_system_alert(
+ alert_message, DiscordChannel.PRODUCT
+ )
+ except Exception as alert_error:
+ logger.error(
+ f"Failed to send insufficient funds Discord alert: {alert_error}"
+ )
+
+ def _handle_low_balance(
+ self,
+ db_client: "DatabaseManagerClient",
+ user_id: str,
+ current_balance: int,
+ transaction_cost: int,
+ ):
+ """Check and handle low balance scenarios after a transaction"""
+ LOW_BALANCE_THRESHOLD = settings.config.low_balance_threshold
+
+ balance_before = current_balance + transaction_cost
+
+ if (
+ current_balance < LOW_BALANCE_THRESHOLD
+ and balance_before >= LOW_BALANCE_THRESHOLD
+ ):
+ base_url = (
+ settings.config.frontend_base_url or settings.config.platform_base_url
+ )
+ queue_notification(
+ NotificationEventModel(
+ user_id=user_id,
+ type=NotificationType.LOW_BALANCE,
+ data=LowBalanceData(
+ current_balance=current_balance,
+ billing_page_link=f"{base_url}/profile/credits",
+ ),
+ )
+ )
+
+ try:
+ user_email = db_client.get_user_email_by_id(user_id)
+ alert_message = (
+ f"⚠️ **Low Balance Alert**\n"
+ f"User: {user_email or user_id}\n"
+ f"Balance dropped below ${LOW_BALANCE_THRESHOLD/100:.2f}\n"
+ f"Current balance: ${current_balance/100:.2f}\n"
+ f"Transaction cost: ${transaction_cost/100:.2f}\n"
+ f"[View User Details]({base_url}/admin/spending?search={user_email})"
+ )
+ get_notification_manager_client().discord_system_alert(
+ alert_message, DiscordChannel.PRODUCT
+ )
+ except Exception as e:
+ logger.error(f"Failed to send low balance Discord alert: {e}")
+
class ExecutionManager(AppProcess):
def __init__(self):
diff --git a/autogpt_platform/backend/backend/executor/manager_low_balance_test.py b/autogpt_platform/backend/backend/executor/manager_low_balance_test.py
new file mode 100644
index 0000000000..d51ffb2511
--- /dev/null
+++ b/autogpt_platform/backend/backend/executor/manager_low_balance_test.py
@@ -0,0 +1,149 @@
+from unittest.mock import MagicMock, patch
+
+import pytest
+from prisma.enums import NotificationType
+
+from backend.data.notifications import LowBalanceData
+from backend.executor.manager import ExecutionProcessor
+from backend.util.test import SpinTestServer
+
+
[email protected](loop_scope="session")
+async def test_handle_low_balance_threshold_crossing(server: SpinTestServer):
+ """Test that _handle_low_balance triggers notification when crossing threshold."""
+
+ execution_processor = ExecutionProcessor()
+ user_id = "test-user-123"
+ current_balance = 400 # $4 - below $5 threshold
+ transaction_cost = 600 # $6 transaction
+
+ # Mock dependencies
+ with patch(
+ "backend.executor.manager.queue_notification"
+ ) as mock_queue_notif, patch(
+ "backend.executor.manager.get_notification_manager_client"
+ ) as mock_get_client, patch(
+ "backend.executor.manager.settings"
+ ) as mock_settings:
+
+ # Setup mocks
+ mock_client = MagicMock()
+ mock_get_client.return_value = mock_client
+ mock_settings.config.low_balance_threshold = 500 # $5 threshold
+ mock_settings.config.frontend_base_url = "https://test.com"
+
+ # Create mock database client
+ mock_db_client = MagicMock()
+ mock_db_client.get_user_email_by_id.return_value = "[email protected]"
+
+ # Test the low balance handler
+ execution_processor._handle_low_balance(
+ db_client=mock_db_client,
+ user_id=user_id,
+ current_balance=current_balance,
+ transaction_cost=transaction_cost,
+ )
+
+ # Verify notification was queued
+ mock_queue_notif.assert_called_once()
+ notification_call = mock_queue_notif.call_args[0][0]
+
+ # Verify notification details
+ assert notification_call.type == NotificationType.LOW_BALANCE
+ assert notification_call.user_id == user_id
+ assert isinstance(notification_call.data, LowBalanceData)
+ assert notification_call.data.current_balance == current_balance
+
+ # Verify Discord alert was sent
+ mock_client.discord_system_alert.assert_called_once()
+ discord_message = mock_client.discord_system_alert.call_args[0][0]
+ assert "Low Balance Alert" in discord_message
+ assert "[email protected]" in discord_message
+ assert "$4.00" in discord_message
+ assert "$6.00" in discord_message
+
+
[email protected](loop_scope="session")
+async def test_handle_low_balance_no_notification_when_not_crossing(
+ server: SpinTestServer,
+):
+ """Test that no notification is sent when not crossing the threshold."""
+
+ execution_processor = ExecutionProcessor()
+ user_id = "test-user-123"
+ current_balance = 600 # $6 - above $5 threshold
+ transaction_cost = (
+ 100 # $1 transaction (balance before was $7, still above threshold)
+ )
+
+ # Mock dependencies
+ with patch(
+ "backend.executor.manager.queue_notification"
+ ) as mock_queue_notif, patch(
+ "backend.executor.manager.get_notification_manager_client"
+ ) as mock_get_client, patch(
+ "backend.executor.manager.settings"
+ ) as mock_settings:
+
+ # Setup mocks
+ mock_client = MagicMock()
+ mock_get_client.return_value = mock_client
+ mock_settings.config.low_balance_threshold = 500 # $5 threshold
+
+ # Create mock database client
+ mock_db_client = MagicMock()
+
+ # Test the low balance handler
+ execution_processor._handle_low_balance(
+ db_client=mock_db_client,
+ user_id=user_id,
+ current_balance=current_balance,
+ transaction_cost=transaction_cost,
+ )
+
+ # Verify no notification was sent
+ mock_queue_notif.assert_not_called()
+ mock_client.discord_system_alert.assert_not_called()
+
+
[email protected](loop_scope="session")
+async def test_handle_low_balance_no_duplicate_when_already_below(
+ server: SpinTestServer,
+):
+ """Test that no notification is sent when already below threshold."""
+
+ execution_processor = ExecutionProcessor()
+ user_id = "test-user-123"
+ current_balance = 300 # $3 - below $5 threshold
+ transaction_cost = (
+ 100 # $1 transaction (balance before was $4, also below threshold)
+ )
+
+ # Mock dependencies
+ with patch(
+ "backend.executor.manager.queue_notification"
+ ) as mock_queue_notif, patch(
+ "backend.executor.manager.get_notification_manager_client"
+ ) as mock_get_client, patch(
+ "backend.executor.manager.settings"
+ ) as mock_settings:
+
+ # Setup mocks
+ mock_client = MagicMock()
+ mock_get_client.return_value = mock_client
+ mock_settings.config.low_balance_threshold = 500 # $5 threshold
+
+ # Create mock database client
+ mock_db_client = MagicMock()
+
+ # Test the low balance handler
+ execution_processor._handle_low_balance(
+ db_client=mock_db_client,
+ user_id=user_id,
+ current_balance=current_balance,
+ transaction_cost=transaction_cost,
+ )
+
+ # Verify no notification was sent (user was already below threshold)
+ mock_queue_notif.assert_not_called()
+ mock_client.discord_system_alert.assert_not_called()
diff --git a/autogpt_platform/backend/backend/notifications/notifications.py b/autogpt_platform/backend/backend/notifications/notifications.py
index 5d2ae39bdf..399e426837 100644
--- a/autogpt_platform/backend/backend/notifications/notifications.py
+++ b/autogpt_platform/backend/backend/notifications/notifications.py
@@ -29,7 +29,7 @@ from backend.data.user import generate_unsubscribe_link
from backend.notifications.email import EmailSender
from backend.util.clients import get_database_manager_async_client
from backend.util.logging import TruncatedLogger
-from backend.util.metrics import discord_send_alert
+from backend.util.metrics import DiscordChannel, discord_send_alert
from backend.util.retry import continuous_retry
from backend.util.service import (
AppService,
@@ -382,8 +382,10 @@ class NotificationManager(AppService):
}
@expose
- async def discord_system_alert(self, content: str):
- await discord_send_alert(content)
+ async def discord_system_alert(
+ self, content: str, channel: DiscordChannel = DiscordChannel.PLATFORM
+ ):
+ await discord_send_alert(content, channel)
async def _queue_scheduled_notification(self, event: SummaryParamsEventModel):
"""Queue a scheduled notification - exposed method for other services to call"""
diff --git a/autogpt_platform/backend/backend/notifications/templates/low_balance.html.jinja2 b/autogpt_platform/backend/backend/notifications/templates/low_balance.html.jinja2
index d39d17cb14..8be13d0473 100644
--- a/autogpt_platform/backend/backend/notifications/templates/low_balance.html.jinja2
+++ b/autogpt_platform/backend/backend/notifications/templates/low_balance.html.jinja2
@@ -1,9 +1,7 @@
{# Low Balance Notification Email Template #}
{# Template variables:
-data.agent_name: the name of the agent
data.current_balance: the current balance of the user
data.billing_page_link: the link to the billing page
-data.shortfall: the shortfall amount
#}
<p style="
@@ -25,7 +23,7 @@ data.shortfall: the shortfall amount
margin-top: 0;
margin-bottom: 20px;
">
- Your agent "<strong>{{ data.agent_name }}</strong>" has been stopped due to low balance.
+ Your account balance has dropped below the recommended threshold.
</p>
<div style="
@@ -44,15 +42,6 @@ data.shortfall: the shortfall amount
">
<strong>Current Balance:</strong> ${{ "{:.2f}".format((data.current_balance|float)/100) }}
</p>
- <p style="
- font-family: 'Poppins', sans-serif;
- color: #070629;
- font-size: 16px;
- margin-top: 0;
- margin-bottom: 10px;
- ">
- <strong>Shortfall:</strong> ${{ "{:.2f}".format((data.shortfall|float)/100) }}
- </p>
</div>
@@ -79,7 +68,7 @@ data.shortfall: the shortfall amount
margin-top: 0;
margin-bottom: 5px;
">
- Your agent "<strong>{{ data.agent_name }}</strong>" requires additional credits to continue running. The current operation has been canceled until your balance is replenished.
+ Your account requires additional credits to continue running agents. Please add credits to your account to avoid service interruption.
</p>
</div>
@@ -110,5 +99,5 @@ data.shortfall: the shortfall amount
margin-bottom: 10px;
font-style: italic;
">
- This is an automated notification. Your agent is stopped and will need manually restarted unless set to trigger automatically.
+ This is an automated low balance notification. Consider adding credits soon to avoid service interruption.
</p>
diff --git a/autogpt_platform/backend/backend/notifications/templates/zero_balance.html.jinja2 b/autogpt_platform/backend/backend/notifications/templates/zero_balance.html.jinja2
new file mode 100644
index 0000000000..eb6879b898
--- /dev/null
+++ b/autogpt_platform/backend/backend/notifications/templates/zero_balance.html.jinja2
@@ -0,0 +1,114 @@
+{# Low Balance Notification Email Template #}
+{# Template variables:
+data.agent_name: the name of the agent
+data.current_balance: the current balance of the user
+data.billing_page_link: the link to the billing page
+data.shortfall: the shortfall amount
+#}
+
+<p style="
+ font-family: 'Poppins', sans-serif;
+ color: #070629;
+ font-size: 16px;
+ line-height: 165%;
+ margin-top: 0;
+ margin-bottom: 10px;
+ ">
+ <strong>Zero Balance Warning</strong>
+</p>
+
+<p style="
+ font-family: 'Poppins', sans-serif;
+ color: #070629;
+ font-size: 16px;
+ line-height: 165%;
+ margin-top: 0;
+ margin-bottom: 20px;
+ ">
+ Your agent "<strong>{{ data.agent_name }}</strong>" has been stopped due to low balance.
+</p>
+
+<div style="
+ margin-left: 15px;
+ margin-bottom: 20px;
+ padding: 15px;
+ border-left: 4px solid #5D23BB;
+ background-color: #f8f8ff;
+ ">
+ <p style="
+ font-family: 'Poppins', sans-serif;
+ color: #070629;
+ font-size: 16px;
+ margin-top: 0;
+ margin-bottom: 10px;
+ ">
+ <strong>Current Balance:</strong> ${{ "{:.2f}".format((data.current_balance|float)/100) }}
+ </p>
+ <p style="
+ font-family: 'Poppins', sans-serif;
+ color: #070629;
+ font-size: 16px;
+ margin-top: 0;
+ margin-bottom: 10px;
+ ">
+ <strong>Shortfall:</strong> ${{ "{:.2f}".format((data.shortfall|float)/100) }}
+ </p>
+</div>
+
+
+<div style="
+ margin-left: 15px;
+ margin-bottom: 20px;
+ padding: 15px;
+ border-left: 4px solid #FF6B6B;
+ background-color: #FFF0F0;
+ ">
+ <p style="
+ font-family: 'Poppins', sans-serif;
+ color: #070629;
+ font-size: 16px;
+ margin-top: 0;
+ margin-bottom: 10px;
+ ">
+ <strong>Low Balance:</strong>
+ </p>
+ <p style="
+ font-family: 'Poppins', sans-serif;
+ color: #070629;
+ font-size: 16px;
+ margin-top: 0;
+ margin-bottom: 5px;
+ ">
+ Your agent "<strong>{{ data.agent_name }}</strong>" requires additional credits to continue running. The current operation has been canceled until your balance is replenished.
+ </p>
+</div>
+
+<div style="
+ text-align: center;
+ margin: 30px 0;
+ ">
+ <a href="{{ data.billing_page_link }}" style="
+ font-family: 'Poppins', sans-serif;
+ background-color: #5D23BB;
+ color: white;
+ padding: 12px 24px;
+ text-decoration: none;
+ border-radius: 4px;
+ font-weight: 500;
+ display: inline-block;
+ ">
+ Manage Billing
+ </a>
+</div>
+
+<p style="
+ font-family: 'Poppins', sans-serif;
+ color: #070629;
+ font-size: 16px;
+ line-height: 150%;
+ margin-top: 30px;
+ margin-bottom: 10px;
+ font-style: italic;
+ ">
+ This is an automated notification. Your agent is stopped and will need manually restarted unless set to trigger automatically.
+</p>
diff --git a/autogpt_platform/backend/backend/util/metrics.py b/autogpt_platform/backend/backend/util/metrics.py
index 41aa27d041..ff92537d4e 100644
--- a/autogpt_platform/backend/backend/util/metrics.py
+++ b/autogpt_platform/backend/backend/util/metrics.py
@@ -1,4 +1,5 @@
import logging
+from enum import Enum
import sentry_sdk
from pydantic import SecretStr
@@ -10,6 +11,11 @@ from backend.util.settings import Settings
settings = Settings()
+class DiscordChannel(str, Enum):
+ PLATFORM = "platform" # For platform/system alerts
+ PRODUCT = "product" # For product alerts (low balance, zero balance, etc.)
+
+
def sentry_init():
sentry_dsn = settings.secrets.sentry_dsn
sentry_sdk.init(
@@ -32,7 +38,9 @@ def sentry_capture_error(error: Exception):
sentry_sdk.flush()
-async def discord_send_alert(content: str):
+async def discord_send_alert(
+ content: str, channel: DiscordChannel = DiscordChannel.PLATFORM
+):
from backend.blocks.discord.bot_blocks import SendDiscordMessageBlock
from backend.data.model import APIKeyCredentials, CredentialsMetaInput, ProviderName
@@ -43,6 +51,14 @@ async def discord_send_alert(content: str):
expires_at=None,
)
+ # Select channel based on enum
+ if channel == DiscordChannel.PLATFORM:
+ channel_name = settings.config.platform_alert_discord_channel
+ elif channel == DiscordChannel.PRODUCT:
+ channel_name = settings.config.product_alert_discord_channel
+ else:
+ channel_name = settings.config.platform_alert_discord_channel
+
return await SendDiscordMessageBlock().run_once(
SendDiscordMessageBlock.Input(
credentials=CredentialsMetaInput(
@@ -52,7 +68,7 @@ async def discord_send_alert(content: str):
provider=ProviderName.DISCORD,
),
message_content=content,
- channel_name=settings.config.platform_alert_discord_channel,
+ channel_name=channel_name,
),
"status",
credentials=creds,
diff --git a/autogpt_platform/backend/backend/util/settings.py b/autogpt_platform/backend/backend/util/settings.py
index 1dff188e72..89f13f965b 100644
--- a/autogpt_platform/backend/backend/util/settings.py
+++ b/autogpt_platform/backend/backend/util/settings.py
@@ -95,6 +95,10 @@ class Config(UpdateTrackingModel["Config"], BaseSettings):
default=500,
description="Maximum number of credits above the balance to be auto-approved.",
)
+ low_balance_threshold: int = Field(
+ default=500,
+ description="Credit threshold for low balance notifications (100 = $1, default 500 = $5)",
+ )
refund_notification_email: str = Field(
default="[email protected]",
description="Email address to send refund notifications to.",
@@ -250,6 +254,10 @@ class Config(UpdateTrackingModel["Config"], BaseSettings):
default="local-alerts",
description="The Discord channel for the platform",
)
+ product_alert_discord_channel: str = Field(
+ default="product-alerts",
+ description="The Discord channel for product alerts (low balance, zero balance, etc.)",
+ )
clamav_service_host: str = Field(
default="localhost",