MelleaTool.from_smolagents() wraps any smolagents
Tool instance so it can be passed to any MelleaSession
call. The HuggingFace ecosystem provides many pre-built tools — PythonInterpreterTool,
DuckDuckGoSearchTool, WikipediaSearchTool, and others.
Prerequisites: pip install 'mellea[smolagents]'
Using smolagents tools
from_smolagents() uses smolagents’ own JSON schema conversion, so the tool’s
description and parameter types are preserved exactly.
Backend note: Tool calling requires a backend and model that support function calling (e.g., Ollama withgranite4:micro, OpenAI withgpt-4o). The default Ollama setup supports this. Full example:docs/examples/tools/smolagents_example.py
Which approach to use
| Scenario | Use |
|---|---|
Your tool exists as a LangChain BaseTool | MelleaTool.from_langchain(tool) |
Your tool exists as a smolagents Tool | MelleaTool.from_smolagents(tool) |
| You have a plain Python function to expose | @tool decorator |
| You have LangChain message history to continue | convert_to_openai_messages → ChatContext |
| You want Mellea as an OpenAI endpoint for another framework | m serve |
See also: Tools and Agents | Context and Sessions