Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion src/a2a/server/tasks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Components for managing tasks within the A2A server."""

import logging

from a2a.server.tasks.base_push_notification_sender import (
BasePushNotificationSender,
)
from a2a.server.tasks.database_task_store import DatabaseTaskStore
from a2a.server.tasks.inmemory_push_notification_config_store import (
InMemoryPushNotificationConfigStore,
)
Expand All @@ -18,6 +19,30 @@
from a2a.server.tasks.task_updater import TaskUpdater


logger = logging.getLogger(__name__)

try:
from a2a.server.tasks.database_task_store import (
DatabaseTaskStore, # type: ignore
)
except ImportError as e:
_original_error = e
# If the database task store is not available, we can still use in-memory stores.
logger.debug(
'DatabaseTaskStore not loaded. This is expected if database dependencies are not installed. Error: %s',
e,
)

class DatabaseTaskStore: # type: ignore
"""Placeholder for DatabaseTaskStore when dependencies are not installed."""

def __init__(self, *args, **kwargs):
raise ImportError(
'To use DatabaseTaskStore, its dependencies must be installed. '
'You can install them with \'pip install "a2a-sdk[sql]"\''
) from _original_error


__all__ = [
'BasePushNotificationSender',
'DatabaseTaskStore',
Expand Down
Loading