How an AI agent works
Suppose you have a folder of notes from a side project. Somewhere in those notes is the reason you chose SQLite over Postgres. You remember discussing it, but you cannot remember which file contains the decision. You could search the folder yourself, read a few files, and put the answer together. What would it take to let a language model do those steps? The model can write a request to search. That request is still just output from the model; it has not searched a single file. Our application must run the search and send the results into another model call. Following that handoff is a useful way to understand an agent. For this example, watch what changes after each tool result: the model has new information for choosing its next action. Give the model a way to look For this example, we will design two tools: search_notes(query) Returns matching file names and short excerpts. read_note(path) Returns the contents of one file in the notes folder. A tool is a capability ...