Middleware: model routing and tool guardrails
Notebook· 15.05· 3 h· Lesson 125 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
- Place Jev at an agent's decision points with middleware: before the run (which model?) and before each tool call (is it safe?).
- Use
langchain-typesafe's experimentalModelRouterMiddlewareandAutoModeMiddleware, and know their limits in 0.0.1a3. - Build a tunable tool gate (
JevToolGate) that allows, asks a human, or blocks, with thresholds from Lesson 15.02. - Defend against prompt injection arriving through tool output, and fail closed when the safety check itself fails.
Before you start
Lessons 15.01–15.04; Module 04 (middleware, human-in-the-loop).
