Tools

A function is enough

A tool is a Python function the agent may call. The function does the work. The agent decides when.

Write a normal function with a docstring. The docstring tells the agent what the tool is for. You will attach it on the next page.

Example

def word_count(text: str) -> str:
    """Count the words in text."""
    return str(len(text.split()))

print(word_count("praison agents university"))

Try it Yourself

Example explained

  • def word_count — A plain function. No agent yet.
  • docstring — The description the agent reads.

Reference: documentation