How does it work?
The model is told what tools exist and what each one does. It replies not with prose but with a request to call one — search this, read that file, run this query. Your code executes the call and hands back the result, which becomes part of the context for the next turn. Repeat until the model says it is finished or a limit you set is reached.
Everything else is engineering around that loop: what tools to expose, how much history to keep, when to ask a human, and when to stop.
