Wraps a BaseLLMAgent as a Tool for delegation patterns.
This allows agents to use other agents as tools, enabling complex multi-agent architectures where coordinator agents can delegate specialized tasks to expert agents.
Examples
# Create a specialist agent
temporal_agent = BaseLLMAgent.new(
broker: Broker.new("qwen3:7b", Ollama),
behaviour: "You are a historian specializing in temporal reasoning.",
tools: [DateResolver]
)
# Wrap it as a tool
temporal_tool = ToolWrapper.new(
agent: temporal_agent,
name: "temporal_specialist",
description: "A historian that can resolve dates and temporal queries."
)
# Use it in a coordinator agent
coordinator = BaseLLMAgent.new(
broker: Broker.new("qwen3:32b", Ollama),
behaviour: "You are a coordinator that delegates to specialists.",
tools: [temporal_tool]
)
Summary
Types
@type t() :: %Mojentic.LLM.Tools.ToolWrapper{ agent: Mojentic.Agents.BaseLLMAgent.t(), description: String.t(), name: String.t() }
Functions
Returns the tool descriptor for this wrapped agent.
The descriptor is built dynamically from the instance's name and description.
Creates a new ToolWrapper.
Parameters
opts: Keyword list with::agent- BaseLLMAgent to wrap (required):name- Tool name for LLM function calling (required):description- Description of what the agent does (required)
Examples
tool = ToolWrapper.new(
agent: my_agent,
name: "specialist",
description: "An expert in specialized topics"
)