≈ Adapter Pattern / Proxy Pattern / Dependency Injection
Extends the capabilities of an LLM by allowing it to interact with the external world (APIs, databases, calculators, software environments) to perform actions or retrieve data not present in its parametric memory. Transforms the LLM from a text generator into a system controller.
Tool Use (or Function Calling) extends the capabilities of an LLM by allowing it to interact with the external world (APIs, databases, calculators, software environments) to perform actions or retrieve data that is not present in its parametric memory. This transforms the LLM from a text generator into a system controller.
1def get_weather(city):2 # Developer decides this is always called here3 data = requests.get(f"api.weather.com/{city}")4 return parse(data)56def main():7 print(get_weather("Tokyo"))1# Tool Definition (The "Adapter")2weather_tool = Tool(3 name="get_weather",4 description="Get current weather for a city. Input should be a city name.",5 func=call_weather_api6)78# The Agent decides IF/WHEN to call it9agent = initialize_agent(tools=[weather_tool], llm=llm)1011# The user prompt triggers the tool usage implicitly12result = agent.run("What should I wear in Tokyo today?")13# Internal Logic:14# 1. Thought: "I need to know the weather in Tokyo."15# 2. Action: Call tool 'get_weather' with arg 'Tokyo'16# 3. Observation: "It is 15C and raining."17# 4. Final Answer: "Wear a raincoat."Traditional SWE
Adapter / Proxy Pattern
Agentic Pattern
Tool Use
Just as the Adapter pattern wraps an incompatible interface (like a 3rd party API) to make it usable by a client class, Agentic Tool Use wraps an external API (like a weather service or SQL database) into a schema (JSON) that the LLM can "understand" and "call."
In SWE, the developer writes the code to call the API explicitly (service.call()). In Agentic Design, the developer defines the interface (the tool definition), and the Agent decides when and how to call it based on the conversation context. This is Inversion of Control at the logic level — the runtime decides the execution path, not the programmer.
Read-only tools (GET requests) are generally safe. Write-enabled tools (POST/DELETE, "Delete User", "Transfer Funds") require strict Guardrails (Pattern 18) and Human-in-the-Loop (Pattern 13) validation.
If the tool API changes, the agent breaks. Robust error handling (Pattern 12) is needed to inform the agent that the tool failed so it can try an alternative strategy rather than hallucinating a result.
Unlearn: "I write the logic that calls the function."
Adapt: "I write the function description so the Agent knows how to use it." You are writing API documentation for a machine reader. The quality of your tool description determines the reliability of the system.
BuildBuild a Data-Grounded Research Agent. Create an agent that can answer questions using real data by calling external tools (APIs, databases) instead of relying on its training data alone.
DebugDebug: Tool Use. The agent calls tools randomly and often picks the wrong one. The synthesizer works fine but gets garbage data. What's missing at the front?
OptimizeOptimize a Tool-Calling Agent. Your research agent uses GPT-4o for decision-making and tool dispatch. Average query involves 3 tool calls. Total cost: $0.020 per query. Target: under $0.008 while keeping quality above 82%.
PromptWrite a Tool-Calling Agent Prompt. You're building a research agent that can use external tools (web search, calculator, database query). Write the system prompt that teaches the agent when and how to call tools.
Tool Use (or Function Calling) extends the capabilities of an LLM by allowing it to interact with the external world (APIs, databases, calculators, software environments) to perform actions or retrieve data that is not present in its parametric memory. This transforms the LLM from a text generator into a system controller.
Just as the Adapter pattern wraps an incompatible interface (like a 3rd party API) to make it usable by a client class, Agentic Tool Use wraps an external API (like a weather service or SQL database) into a schema (JSON) that the LLM can "understand" and "call." However, there is a key divergence: In SWE, the developer writes the code to call the API explicitly (service.call()). In Agentic Design, the developer defines the interface (the tool definition), and the Agent decides when and how to call it based on the conversation context. This is Inversion of Control at the logic level — the runtime decides the execution path, not the programmer.
Read-only tools (GET requests) are generally safe. Write-enabled tools (POST/DELETE, "Delete User", "Transfer Funds") require strict Guardrails (Pattern 18) and Human-in-the-Loop (Pattern 13) validation. If the tool API changes, the agent breaks. Robust error handling (Pattern 12) is needed to inform the agent that the tool failed so it can try an alternative strategy rather than hallucinating a result.
An AI agent autonomously perceives, reasons, plans, and acts. A chatbot just replies. Here's the difference in 3 minutes.
The tool use pattern lets an AI agent call APIs, query databases, and run code to take real-world actions. Here's how function calling works with Python examples.
This week, we look at new tools for agent skills and knowledge retrieval, alongside a critical security vulnerability impacting LLM frameworks.
This week's digest covers new open-source agent skills for scientific tasks, a code knowledge graph for efficient RAG, and a multi-agent world model for enhanced collaboration.
This week, we see significant advancements in agentic AI, from the standardization and specialization of agent skills to impressive demonstrations of local LLM deployment on edge hardware.