Tool#

class lumen.ai.tools.Tool(*, always_use, interface, memory, llm, prompts, template_overrides, conditions, exclusions, not_with, purpose, name)#

A Tool can be invoked by another Actor to provide additional context or respond to a question. Unlike an Agent they never interact with or on behalf of a user directly.


Parameters#

always_use

type: bool
default: False
Whether to always use this tool, even if it is not explicitlyrequired by the current context.

conditions

type: list
default: ['Always requires a supporting agent to interpret results']
Specific criteria that determine when this actor should be invoked.These conditions establish explicit relationships between actors in the system,defining the circumstances under which this actor becomes relevant.While ‘purpose’ describes what the actor does, conditions specifythe precise situations that warrant its use.

exclusions

type: list
default: []
List of context values that this actor should not be invoked with.This is useful for actors that are not relevant in certain contextsor for actors that should not be invoked in certain situations.

interface

type: panel.chat.ChatFeed
default: None
The interface for the Coordinator to interact with.

llm

type: lumen.ai.llm.Llm
default: None
The LLM implementation to query.

memory

type: lumen.ai.memory._Memory
default: None
Local memory which will be used to provide the agent context.If None the global memory will be used.

name

type: str
default: 'Tool'
String identifier for this object.

not_with

type: list
default: []
List of actors that this actor should not be invoked with.

prompts

type: dict
default: {'main': {'template': PosixPath('/Users/runner/work/lumen/lumen/lumen/ai/prompts/Actor/main.jinja2')}}
A dictionary of prompts, indexed by prompt name.Each prompt should be defined as a dictionary containing a template’template’ and optionally a ‘model’ and ‘tools’.

provides

type: list
default: []
List of context values it provides to current working memory.

purpose

type: str
default: ''
A descriptive statement of this actor’s functionality and capabilities.Serves as a high-level explanation for other actors to understandwhat this actor does and when it might be useful to invoke it.

requires

type: list
default: []
List of context values it requires to be in memory.

template_overrides

type: dict
default: {}
Overrides the template’s blocks (instructions, context, tools, examples).Is a nested dictionary with the prompt name (e.g. main) as the keyand the block names as the inner keys with the new content as thevalues.


Methods#

async Tool.requirements(messages: list[Message]) list[str]#
abstractmethod async Tool.respond(messages: list[Message], **kwargs: dict[str, Any]) Any#

Responds to the provided messages.