liveBook · Manning

Tool registry

As explained in Build a Multi-Agent System (from Scratch)

A tool registry is a collection that organizes tools for lookup and dispatch.

A tool registry organizes an agent’s tools for lookup when handling tool-call requests. In an LLM agent, it works alongside the tool set and the backbone LLM. section 4.1

Register tools by name:

  • Adding a tool stores it in the registry; adding another tool with the same name raises an error. section 4.1.2

Adding a simple tool

An agent can register a function-backed tool that adds one to an integer. section 4.1.2

Listing 4.4 Implementing LLMAgent: add_tool()
# llm_agents_from_scratch/agent/llm_agent.py
… #A
from llm_agents_from_scratch.base.tool import AsyncBaseTool, Tool
 
 
class LLMAgent:
    … #B
 
    def add_tool(self, tool: Tool) -> Self:
        """Add a tool to the agents tool set.
 
        NOTE: Supports fluent style for convenience.
 
        Args:
            tool (Tool): The tool to equip the LLM agent.
 
        """
        if tool.name in self.tools_registry:
            raise LLMAgentError( #C
                      f"Tool with name {tool.name} already exists.",
                  )
        self.tools_registry[tool.name] = tool
        return self

See the add_tool() implementation, including its duplicate-name check and fluent return. section 4.1.2

How Build a Multi-Agent System (from Scratch) covers it

How deep it goes
Defines the registry’s lookup role and shows registration with duplicate-name checking, but leaves the processing loop for later.
Examples
Uses a function-backed add_one tool to demonstrate registration with an LLM agent.
What it assumes
Assumes familiarity with the Tool and LLM types; their implementations are not covered here.
What you can do after
Configure an LLM agent by registering uniquely named tools for later tool-call lookup.
How it connects
Connects tool registries to LLM agents, tools, and tool-call requests.

Also explained in

Compare how 4 books explain tool registry →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Multi-Agent System (from Scratch). The section links point to the parts of the book it draws on.