❤️ 15/15

A Tool Is Just an Ordinary Function

Don't be scared by the word "tool." A tool you give an Agent is just a normal function you wrote, plus a line saying "what this function does," so the large model knows when to use it.

def get_weather(city: str) -> str:
    """查询某个城市今天的天气。"""
    return weather_api(city)

tools = [get_weather]  # 把工具交给 Agent