AI / A CONCEPT NOTE

Agents & Tool Use

LLMs that take actions — not just talk

~85 sec read

Overview · mechanism
pitfall · examples

01 / THE SHORT VERSION

The idea in a few sentences.

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.

02 / FOLLOW THE MECHANISM

How an agent cycle runs

  1. Task input

    the user asks: 'Find the slowest API endpoint and suggest a fix.'

  2. LLM reasoning

    the model outputs a thought and selects a tool: call_tool: query_prometheus, args: { query: 'http_request_duration_seconds_p99' }.

  3. Runtime executor

    calls the tool function with the provided arguments and returns the result to the LLM.

  4. LLM observation

    reads the tool output and decides: either call another tool or produce the final answer.

  5. Final output

    once the LLM determines the task is complete, it outputs the response to the user.

04 / COMMAND NOTES

Read the command, then the result.

Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.

EXAMPLE 01 · INCOMPLETE SKETCH

SDK call with tool definitions

python -c "from openai import OpenAI; client = OpenAI(); response = client.chat.completions.create(model='gpt-4', tools=[...])"

The ellipsis omits required code or values. This sketch is not runnable as written.

Explore command anatomy in the CLI lab