Lesson deck

Agents, middleware and memory flashcards

Reviewing needs JavaScript. You can read every card in the list below.

Loading your cards...

Back to the lesson14 cards in this deck

Read all 14 cards as a list
  1. Front
    What does create_agent build?
    Back
    A loop on the LangGraph runtime: call the model, run the tools it asks for, add results, stop when no tool is requested. Persistence and approvals come from the runtime.
  2. Front
    The middleware hooks and when each runs?
    Back
    Node-style: before_agent and after_agent (once per invocation), before_model and after_model (every model turn). Wrap-style: wrap_model_call and wrap_tool_call (around each call; the handler can run zero, one or many times).
  3. Front
    Which hook fits history trimming? A tool retry? A reply guard?
    Back
    Trimming: before_model. Tool retry or error shaping: wrap_tool_call. Reply guard: after_model.
  4. Front
    How do you stop a runaway agent loop?
    Back
    A model call limit (and a tool call limit) in middleware, with a chosen exit behaviour. Do not rely on a prompt sentence.
  5. Front
    Middleware execution order for [m1, m2, m3]?
    Back
    before hooks: m1, m2, m3. wrap hooks nest, m1 outermost. after hooks: m3, m2, m1.
  6. Front
    Where should redaction and approval go?
    Back
    Redaction first, before anything that logs or forwards. Approval only on tools that write, spend or send, not on every tool.
  7. Front
    What needs a checkpointer in a create_agent agent?
    Back
    Conversation continuity by thread id, human-in-the-loop approval that resumes, and per-thread limits. Runtime context and the system prompt do not.
  8. Front
    State, short-term memory, runtime context, long-term memory?
    Back
    State: messages plus custom fields, per thread. Short-term: checkpointer plus thread id. Context: read-only data per invocation (user, tenant). Long-term: a namespaced store across threads.
  9. Front
    Why does cost sometimes rise after enabling summarisation?
    Back
    Each summary is an extra model call, a trigger that fires too often repeats it, and lost facts can cause extra tool calls. Check traces before and after.
  10. Front
    Name the five multi-agent patterns in the docs.
    Back
    Subagents, handoffs, skills, router, custom workflow (a LangGraph graph).
  11. Front
    Cost of each pattern?
    Back
    Subagents: extra model call per request. Handoffs: sequential. Skills: loaded text stays in context. Router: stateless, a routing call every time. Custom: more code.
  12. Front
    When should you add a second agent?
    Back
    Only for a measured need: context isolation, parallel work or independent evaluation. A single agent with good tools often does the job.
  13. Front
    Old to new: create_react_agent, prompt=, pre_model_hook, post_model_hook?
    Back
    create_agent, system_prompt=, before_model middleware, after_model middleware. Legacy chains and retrievers moved to langchain-classic.
  14. Front
    A safe migration method?
    Back
    Pin versions, write evaluations of current behaviour, port one piece at a time, compare traces and scores after each, then remove the bridge package.