Tool Registry

t-249·WorkTask·
·
·
Created2 months ago·Updated1 month ago

Dependencies

Description

Edit

Create Omni/Agent/Registry.hs for pluggable tool management, allowing agents to declare their tool requirements.

Context

Different agents need different tools:

  • Coder agent: read_file, write_file, edit_file, run_bash, search_codebase
  • Telegram bot: remember, recall, web_search
  • Researcher: web_search, read_web_page, remember

Tools should be defined once and composed into agent-specific sets.

Current State

  • Omni/Agent/Tools.hs defines 6 tools as individual values (allTools list)
  • Each tool is an Engine.Tool with name, description, schema, execute function
  • Tools are passed directly to AgentConfig.agentTools

Requirements

1. Create Registry.hs with tool categories:

data ToolCategory
  = CodingTools      -- read, write, edit, bash, search
  | WebTools         -- web_search, read_web_page
  | MemoryTools      -- remember, recall (from Memory module)
  | TaskTools        -- task_create, task_list, task_update (future)
  deriving (Show, Eq)

-- Get tools by category
getToolsByCategory :: ToolCategory -> [Engine.Tool]

-- Compose multiple categories
getTools :: [ToolCategory] -> [Engine.Tool]

-- Named tool sets for convenience
coderTools :: [Engine.Tool]
coderTools = getTools [CodingTools]

telegramTools :: [Engine.Tool]
telegramTools = getTools [MemoryTools, WebTools]

2. Implement web_search tool:

  • Use DuckDuckGo HTML search (no API key needed): https://html.duckduckgo.com/html/?q=query
  • Parse results from HTML response
  • Return top 5 results with title, URL, snippet
webSearchTool :: Engine.Tool
-- Args: { "query": "search terms" }
-- Returns: [{ "title": "...", "url": "...", "snippet": "..." }]

3. Implement read_web_page tool:

  • Fetch URL content via HTTP GET
  • Strip HTML tags, extract text content
  • Truncate to reasonable length (e.g., 10000 chars)
readWebPageTool :: Engine.Tool
-- Args: { "url": "https://..." }
-- Returns: { "content": "page text..." }

4. Re-export existing tools:

  • Import from Omni.Agent.Tools
  • Categorize existing tools under CodingTools

5. Memory tools integration:

  • Import rememberTool and recallTool from Omni.Agent.Memory (when available)
  • For now, can stub with placeholder that returns error

Files to Create

  • Omni/Agent/Registry.hs - main registry module
  • Omni/Agent/Tools/Web.hs - web_search and read_web_page implementations

Files to Modify

  • None required, but can optionally reorganize Tools.hs

Dependencies

  • http-conduit for HTTP requests
  • tagsoup or similar for HTML parsing (check what's in Bild.nix)
  • Depends on t-247 (Provider) being complete

Testing

  • bild --test Omni/Agent/Registry.hs
  • Test getToolsByCategory returns correct tools
  • Test web_search with real query
  • Test read_web_page with simple URL

Reference

  • See Omni/Agent/Tools.hs for tool implementation patterns
  • See Omni/Agent/Engine.hs Tool type definition (lines 225-230)

Timeline (1)

🔄[human]Open → Done1 month ago