Add tool‑use plugin: call external APIs (weather, calculators, search)

So far, your assistant can:

  • Answer using its pre-trained knowledge

  • Retrieve info from a local RAG knowledge base

But what if it needs live data? 👉 “What’s the weather today?” 👉 “What’s 23.5% of 450?” 👉 “Search the latest news for me.”

A purely static LLM can’t do these by itself — so you extend its capabilities by adding tool-use plugins.


What Is Tool Use?

Tool use means:

  • The assistant recognizes it can’t answer from memory.

  • It calls a real external tool (API, database, function).

  • It returns the result back to the user in natural language.

This makes your AI act like an agent — not just a static chatbot.


Common Tools You Might Add

Tool
Example API

Weather

OpenWeatherMap, WeatherAPI

Calculator

Python’s eval(), or a custom math parser

Web Search

DuckDuckGo API, SerpAPI

News

NewsAPI.org

Database

SQL or vector DB queries


How It Works

1️⃣ Detect intent — Figure out if the user’s prompt needs a tool. 2️⃣ Call the tool — Send an API request or run a Python function. 3️⃣ Combine the tool output with a natural LLM reply.


Practical Example: Weather Plugin


1️⃣ Add a Python Function


2️⃣ Detect When to Use It

Example: simple keyword check.


3️⃣ Handle the Tool Call


4️⃣ Combine with LLM Fallback


✅ Now your assistant can:

  • Answer normal questions using the LLM

  • Call a live tool for weather or math when needed


How to Make This Smarter

  • Use intent classification with an LLM instead of keyword hacks.

  • Chain tools with langchain or Autogen.

  • Add logging so you know when a tool was used.

  • Validate and sanitize user input for safety (don’t eval() blindly).


When to Add Plugins

Tool Use
Example Use

Quick answers

Weather, stock prices, exchange rates

Tasks

Math, unit conversions

Data updates

News headlines

Backend integration

CRM or database lookups


🗝️ Key Takeaway

Tool-use = static LLM + live data = smarter assistant. It makes your chatbot truly interactive, not just a text regurgitator.


➡️ Next: Learn how to chain multiple tools together with an orchestration framework — or add simple error handling to keep your agent safe!

Last updated