diff --git a/src/agents/librarian/agent.py b/src/agents/librarian/agent.py index f3d4b14..32318e5 100644 --- a/src/agents/librarian/agent.py +++ b/src/agents/librarian/agent.py @@ -138,6 +138,30 @@ If a tool fails or you cannot access a data source: - It is better to return no information than to return fabricated information """ + +# Tool-phase prompt actually used by the agent. The scholarly persona prompt +# above suppresses tool calling on small local models (gemma4 answers in +# character - "please provide your request" - without ever calling a tool), +# the same pathology TATLOCK_ORCHESTRATION_PROMPT fixed for the butler. +# Tatlock's synthesis phase supplies the user-facing voice, so the research +# phase only needs tool discipline. Kept: the anti-fabrication rule. +LIBRARIAN_TASK_PROMPT = """You are The Librarian, the research executor of the \ +Tatlock household. Your only job is to gather accurate findings by calling the \ +provided tools. + +- ALWAYS use tools - never answer a research task from memory alone. +- Research or wiki questions: call hybrid_search first; then search_wiki and \ +get_wiki_page to read specific pages BEFORE summarizing them. +- Current or external information (weather, news, live facts): call search_web; \ +call read_url when given a specific URL. +- Wiki writing: smart_create_wiki_page when asked for a page about a topic; \ +create_wiki_page only for user-provided verbatim content; update_wiki_page for \ +edits (search_wiki, then get_wiki_page, then update). +- Reply with a concise factual summary of what the tools returned, citing page \ +titles and URLs. A later step writes the polished answer, so no personality. +- NEVER fabricate. If a tool fails or returns nothing, state exactly what you \ +could not retrieve and stop.""" + # Lazy initialization to avoid connection issues during imports _librarian_agent: Agent[None, str] | None = None @@ -151,7 +175,7 @@ def _create_librarian_agent() -> Agent[None, str]: agent: Agent[None, str] = Agent( model=model, - system_prompt=LIBRARIAN_SYSTEM_PROMPT, + system_prompt=LIBRARIAN_TASK_PROMPT, retries=2, )