Tool calling without an agent
Notebook· 02.02· 120–150 min· Lesson 20 of 129
The notebook opens in your lab, in a new tab. If your server is stopped, it starts first (a few seconds).
By the end you can
- Bind tools to a model with
bind_toolsand see exactly what goes over the wire (tools,tool_choice). - Read a tool-calling reply:
tool_calls,content_blocks,finish_reason,invalid_tool_calls. - Control tool use with
tool_choice(auto,required/any, a tool name) and know Groq's limits (no parallel calls on GPT-OSS). - Execute tool calls and return
ToolMessages that follow the message-ordering rules. - Write the agent loop by hand, with a stop condition and a step limit, and handle bad tool calls without crashing.
- Recognize server-side tools (Groq's
browser_search) and the OpenAI-compatible fallback (ChatOpenAIpointed at Groq).
Before you start
Lesson 02.01 (tools). Lesson 01.02 (messages).
