Tools in your process

A function in Python

In Agents you passed a Python function in tools=[]. The agent runs it inside the same process.

MCP is for tools that live in another program. The pattern in the Agent is the same; only the source of the tool changes.

Example

from praisonai import Agent

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

agent = Agent(instructions="Use word_count when asked.", tools=[word_count])
print(agent.start("How many words in: one two three"))

Try it Yourself

Example explained

  • tools — In-process tools you define yourself.

Reference: documentation