Skip to main content
>_ supraj.dev
TOPIC AI
Agents & Tool Use LLMs that take actions — not just talk
IN 10 SECONDS

An agent is an LLM looped into a cycle: it receives a task, calls tools (APIs, databases, shell commands) based on its reasoning, gets the results, and decides the next action. The model orchestrates the process, but the tools execute the actions. This turns an LLM from a chatbot into an autonomous operator.

GOTCHA Agents amplify both the power and the risk of LLMs. A hallucinated tool call can delete infrastructure or charge your credit card. Always sandbox tool execution with least-privilege permissions, rate limits, and human-in-the-loop for destructive actions.
HOW AN AGENT CYCLE RUNS
01 Task input the user asks: 'Find the slowest API endpoint and suggest a fix.'
02 LLM reasoning the model outputs a thought and selects a tool: `call_tool: query_prometheus, args: { query: 'http_request_duration_seconds_p99' }`.
03 Runtime executor calls the tool function with the provided arguments and returns the result to the LLM.
04 LLM observation reads the tool output and decides: either call another tool or produce the final answer.
05 Final output once the LLM determines the task is complete, it outputs the response to the user.
POKE IT YOURSELF
python -c "from openai import OpenAI; client = OpenAI(); response = client.chat.completions.create(model='gpt-4', tools=[...])" — SDK call with tool definitions