Files
tatlock/src/agents/tatlock_core/toolset.py
T
jpmschweitzerandClaude Opus 4.5 100ebeae52 feat: migrate web search from tatlock_core to Librarian
Move web search functionality to The Librarian agent, integrating with
the library-desk /rag/search endpoint for enhanced search capabilities.

Changes:
- Add search_web, read_url, read_urls_batch tools to Librarian
- Add WebSearchResult, ContentExtractionResult models to client
- Add search_web, extract_content, extract_content_batch client methods
- Update Librarian capability with web/url/internet domains
- Remove search_web from tatlock_core tools and toolset
- Update Tatlock system prompt to delegate web search to Librarian
- Add comprehensive unit tests for new Librarian tools
- Clean up legacy src/agents/tools.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 18:30:16 +01:00

79 lines
2.1 KiB
Python

"""
PydanticAI toolset for Tatlock's core tools.
Converts the core tool functions into PydanticAI tool definitions
that can be registered with agents and the household registry.
"""
from pydantic_ai.tools import Tool
from . import tools
# Create tool definitions for PydanticAI
calculator_tool = Tool(
function=tools.calculate,
name="calculate",
description=(
"Safely evaluate mathematical expressions. "
"Supports basic arithmetic (+, -, *, /, %, **), "
"functions (sqrt, sin, cos, log, exp, etc.), "
"and constants (pi, e). "
"Use this for ALL mathematical calculations."
),
)
current_datetime_tool = Tool(
function=tools.get_current_datetime,
name="get_current_datetime",
description=(
"Get the current date and time. "
"Supports various formats: 'full' (datetime), 'date' (YYYY-MM-DD), "
"'time' (HH:MM:SS), 'iso' (ISO 8601), or custom strftime format. "
"Use this instead of guessing the current date/time."
),
)
time_offset_tool = Tool(
function=tools.calculate_time_offset,
name="calculate_time_offset",
description=(
"Calculate a date/time relative to now. "
"Accepts natural language like '1 week ago', '2 days from now', "
"'3 months ago', etc. "
"Use this for calculating past or future dates."
),
)
time_difference_tool = Tool(
function=tools.time_difference,
name="time_difference",
description=(
"Calculate the difference between two dates. "
"Accepts dates in YYYY-MM-DD or YYYY-MM-DD HH:MM:SS format. "
"Second date can be 'now'. "
"Returns human-readable difference (e.g., '5 days, 3 hours')."
),
)
# NOTE: Web search has been moved to The Librarian agent.
# Use delegate_to_librarian(task="search web for ...") for web search.
# Combined toolset of all core tools
tatlock_core_tools = [
calculator_tool,
current_datetime_tool,
time_offset_tool,
time_difference_tool,
]
def get_core_tools():
"""
Get list of Tatlock's core tool definitions.
Returns:
List of PydanticAI Tool objects
"""
return tatlock_core_tools