Basic Example: Building Your First Team
π§βπ€βπ§ Basic Example: Building Your First Team
from nalona import Agent, Tool, TaskForce
from nalona.llms import Gemini
# Initialize your LLM
llm = Gemini()
# Define tools
def say_hello(name: str):
return f"Hello there, {name}! π"
def calculate(equation: str):
return eval(equation)
hello_tool = Tool(func=say_hello,
description="Greets the user by name.",
params={'name': {'description': 'The name to greet.', 'type': 'str', 'default': 'unknown'}})
calculate_tool = Tool(func=calculate,
description="Evaluates an equation.",
params={'equation': {'description': 'The equation to evaluate.', 'type': 'str', 'default': 'unknown'}})
# Create agents
greeter = Agent(llm=llm,
tools=[hello_tool],
identity="Friendly Greeter",
verbose=True)
math_magician = Agent(llm=llm,
tools=[calculate_tool],
identity="Math Magician",
verbose=True)
# Assemble your task force!
force = TaskForce(agents=[greeter, math_magician], caching_dir='cache')
force.start_force()
force.execute_agent(greeter, "Hi I am mervin")
force.execute_agent(math_magician, "2+2")
force.exit_force()This example demonstrates creating agents with tools and using a TaskForce to manage execution.
π§ Important Questions
What does record_result func do?
The record_result function is used to save the result of an agent's workflow. This can be useful for passing one agent's response to another.
This concludes in the scalability and simplicity of the architecture.
π Advanced Features
Multi-LLM Support: Seamlessly switch between different language models
Custom Tool Creation: Easily create and integrate your own tools
Response Validation: Ensure output quality with built-in validation
Easy Passing of Information: Share information between agents with ease using the
record_resultfunctionScalable Architecture: Build large-scale AI agent networks with the TaskForce class
π Performance and Scalability
a1zo is designed for efficiency:
Lightweight core for minimal overhead
Scalable architecture for complex agent networks
Actual Use Case:
The Tools used from Nalona AI in the use case are totally experimental and are not recommended to use.
Last updated