""" Librarian capability registration for the Household Registry. Defines The Librarian's capabilities and registers it as a household member for coordination by the Steward and Tatlock. """ from src.agents.librarian.agent import get_librarian_agent from src.agents.librarian.tools import LIBRARIAN_TOOLS from src.core.household_registry import ( HouseholdCapability, get_household_registry, ) from src.core.logging_config import get_logger logger = get_logger(__name__) # The Librarian's capability summary for Steward coordination LIBRARIAN_CAPABILITY = HouseholdCapability( name="librarian", role="The Librarian", category="research", description=( "Research, web search, and wiki management: can SEARCH the web for current " "information, READ URLs/articles, CREATE wiki pages about topics " "(with automatic HybridRAG research), UPDATE existing pages, " "and synthesize information from multiple sources. " "Use for: 'search for X', 'what is X', 'create a page about X', 'read this URL'" ), domains=[ "research", "knowledge", "information", "wiki", "documents", "search", "web", "url", "internet", "synthesis", "create", "write", "update", ], cost="medium", # Multiple API calls to library-desk requires_network=True, # Needs library-desk API access ) def get_librarian_capability() -> HouseholdCapability: """Get The Librarian's capability definition.""" return LIBRARIAN_CAPABILITY def register_librarian() -> None: """ Register The Librarian with the Household Registry. This makes The Librarian available for: - Steward recommendations (via capability summary) - Tatlock delegation (via agent reference) - Tool scoping (via tool list) """ registry = get_household_registry() # Check if already registered if "librarian" in registry: logger.debug("librarian_already_registered") return registry.register( name="librarian", capability=LIBRARIAN_CAPABILITY, tools=LIBRARIAN_TOOLS, agent=get_librarian_agent(), ) logger.info( "librarian_registered", role=LIBRARIAN_CAPABILITY.role, domains=LIBRARIAN_CAPABILITY.domains, tool_count=len(LIBRARIAN_TOOLS), ) def unregister_librarian() -> None: """Unregister The Librarian from the Household Registry.""" registry = get_household_registry() registry.unregister("librarian") logger.info("librarian_unregistered")