The Agent Class

👤 The Agent Class

The Agent class is the heart of Nalona AI. It represents an individual AI agent within your system.

Key Attributes

Attribute
Description

llm

An instance of the LLM (Large Language Model) class that the agent will use for language processing and decision-making.

tools

A list of Tool objects that define the actions the agent can perform.

identity

A string representing the agent's name or identifier.

description

A brief description of the agent's role or purpose.

expected_output

A string describing the expected format or style of the agent's responses.

ask_user

A boolean value indicating whether the agent should ask the user for input when generating responses. Defaults to True.

max_iterations

The maximum number of iterations the agent will attempt to generate a valid response. Defaults to 3.

check_response_validity

A boolean value indicating whether the agent should check the validity of the response before it is returned. Defaults to False.

output_file

The name of the file where the agent's responses will be saved. Defaults to None.

verbose

A boolean value indicating whether the agent should print verbose output during execution. Defaults to False.

Methods

  • rollout(): Execute the agent's main workflow

🧰 The Tool Class

Tools are actions or capabilities that an agent can perform.

from nalona import Tool

def get_weather(city: str):
    """Fetches the current weather for a given city."""
    # Implementation...
    return weather_data

weather_tool = Tool(
    func=get_weather,
    description="Gets the current weather for a specified city.",
    params={'city': {'description': 'The city to check weather for', 'type': 'str', 'default': 'unknown'}}
)

Last updated