Exercise 2 — A diagnostic agent with two tools

Guided practice6 min
Time
35 min
You need
the kit, the venv, Ollama running, week12/diag_tools.py from Exercise 1
Deliverable
the output of Steps 5 to 7, with the line rounds used: for each question

The lab kit of the course: https://github.com/hrhouma2/aiopsatlas-ml-data-diagnostics-labs-en

Goal

In Exercise 1 a classifier chose the tool. Today the model chooses. You give it the two tools with bind_tools. It asks for one, a ToolNode runs it, the result comes back, and the model asks again or answers. The conversation lives in MessagesState. A counter in the state stops the loop after 3 tool rounds. You will also see, honestly, where a 3B model fails, and how to write a question it can follow.

Preview — the rest of the lesson is for enrolled readers.

Already enrolled with a code?

Your access is tied to your account, not to this link. Sign in with the same email you used in class: your course is waiting, no need to enter the code again.

Sign inNo account yet? Create one
This lesson is part of the “Week 12 — Stateful workflows with LangGraph” module

The first modules of the course are open to everyone. For the rest you have three options: buy this course once and for all, subscribe, or enter the code handed out in class.

Are you a student on this course?

The code is tied to your account: sign in or create an account and it will be applied automatically when you come back.

No account yet? Create one