Skip to content
masterclass Buddy

AI Agents · Concept

Agent Loop

Middleware adds hooks that control an agent during model calls and tool execution. It can observe, transform, retry, guard, or stop parts of the agent loop.

Last updated

Syntax

create_agent(model=..., tools=[...], middleware=[...])

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • create_agent
  • SummarizationMiddleware
  • HumanInTheLoopMiddleware
  • LangGraph
  • StateGraph
  • AgentState
  • PIIMiddleware
  • ModelRetryMiddleware

Source: Middleware overview. Checked 2026-11-03.