Data agent
Count with a tool
A data agent answers from numbers you pass in, or from a tool that computes them.
The tool does the arithmetic. The agent is told to use it.
Example
from praisonai import Agent
def total(values: str) -> str:
"""Add a comma-separated list of numbers."""
nums = [float(part) for part in values.split(",") if part.strip()]
return str(sum(nums))
agent = Agent(
name="Data",
instructions="Use the total tool for arithmetic.",
tools=[total],
)
print(total("2, 4, 6"))
print(agent.start("What is the total of 2, 4, 6?"))Reference: documentation