Agent with Tools

Give a MiniMax agent a web search tool and stream the response.

The current Agno adapter does not preserve all MiniMax thinking content when sending assistant messages back after a tool call. For MiniMax-M3 tool workflows, set extra_body={"thinking": {"type": "disabled"}} as shown in the tool example. This avoids the affected thinking-history path. M2.x models cannot disable thinking this way; see MiniMax tool history and thinking controls.

Code

from agno.agent import Agent
from agno.models.minimax import MiniMax
from agno.tools.websearch import WebSearchTools

agent = Agent(
    model=MiniMax(id="MiniMax-M3", extra_body={"thinking": {"type": "disabled"}}),
    markdown=True,
    tools=[WebSearchTools()],
)

if __name__ == "__main__":
    agent.print_response("What is happening in France?", stream=True)

Usage

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Set your API key

export MINIMAX_API_KEY=xxx

Install dependencies

uv pip install -U openai ddgs agno

Run Agent

Save the code above as tool_use.py, then run:

python tool_use.py