- Add Librarian registration to household member registration - Error handling to prevent startup failure if Librarian unavailable 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
78 lines
2.1 KiB
Python
78 lines
2.1 KiB
Python
"""
|
|
Application startup module.
|
|
|
|
Handles initialization of household registry and other startup tasks.
|
|
This module should be called during application startup to register
|
|
all household members.
|
|
"""
|
|
from src.agents.librarian import register_librarian
|
|
from src.agents.tatlock_core import TATLOCK_CORE_CAPABILITY, tatlock_core_tools
|
|
from src.core.household_registry import get_household_registry
|
|
from src.core.logging_config import get_logger
|
|
|
|
logger = get_logger(__name__)
|
|
|
|
|
|
def register_household_members():
|
|
"""
|
|
Register all household members with the registry.
|
|
|
|
This function should be called during application startup to make
|
|
household capabilities available to the Steward.
|
|
|
|
Currently registers:
|
|
- tatlock_core: Butler's core tools (calculator, datetime, web search)
|
|
- librarian: Research and knowledge management (Phase 3)
|
|
"""
|
|
registry = get_household_registry()
|
|
|
|
logger.info("household_registration_starting")
|
|
|
|
# Register Tatlock's core tools
|
|
registry.register(
|
|
name="tatlock_core",
|
|
capability=TATLOCK_CORE_CAPABILITY,
|
|
tools=tatlock_core_tools,
|
|
agent=None, # No expert agent for core tools
|
|
)
|
|
|
|
logger.info(
|
|
"household_member_registered",
|
|
name="tatlock_core",
|
|
tool_count=len(tatlock_core_tools),
|
|
)
|
|
|
|
# Register The Librarian (Phase 3)
|
|
try:
|
|
register_librarian()
|
|
except Exception as e:
|
|
# Don't fail startup if Librarian registration fails
|
|
logger.warning(
|
|
"librarian_registration_failed",
|
|
error=str(e),
|
|
)
|
|
|
|
logger.info(
|
|
"household_registration_complete",
|
|
total_members=len(registry),
|
|
)
|
|
|
|
|
|
def initialize_application():
|
|
"""
|
|
Initialize the application.
|
|
|
|
Performs all startup tasks:
|
|
1. Register household members
|
|
2. (Future) Initialize connections
|
|
3. (Future) Load configuration
|
|
|
|
This should be called once during application startup.
|
|
"""
|
|
logger.info("application_initialization_starting")
|
|
|
|
# Register household members
|
|
register_household_members()
|
|
|
|
logger.info("application_initialization_complete")
|