[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-langchain-langchain-middleware":3,"mdc-z7px8u-key":34,"related-org-langchain-langchain-middleware":4509,"related-repo-langchain-langchain-middleware":4688},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":12,"stars":24,"repoUrl":25,"updatedAt":26,"license":27,"forks":28,"topics":29,"repo":30,"sourceUrl":32,"mdContent":33},"langchain-middleware","implement LangChain middleware and human-in-the-loop approvals","INVOKE THIS SKILL when you need human-in-the-loop approval, custom middleware, or structured output. Covers HumanInTheLoopMiddleware for human approval of dangerous tool calls, creating custom middleware with hooks, Command resume patterns, and structured output with Pydantic\u002FZod.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},"langchain","LangChain","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Flangchain.png","langchain-ai",[13,17,18,21],{"name":14,"slug":15,"type":16},"LLM","llm","tag",{"name":9,"slug":8,"type":16},{"name":19,"slug":20,"type":16},"Agents","agents",{"name":22,"slug":23,"type":16},"Approvals","approvals",877,"https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangchain-skills","2026-04-06T18:26:28.443987",null,77,[],{"repoUrl":25,"stars":24,"forks":28,"topics":31,"description":27},[],"https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangchain-skills\u002Ftree\u002FHEAD\u002Fconfig\u002Fskills\u002Flangchain-middleware","---\nname: langchain-middleware\ndescription: \"INVOKE THIS SKILL when you need human-in-the-loop approval, custom middleware, or structured output. Covers HumanInTheLoopMiddleware for human approval of dangerous tool calls, creating custom middleware with hooks, Command resume patterns, and structured output with Pydantic\u002FZod.\"\n---\n\n\u003Coverview>\nMiddleware patterns for production LangChain agents:\n\n- **HumanInTheLoopMiddleware** \u002F **humanInTheLoopMiddleware**: Pause before dangerous tool calls for human approval\n- **Custom middleware**: Intercept tool calls for error handling, logging, retry logic\n- **Command resume**: Continue execution after human decisions (approve, edit, reject)\n\n**Requirements:** Checkpointer + thread_id config for all HITL workflows.\n\u003C\u002Foverview>\n\n---\n\n## Human-in-the-Loop\n\n\u003Cex-basic-hitl-setup>\n\u003Cpython>\nSet up an agent with HITL middleware that pauses before sending emails for approval.\n\n```python\nfrom langchain.agents import create_agent\nfrom langchain.agents.middleware import HumanInTheLoopMiddleware\nfrom langgraph.checkpoint.memory import MemorySaver\nfrom langchain.tools import tool\n\n@tool\ndef send_email(to: str, subject: str, body: str) -> str:\n    \"\"\"Send an email.\"\"\"\n    return f\"Email sent to {to}\"\n\nagent = create_agent(\n    model=\"gpt-4.1\",\n    tools=[send_email],\n    checkpointer=MemorySaver(),  # Required for HITL\n    middleware=[\n        HumanInTheLoopMiddleware(\n            interrupt_on={\n                \"send_email\": {\"allowed_decisions\": [\"approve\", \"edit\", \"reject\"]},\n            }\n        )\n    ],\n)\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nSet up an agent with HITL that pauses before sending emails for human approval.\n\n```typescript\nimport { createAgent, humanInTheLoopMiddleware } from \"langchain\";\nimport { MemorySaver } from \"@langchain\u002Flanggraph\";\nimport { tool } from \"@langchain\u002Fcore\u002Ftools\";\nimport { z } from \"zod\";\n\nconst sendEmail = tool(\n  async ({ to, subject, body }) => `Email sent to ${to}`,\n  {\n    name: \"send_email\",\n    description: \"Send an email\",\n    schema: z.object({ to: z.string(), subject: z.string(), body: z.string() }),\n  }\n);\n\nconst agent = createAgent({\n  model: \"anthropic:claude-sonnet-4-5\",\n  tools: [sendEmail],\n  checkpointer: new MemorySaver(),\n  middleware: [\n    humanInTheLoopMiddleware({\n      interruptOn: { send_email: { allowedDecisions: [\"approve\", \"edit\", \"reject\"] } },\n    }),\n  ],\n});\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-basic-hitl-setup>\n\n\u003Cex-running-with-interrupts>\n\u003Cpython>\nRun the agent, detect an interrupt, then resume execution after human approval.\n\n```python\nfrom langgraph.types import Command\n\nconfig = {\"configurable\": {\"thread_id\": \"session-1\"}}\n\n# Step 1: Agent runs until it needs to call tool\nresult1 = agent.invoke({\n    \"messages\": [{\"role\": \"user\", \"content\": \"Send email to john@example.com\"}]\n}, config=config)\n\n# Check for interrupt\nif \"__interrupt__\" in result1:\n    print(f\"Waiting for approval: {result1['__interrupt__']}\")\n\n# Step 2: Human approves\nresult2 = agent.invoke(\n    Command(resume={\"decisions\": [{\"type\": \"approve\"}]}),\n    config=config\n)\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nRun the agent, detect an interrupt, then resume execution after human approval.\n\n```typescript\nimport { Command } from \"@langchain\u002Flanggraph\";\n\nconst config = { configurable: { thread_id: \"session-1\" } };\n\n\u002F\u002F Step 1: Agent runs until it needs to call tool\nconst result1 = await agent.invoke({\n  messages: [{ role: \"user\", content: \"Send email to john@example.com\" }]\n}, config);\n\n\u002F\u002F Check for interrupt\nif (result1.__interrupt__) {\n  console.log(`Waiting for approval: ${result1.__interrupt__}`);\n}\n\n\u002F\u002F Step 2: Human approves\nconst result2 = await agent.invoke(\n  new Command({ resume: { decisions: [{ type: \"approve\" }] } }),\n  config\n);\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-running-with-interrupts>\n\n\u003Cex-editing-tool-arguments>\n\u003Cpython>\nEdit the tool arguments before approving when the original values need correction.\n\n```python\n# Human edits the arguments — edited_action must include name + args\nresult2 = agent.invoke(\n    Command(resume={\n        \"decisions\": [{\n            \"type\": \"edit\",\n            \"edited_action\": {\n                \"name\": \"send_email\",\n                \"args\": {\n                    \"to\": \"alice@company.com\",  # Fixed email\n                    \"subject\": \"Project Meeting - Updated\",\n                    \"body\": \"...\",\n                },\n            },\n        }]\n    }),\n    config=config\n)\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nEdit the tool arguments before approving when the original values need correction.\n\n```typescript\n\u002F\u002F Human edits the arguments — editedAction must include name + args\nconst result2 = await agent.invoke(\n  new Command({\n    resume: {\n      decisions: [{\n        type: \"edit\",\n        editedAction: {\n          name: \"send_email\",\n          args: {\n            to: \"alice@company.com\",  \u002F\u002F Fixed email\n            subject: \"Project Meeting - Updated\",\n            body: \"...\",\n          },\n        },\n      }]\n    }\n  }),\n  config\n);\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-editing-tool-arguments>\n\n\u003Cex-rejecting-with-feedback>\n\u003Cpython>\nReject a tool call and provide feedback explaining why it was rejected.\n\n```python\n# Human rejects\nresult2 = agent.invoke(\n    Command(resume={\n        \"decisions\": [{\n            \"type\": \"reject\",\n            \"feedback\": \"Cannot delete customer data without manager approval\",\n        }]\n    }),\n    config=config\n)\n```\n\u003C\u002Fpython>\n\u003C\u002Fex-rejecting-with-feedback>\n\n\u003Cex-multiple-tools-different-policies>\n\u003Cpython>\nConfigure different HITL policies for each tool based on risk level.\n\n```python\nagent = create_agent(\n    model=\"gpt-4.1\",\n    tools=[send_email, read_email, delete_email],\n    checkpointer=MemorySaver(),\n    middleware=[\n        HumanInTheLoopMiddleware(\n            interrupt_on={\n                \"send_email\": {\"allowed_decisions\": [\"approve\", \"edit\", \"reject\"]},\n                \"delete_email\": {\"allowed_decisions\": [\"approve\", \"reject\"]},  # No edit\n                \"read_email\": False,  # No HITL for reading\n            }\n        )\n    ],\n)\n```\n\u003C\u002Fpython>\n\u003C\u002Fex-multiple-tools-different-policies>\n\n\u003Cboundaries>\n### What You CAN Configure\n\n- Which tools require approval (per-tool policies)\n- Allowed decisions per tool (approve, edit, reject)\n- Custom middleware hooks: `before_model`, `after_model`, `wrap_tool_call`, `before_agent`, `after_agent`\n- Tool-specific middleware (apply only to certain tools)\n\u003C\u002Fboundaries>\n\n---\n\n## Custom Middleware Hooks\n\nSix decorator hooks are available. Two patterns:\n\n- **Wrap hooks** (`wrap_tool_call`, `wrap_model_call`): `(request, handler)` — call `handler(request)` to proceed, or return early to short-circuit.\n- **Before\u002Fafter hooks** (`before_model`, `after_model`, `before_agent`, `after_agent`): `(state, runtime)` — inspect or modify state. Return `None` or a dict of state updates.\n\n\u003Cex-wrap-tool-call>\n\u003Cpython>\n`@wrap_tool_call` intercepts tool execution. **Do NOT use `yield`** — it creates a generator and causes `NotImplementedError`.\n\n```python\nfrom langchain.agents.middleware import wrap_tool_call\n\n@wrap_tool_call\ndef retry_middleware(request, handler):\n    for attempt in range(3):\n        try:\n            return handler(request)\n        except Exception:\n            if attempt == 2:\n                raise\n\n@wrap_tool_call\ndef guard_middleware(request, handler):\n    if request.tool_call[\"name\"] == \"dangerous_tool\":\n        return \"This tool is disabled\"  # short-circuit\n    return handler(request)\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\n`createMiddleware({ wrapToolCall })` intercepts tool execution.\n\n```typescript\nimport { createMiddleware } from \"langchain\";\n\nconst retryMiddleware = createMiddleware({\n  wrapToolCall: async (request, handler) => {\n    for (let attempt = 0; attempt \u003C 3; attempt++) {\n      try { return await handler(request); }\n      catch (e) { if (attempt === 2) throw e; }\n    }\n  },\n});\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-wrap-tool-call>\n\n\u003Cex-before-after-hooks>\n\u003Cpython>\n`before_model` \u002F `after_model` \u002F `before_agent` \u002F `after_agent` all share `(state, runtime)` signature.\n\n```python\nfrom langchain.agents.middleware import before_model, after_model\n\n@before_model\ndef log_calls(state, runtime):\n    print(f\"Calling model with {len(state['messages'])} messages\")\n\n@after_model\ndef check_output(state, runtime):\n    print(f\"Model responded\")\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nAll before\u002Fafter hooks share the same `(state, runtime)` signature via `createMiddleware`.\n\n```typescript\nimport { createMiddleware } from \"langchain\";\n\nconst loggingMiddleware = createMiddleware({\n  beforeModel: (state, runtime) => {\n    console.log(`Calling model with ${state.messages.length} messages`);\n  },\n  afterModel: (state, runtime) => {\n    console.log(\"Model responded\");\n  },\n});\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-before-after-hooks>\n\n\u003Cboundaries>\n### What You CANNOT Configure\n\n- Interrupt after tool execution (must be before)\n- Skip checkpointer requirement for HITL\n\u003C\u002Fboundaries>\n\n\u003Cfix-missing-checkpointer>\n\u003Cpython>\nHITL middleware requires a checkpointer to persist state.\n\n```python\n# WRONG\nagent = create_agent(model=\"gpt-4.1\", tools=[send_email], middleware=[HumanInTheLoopMiddleware({...})])\n\n# CORRECT\nagent = create_agent(\n    model=\"gpt-4.1\", tools=[send_email],\n    checkpointer=MemorySaver(),  # Required\n    middleware=[HumanInTheLoopMiddleware({...})]\n)\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nHITL requires a checkpointer to persist state.\n\n```typescript\n\u002F\u002F WRONG: No checkpointer\nconst agent = createAgent({\n  model: \"anthropic:claude-sonnet-4-5\", tools: [sendEmail],\n  middleware: [humanInTheLoopMiddleware({ interruptOn: { send_email: true } })],\n});\n\n\u002F\u002F CORRECT: Add checkpointer\nconst agent = createAgent({\n  model: \"anthropic:claude-sonnet-4-5\", tools: [sendEmail],\n  checkpointer: new MemorySaver(),\n  middleware: [humanInTheLoopMiddleware({ interruptOn: { send_email: true } })],\n});\n```\n\u003C\u002Ftypescript>\n\u003C\u002Ffix-missing-checkpointer>\n\n\u003Cfix-no-thread-id>\n\u003Cpython>\nAlways provide thread_id when using HITL to track conversation state.\n\n```python\n# WRONG\nagent.invoke(input)  # No config!\n\n# CORRECT\nagent.invoke(input, config={\"configurable\": {\"thread_id\": \"user-123\"}})\n```\n\u003C\u002Fpython>\n\u003C\u002Ffix-no-thread-id>\n\n\u003Cfix-wrong-resume-syntax>\n\u003Cpython>\nUse Command class to resume execution after an interrupt.\n\n```python\n# WRONG\nagent.invoke({\"resume\": {\"decisions\": [...]}})\n\n# CORRECT\nfrom langgraph.types import Command\nagent.invoke(Command(resume={\"decisions\": [{\"type\": \"approve\"}]}), config=config)\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nUse Command class to resume execution after an interrupt.\n\n```typescript\n\u002F\u002F WRONG\nawait agent.invoke({ resume: { decisions: [...] } });\n\n\u002F\u002F CORRECT\nimport { Command } from \"@langchain\u002Flanggraph\";\nawait agent.invoke(new Command({ resume: { decisions: [{ type: \"approve\" }] } }), config);\n```\n\u003C\u002Ftypescript>\n\u003C\u002Ffix-wrong-resume-syntax>\n",{"data":35,"body":36},{"name":4,"description":6},{"type":37,"children":38},"root",[39,4503],{"type":40,"tag":41,"props":42,"children":43},"element","overview",{},[44,47,90,101,105,112,1161,1866,2375,2464,2582],{"type":45,"value":46},"text","\nMiddleware patterns for production LangChain agents:\n",{"type":40,"tag":48,"props":49,"children":50},"ul",{},[51,70,80],{"type":40,"tag":52,"props":53,"children":54},"li",{},[55,61,63,68],{"type":40,"tag":56,"props":57,"children":58},"strong",{},[59],{"type":45,"value":60},"HumanInTheLoopMiddleware",{"type":45,"value":62}," \u002F ",{"type":40,"tag":56,"props":64,"children":65},{},[66],{"type":45,"value":67},"humanInTheLoopMiddleware",{"type":45,"value":69},": Pause before dangerous tool calls for human approval",{"type":40,"tag":52,"props":71,"children":72},{},[73,78],{"type":40,"tag":56,"props":74,"children":75},{},[76],{"type":45,"value":77},"Custom middleware",{"type":45,"value":79},": Intercept tool calls for error handling, logging, retry logic",{"type":40,"tag":52,"props":81,"children":82},{},[83,88],{"type":40,"tag":56,"props":84,"children":85},{},[86],{"type":45,"value":87},"Command resume",{"type":45,"value":89},": Continue execution after human decisions (approve, edit, reject)",{"type":40,"tag":91,"props":92,"children":93},"p",{},[94,99],{"type":40,"tag":56,"props":95,"children":96},{},[97],{"type":45,"value":98},"Requirements:",{"type":45,"value":100}," Checkpointer + thread_id config for all HITL workflows.\n",{"type":40,"tag":102,"props":103,"children":104},"hr",{},[],{"type":40,"tag":106,"props":107,"children":109},"h2",{"id":108},"human-in-the-loop",[110],{"type":45,"value":111},"Human-in-the-Loop",{"type":40,"tag":113,"props":114,"children":115},"ex-basic-hitl-setup",{},[116,333],{"type":40,"tag":117,"props":118,"children":119},"python",{},[120,122],{"type":45,"value":121},"\nSet up an agent with HITL middleware that pauses before sending emails for approval.\n",{"type":40,"tag":123,"props":124,"children":128},"pre",{"className":125,"code":126,"language":117,"meta":127,"style":127},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","from langchain.agents import create_agent\nfrom langchain.agents.middleware import HumanInTheLoopMiddleware\nfrom langgraph.checkpoint.memory import MemorySaver\nfrom langchain.tools import tool\n\n@tool\ndef send_email(to: str, subject: str, body: str) -> str:\n    \"\"\"Send an email.\"\"\"\n    return f\"Email sent to {to}\"\n\nagent = create_agent(\n    model=\"gpt-4.1\",\n    tools=[send_email],\n    checkpointer=MemorySaver(),  # Required for HITL\n    middleware=[\n        HumanInTheLoopMiddleware(\n            interrupt_on={\n                \"send_email\": {\"allowed_decisions\": [\"approve\", \"edit\", \"reject\"]},\n            }\n        )\n    ],\n)\n","",[129],{"type":40,"tag":130,"props":131,"children":132},"code",{"__ignoreMap":127},[133,144,153,162,171,181,190,199,208,217,225,234,243,252,261,270,279,288,297,306,315,324],{"type":40,"tag":134,"props":135,"children":138},"span",{"class":136,"line":137},"line",1,[139],{"type":40,"tag":134,"props":140,"children":141},{},[142],{"type":45,"value":143},"from langchain.agents import create_agent\n",{"type":40,"tag":134,"props":145,"children":147},{"class":136,"line":146},2,[148],{"type":40,"tag":134,"props":149,"children":150},{},[151],{"type":45,"value":152},"from langchain.agents.middleware import HumanInTheLoopMiddleware\n",{"type":40,"tag":134,"props":154,"children":156},{"class":136,"line":155},3,[157],{"type":40,"tag":134,"props":158,"children":159},{},[160],{"type":45,"value":161},"from langgraph.checkpoint.memory import MemorySaver\n",{"type":40,"tag":134,"props":163,"children":165},{"class":136,"line":164},4,[166],{"type":40,"tag":134,"props":167,"children":168},{},[169],{"type":45,"value":170},"from langchain.tools import tool\n",{"type":40,"tag":134,"props":172,"children":174},{"class":136,"line":173},5,[175],{"type":40,"tag":134,"props":176,"children":178},{"emptyLinePlaceholder":177},true,[179],{"type":45,"value":180},"\n",{"type":40,"tag":134,"props":182,"children":184},{"class":136,"line":183},6,[185],{"type":40,"tag":134,"props":186,"children":187},{},[188],{"type":45,"value":189},"@tool\n",{"type":40,"tag":134,"props":191,"children":193},{"class":136,"line":192},7,[194],{"type":40,"tag":134,"props":195,"children":196},{},[197],{"type":45,"value":198},"def send_email(to: str, subject: str, body: str) -> str:\n",{"type":40,"tag":134,"props":200,"children":202},{"class":136,"line":201},8,[203],{"type":40,"tag":134,"props":204,"children":205},{},[206],{"type":45,"value":207},"    \"\"\"Send an email.\"\"\"\n",{"type":40,"tag":134,"props":209,"children":211},{"class":136,"line":210},9,[212],{"type":40,"tag":134,"props":213,"children":214},{},[215],{"type":45,"value":216},"    return f\"Email sent to {to}\"\n",{"type":40,"tag":134,"props":218,"children":220},{"class":136,"line":219},10,[221],{"type":40,"tag":134,"props":222,"children":223},{"emptyLinePlaceholder":177},[224],{"type":45,"value":180},{"type":40,"tag":134,"props":226,"children":228},{"class":136,"line":227},11,[229],{"type":40,"tag":134,"props":230,"children":231},{},[232],{"type":45,"value":233},"agent = create_agent(\n",{"type":40,"tag":134,"props":235,"children":237},{"class":136,"line":236},12,[238],{"type":40,"tag":134,"props":239,"children":240},{},[241],{"type":45,"value":242},"    model=\"gpt-4.1\",\n",{"type":40,"tag":134,"props":244,"children":246},{"class":136,"line":245},13,[247],{"type":40,"tag":134,"props":248,"children":249},{},[250],{"type":45,"value":251},"    tools=[send_email],\n",{"type":40,"tag":134,"props":253,"children":255},{"class":136,"line":254},14,[256],{"type":40,"tag":134,"props":257,"children":258},{},[259],{"type":45,"value":260},"    checkpointer=MemorySaver(),  # Required for HITL\n",{"type":40,"tag":134,"props":262,"children":264},{"class":136,"line":263},15,[265],{"type":40,"tag":134,"props":266,"children":267},{},[268],{"type":45,"value":269},"    middleware=[\n",{"type":40,"tag":134,"props":271,"children":273},{"class":136,"line":272},16,[274],{"type":40,"tag":134,"props":275,"children":276},{},[277],{"type":45,"value":278},"        HumanInTheLoopMiddleware(\n",{"type":40,"tag":134,"props":280,"children":282},{"class":136,"line":281},17,[283],{"type":40,"tag":134,"props":284,"children":285},{},[286],{"type":45,"value":287},"            interrupt_on={\n",{"type":40,"tag":134,"props":289,"children":291},{"class":136,"line":290},18,[292],{"type":40,"tag":134,"props":293,"children":294},{},[295],{"type":45,"value":296},"                \"send_email\": {\"allowed_decisions\": [\"approve\", \"edit\", \"reject\"]},\n",{"type":40,"tag":134,"props":298,"children":300},{"class":136,"line":299},19,[301],{"type":40,"tag":134,"props":302,"children":303},{},[304],{"type":45,"value":305},"            }\n",{"type":40,"tag":134,"props":307,"children":309},{"class":136,"line":308},20,[310],{"type":40,"tag":134,"props":311,"children":312},{},[313],{"type":45,"value":314},"        )\n",{"type":40,"tag":134,"props":316,"children":318},{"class":136,"line":317},21,[319],{"type":40,"tag":134,"props":320,"children":321},{},[322],{"type":45,"value":323},"    ],\n",{"type":40,"tag":134,"props":325,"children":327},{"class":136,"line":326},22,[328],{"type":40,"tag":134,"props":329,"children":330},{},[331],{"type":45,"value":332},")\n",{"type":40,"tag":334,"props":335,"children":336},"typescript",{},[337,339],{"type":45,"value":338},"\nSet up an agent with HITL that pauses before sending emails for human approval.\n",{"type":40,"tag":123,"props":340,"children":343},{"className":341,"code":342,"language":334,"meta":127,"style":127},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { createAgent, humanInTheLoopMiddleware } from \"langchain\";\nimport { MemorySaver } from \"@langchain\u002Flanggraph\";\nimport { tool } from \"@langchain\u002Fcore\u002Ftools\";\nimport { z } from \"zod\";\n\nconst sendEmail = tool(\n  async ({ to, subject, body }) => `Email sent to ${to}`,\n  {\n    name: \"send_email\",\n    description: \"Send an email\",\n    schema: z.object({ to: z.string(), subject: z.string(), body: z.string() }),\n  }\n);\n\nconst agent = createAgent({\n  model: \"anthropic:claude-sonnet-4-5\",\n  tools: [sendEmail],\n  checkpointer: new MemorySaver(),\n  middleware: [\n    humanInTheLoopMiddleware({\n      interruptOn: { send_email: { allowedDecisions: [\"approve\", \"edit\", \"reject\"] } },\n    }),\n  ],\n});\n",[344],{"type":40,"tag":130,"props":345,"children":346},{"__ignoreMap":127},[347,408,449,490,531,538,567,644,652,683,712,845,853,864,871,900,929,950,979,996,1012,1116,1132,1145],{"type":40,"tag":134,"props":348,"children":349},{"class":136,"line":137},[350,356,362,368,373,378,383,388,393,398,403],{"type":40,"tag":134,"props":351,"children":353},{"style":352},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[354],{"type":45,"value":355},"import",{"type":40,"tag":134,"props":357,"children":359},{"style":358},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[360],{"type":45,"value":361}," {",{"type":40,"tag":134,"props":363,"children":365},{"style":364},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[366],{"type":45,"value":367}," createAgent",{"type":40,"tag":134,"props":369,"children":370},{"style":358},[371],{"type":45,"value":372},",",{"type":40,"tag":134,"props":374,"children":375},{"style":364},[376],{"type":45,"value":377}," humanInTheLoopMiddleware",{"type":40,"tag":134,"props":379,"children":380},{"style":358},[381],{"type":45,"value":382}," }",{"type":40,"tag":134,"props":384,"children":385},{"style":352},[386],{"type":45,"value":387}," from",{"type":40,"tag":134,"props":389,"children":390},{"style":358},[391],{"type":45,"value":392}," \"",{"type":40,"tag":134,"props":394,"children":396},{"style":395},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[397],{"type":45,"value":8},{"type":40,"tag":134,"props":399,"children":400},{"style":358},[401],{"type":45,"value":402},"\"",{"type":40,"tag":134,"props":404,"children":405},{"style":358},[406],{"type":45,"value":407},";\n",{"type":40,"tag":134,"props":409,"children":410},{"class":136,"line":146},[411,415,419,424,428,432,436,441,445],{"type":40,"tag":134,"props":412,"children":413},{"style":352},[414],{"type":45,"value":355},{"type":40,"tag":134,"props":416,"children":417},{"style":358},[418],{"type":45,"value":361},{"type":40,"tag":134,"props":420,"children":421},{"style":364},[422],{"type":45,"value":423}," MemorySaver",{"type":40,"tag":134,"props":425,"children":426},{"style":358},[427],{"type":45,"value":382},{"type":40,"tag":134,"props":429,"children":430},{"style":352},[431],{"type":45,"value":387},{"type":40,"tag":134,"props":433,"children":434},{"style":358},[435],{"type":45,"value":392},{"type":40,"tag":134,"props":437,"children":438},{"style":395},[439],{"type":45,"value":440},"@langchain\u002Flanggraph",{"type":40,"tag":134,"props":442,"children":443},{"style":358},[444],{"type":45,"value":402},{"type":40,"tag":134,"props":446,"children":447},{"style":358},[448],{"type":45,"value":407},{"type":40,"tag":134,"props":450,"children":451},{"class":136,"line":155},[452,456,460,465,469,473,477,482,486],{"type":40,"tag":134,"props":453,"children":454},{"style":352},[455],{"type":45,"value":355},{"type":40,"tag":134,"props":457,"children":458},{"style":358},[459],{"type":45,"value":361},{"type":40,"tag":134,"props":461,"children":462},{"style":364},[463],{"type":45,"value":464}," tool",{"type":40,"tag":134,"props":466,"children":467},{"style":358},[468],{"type":45,"value":382},{"type":40,"tag":134,"props":470,"children":471},{"style":352},[472],{"type":45,"value":387},{"type":40,"tag":134,"props":474,"children":475},{"style":358},[476],{"type":45,"value":392},{"type":40,"tag":134,"props":478,"children":479},{"style":395},[480],{"type":45,"value":481},"@langchain\u002Fcore\u002Ftools",{"type":40,"tag":134,"props":483,"children":484},{"style":358},[485],{"type":45,"value":402},{"type":40,"tag":134,"props":487,"children":488},{"style":358},[489],{"type":45,"value":407},{"type":40,"tag":134,"props":491,"children":492},{"class":136,"line":164},[493,497,501,506,510,514,518,523,527],{"type":40,"tag":134,"props":494,"children":495},{"style":352},[496],{"type":45,"value":355},{"type":40,"tag":134,"props":498,"children":499},{"style":358},[500],{"type":45,"value":361},{"type":40,"tag":134,"props":502,"children":503},{"style":364},[504],{"type":45,"value":505}," z",{"type":40,"tag":134,"props":507,"children":508},{"style":358},[509],{"type":45,"value":382},{"type":40,"tag":134,"props":511,"children":512},{"style":352},[513],{"type":45,"value":387},{"type":40,"tag":134,"props":515,"children":516},{"style":358},[517],{"type":45,"value":392},{"type":40,"tag":134,"props":519,"children":520},{"style":395},[521],{"type":45,"value":522},"zod",{"type":40,"tag":134,"props":524,"children":525},{"style":358},[526],{"type":45,"value":402},{"type":40,"tag":134,"props":528,"children":529},{"style":358},[530],{"type":45,"value":407},{"type":40,"tag":134,"props":532,"children":533},{"class":136,"line":173},[534],{"type":40,"tag":134,"props":535,"children":536},{"emptyLinePlaceholder":177},[537],{"type":45,"value":180},{"type":40,"tag":134,"props":539,"children":540},{"class":136,"line":183},[541,547,552,557,562],{"type":40,"tag":134,"props":542,"children":544},{"style":543},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[545],{"type":45,"value":546},"const",{"type":40,"tag":134,"props":548,"children":549},{"style":364},[550],{"type":45,"value":551}," sendEmail ",{"type":40,"tag":134,"props":553,"children":554},{"style":358},[555],{"type":45,"value":556},"=",{"type":40,"tag":134,"props":558,"children":560},{"style":559},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[561],{"type":45,"value":464},{"type":40,"tag":134,"props":563,"children":564},{"style":364},[565],{"type":45,"value":566},"(\n",{"type":40,"tag":134,"props":568,"children":569},{"class":136,"line":192},[570,575,580,586,590,595,599,604,609,614,619,624,629,634,639],{"type":40,"tag":134,"props":571,"children":572},{"style":543},[573],{"type":45,"value":574},"  async",{"type":40,"tag":134,"props":576,"children":577},{"style":358},[578],{"type":45,"value":579}," ({",{"type":40,"tag":134,"props":581,"children":583},{"style":582},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[584],{"type":45,"value":585}," to",{"type":40,"tag":134,"props":587,"children":588},{"style":358},[589],{"type":45,"value":372},{"type":40,"tag":134,"props":591,"children":592},{"style":582},[593],{"type":45,"value":594}," subject",{"type":40,"tag":134,"props":596,"children":597},{"style":358},[598],{"type":45,"value":372},{"type":40,"tag":134,"props":600,"children":601},{"style":582},[602],{"type":45,"value":603}," body",{"type":40,"tag":134,"props":605,"children":606},{"style":358},[607],{"type":45,"value":608}," })",{"type":40,"tag":134,"props":610,"children":611},{"style":543},[612],{"type":45,"value":613}," =>",{"type":40,"tag":134,"props":615,"children":616},{"style":358},[617],{"type":45,"value":618}," `",{"type":40,"tag":134,"props":620,"children":621},{"style":395},[622],{"type":45,"value":623},"Email sent to ",{"type":40,"tag":134,"props":625,"children":626},{"style":358},[627],{"type":45,"value":628},"${",{"type":40,"tag":134,"props":630,"children":631},{"style":364},[632],{"type":45,"value":633},"to",{"type":40,"tag":134,"props":635,"children":636},{"style":358},[637],{"type":45,"value":638},"}`",{"type":40,"tag":134,"props":640,"children":641},{"style":358},[642],{"type":45,"value":643},",\n",{"type":40,"tag":134,"props":645,"children":646},{"class":136,"line":201},[647],{"type":40,"tag":134,"props":648,"children":649},{"style":358},[650],{"type":45,"value":651},"  {\n",{"type":40,"tag":134,"props":653,"children":654},{"class":136,"line":210},[655,661,666,670,675,679],{"type":40,"tag":134,"props":656,"children":658},{"style":657},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[659],{"type":45,"value":660},"    name",{"type":40,"tag":134,"props":662,"children":663},{"style":358},[664],{"type":45,"value":665},":",{"type":40,"tag":134,"props":667,"children":668},{"style":358},[669],{"type":45,"value":392},{"type":40,"tag":134,"props":671,"children":672},{"style":395},[673],{"type":45,"value":674},"send_email",{"type":40,"tag":134,"props":676,"children":677},{"style":358},[678],{"type":45,"value":402},{"type":40,"tag":134,"props":680,"children":681},{"style":358},[682],{"type":45,"value":643},{"type":40,"tag":134,"props":684,"children":685},{"class":136,"line":219},[686,691,695,699,704,708],{"type":40,"tag":134,"props":687,"children":688},{"style":657},[689],{"type":45,"value":690},"    description",{"type":40,"tag":134,"props":692,"children":693},{"style":358},[694],{"type":45,"value":665},{"type":40,"tag":134,"props":696,"children":697},{"style":358},[698],{"type":45,"value":392},{"type":40,"tag":134,"props":700,"children":701},{"style":395},[702],{"type":45,"value":703},"Send an email",{"type":40,"tag":134,"props":705,"children":706},{"style":358},[707],{"type":45,"value":402},{"type":40,"tag":134,"props":709,"children":710},{"style":358},[711],{"type":45,"value":643},{"type":40,"tag":134,"props":713,"children":714},{"class":136,"line":227},[715,720,724,728,733,738,743,748,752,756,760,764,769,774,778,782,786,790,794,798,802,806,810,814,818,822,826,831,836,841],{"type":40,"tag":134,"props":716,"children":717},{"style":657},[718],{"type":45,"value":719},"    schema",{"type":40,"tag":134,"props":721,"children":722},{"style":358},[723],{"type":45,"value":665},{"type":40,"tag":134,"props":725,"children":726},{"style":364},[727],{"type":45,"value":505},{"type":40,"tag":134,"props":729,"children":730},{"style":358},[731],{"type":45,"value":732},".",{"type":40,"tag":134,"props":734,"children":735},{"style":559},[736],{"type":45,"value":737},"object",{"type":40,"tag":134,"props":739,"children":740},{"style":364},[741],{"type":45,"value":742},"(",{"type":40,"tag":134,"props":744,"children":745},{"style":358},[746],{"type":45,"value":747},"{",{"type":40,"tag":134,"props":749,"children":750},{"style":657},[751],{"type":45,"value":585},{"type":40,"tag":134,"props":753,"children":754},{"style":358},[755],{"type":45,"value":665},{"type":40,"tag":134,"props":757,"children":758},{"style":364},[759],{"type":45,"value":505},{"type":40,"tag":134,"props":761,"children":762},{"style":358},[763],{"type":45,"value":732},{"type":40,"tag":134,"props":765,"children":766},{"style":559},[767],{"type":45,"value":768},"string",{"type":40,"tag":134,"props":770,"children":771},{"style":364},[772],{"type":45,"value":773},"()",{"type":40,"tag":134,"props":775,"children":776},{"style":358},[777],{"type":45,"value":372},{"type":40,"tag":134,"props":779,"children":780},{"style":657},[781],{"type":45,"value":594},{"type":40,"tag":134,"props":783,"children":784},{"style":358},[785],{"type":45,"value":665},{"type":40,"tag":134,"props":787,"children":788},{"style":364},[789],{"type":45,"value":505},{"type":40,"tag":134,"props":791,"children":792},{"style":358},[793],{"type":45,"value":732},{"type":40,"tag":134,"props":795,"children":796},{"style":559},[797],{"type":45,"value":768},{"type":40,"tag":134,"props":799,"children":800},{"style":364},[801],{"type":45,"value":773},{"type":40,"tag":134,"props":803,"children":804},{"style":358},[805],{"type":45,"value":372},{"type":40,"tag":134,"props":807,"children":808},{"style":657},[809],{"type":45,"value":603},{"type":40,"tag":134,"props":811,"children":812},{"style":358},[813],{"type":45,"value":665},{"type":40,"tag":134,"props":815,"children":816},{"style":364},[817],{"type":45,"value":505},{"type":40,"tag":134,"props":819,"children":820},{"style":358},[821],{"type":45,"value":732},{"type":40,"tag":134,"props":823,"children":824},{"style":559},[825],{"type":45,"value":768},{"type":40,"tag":134,"props":827,"children":828},{"style":364},[829],{"type":45,"value":830},"() ",{"type":40,"tag":134,"props":832,"children":833},{"style":358},[834],{"type":45,"value":835},"}",{"type":40,"tag":134,"props":837,"children":838},{"style":364},[839],{"type":45,"value":840},")",{"type":40,"tag":134,"props":842,"children":843},{"style":358},[844],{"type":45,"value":643},{"type":40,"tag":134,"props":846,"children":847},{"class":136,"line":236},[848],{"type":40,"tag":134,"props":849,"children":850},{"style":358},[851],{"type":45,"value":852},"  }\n",{"type":40,"tag":134,"props":854,"children":855},{"class":136,"line":245},[856,860],{"type":40,"tag":134,"props":857,"children":858},{"style":364},[859],{"type":45,"value":840},{"type":40,"tag":134,"props":861,"children":862},{"style":358},[863],{"type":45,"value":407},{"type":40,"tag":134,"props":865,"children":866},{"class":136,"line":254},[867],{"type":40,"tag":134,"props":868,"children":869},{"emptyLinePlaceholder":177},[870],{"type":45,"value":180},{"type":40,"tag":134,"props":872,"children":873},{"class":136,"line":263},[874,878,883,887,891,895],{"type":40,"tag":134,"props":875,"children":876},{"style":543},[877],{"type":45,"value":546},{"type":40,"tag":134,"props":879,"children":880},{"style":364},[881],{"type":45,"value":882}," agent ",{"type":40,"tag":134,"props":884,"children":885},{"style":358},[886],{"type":45,"value":556},{"type":40,"tag":134,"props":888,"children":889},{"style":559},[890],{"type":45,"value":367},{"type":40,"tag":134,"props":892,"children":893},{"style":364},[894],{"type":45,"value":742},{"type":40,"tag":134,"props":896,"children":897},{"style":358},[898],{"type":45,"value":899},"{\n",{"type":40,"tag":134,"props":901,"children":902},{"class":136,"line":272},[903,908,912,916,921,925],{"type":40,"tag":134,"props":904,"children":905},{"style":657},[906],{"type":45,"value":907},"  model",{"type":40,"tag":134,"props":909,"children":910},{"style":358},[911],{"type":45,"value":665},{"type":40,"tag":134,"props":913,"children":914},{"style":358},[915],{"type":45,"value":392},{"type":40,"tag":134,"props":917,"children":918},{"style":395},[919],{"type":45,"value":920},"anthropic:claude-sonnet-4-5",{"type":40,"tag":134,"props":922,"children":923},{"style":358},[924],{"type":45,"value":402},{"type":40,"tag":134,"props":926,"children":927},{"style":358},[928],{"type":45,"value":643},{"type":40,"tag":134,"props":930,"children":931},{"class":136,"line":281},[932,937,941,946],{"type":40,"tag":134,"props":933,"children":934},{"style":657},[935],{"type":45,"value":936},"  tools",{"type":40,"tag":134,"props":938,"children":939},{"style":358},[940],{"type":45,"value":665},{"type":40,"tag":134,"props":942,"children":943},{"style":364},[944],{"type":45,"value":945}," [sendEmail]",{"type":40,"tag":134,"props":947,"children":948},{"style":358},[949],{"type":45,"value":643},{"type":40,"tag":134,"props":951,"children":952},{"class":136,"line":290},[953,958,962,967,971,975],{"type":40,"tag":134,"props":954,"children":955},{"style":657},[956],{"type":45,"value":957},"  checkpointer",{"type":40,"tag":134,"props":959,"children":960},{"style":358},[961],{"type":45,"value":665},{"type":40,"tag":134,"props":963,"children":964},{"style":358},[965],{"type":45,"value":966}," new",{"type":40,"tag":134,"props":968,"children":969},{"style":559},[970],{"type":45,"value":423},{"type":40,"tag":134,"props":972,"children":973},{"style":364},[974],{"type":45,"value":773},{"type":40,"tag":134,"props":976,"children":977},{"style":358},[978],{"type":45,"value":643},{"type":40,"tag":134,"props":980,"children":981},{"class":136,"line":299},[982,987,991],{"type":40,"tag":134,"props":983,"children":984},{"style":657},[985],{"type":45,"value":986},"  middleware",{"type":40,"tag":134,"props":988,"children":989},{"style":358},[990],{"type":45,"value":665},{"type":40,"tag":134,"props":992,"children":993},{"style":364},[994],{"type":45,"value":995}," [\n",{"type":40,"tag":134,"props":997,"children":998},{"class":136,"line":308},[999,1004,1008],{"type":40,"tag":134,"props":1000,"children":1001},{"style":559},[1002],{"type":45,"value":1003},"    humanInTheLoopMiddleware",{"type":40,"tag":134,"props":1005,"children":1006},{"style":364},[1007],{"type":45,"value":742},{"type":40,"tag":134,"props":1009,"children":1010},{"style":358},[1011],{"type":45,"value":899},{"type":40,"tag":134,"props":1013,"children":1014},{"class":136,"line":317},[1015,1020,1024,1028,1033,1037,1041,1046,1050,1055,1059,1064,1068,1072,1076,1081,1085,1089,1093,1098,1102,1107,1111],{"type":40,"tag":134,"props":1016,"children":1017},{"style":657},[1018],{"type":45,"value":1019},"      interruptOn",{"type":40,"tag":134,"props":1021,"children":1022},{"style":358},[1023],{"type":45,"value":665},{"type":40,"tag":134,"props":1025,"children":1026},{"style":358},[1027],{"type":45,"value":361},{"type":40,"tag":134,"props":1029,"children":1030},{"style":657},[1031],{"type":45,"value":1032}," send_email",{"type":40,"tag":134,"props":1034,"children":1035},{"style":358},[1036],{"type":45,"value":665},{"type":40,"tag":134,"props":1038,"children":1039},{"style":358},[1040],{"type":45,"value":361},{"type":40,"tag":134,"props":1042,"children":1043},{"style":657},[1044],{"type":45,"value":1045}," allowedDecisions",{"type":40,"tag":134,"props":1047,"children":1048},{"style":358},[1049],{"type":45,"value":665},{"type":40,"tag":134,"props":1051,"children":1052},{"style":364},[1053],{"type":45,"value":1054}," [",{"type":40,"tag":134,"props":1056,"children":1057},{"style":358},[1058],{"type":45,"value":402},{"type":40,"tag":134,"props":1060,"children":1061},{"style":395},[1062],{"type":45,"value":1063},"approve",{"type":40,"tag":134,"props":1065,"children":1066},{"style":358},[1067],{"type":45,"value":402},{"type":40,"tag":134,"props":1069,"children":1070},{"style":358},[1071],{"type":45,"value":372},{"type":40,"tag":134,"props":1073,"children":1074},{"style":358},[1075],{"type":45,"value":392},{"type":40,"tag":134,"props":1077,"children":1078},{"style":395},[1079],{"type":45,"value":1080},"edit",{"type":40,"tag":134,"props":1082,"children":1083},{"style":358},[1084],{"type":45,"value":402},{"type":40,"tag":134,"props":1086,"children":1087},{"style":358},[1088],{"type":45,"value":372},{"type":40,"tag":134,"props":1090,"children":1091},{"style":358},[1092],{"type":45,"value":392},{"type":40,"tag":134,"props":1094,"children":1095},{"style":395},[1096],{"type":45,"value":1097},"reject",{"type":40,"tag":134,"props":1099,"children":1100},{"style":358},[1101],{"type":45,"value":402},{"type":40,"tag":134,"props":1103,"children":1104},{"style":364},[1105],{"type":45,"value":1106},"] ",{"type":40,"tag":134,"props":1108,"children":1109},{"style":358},[1110],{"type":45,"value":835},{"type":40,"tag":134,"props":1112,"children":1113},{"style":358},[1114],{"type":45,"value":1115}," },\n",{"type":40,"tag":134,"props":1117,"children":1118},{"class":136,"line":326},[1119,1124,1128],{"type":40,"tag":134,"props":1120,"children":1121},{"style":358},[1122],{"type":45,"value":1123},"    }",{"type":40,"tag":134,"props":1125,"children":1126},{"style":364},[1127],{"type":45,"value":840},{"type":40,"tag":134,"props":1129,"children":1130},{"style":358},[1131],{"type":45,"value":643},{"type":40,"tag":134,"props":1133,"children":1135},{"class":136,"line":1134},23,[1136,1141],{"type":40,"tag":134,"props":1137,"children":1138},{"style":364},[1139],{"type":45,"value":1140},"  ]",{"type":40,"tag":134,"props":1142,"children":1143},{"style":358},[1144],{"type":45,"value":643},{"type":40,"tag":134,"props":1146,"children":1148},{"class":136,"line":1147},24,[1149,1153,1157],{"type":40,"tag":134,"props":1150,"children":1151},{"style":358},[1152],{"type":45,"value":835},{"type":40,"tag":134,"props":1154,"children":1155},{"style":364},[1156],{"type":45,"value":840},{"type":40,"tag":134,"props":1158,"children":1159},{"style":358},[1160],{"type":45,"value":407},{"type":40,"tag":1162,"props":1163,"children":1164},"ex-running-with-interrupts",{},[1165,1316],{"type":40,"tag":117,"props":1166,"children":1167},{},[1168,1170],{"type":45,"value":1169},"\nRun the agent, detect an interrupt, then resume execution after human approval.\n",{"type":40,"tag":123,"props":1171,"children":1173},{"className":125,"code":1172,"language":117,"meta":127,"style":127},"from langgraph.types import Command\n\nconfig = {\"configurable\": {\"thread_id\": \"session-1\"}}\n\n# Step 1: Agent runs until it needs to call tool\nresult1 = agent.invoke({\n    \"messages\": [{\"role\": \"user\", \"content\": \"Send email to john@example.com\"}]\n}, config=config)\n\n# Check for interrupt\nif \"__interrupt__\" in result1:\n    print(f\"Waiting for approval: {result1['__interrupt__']}\")\n\n# Step 2: Human approves\nresult2 = agent.invoke(\n    Command(resume={\"decisions\": [{\"type\": \"approve\"}]}),\n    config=config\n)\n",[1174],{"type":40,"tag":130,"props":1175,"children":1176},{"__ignoreMap":127},[1177,1185,1192,1200,1207,1215,1223,1231,1239,1246,1254,1262,1270,1277,1285,1293,1301,1309],{"type":40,"tag":134,"props":1178,"children":1179},{"class":136,"line":137},[1180],{"type":40,"tag":134,"props":1181,"children":1182},{},[1183],{"type":45,"value":1184},"from langgraph.types import Command\n",{"type":40,"tag":134,"props":1186,"children":1187},{"class":136,"line":146},[1188],{"type":40,"tag":134,"props":1189,"children":1190},{"emptyLinePlaceholder":177},[1191],{"type":45,"value":180},{"type":40,"tag":134,"props":1193,"children":1194},{"class":136,"line":155},[1195],{"type":40,"tag":134,"props":1196,"children":1197},{},[1198],{"type":45,"value":1199},"config = {\"configurable\": {\"thread_id\": \"session-1\"}}\n",{"type":40,"tag":134,"props":1201,"children":1202},{"class":136,"line":164},[1203],{"type":40,"tag":134,"props":1204,"children":1205},{"emptyLinePlaceholder":177},[1206],{"type":45,"value":180},{"type":40,"tag":134,"props":1208,"children":1209},{"class":136,"line":173},[1210],{"type":40,"tag":134,"props":1211,"children":1212},{},[1213],{"type":45,"value":1214},"# Step 1: Agent runs until it needs to call tool\n",{"type":40,"tag":134,"props":1216,"children":1217},{"class":136,"line":183},[1218],{"type":40,"tag":134,"props":1219,"children":1220},{},[1221],{"type":45,"value":1222},"result1 = agent.invoke({\n",{"type":40,"tag":134,"props":1224,"children":1225},{"class":136,"line":192},[1226],{"type":40,"tag":134,"props":1227,"children":1228},{},[1229],{"type":45,"value":1230},"    \"messages\": [{\"role\": \"user\", \"content\": \"Send email to john@example.com\"}]\n",{"type":40,"tag":134,"props":1232,"children":1233},{"class":136,"line":201},[1234],{"type":40,"tag":134,"props":1235,"children":1236},{},[1237],{"type":45,"value":1238},"}, config=config)\n",{"type":40,"tag":134,"props":1240,"children":1241},{"class":136,"line":210},[1242],{"type":40,"tag":134,"props":1243,"children":1244},{"emptyLinePlaceholder":177},[1245],{"type":45,"value":180},{"type":40,"tag":134,"props":1247,"children":1248},{"class":136,"line":219},[1249],{"type":40,"tag":134,"props":1250,"children":1251},{},[1252],{"type":45,"value":1253},"# Check for interrupt\n",{"type":40,"tag":134,"props":1255,"children":1256},{"class":136,"line":227},[1257],{"type":40,"tag":134,"props":1258,"children":1259},{},[1260],{"type":45,"value":1261},"if \"__interrupt__\" in result1:\n",{"type":40,"tag":134,"props":1263,"children":1264},{"class":136,"line":236},[1265],{"type":40,"tag":134,"props":1266,"children":1267},{},[1268],{"type":45,"value":1269},"    print(f\"Waiting for approval: {result1['__interrupt__']}\")\n",{"type":40,"tag":134,"props":1271,"children":1272},{"class":136,"line":245},[1273],{"type":40,"tag":134,"props":1274,"children":1275},{"emptyLinePlaceholder":177},[1276],{"type":45,"value":180},{"type":40,"tag":134,"props":1278,"children":1279},{"class":136,"line":254},[1280],{"type":40,"tag":134,"props":1281,"children":1282},{},[1283],{"type":45,"value":1284},"# Step 2: Human approves\n",{"type":40,"tag":134,"props":1286,"children":1287},{"class":136,"line":263},[1288],{"type":40,"tag":134,"props":1289,"children":1290},{},[1291],{"type":45,"value":1292},"result2 = agent.invoke(\n",{"type":40,"tag":134,"props":1294,"children":1295},{"class":136,"line":272},[1296],{"type":40,"tag":134,"props":1297,"children":1298},{},[1299],{"type":45,"value":1300},"    Command(resume={\"decisions\": [{\"type\": \"approve\"}]}),\n",{"type":40,"tag":134,"props":1302,"children":1303},{"class":136,"line":281},[1304],{"type":40,"tag":134,"props":1305,"children":1306},{},[1307],{"type":45,"value":1308},"    config=config\n",{"type":40,"tag":134,"props":1310,"children":1311},{"class":136,"line":290},[1312],{"type":40,"tag":134,"props":1313,"children":1314},{},[1315],{"type":45,"value":332},{"type":40,"tag":334,"props":1317,"children":1318},{},[1319,1320],{"type":45,"value":1169},{"type":40,"tag":123,"props":1321,"children":1323},{"className":341,"code":1322,"language":334,"meta":127,"style":127},"import { Command } from \"@langchain\u002Flanggraph\";\n\nconst config = { configurable: { thread_id: \"session-1\" } };\n\n\u002F\u002F Step 1: Agent runs until it needs to call tool\nconst result1 = await agent.invoke({\n  messages: [{ role: \"user\", content: \"Send email to john@example.com\" }]\n}, config);\n\n\u002F\u002F Check for interrupt\nif (result1.__interrupt__) {\n  console.log(`Waiting for approval: ${result1.__interrupt__}`);\n}\n\n\u002F\u002F Step 2: Human approves\nconst result2 = await agent.invoke(\n  new Command({ resume: { decisions: [{ type: \"approve\" }] } }),\n  config\n);\n",[1324],{"type":40,"tag":130,"props":1325,"children":1326},{"__ignoreMap":127},[1327,1367,1374,1438,1445,1454,1497,1574,1591,1598,1606,1632,1693,1701,1708,1716,1752,1847,1855],{"type":40,"tag":134,"props":1328,"children":1329},{"class":136,"line":137},[1330,1334,1338,1343,1347,1351,1355,1359,1363],{"type":40,"tag":134,"props":1331,"children":1332},{"style":352},[1333],{"type":45,"value":355},{"type":40,"tag":134,"props":1335,"children":1336},{"style":358},[1337],{"type":45,"value":361},{"type":40,"tag":134,"props":1339,"children":1340},{"style":364},[1341],{"type":45,"value":1342}," Command",{"type":40,"tag":134,"props":1344,"children":1345},{"style":358},[1346],{"type":45,"value":382},{"type":40,"tag":134,"props":1348,"children":1349},{"style":352},[1350],{"type":45,"value":387},{"type":40,"tag":134,"props":1352,"children":1353},{"style":358},[1354],{"type":45,"value":392},{"type":40,"tag":134,"props":1356,"children":1357},{"style":395},[1358],{"type":45,"value":440},{"type":40,"tag":134,"props":1360,"children":1361},{"style":358},[1362],{"type":45,"value":402},{"type":40,"tag":134,"props":1364,"children":1365},{"style":358},[1366],{"type":45,"value":407},{"type":40,"tag":134,"props":1368,"children":1369},{"class":136,"line":146},[1370],{"type":40,"tag":134,"props":1371,"children":1372},{"emptyLinePlaceholder":177},[1373],{"type":45,"value":180},{"type":40,"tag":134,"props":1375,"children":1376},{"class":136,"line":155},[1377,1381,1386,1390,1394,1399,1403,1407,1412,1416,1420,1425,1429,1433],{"type":40,"tag":134,"props":1378,"children":1379},{"style":543},[1380],{"type":45,"value":546},{"type":40,"tag":134,"props":1382,"children":1383},{"style":364},[1384],{"type":45,"value":1385}," config ",{"type":40,"tag":134,"props":1387,"children":1388},{"style":358},[1389],{"type":45,"value":556},{"type":40,"tag":134,"props":1391,"children":1392},{"style":358},[1393],{"type":45,"value":361},{"type":40,"tag":134,"props":1395,"children":1396},{"style":657},[1397],{"type":45,"value":1398}," configurable",{"type":40,"tag":134,"props":1400,"children":1401},{"style":358},[1402],{"type":45,"value":665},{"type":40,"tag":134,"props":1404,"children":1405},{"style":358},[1406],{"type":45,"value":361},{"type":40,"tag":134,"props":1408,"children":1409},{"style":657},[1410],{"type":45,"value":1411}," thread_id",{"type":40,"tag":134,"props":1413,"children":1414},{"style":358},[1415],{"type":45,"value":665},{"type":40,"tag":134,"props":1417,"children":1418},{"style":358},[1419],{"type":45,"value":392},{"type":40,"tag":134,"props":1421,"children":1422},{"style":395},[1423],{"type":45,"value":1424},"session-1",{"type":40,"tag":134,"props":1426,"children":1427},{"style":358},[1428],{"type":45,"value":402},{"type":40,"tag":134,"props":1430,"children":1431},{"style":358},[1432],{"type":45,"value":382},{"type":40,"tag":134,"props":1434,"children":1435},{"style":358},[1436],{"type":45,"value":1437}," };\n",{"type":40,"tag":134,"props":1439,"children":1440},{"class":136,"line":164},[1441],{"type":40,"tag":134,"props":1442,"children":1443},{"emptyLinePlaceholder":177},[1444],{"type":45,"value":180},{"type":40,"tag":134,"props":1446,"children":1447},{"class":136,"line":173},[1448],{"type":40,"tag":134,"props":1449,"children":1451},{"style":1450},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[1452],{"type":45,"value":1453},"\u002F\u002F Step 1: Agent runs until it needs to call tool\n",{"type":40,"tag":134,"props":1455,"children":1456},{"class":136,"line":183},[1457,1461,1466,1470,1475,1480,1484,1489,1493],{"type":40,"tag":134,"props":1458,"children":1459},{"style":543},[1460],{"type":45,"value":546},{"type":40,"tag":134,"props":1462,"children":1463},{"style":364},[1464],{"type":45,"value":1465}," result1 ",{"type":40,"tag":134,"props":1467,"children":1468},{"style":358},[1469],{"type":45,"value":556},{"type":40,"tag":134,"props":1471,"children":1472},{"style":352},[1473],{"type":45,"value":1474}," await",{"type":40,"tag":134,"props":1476,"children":1477},{"style":364},[1478],{"type":45,"value":1479}," agent",{"type":40,"tag":134,"props":1481,"children":1482},{"style":358},[1483],{"type":45,"value":732},{"type":40,"tag":134,"props":1485,"children":1486},{"style":559},[1487],{"type":45,"value":1488},"invoke",{"type":40,"tag":134,"props":1490,"children":1491},{"style":364},[1492],{"type":45,"value":742},{"type":40,"tag":134,"props":1494,"children":1495},{"style":358},[1496],{"type":45,"value":899},{"type":40,"tag":134,"props":1498,"children":1499},{"class":136,"line":192},[1500,1505,1509,1513,1517,1522,1526,1530,1535,1539,1543,1548,1552,1556,1561,1565,1569],{"type":40,"tag":134,"props":1501,"children":1502},{"style":657},[1503],{"type":45,"value":1504},"  messages",{"type":40,"tag":134,"props":1506,"children":1507},{"style":358},[1508],{"type":45,"value":665},{"type":40,"tag":134,"props":1510,"children":1511},{"style":364},[1512],{"type":45,"value":1054},{"type":40,"tag":134,"props":1514,"children":1515},{"style":358},[1516],{"type":45,"value":747},{"type":40,"tag":134,"props":1518,"children":1519},{"style":657},[1520],{"type":45,"value":1521}," role",{"type":40,"tag":134,"props":1523,"children":1524},{"style":358},[1525],{"type":45,"value":665},{"type":40,"tag":134,"props":1527,"children":1528},{"style":358},[1529],{"type":45,"value":392},{"type":40,"tag":134,"props":1531,"children":1532},{"style":395},[1533],{"type":45,"value":1534},"user",{"type":40,"tag":134,"props":1536,"children":1537},{"style":358},[1538],{"type":45,"value":402},{"type":40,"tag":134,"props":1540,"children":1541},{"style":358},[1542],{"type":45,"value":372},{"type":40,"tag":134,"props":1544,"children":1545},{"style":657},[1546],{"type":45,"value":1547}," content",{"type":40,"tag":134,"props":1549,"children":1550},{"style":358},[1551],{"type":45,"value":665},{"type":40,"tag":134,"props":1553,"children":1554},{"style":358},[1555],{"type":45,"value":392},{"type":40,"tag":134,"props":1557,"children":1558},{"style":395},[1559],{"type":45,"value":1560},"Send email to john@example.com",{"type":40,"tag":134,"props":1562,"children":1563},{"style":358},[1564],{"type":45,"value":402},{"type":40,"tag":134,"props":1566,"children":1567},{"style":358},[1568],{"type":45,"value":382},{"type":40,"tag":134,"props":1570,"children":1571},{"style":364},[1572],{"type":45,"value":1573},"]\n",{"type":40,"tag":134,"props":1575,"children":1576},{"class":136,"line":201},[1577,1582,1587],{"type":40,"tag":134,"props":1578,"children":1579},{"style":358},[1580],{"type":45,"value":1581},"},",{"type":40,"tag":134,"props":1583,"children":1584},{"style":364},[1585],{"type":45,"value":1586}," config)",{"type":40,"tag":134,"props":1588,"children":1589},{"style":358},[1590],{"type":45,"value":407},{"type":40,"tag":134,"props":1592,"children":1593},{"class":136,"line":210},[1594],{"type":40,"tag":134,"props":1595,"children":1596},{"emptyLinePlaceholder":177},[1597],{"type":45,"value":180},{"type":40,"tag":134,"props":1599,"children":1600},{"class":136,"line":219},[1601],{"type":40,"tag":134,"props":1602,"children":1603},{"style":1450},[1604],{"type":45,"value":1605},"\u002F\u002F Check for interrupt\n",{"type":40,"tag":134,"props":1607,"children":1608},{"class":136,"line":227},[1609,1614,1619,1623,1628],{"type":40,"tag":134,"props":1610,"children":1611},{"style":352},[1612],{"type":45,"value":1613},"if",{"type":40,"tag":134,"props":1615,"children":1616},{"style":364},[1617],{"type":45,"value":1618}," (result1",{"type":40,"tag":134,"props":1620,"children":1621},{"style":358},[1622],{"type":45,"value":732},{"type":40,"tag":134,"props":1624,"children":1625},{"style":364},[1626],{"type":45,"value":1627},"__interrupt__) ",{"type":40,"tag":134,"props":1629,"children":1630},{"style":358},[1631],{"type":45,"value":899},{"type":40,"tag":134,"props":1633,"children":1634},{"class":136,"line":236},[1635,1640,1644,1649,1653,1658,1663,1667,1672,1676,1681,1685,1689],{"type":40,"tag":134,"props":1636,"children":1637},{"style":364},[1638],{"type":45,"value":1639},"  console",{"type":40,"tag":134,"props":1641,"children":1642},{"style":358},[1643],{"type":45,"value":732},{"type":40,"tag":134,"props":1645,"children":1646},{"style":559},[1647],{"type":45,"value":1648},"log",{"type":40,"tag":134,"props":1650,"children":1651},{"style":657},[1652],{"type":45,"value":742},{"type":40,"tag":134,"props":1654,"children":1655},{"style":358},[1656],{"type":45,"value":1657},"`",{"type":40,"tag":134,"props":1659,"children":1660},{"style":395},[1661],{"type":45,"value":1662},"Waiting for approval: ",{"type":40,"tag":134,"props":1664,"children":1665},{"style":358},[1666],{"type":45,"value":628},{"type":40,"tag":134,"props":1668,"children":1669},{"style":364},[1670],{"type":45,"value":1671},"result1",{"type":40,"tag":134,"props":1673,"children":1674},{"style":358},[1675],{"type":45,"value":732},{"type":40,"tag":134,"props":1677,"children":1678},{"style":364},[1679],{"type":45,"value":1680},"__interrupt__",{"type":40,"tag":134,"props":1682,"children":1683},{"style":358},[1684],{"type":45,"value":638},{"type":40,"tag":134,"props":1686,"children":1687},{"style":657},[1688],{"type":45,"value":840},{"type":40,"tag":134,"props":1690,"children":1691},{"style":358},[1692],{"type":45,"value":407},{"type":40,"tag":134,"props":1694,"children":1695},{"class":136,"line":245},[1696],{"type":40,"tag":134,"props":1697,"children":1698},{"style":358},[1699],{"type":45,"value":1700},"}\n",{"type":40,"tag":134,"props":1702,"children":1703},{"class":136,"line":254},[1704],{"type":40,"tag":134,"props":1705,"children":1706},{"emptyLinePlaceholder":177},[1707],{"type":45,"value":180},{"type":40,"tag":134,"props":1709,"children":1710},{"class":136,"line":263},[1711],{"type":40,"tag":134,"props":1712,"children":1713},{"style":1450},[1714],{"type":45,"value":1715},"\u002F\u002F Step 2: Human approves\n",{"type":40,"tag":134,"props":1717,"children":1718},{"class":136,"line":272},[1719,1723,1728,1732,1736,1740,1744,1748],{"type":40,"tag":134,"props":1720,"children":1721},{"style":543},[1722],{"type":45,"value":546},{"type":40,"tag":134,"props":1724,"children":1725},{"style":364},[1726],{"type":45,"value":1727}," result2 ",{"type":40,"tag":134,"props":1729,"children":1730},{"style":358},[1731],{"type":45,"value":556},{"type":40,"tag":134,"props":1733,"children":1734},{"style":352},[1735],{"type":45,"value":1474},{"type":40,"tag":134,"props":1737,"children":1738},{"style":364},[1739],{"type":45,"value":1479},{"type":40,"tag":134,"props":1741,"children":1742},{"style":358},[1743],{"type":45,"value":732},{"type":40,"tag":134,"props":1745,"children":1746},{"style":559},[1747],{"type":45,"value":1488},{"type":40,"tag":134,"props":1749,"children":1750},{"style":364},[1751],{"type":45,"value":566},{"type":40,"tag":134,"props":1753,"children":1754},{"class":136,"line":281},[1755,1760,1764,1768,1772,1777,1781,1785,1790,1794,1798,1802,1807,1811,1815,1819,1823,1827,1831,1835,1839,1843],{"type":40,"tag":134,"props":1756,"children":1757},{"style":358},[1758],{"type":45,"value":1759},"  new",{"type":40,"tag":134,"props":1761,"children":1762},{"style":559},[1763],{"type":45,"value":1342},{"type":40,"tag":134,"props":1765,"children":1766},{"style":364},[1767],{"type":45,"value":742},{"type":40,"tag":134,"props":1769,"children":1770},{"style":358},[1771],{"type":45,"value":747},{"type":40,"tag":134,"props":1773,"children":1774},{"style":657},[1775],{"type":45,"value":1776}," resume",{"type":40,"tag":134,"props":1778,"children":1779},{"style":358},[1780],{"type":45,"value":665},{"type":40,"tag":134,"props":1782,"children":1783},{"style":358},[1784],{"type":45,"value":361},{"type":40,"tag":134,"props":1786,"children":1787},{"style":657},[1788],{"type":45,"value":1789}," decisions",{"type":40,"tag":134,"props":1791,"children":1792},{"style":358},[1793],{"type":45,"value":665},{"type":40,"tag":134,"props":1795,"children":1796},{"style":364},[1797],{"type":45,"value":1054},{"type":40,"tag":134,"props":1799,"children":1800},{"style":358},[1801],{"type":45,"value":747},{"type":40,"tag":134,"props":1803,"children":1804},{"style":657},[1805],{"type":45,"value":1806}," type",{"type":40,"tag":134,"props":1808,"children":1809},{"style":358},[1810],{"type":45,"value":665},{"type":40,"tag":134,"props":1812,"children":1813},{"style":358},[1814],{"type":45,"value":392},{"type":40,"tag":134,"props":1816,"children":1817},{"style":395},[1818],{"type":45,"value":1063},{"type":40,"tag":134,"props":1820,"children":1821},{"style":358},[1822],{"type":45,"value":402},{"type":40,"tag":134,"props":1824,"children":1825},{"style":358},[1826],{"type":45,"value":382},{"type":40,"tag":134,"props":1828,"children":1829},{"style":364},[1830],{"type":45,"value":1106},{"type":40,"tag":134,"props":1832,"children":1833},{"style":358},[1834],{"type":45,"value":835},{"type":40,"tag":134,"props":1836,"children":1837},{"style":358},[1838],{"type":45,"value":382},{"type":40,"tag":134,"props":1840,"children":1841},{"style":364},[1842],{"type":45,"value":840},{"type":40,"tag":134,"props":1844,"children":1845},{"style":358},[1846],{"type":45,"value":643},{"type":40,"tag":134,"props":1848,"children":1849},{"class":136,"line":290},[1850],{"type":40,"tag":134,"props":1851,"children":1852},{"style":364},[1853],{"type":45,"value":1854},"  config\n",{"type":40,"tag":134,"props":1856,"children":1857},{"class":136,"line":299},[1858,1862],{"type":40,"tag":134,"props":1859,"children":1860},{"style":364},[1861],{"type":45,"value":840},{"type":40,"tag":134,"props":1863,"children":1864},{"style":358},[1865],{"type":45,"value":407},{"type":40,"tag":1867,"props":1868,"children":1869},"ex-editing-tool-arguments",{},[1870,2015],{"type":40,"tag":117,"props":1871,"children":1872},{},[1873,1875],{"type":45,"value":1874},"\nEdit the tool arguments before approving when the original values need correction.\n",{"type":40,"tag":123,"props":1876,"children":1878},{"className":125,"code":1877,"language":117,"meta":127,"style":127},"# Human edits the arguments — edited_action must include name + args\nresult2 = agent.invoke(\n    Command(resume={\n        \"decisions\": [{\n            \"type\": \"edit\",\n            \"edited_action\": {\n                \"name\": \"send_email\",\n                \"args\": {\n                    \"to\": \"alice@company.com\",  # Fixed email\n                    \"subject\": \"Project Meeting - Updated\",\n                    \"body\": \"...\",\n                },\n            },\n        }]\n    }),\n    config=config\n)\n",[1879],{"type":40,"tag":130,"props":1880,"children":1881},{"__ignoreMap":127},[1882,1890,1897,1905,1913,1921,1929,1937,1945,1953,1961,1969,1977,1985,1993,2001,2008],{"type":40,"tag":134,"props":1883,"children":1884},{"class":136,"line":137},[1885],{"type":40,"tag":134,"props":1886,"children":1887},{},[1888],{"type":45,"value":1889},"# Human edits the arguments — edited_action must include name + args\n",{"type":40,"tag":134,"props":1891,"children":1892},{"class":136,"line":146},[1893],{"type":40,"tag":134,"props":1894,"children":1895},{},[1896],{"type":45,"value":1292},{"type":40,"tag":134,"props":1898,"children":1899},{"class":136,"line":155},[1900],{"type":40,"tag":134,"props":1901,"children":1902},{},[1903],{"type":45,"value":1904},"    Command(resume={\n",{"type":40,"tag":134,"props":1906,"children":1907},{"class":136,"line":164},[1908],{"type":40,"tag":134,"props":1909,"children":1910},{},[1911],{"type":45,"value":1912},"        \"decisions\": [{\n",{"type":40,"tag":134,"props":1914,"children":1915},{"class":136,"line":173},[1916],{"type":40,"tag":134,"props":1917,"children":1918},{},[1919],{"type":45,"value":1920},"            \"type\": \"edit\",\n",{"type":40,"tag":134,"props":1922,"children":1923},{"class":136,"line":183},[1924],{"type":40,"tag":134,"props":1925,"children":1926},{},[1927],{"type":45,"value":1928},"            \"edited_action\": {\n",{"type":40,"tag":134,"props":1930,"children":1931},{"class":136,"line":192},[1932],{"type":40,"tag":134,"props":1933,"children":1934},{},[1935],{"type":45,"value":1936},"                \"name\": \"send_email\",\n",{"type":40,"tag":134,"props":1938,"children":1939},{"class":136,"line":201},[1940],{"type":40,"tag":134,"props":1941,"children":1942},{},[1943],{"type":45,"value":1944},"                \"args\": {\n",{"type":40,"tag":134,"props":1946,"children":1947},{"class":136,"line":210},[1948],{"type":40,"tag":134,"props":1949,"children":1950},{},[1951],{"type":45,"value":1952},"                    \"to\": \"alice@company.com\",  # Fixed email\n",{"type":40,"tag":134,"props":1954,"children":1955},{"class":136,"line":219},[1956],{"type":40,"tag":134,"props":1957,"children":1958},{},[1959],{"type":45,"value":1960},"                    \"subject\": \"Project Meeting - Updated\",\n",{"type":40,"tag":134,"props":1962,"children":1963},{"class":136,"line":227},[1964],{"type":40,"tag":134,"props":1965,"children":1966},{},[1967],{"type":45,"value":1968},"                    \"body\": \"...\",\n",{"type":40,"tag":134,"props":1970,"children":1971},{"class":136,"line":236},[1972],{"type":40,"tag":134,"props":1973,"children":1974},{},[1975],{"type":45,"value":1976},"                },\n",{"type":40,"tag":134,"props":1978,"children":1979},{"class":136,"line":245},[1980],{"type":40,"tag":134,"props":1981,"children":1982},{},[1983],{"type":45,"value":1984},"            },\n",{"type":40,"tag":134,"props":1986,"children":1987},{"class":136,"line":254},[1988],{"type":40,"tag":134,"props":1989,"children":1990},{},[1991],{"type":45,"value":1992},"        }]\n",{"type":40,"tag":134,"props":1994,"children":1995},{"class":136,"line":263},[1996],{"type":40,"tag":134,"props":1997,"children":1998},{},[1999],{"type":45,"value":2000},"    }),\n",{"type":40,"tag":134,"props":2002,"children":2003},{"class":136,"line":272},[2004],{"type":40,"tag":134,"props":2005,"children":2006},{},[2007],{"type":45,"value":1308},{"type":40,"tag":134,"props":2009,"children":2010},{"class":136,"line":281},[2011],{"type":40,"tag":134,"props":2012,"children":2013},{},[2014],{"type":45,"value":332},{"type":40,"tag":334,"props":2016,"children":2017},{},[2018,2019],{"type":45,"value":1874},{"type":40,"tag":123,"props":2020,"children":2022},{"className":341,"code":2021,"language":334,"meta":127,"style":127},"\u002F\u002F Human edits the arguments — editedAction must include name + args\nconst result2 = await agent.invoke(\n  new Command({\n    resume: {\n      decisions: [{\n        type: \"edit\",\n        editedAction: {\n          name: \"send_email\",\n          args: {\n            to: \"alice@company.com\",  \u002F\u002F Fixed email\n            subject: \"Project Meeting - Updated\",\n            body: \"...\",\n          },\n        },\n      }]\n    }\n  }),\n  config\n);\n",[2023],{"type":40,"tag":130,"props":2024,"children":2025},{"__ignoreMap":127},[2026,2034,2069,2088,2105,2125,2153,2169,2197,2213,2247,2276,2305,2313,2321,2333,2341,2357,2364],{"type":40,"tag":134,"props":2027,"children":2028},{"class":136,"line":137},[2029],{"type":40,"tag":134,"props":2030,"children":2031},{"style":1450},[2032],{"type":45,"value":2033},"\u002F\u002F Human edits the arguments — editedAction must include name + args\n",{"type":40,"tag":134,"props":2035,"children":2036},{"class":136,"line":146},[2037,2041,2045,2049,2053,2057,2061,2065],{"type":40,"tag":134,"props":2038,"children":2039},{"style":543},[2040],{"type":45,"value":546},{"type":40,"tag":134,"props":2042,"children":2043},{"style":364},[2044],{"type":45,"value":1727},{"type":40,"tag":134,"props":2046,"children":2047},{"style":358},[2048],{"type":45,"value":556},{"type":40,"tag":134,"props":2050,"children":2051},{"style":352},[2052],{"type":45,"value":1474},{"type":40,"tag":134,"props":2054,"children":2055},{"style":364},[2056],{"type":45,"value":1479},{"type":40,"tag":134,"props":2058,"children":2059},{"style":358},[2060],{"type":45,"value":732},{"type":40,"tag":134,"props":2062,"children":2063},{"style":559},[2064],{"type":45,"value":1488},{"type":40,"tag":134,"props":2066,"children":2067},{"style":364},[2068],{"type":45,"value":566},{"type":40,"tag":134,"props":2070,"children":2071},{"class":136,"line":155},[2072,2076,2080,2084],{"type":40,"tag":134,"props":2073,"children":2074},{"style":358},[2075],{"type":45,"value":1759},{"type":40,"tag":134,"props":2077,"children":2078},{"style":559},[2079],{"type":45,"value":1342},{"type":40,"tag":134,"props":2081,"children":2082},{"style":364},[2083],{"type":45,"value":742},{"type":40,"tag":134,"props":2085,"children":2086},{"style":358},[2087],{"type":45,"value":899},{"type":40,"tag":134,"props":2089,"children":2090},{"class":136,"line":164},[2091,2096,2100],{"type":40,"tag":134,"props":2092,"children":2093},{"style":657},[2094],{"type":45,"value":2095},"    resume",{"type":40,"tag":134,"props":2097,"children":2098},{"style":358},[2099],{"type":45,"value":665},{"type":40,"tag":134,"props":2101,"children":2102},{"style":358},[2103],{"type":45,"value":2104}," {\n",{"type":40,"tag":134,"props":2106,"children":2107},{"class":136,"line":173},[2108,2113,2117,2121],{"type":40,"tag":134,"props":2109,"children":2110},{"style":657},[2111],{"type":45,"value":2112},"      decisions",{"type":40,"tag":134,"props":2114,"children":2115},{"style":358},[2116],{"type":45,"value":665},{"type":40,"tag":134,"props":2118,"children":2119},{"style":364},[2120],{"type":45,"value":1054},{"type":40,"tag":134,"props":2122,"children":2123},{"style":358},[2124],{"type":45,"value":899},{"type":40,"tag":134,"props":2126,"children":2127},{"class":136,"line":183},[2128,2133,2137,2141,2145,2149],{"type":40,"tag":134,"props":2129,"children":2130},{"style":657},[2131],{"type":45,"value":2132},"        type",{"type":40,"tag":134,"props":2134,"children":2135},{"style":358},[2136],{"type":45,"value":665},{"type":40,"tag":134,"props":2138,"children":2139},{"style":358},[2140],{"type":45,"value":392},{"type":40,"tag":134,"props":2142,"children":2143},{"style":395},[2144],{"type":45,"value":1080},{"type":40,"tag":134,"props":2146,"children":2147},{"style":358},[2148],{"type":45,"value":402},{"type":40,"tag":134,"props":2150,"children":2151},{"style":358},[2152],{"type":45,"value":643},{"type":40,"tag":134,"props":2154,"children":2155},{"class":136,"line":192},[2156,2161,2165],{"type":40,"tag":134,"props":2157,"children":2158},{"style":657},[2159],{"type":45,"value":2160},"        editedAction",{"type":40,"tag":134,"props":2162,"children":2163},{"style":358},[2164],{"type":45,"value":665},{"type":40,"tag":134,"props":2166,"children":2167},{"style":358},[2168],{"type":45,"value":2104},{"type":40,"tag":134,"props":2170,"children":2171},{"class":136,"line":201},[2172,2177,2181,2185,2189,2193],{"type":40,"tag":134,"props":2173,"children":2174},{"style":657},[2175],{"type":45,"value":2176},"          name",{"type":40,"tag":134,"props":2178,"children":2179},{"style":358},[2180],{"type":45,"value":665},{"type":40,"tag":134,"props":2182,"children":2183},{"style":358},[2184],{"type":45,"value":392},{"type":40,"tag":134,"props":2186,"children":2187},{"style":395},[2188],{"type":45,"value":674},{"type":40,"tag":134,"props":2190,"children":2191},{"style":358},[2192],{"type":45,"value":402},{"type":40,"tag":134,"props":2194,"children":2195},{"style":358},[2196],{"type":45,"value":643},{"type":40,"tag":134,"props":2198,"children":2199},{"class":136,"line":210},[2200,2205,2209],{"type":40,"tag":134,"props":2201,"children":2202},{"style":657},[2203],{"type":45,"value":2204},"          args",{"type":40,"tag":134,"props":2206,"children":2207},{"style":358},[2208],{"type":45,"value":665},{"type":40,"tag":134,"props":2210,"children":2211},{"style":358},[2212],{"type":45,"value":2104},{"type":40,"tag":134,"props":2214,"children":2215},{"class":136,"line":219},[2216,2221,2225,2229,2234,2238,2242],{"type":40,"tag":134,"props":2217,"children":2218},{"style":657},[2219],{"type":45,"value":2220},"            to",{"type":40,"tag":134,"props":2222,"children":2223},{"style":358},[2224],{"type":45,"value":665},{"type":40,"tag":134,"props":2226,"children":2227},{"style":358},[2228],{"type":45,"value":392},{"type":40,"tag":134,"props":2230,"children":2231},{"style":395},[2232],{"type":45,"value":2233},"alice@company.com",{"type":40,"tag":134,"props":2235,"children":2236},{"style":358},[2237],{"type":45,"value":402},{"type":40,"tag":134,"props":2239,"children":2240},{"style":358},[2241],{"type":45,"value":372},{"type":40,"tag":134,"props":2243,"children":2244},{"style":1450},[2245],{"type":45,"value":2246},"  \u002F\u002F Fixed email\n",{"type":40,"tag":134,"props":2248,"children":2249},{"class":136,"line":227},[2250,2255,2259,2263,2268,2272],{"type":40,"tag":134,"props":2251,"children":2252},{"style":657},[2253],{"type":45,"value":2254},"            subject",{"type":40,"tag":134,"props":2256,"children":2257},{"style":358},[2258],{"type":45,"value":665},{"type":40,"tag":134,"props":2260,"children":2261},{"style":358},[2262],{"type":45,"value":392},{"type":40,"tag":134,"props":2264,"children":2265},{"style":395},[2266],{"type":45,"value":2267},"Project Meeting - Updated",{"type":40,"tag":134,"props":2269,"children":2270},{"style":358},[2271],{"type":45,"value":402},{"type":40,"tag":134,"props":2273,"children":2274},{"style":358},[2275],{"type":45,"value":643},{"type":40,"tag":134,"props":2277,"children":2278},{"class":136,"line":236},[2279,2284,2288,2292,2297,2301],{"type":40,"tag":134,"props":2280,"children":2281},{"style":657},[2282],{"type":45,"value":2283},"            body",{"type":40,"tag":134,"props":2285,"children":2286},{"style":358},[2287],{"type":45,"value":665},{"type":40,"tag":134,"props":2289,"children":2290},{"style":358},[2291],{"type":45,"value":392},{"type":40,"tag":134,"props":2293,"children":2294},{"style":395},[2295],{"type":45,"value":2296},"...",{"type":40,"tag":134,"props":2298,"children":2299},{"style":358},[2300],{"type":45,"value":402},{"type":40,"tag":134,"props":2302,"children":2303},{"style":358},[2304],{"type":45,"value":643},{"type":40,"tag":134,"props":2306,"children":2307},{"class":136,"line":245},[2308],{"type":40,"tag":134,"props":2309,"children":2310},{"style":358},[2311],{"type":45,"value":2312},"          },\n",{"type":40,"tag":134,"props":2314,"children":2315},{"class":136,"line":254},[2316],{"type":40,"tag":134,"props":2317,"children":2318},{"style":358},[2319],{"type":45,"value":2320},"        },\n",{"type":40,"tag":134,"props":2322,"children":2323},{"class":136,"line":263},[2324,2329],{"type":40,"tag":134,"props":2325,"children":2326},{"style":358},[2327],{"type":45,"value":2328},"      }",{"type":40,"tag":134,"props":2330,"children":2331},{"style":364},[2332],{"type":45,"value":1573},{"type":40,"tag":134,"props":2334,"children":2335},{"class":136,"line":272},[2336],{"type":40,"tag":134,"props":2337,"children":2338},{"style":358},[2339],{"type":45,"value":2340},"    }\n",{"type":40,"tag":134,"props":2342,"children":2343},{"class":136,"line":281},[2344,2349,2353],{"type":40,"tag":134,"props":2345,"children":2346},{"style":358},[2347],{"type":45,"value":2348},"  }",{"type":40,"tag":134,"props":2350,"children":2351},{"style":364},[2352],{"type":45,"value":840},{"type":40,"tag":134,"props":2354,"children":2355},{"style":358},[2356],{"type":45,"value":643},{"type":40,"tag":134,"props":2358,"children":2359},{"class":136,"line":290},[2360],{"type":40,"tag":134,"props":2361,"children":2362},{"style":364},[2363],{"type":45,"value":1854},{"type":40,"tag":134,"props":2365,"children":2366},{"class":136,"line":299},[2367,2371],{"type":40,"tag":134,"props":2368,"children":2369},{"style":364},[2370],{"type":45,"value":840},{"type":40,"tag":134,"props":2372,"children":2373},{"style":358},[2374],{"type":45,"value":407},{"type":40,"tag":2376,"props":2377,"children":2378},"ex-rejecting-with-feedback",{},[2379],{"type":40,"tag":117,"props":2380,"children":2381},{},[2382,2384],{"type":45,"value":2383},"\nReject a tool call and provide feedback explaining why it was rejected.\n",{"type":40,"tag":123,"props":2385,"children":2387},{"className":125,"code":2386,"language":117,"meta":127,"style":127},"# Human rejects\nresult2 = agent.invoke(\n    Command(resume={\n        \"decisions\": [{\n            \"type\": \"reject\",\n            \"feedback\": \"Cannot delete customer data without manager approval\",\n        }]\n    }),\n    config=config\n)\n",[2388],{"type":40,"tag":130,"props":2389,"children":2390},{"__ignoreMap":127},[2391,2399,2406,2413,2420,2428,2436,2443,2450,2457],{"type":40,"tag":134,"props":2392,"children":2393},{"class":136,"line":137},[2394],{"type":40,"tag":134,"props":2395,"children":2396},{},[2397],{"type":45,"value":2398},"# Human rejects\n",{"type":40,"tag":134,"props":2400,"children":2401},{"class":136,"line":146},[2402],{"type":40,"tag":134,"props":2403,"children":2404},{},[2405],{"type":45,"value":1292},{"type":40,"tag":134,"props":2407,"children":2408},{"class":136,"line":155},[2409],{"type":40,"tag":134,"props":2410,"children":2411},{},[2412],{"type":45,"value":1904},{"type":40,"tag":134,"props":2414,"children":2415},{"class":136,"line":164},[2416],{"type":40,"tag":134,"props":2417,"children":2418},{},[2419],{"type":45,"value":1912},{"type":40,"tag":134,"props":2421,"children":2422},{"class":136,"line":173},[2423],{"type":40,"tag":134,"props":2424,"children":2425},{},[2426],{"type":45,"value":2427},"            \"type\": \"reject\",\n",{"type":40,"tag":134,"props":2429,"children":2430},{"class":136,"line":183},[2431],{"type":40,"tag":134,"props":2432,"children":2433},{},[2434],{"type":45,"value":2435},"            \"feedback\": \"Cannot delete customer data without manager approval\",\n",{"type":40,"tag":134,"props":2437,"children":2438},{"class":136,"line":192},[2439],{"type":40,"tag":134,"props":2440,"children":2441},{},[2442],{"type":45,"value":1992},{"type":40,"tag":134,"props":2444,"children":2445},{"class":136,"line":201},[2446],{"type":40,"tag":134,"props":2447,"children":2448},{},[2449],{"type":45,"value":2000},{"type":40,"tag":134,"props":2451,"children":2452},{"class":136,"line":210},[2453],{"type":40,"tag":134,"props":2454,"children":2455},{},[2456],{"type":45,"value":1308},{"type":40,"tag":134,"props":2458,"children":2459},{"class":136,"line":219},[2460],{"type":40,"tag":134,"props":2461,"children":2462},{},[2463],{"type":45,"value":332},{"type":40,"tag":2465,"props":2466,"children":2467},"ex-multiple-tools-different-policies",{},[2468],{"type":40,"tag":117,"props":2469,"children":2470},{},[2471,2473],{"type":45,"value":2472},"\nConfigure different HITL policies for each tool based on risk level.\n",{"type":40,"tag":123,"props":2474,"children":2476},{"className":125,"code":2475,"language":117,"meta":127,"style":127},"agent = create_agent(\n    model=\"gpt-4.1\",\n    tools=[send_email, read_email, delete_email],\n    checkpointer=MemorySaver(),\n    middleware=[\n        HumanInTheLoopMiddleware(\n            interrupt_on={\n                \"send_email\": {\"allowed_decisions\": [\"approve\", \"edit\", \"reject\"]},\n                \"delete_email\": {\"allowed_decisions\": [\"approve\", \"reject\"]},  # No edit\n                \"read_email\": False,  # No HITL for reading\n            }\n        )\n    ],\n)\n",[2477],{"type":40,"tag":130,"props":2478,"children":2479},{"__ignoreMap":127},[2480,2487,2494,2502,2510,2517,2524,2531,2538,2546,2554,2561,2568,2575],{"type":40,"tag":134,"props":2481,"children":2482},{"class":136,"line":137},[2483],{"type":40,"tag":134,"props":2484,"children":2485},{},[2486],{"type":45,"value":233},{"type":40,"tag":134,"props":2488,"children":2489},{"class":136,"line":146},[2490],{"type":40,"tag":134,"props":2491,"children":2492},{},[2493],{"type":45,"value":242},{"type":40,"tag":134,"props":2495,"children":2496},{"class":136,"line":155},[2497],{"type":40,"tag":134,"props":2498,"children":2499},{},[2500],{"type":45,"value":2501},"    tools=[send_email, read_email, delete_email],\n",{"type":40,"tag":134,"props":2503,"children":2504},{"class":136,"line":164},[2505],{"type":40,"tag":134,"props":2506,"children":2507},{},[2508],{"type":45,"value":2509},"    checkpointer=MemorySaver(),\n",{"type":40,"tag":134,"props":2511,"children":2512},{"class":136,"line":173},[2513],{"type":40,"tag":134,"props":2514,"children":2515},{},[2516],{"type":45,"value":269},{"type":40,"tag":134,"props":2518,"children":2519},{"class":136,"line":183},[2520],{"type":40,"tag":134,"props":2521,"children":2522},{},[2523],{"type":45,"value":278},{"type":40,"tag":134,"props":2525,"children":2526},{"class":136,"line":192},[2527],{"type":40,"tag":134,"props":2528,"children":2529},{},[2530],{"type":45,"value":287},{"type":40,"tag":134,"props":2532,"children":2533},{"class":136,"line":201},[2534],{"type":40,"tag":134,"props":2535,"children":2536},{},[2537],{"type":45,"value":296},{"type":40,"tag":134,"props":2539,"children":2540},{"class":136,"line":210},[2541],{"type":40,"tag":134,"props":2542,"children":2543},{},[2544],{"type":45,"value":2545},"                \"delete_email\": {\"allowed_decisions\": [\"approve\", \"reject\"]},  # No edit\n",{"type":40,"tag":134,"props":2547,"children":2548},{"class":136,"line":219},[2549],{"type":40,"tag":134,"props":2550,"children":2551},{},[2552],{"type":45,"value":2553},"                \"read_email\": False,  # No HITL for reading\n",{"type":40,"tag":134,"props":2555,"children":2556},{"class":136,"line":227},[2557],{"type":40,"tag":134,"props":2558,"children":2559},{},[2560],{"type":45,"value":305},{"type":40,"tag":134,"props":2562,"children":2563},{"class":136,"line":236},[2564],{"type":40,"tag":134,"props":2565,"children":2566},{},[2567],{"type":45,"value":314},{"type":40,"tag":134,"props":2569,"children":2570},{"class":136,"line":245},[2571],{"type":40,"tag":134,"props":2572,"children":2573},{},[2574],{"type":45,"value":323},{"type":40,"tag":134,"props":2576,"children":2577},{"class":136,"line":254},[2578],{"type":40,"tag":134,"props":2579,"children":2580},{},[2581],{"type":45,"value":332},{"type":40,"tag":2583,"props":2584,"children":2585},"boundaries",{},[2586,2588,2646,2649,2655,2660,2752,3248,3647],{"type":45,"value":2587},"\n### What You CAN Configure\n",{"type":40,"tag":48,"props":2589,"children":2590},{},[2591,2596,2601,2641],{"type":40,"tag":52,"props":2592,"children":2593},{},[2594],{"type":45,"value":2595},"Which tools require approval (per-tool policies)",{"type":40,"tag":52,"props":2597,"children":2598},{},[2599],{"type":45,"value":2600},"Allowed decisions per tool (approve, edit, reject)",{"type":40,"tag":52,"props":2602,"children":2603},{},[2604,2606,2612,2614,2620,2621,2627,2628,2634,2635],{"type":45,"value":2605},"Custom middleware hooks: ",{"type":40,"tag":130,"props":2607,"children":2609},{"className":2608},[],[2610],{"type":45,"value":2611},"before_model",{"type":45,"value":2613},", ",{"type":40,"tag":130,"props":2615,"children":2617},{"className":2616},[],[2618],{"type":45,"value":2619},"after_model",{"type":45,"value":2613},{"type":40,"tag":130,"props":2622,"children":2624},{"className":2623},[],[2625],{"type":45,"value":2626},"wrap_tool_call",{"type":45,"value":2613},{"type":40,"tag":130,"props":2629,"children":2631},{"className":2630},[],[2632],{"type":45,"value":2633},"before_agent",{"type":45,"value":2613},{"type":40,"tag":130,"props":2636,"children":2638},{"className":2637},[],[2639],{"type":45,"value":2640},"after_agent",{"type":40,"tag":52,"props":2642,"children":2643},{},[2644],{"type":45,"value":2645},"Tool-specific middleware (apply only to certain tools)\n\n",{"type":40,"tag":102,"props":2647,"children":2648},{},[],{"type":40,"tag":106,"props":2650,"children":2652},{"id":2651},"custom-middleware-hooks",[2653],{"type":45,"value":2654},"Custom Middleware Hooks",{"type":40,"tag":91,"props":2656,"children":2657},{},[2658],{"type":45,"value":2659},"Six decorator hooks are available. Two patterns:",{"type":40,"tag":48,"props":2661,"children":2662},{},[2663,2703],{"type":40,"tag":52,"props":2664,"children":2665},{},[2666,2671,2673,2678,2679,2685,2687,2693,2695,2701],{"type":40,"tag":56,"props":2667,"children":2668},{},[2669],{"type":45,"value":2670},"Wrap hooks",{"type":45,"value":2672}," (",{"type":40,"tag":130,"props":2674,"children":2676},{"className":2675},[],[2677],{"type":45,"value":2626},{"type":45,"value":2613},{"type":40,"tag":130,"props":2680,"children":2682},{"className":2681},[],[2683],{"type":45,"value":2684},"wrap_model_call",{"type":45,"value":2686},"): ",{"type":40,"tag":130,"props":2688,"children":2690},{"className":2689},[],[2691],{"type":45,"value":2692},"(request, handler)",{"type":45,"value":2694}," — call ",{"type":40,"tag":130,"props":2696,"children":2698},{"className":2697},[],[2699],{"type":45,"value":2700},"handler(request)",{"type":45,"value":2702}," to proceed, or return early to short-circuit.",{"type":40,"tag":52,"props":2704,"children":2705},{},[2706,2711,2712,2717,2718,2723,2724,2729,2730,2735,2736,2742,2744,2750],{"type":40,"tag":56,"props":2707,"children":2708},{},[2709],{"type":45,"value":2710},"Before\u002Fafter hooks",{"type":45,"value":2672},{"type":40,"tag":130,"props":2713,"children":2715},{"className":2714},[],[2716],{"type":45,"value":2611},{"type":45,"value":2613},{"type":40,"tag":130,"props":2719,"children":2721},{"className":2720},[],[2722],{"type":45,"value":2619},{"type":45,"value":2613},{"type":40,"tag":130,"props":2725,"children":2727},{"className":2726},[],[2728],{"type":45,"value":2633},{"type":45,"value":2613},{"type":40,"tag":130,"props":2731,"children":2733},{"className":2732},[],[2734],{"type":45,"value":2640},{"type":45,"value":2686},{"type":40,"tag":130,"props":2737,"children":2739},{"className":2738},[],[2740],{"type":45,"value":2741},"(state, runtime)",{"type":45,"value":2743}," — inspect or modify state. Return ",{"type":40,"tag":130,"props":2745,"children":2747},{"className":2746},[],[2748],{"type":45,"value":2749},"None",{"type":45,"value":2751}," or a dict of state updates.",{"type":40,"tag":2753,"props":2754,"children":2755},"ex-wrap-tool-call",{},[2756,2893],{"type":40,"tag":117,"props":2757,"children":2758},{},[2759,2761],{"type":45,"value":2760},"\n`@wrap_tool_call` intercepts tool execution. **Do NOT use `yield`** — it creates a generator and causes `NotImplementedError`.\n",{"type":40,"tag":123,"props":2762,"children":2764},{"className":125,"code":2763,"language":117,"meta":127,"style":127},"from langchain.agents.middleware import wrap_tool_call\n\n@wrap_tool_call\ndef retry_middleware(request, handler):\n    for attempt in range(3):\n        try:\n            return handler(request)\n        except Exception:\n            if attempt == 2:\n                raise\n\n@wrap_tool_call\ndef guard_middleware(request, handler):\n    if request.tool_call[\"name\"] == \"dangerous_tool\":\n        return \"This tool is disabled\"  # short-circuit\n    return handler(request)\n",[2765],{"type":40,"tag":130,"props":2766,"children":2767},{"__ignoreMap":127},[2768,2776,2783,2791,2799,2807,2815,2823,2831,2839,2847,2854,2861,2869,2877,2885],{"type":40,"tag":134,"props":2769,"children":2770},{"class":136,"line":137},[2771],{"type":40,"tag":134,"props":2772,"children":2773},{},[2774],{"type":45,"value":2775},"from langchain.agents.middleware import wrap_tool_call\n",{"type":40,"tag":134,"props":2777,"children":2778},{"class":136,"line":146},[2779],{"type":40,"tag":134,"props":2780,"children":2781},{"emptyLinePlaceholder":177},[2782],{"type":45,"value":180},{"type":40,"tag":134,"props":2784,"children":2785},{"class":136,"line":155},[2786],{"type":40,"tag":134,"props":2787,"children":2788},{},[2789],{"type":45,"value":2790},"@wrap_tool_call\n",{"type":40,"tag":134,"props":2792,"children":2793},{"class":136,"line":164},[2794],{"type":40,"tag":134,"props":2795,"children":2796},{},[2797],{"type":45,"value":2798},"def retry_middleware(request, handler):\n",{"type":40,"tag":134,"props":2800,"children":2801},{"class":136,"line":173},[2802],{"type":40,"tag":134,"props":2803,"children":2804},{},[2805],{"type":45,"value":2806},"    for attempt in range(3):\n",{"type":40,"tag":134,"props":2808,"children":2809},{"class":136,"line":183},[2810],{"type":40,"tag":134,"props":2811,"children":2812},{},[2813],{"type":45,"value":2814},"        try:\n",{"type":40,"tag":134,"props":2816,"children":2817},{"class":136,"line":192},[2818],{"type":40,"tag":134,"props":2819,"children":2820},{},[2821],{"type":45,"value":2822},"            return handler(request)\n",{"type":40,"tag":134,"props":2824,"children":2825},{"class":136,"line":201},[2826],{"type":40,"tag":134,"props":2827,"children":2828},{},[2829],{"type":45,"value":2830},"        except Exception:\n",{"type":40,"tag":134,"props":2832,"children":2833},{"class":136,"line":210},[2834],{"type":40,"tag":134,"props":2835,"children":2836},{},[2837],{"type":45,"value":2838},"            if attempt == 2:\n",{"type":40,"tag":134,"props":2840,"children":2841},{"class":136,"line":219},[2842],{"type":40,"tag":134,"props":2843,"children":2844},{},[2845],{"type":45,"value":2846},"                raise\n",{"type":40,"tag":134,"props":2848,"children":2849},{"class":136,"line":227},[2850],{"type":40,"tag":134,"props":2851,"children":2852},{"emptyLinePlaceholder":177},[2853],{"type":45,"value":180},{"type":40,"tag":134,"props":2855,"children":2856},{"class":136,"line":236},[2857],{"type":40,"tag":134,"props":2858,"children":2859},{},[2860],{"type":45,"value":2790},{"type":40,"tag":134,"props":2862,"children":2863},{"class":136,"line":245},[2864],{"type":40,"tag":134,"props":2865,"children":2866},{},[2867],{"type":45,"value":2868},"def guard_middleware(request, handler):\n",{"type":40,"tag":134,"props":2870,"children":2871},{"class":136,"line":254},[2872],{"type":40,"tag":134,"props":2873,"children":2874},{},[2875],{"type":45,"value":2876},"    if request.tool_call[\"name\"] == \"dangerous_tool\":\n",{"type":40,"tag":134,"props":2878,"children":2879},{"class":136,"line":263},[2880],{"type":40,"tag":134,"props":2881,"children":2882},{},[2883],{"type":45,"value":2884},"        return \"This tool is disabled\"  # short-circuit\n",{"type":40,"tag":134,"props":2886,"children":2887},{"class":136,"line":272},[2888],{"type":40,"tag":134,"props":2889,"children":2890},{},[2891],{"type":45,"value":2892},"    return handler(request)\n",{"type":40,"tag":334,"props":2894,"children":2895},{},[2896,2898],{"type":45,"value":2897},"\n`createMiddleware({ wrapToolCall })` intercepts tool execution.\n",{"type":40,"tag":123,"props":2899,"children":2901},{"className":341,"code":2900,"language":334,"meta":127,"style":127},"import { createMiddleware } from \"langchain\";\n\nconst retryMiddleware = createMiddleware({\n  wrapToolCall: async (request, handler) => {\n    for (let attempt = 0; attempt \u003C 3; attempt++) {\n      try { return await handler(request); }\n      catch (e) { if (attempt === 2) throw e; }\n    }\n  },\n});\n",[2902],{"type":40,"tag":130,"props":2903,"children":2904},{"__ignoreMap":127},[2905,2945,2952,2980,3027,3101,3147,3218,3225,3233],{"type":40,"tag":134,"props":2906,"children":2907},{"class":136,"line":137},[2908,2912,2916,2921,2925,2929,2933,2937,2941],{"type":40,"tag":134,"props":2909,"children":2910},{"style":352},[2911],{"type":45,"value":355},{"type":40,"tag":134,"props":2913,"children":2914},{"style":358},[2915],{"type":45,"value":361},{"type":40,"tag":134,"props":2917,"children":2918},{"style":364},[2919],{"type":45,"value":2920}," createMiddleware",{"type":40,"tag":134,"props":2922,"children":2923},{"style":358},[2924],{"type":45,"value":382},{"type":40,"tag":134,"props":2926,"children":2927},{"style":352},[2928],{"type":45,"value":387},{"type":40,"tag":134,"props":2930,"children":2931},{"style":358},[2932],{"type":45,"value":392},{"type":40,"tag":134,"props":2934,"children":2935},{"style":395},[2936],{"type":45,"value":8},{"type":40,"tag":134,"props":2938,"children":2939},{"style":358},[2940],{"type":45,"value":402},{"type":40,"tag":134,"props":2942,"children":2943},{"style":358},[2944],{"type":45,"value":407},{"type":40,"tag":134,"props":2946,"children":2947},{"class":136,"line":146},[2948],{"type":40,"tag":134,"props":2949,"children":2950},{"emptyLinePlaceholder":177},[2951],{"type":45,"value":180},{"type":40,"tag":134,"props":2953,"children":2954},{"class":136,"line":155},[2955,2959,2964,2968,2972,2976],{"type":40,"tag":134,"props":2956,"children":2957},{"style":543},[2958],{"type":45,"value":546},{"type":40,"tag":134,"props":2960,"children":2961},{"style":364},[2962],{"type":45,"value":2963}," retryMiddleware ",{"type":40,"tag":134,"props":2965,"children":2966},{"style":358},[2967],{"type":45,"value":556},{"type":40,"tag":134,"props":2969,"children":2970},{"style":559},[2971],{"type":45,"value":2920},{"type":40,"tag":134,"props":2973,"children":2974},{"style":364},[2975],{"type":45,"value":742},{"type":40,"tag":134,"props":2977,"children":2978},{"style":358},[2979],{"type":45,"value":899},{"type":40,"tag":134,"props":2981,"children":2982},{"class":136,"line":164},[2983,2988,2992,2997,3001,3006,3010,3015,3019,3023],{"type":40,"tag":134,"props":2984,"children":2985},{"style":559},[2986],{"type":45,"value":2987},"  wrapToolCall",{"type":40,"tag":134,"props":2989,"children":2990},{"style":358},[2991],{"type":45,"value":665},{"type":40,"tag":134,"props":2993,"children":2994},{"style":543},[2995],{"type":45,"value":2996}," async",{"type":40,"tag":134,"props":2998,"children":2999},{"style":358},[3000],{"type":45,"value":2672},{"type":40,"tag":134,"props":3002,"children":3003},{"style":582},[3004],{"type":45,"value":3005},"request",{"type":40,"tag":134,"props":3007,"children":3008},{"style":358},[3009],{"type":45,"value":372},{"type":40,"tag":134,"props":3011,"children":3012},{"style":582},[3013],{"type":45,"value":3014}," handler",{"type":40,"tag":134,"props":3016,"children":3017},{"style":358},[3018],{"type":45,"value":840},{"type":40,"tag":134,"props":3020,"children":3021},{"style":543},[3022],{"type":45,"value":613},{"type":40,"tag":134,"props":3024,"children":3025},{"style":358},[3026],{"type":45,"value":2104},{"type":40,"tag":134,"props":3028,"children":3029},{"class":136,"line":173},[3030,3035,3039,3044,3049,3054,3060,3065,3069,3074,3079,3083,3087,3092,3097],{"type":40,"tag":134,"props":3031,"children":3032},{"style":352},[3033],{"type":45,"value":3034},"    for",{"type":40,"tag":134,"props":3036,"children":3037},{"style":657},[3038],{"type":45,"value":2672},{"type":40,"tag":134,"props":3040,"children":3041},{"style":543},[3042],{"type":45,"value":3043},"let",{"type":40,"tag":134,"props":3045,"children":3046},{"style":364},[3047],{"type":45,"value":3048}," attempt",{"type":40,"tag":134,"props":3050,"children":3051},{"style":358},[3052],{"type":45,"value":3053}," =",{"type":40,"tag":134,"props":3055,"children":3057},{"style":3056},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[3058],{"type":45,"value":3059}," 0",{"type":40,"tag":134,"props":3061,"children":3062},{"style":358},[3063],{"type":45,"value":3064},";",{"type":40,"tag":134,"props":3066,"children":3067},{"style":364},[3068],{"type":45,"value":3048},{"type":40,"tag":134,"props":3070,"children":3071},{"style":358},[3072],{"type":45,"value":3073}," \u003C",{"type":40,"tag":134,"props":3075,"children":3076},{"style":3056},[3077],{"type":45,"value":3078}," 3",{"type":40,"tag":134,"props":3080,"children":3081},{"style":358},[3082],{"type":45,"value":3064},{"type":40,"tag":134,"props":3084,"children":3085},{"style":364},[3086],{"type":45,"value":3048},{"type":40,"tag":134,"props":3088,"children":3089},{"style":358},[3090],{"type":45,"value":3091},"++",{"type":40,"tag":134,"props":3093,"children":3094},{"style":657},[3095],{"type":45,"value":3096},") ",{"type":40,"tag":134,"props":3098,"children":3099},{"style":358},[3100],{"type":45,"value":899},{"type":40,"tag":134,"props":3102,"children":3103},{"class":136,"line":183},[3104,3109,3113,3118,3122,3126,3130,3134,3138,3142],{"type":40,"tag":134,"props":3105,"children":3106},{"style":352},[3107],{"type":45,"value":3108},"      try",{"type":40,"tag":134,"props":3110,"children":3111},{"style":358},[3112],{"type":45,"value":361},{"type":40,"tag":134,"props":3114,"children":3115},{"style":352},[3116],{"type":45,"value":3117}," return",{"type":40,"tag":134,"props":3119,"children":3120},{"style":352},[3121],{"type":45,"value":1474},{"type":40,"tag":134,"props":3123,"children":3124},{"style":559},[3125],{"type":45,"value":3014},{"type":40,"tag":134,"props":3127,"children":3128},{"style":657},[3129],{"type":45,"value":742},{"type":40,"tag":134,"props":3131,"children":3132},{"style":364},[3133],{"type":45,"value":3005},{"type":40,"tag":134,"props":3135,"children":3136},{"style":657},[3137],{"type":45,"value":840},{"type":40,"tag":134,"props":3139,"children":3140},{"style":358},[3141],{"type":45,"value":3064},{"type":40,"tag":134,"props":3143,"children":3144},{"style":358},[3145],{"type":45,"value":3146}," }\n",{"type":40,"tag":134,"props":3148,"children":3149},{"class":136,"line":192},[3150,3155,3159,3164,3168,3172,3177,3181,3186,3191,3196,3200,3205,3210,3214],{"type":40,"tag":134,"props":3151,"children":3152},{"style":352},[3153],{"type":45,"value":3154},"      catch",{"type":40,"tag":134,"props":3156,"children":3157},{"style":657},[3158],{"type":45,"value":2672},{"type":40,"tag":134,"props":3160,"children":3161},{"style":364},[3162],{"type":45,"value":3163},"e",{"type":40,"tag":134,"props":3165,"children":3166},{"style":657},[3167],{"type":45,"value":3096},{"type":40,"tag":134,"props":3169,"children":3170},{"style":358},[3171],{"type":45,"value":747},{"type":40,"tag":134,"props":3173,"children":3174},{"style":352},[3175],{"type":45,"value":3176}," if",{"type":40,"tag":134,"props":3178,"children":3179},{"style":657},[3180],{"type":45,"value":2672},{"type":40,"tag":134,"props":3182,"children":3183},{"style":364},[3184],{"type":45,"value":3185},"attempt",{"type":40,"tag":134,"props":3187,"children":3188},{"style":358},[3189],{"type":45,"value":3190}," ===",{"type":40,"tag":134,"props":3192,"children":3193},{"style":3056},[3194],{"type":45,"value":3195}," 2",{"type":40,"tag":134,"props":3197,"children":3198},{"style":657},[3199],{"type":45,"value":3096},{"type":40,"tag":134,"props":3201,"children":3202},{"style":352},[3203],{"type":45,"value":3204},"throw",{"type":40,"tag":134,"props":3206,"children":3207},{"style":364},[3208],{"type":45,"value":3209}," e",{"type":40,"tag":134,"props":3211,"children":3212},{"style":358},[3213],{"type":45,"value":3064},{"type":40,"tag":134,"props":3215,"children":3216},{"style":358},[3217],{"type":45,"value":3146},{"type":40,"tag":134,"props":3219,"children":3220},{"class":136,"line":201},[3221],{"type":40,"tag":134,"props":3222,"children":3223},{"style":358},[3224],{"type":45,"value":2340},{"type":40,"tag":134,"props":3226,"children":3227},{"class":136,"line":210},[3228],{"type":40,"tag":134,"props":3229,"children":3230},{"style":358},[3231],{"type":45,"value":3232},"  },\n",{"type":40,"tag":134,"props":3234,"children":3235},{"class":136,"line":219},[3236,3240,3244],{"type":40,"tag":134,"props":3237,"children":3238},{"style":358},[3239],{"type":45,"value":835},{"type":40,"tag":134,"props":3241,"children":3242},{"style":364},[3243],{"type":45,"value":840},{"type":40,"tag":134,"props":3245,"children":3246},{"style":358},[3247],{"type":45,"value":407},{"type":40,"tag":3249,"props":3250,"children":3251},"ex-before-after-hooks",{},[3252,3334],{"type":40,"tag":117,"props":3253,"children":3254},{},[3255,3257],{"type":45,"value":3256},"\n`before_model` \u002F `after_model` \u002F `before_agent` \u002F `after_agent` all share `(state, runtime)` signature.\n",{"type":40,"tag":123,"props":3258,"children":3260},{"className":125,"code":3259,"language":117,"meta":127,"style":127},"from langchain.agents.middleware import before_model, after_model\n\n@before_model\ndef log_calls(state, runtime):\n    print(f\"Calling model with {len(state['messages'])} messages\")\n\n@after_model\ndef check_output(state, runtime):\n    print(f\"Model responded\")\n",[3261],{"type":40,"tag":130,"props":3262,"children":3263},{"__ignoreMap":127},[3264,3272,3279,3287,3295,3303,3310,3318,3326],{"type":40,"tag":134,"props":3265,"children":3266},{"class":136,"line":137},[3267],{"type":40,"tag":134,"props":3268,"children":3269},{},[3270],{"type":45,"value":3271},"from langchain.agents.middleware import before_model, after_model\n",{"type":40,"tag":134,"props":3273,"children":3274},{"class":136,"line":146},[3275],{"type":40,"tag":134,"props":3276,"children":3277},{"emptyLinePlaceholder":177},[3278],{"type":45,"value":180},{"type":40,"tag":134,"props":3280,"children":3281},{"class":136,"line":155},[3282],{"type":40,"tag":134,"props":3283,"children":3284},{},[3285],{"type":45,"value":3286},"@before_model\n",{"type":40,"tag":134,"props":3288,"children":3289},{"class":136,"line":164},[3290],{"type":40,"tag":134,"props":3291,"children":3292},{},[3293],{"type":45,"value":3294},"def log_calls(state, runtime):\n",{"type":40,"tag":134,"props":3296,"children":3297},{"class":136,"line":173},[3298],{"type":40,"tag":134,"props":3299,"children":3300},{},[3301],{"type":45,"value":3302},"    print(f\"Calling model with {len(state['messages'])} messages\")\n",{"type":40,"tag":134,"props":3304,"children":3305},{"class":136,"line":183},[3306],{"type":40,"tag":134,"props":3307,"children":3308},{"emptyLinePlaceholder":177},[3309],{"type":45,"value":180},{"type":40,"tag":134,"props":3311,"children":3312},{"class":136,"line":192},[3313],{"type":40,"tag":134,"props":3314,"children":3315},{},[3316],{"type":45,"value":3317},"@after_model\n",{"type":40,"tag":134,"props":3319,"children":3320},{"class":136,"line":201},[3321],{"type":40,"tag":134,"props":3322,"children":3323},{},[3324],{"type":45,"value":3325},"def check_output(state, runtime):\n",{"type":40,"tag":134,"props":3327,"children":3328},{"class":136,"line":210},[3329],{"type":40,"tag":134,"props":3330,"children":3331},{},[3332],{"type":45,"value":3333},"    print(f\"Model responded\")\n",{"type":40,"tag":334,"props":3335,"children":3336},{},[3337,3339],{"type":45,"value":3338},"\nAll before\u002Fafter hooks share the same `(state, runtime)` signature via `createMiddleware`.\n",{"type":40,"tag":123,"props":3340,"children":3342},{"className":341,"code":3341,"language":334,"meta":127,"style":127},"import { createMiddleware } from \"langchain\";\n\nconst loggingMiddleware = createMiddleware({\n  beforeModel: (state, runtime) => {\n    console.log(`Calling model with ${state.messages.length} messages`);\n  },\n  afterModel: (state, runtime) => {\n    console.log(\"Model responded\");\n  },\n});\n",[3343],{"type":40,"tag":130,"props":3344,"children":3345},{"__ignoreMap":127},[3346,3385,3392,3420,3462,3538,3545,3585,3625,3632],{"type":40,"tag":134,"props":3347,"children":3348},{"class":136,"line":137},[3349,3353,3357,3361,3365,3369,3373,3377,3381],{"type":40,"tag":134,"props":3350,"children":3351},{"style":352},[3352],{"type":45,"value":355},{"type":40,"tag":134,"props":3354,"children":3355},{"style":358},[3356],{"type":45,"value":361},{"type":40,"tag":134,"props":3358,"children":3359},{"style":364},[3360],{"type":45,"value":2920},{"type":40,"tag":134,"props":3362,"children":3363},{"style":358},[3364],{"type":45,"value":382},{"type":40,"tag":134,"props":3366,"children":3367},{"style":352},[3368],{"type":45,"value":387},{"type":40,"tag":134,"props":3370,"children":3371},{"style":358},[3372],{"type":45,"value":392},{"type":40,"tag":134,"props":3374,"children":3375},{"style":395},[3376],{"type":45,"value":8},{"type":40,"tag":134,"props":3378,"children":3379},{"style":358},[3380],{"type":45,"value":402},{"type":40,"tag":134,"props":3382,"children":3383},{"style":358},[3384],{"type":45,"value":407},{"type":40,"tag":134,"props":3386,"children":3387},{"class":136,"line":146},[3388],{"type":40,"tag":134,"props":3389,"children":3390},{"emptyLinePlaceholder":177},[3391],{"type":45,"value":180},{"type":40,"tag":134,"props":3393,"children":3394},{"class":136,"line":155},[3395,3399,3404,3408,3412,3416],{"type":40,"tag":134,"props":3396,"children":3397},{"style":543},[3398],{"type":45,"value":546},{"type":40,"tag":134,"props":3400,"children":3401},{"style":364},[3402],{"type":45,"value":3403}," loggingMiddleware ",{"type":40,"tag":134,"props":3405,"children":3406},{"style":358},[3407],{"type":45,"value":556},{"type":40,"tag":134,"props":3409,"children":3410},{"style":559},[3411],{"type":45,"value":2920},{"type":40,"tag":134,"props":3413,"children":3414},{"style":364},[3415],{"type":45,"value":742},{"type":40,"tag":134,"props":3417,"children":3418},{"style":358},[3419],{"type":45,"value":899},{"type":40,"tag":134,"props":3421,"children":3422},{"class":136,"line":164},[3423,3428,3432,3436,3441,3445,3450,3454,3458],{"type":40,"tag":134,"props":3424,"children":3425},{"style":559},[3426],{"type":45,"value":3427},"  beforeModel",{"type":40,"tag":134,"props":3429,"children":3430},{"style":358},[3431],{"type":45,"value":665},{"type":40,"tag":134,"props":3433,"children":3434},{"style":358},[3435],{"type":45,"value":2672},{"type":40,"tag":134,"props":3437,"children":3438},{"style":582},[3439],{"type":45,"value":3440},"state",{"type":40,"tag":134,"props":3442,"children":3443},{"style":358},[3444],{"type":45,"value":372},{"type":40,"tag":134,"props":3446,"children":3447},{"style":582},[3448],{"type":45,"value":3449}," runtime",{"type":40,"tag":134,"props":3451,"children":3452},{"style":358},[3453],{"type":45,"value":840},{"type":40,"tag":134,"props":3455,"children":3456},{"style":543},[3457],{"type":45,"value":613},{"type":40,"tag":134,"props":3459,"children":3460},{"style":358},[3461],{"type":45,"value":2104},{"type":40,"tag":134,"props":3463,"children":3464},{"class":136,"line":173},[3465,3470,3474,3478,3482,3486,3491,3495,3499,3503,3508,3512,3517,3521,3526,3530,3534],{"type":40,"tag":134,"props":3466,"children":3467},{"style":364},[3468],{"type":45,"value":3469},"    console",{"type":40,"tag":134,"props":3471,"children":3472},{"style":358},[3473],{"type":45,"value":732},{"type":40,"tag":134,"props":3475,"children":3476},{"style":559},[3477],{"type":45,"value":1648},{"type":40,"tag":134,"props":3479,"children":3480},{"style":657},[3481],{"type":45,"value":742},{"type":40,"tag":134,"props":3483,"children":3484},{"style":358},[3485],{"type":45,"value":1657},{"type":40,"tag":134,"props":3487,"children":3488},{"style":395},[3489],{"type":45,"value":3490},"Calling model with ",{"type":40,"tag":134,"props":3492,"children":3493},{"style":358},[3494],{"type":45,"value":628},{"type":40,"tag":134,"props":3496,"children":3497},{"style":364},[3498],{"type":45,"value":3440},{"type":40,"tag":134,"props":3500,"children":3501},{"style":358},[3502],{"type":45,"value":732},{"type":40,"tag":134,"props":3504,"children":3505},{"style":364},[3506],{"type":45,"value":3507},"messages",{"type":40,"tag":134,"props":3509,"children":3510},{"style":358},[3511],{"type":45,"value":732},{"type":40,"tag":134,"props":3513,"children":3514},{"style":364},[3515],{"type":45,"value":3516},"length",{"type":40,"tag":134,"props":3518,"children":3519},{"style":358},[3520],{"type":45,"value":835},{"type":40,"tag":134,"props":3522,"children":3523},{"style":395},[3524],{"type":45,"value":3525}," messages",{"type":40,"tag":134,"props":3527,"children":3528},{"style":358},[3529],{"type":45,"value":1657},{"type":40,"tag":134,"props":3531,"children":3532},{"style":657},[3533],{"type":45,"value":840},{"type":40,"tag":134,"props":3535,"children":3536},{"style":358},[3537],{"type":45,"value":407},{"type":40,"tag":134,"props":3539,"children":3540},{"class":136,"line":183},[3541],{"type":40,"tag":134,"props":3542,"children":3543},{"style":358},[3544],{"type":45,"value":3232},{"type":40,"tag":134,"props":3546,"children":3547},{"class":136,"line":192},[3548,3553,3557,3561,3565,3569,3573,3577,3581],{"type":40,"tag":134,"props":3549,"children":3550},{"style":559},[3551],{"type":45,"value":3552},"  afterModel",{"type":40,"tag":134,"props":3554,"children":3555},{"style":358},[3556],{"type":45,"value":665},{"type":40,"tag":134,"props":3558,"children":3559},{"style":358},[3560],{"type":45,"value":2672},{"type":40,"tag":134,"props":3562,"children":3563},{"style":582},[3564],{"type":45,"value":3440},{"type":40,"tag":134,"props":3566,"children":3567},{"style":358},[3568],{"type":45,"value":372},{"type":40,"tag":134,"props":3570,"children":3571},{"style":582},[3572],{"type":45,"value":3449},{"type":40,"tag":134,"props":3574,"children":3575},{"style":358},[3576],{"type":45,"value":840},{"type":40,"tag":134,"props":3578,"children":3579},{"style":543},[3580],{"type":45,"value":613},{"type":40,"tag":134,"props":3582,"children":3583},{"style":358},[3584],{"type":45,"value":2104},{"type":40,"tag":134,"props":3586,"children":3587},{"class":136,"line":201},[3588,3592,3596,3600,3604,3608,3613,3617,3621],{"type":40,"tag":134,"props":3589,"children":3590},{"style":364},[3591],{"type":45,"value":3469},{"type":40,"tag":134,"props":3593,"children":3594},{"style":358},[3595],{"type":45,"value":732},{"type":40,"tag":134,"props":3597,"children":3598},{"style":559},[3599],{"type":45,"value":1648},{"type":40,"tag":134,"props":3601,"children":3602},{"style":657},[3603],{"type":45,"value":742},{"type":40,"tag":134,"props":3605,"children":3606},{"style":358},[3607],{"type":45,"value":402},{"type":40,"tag":134,"props":3609,"children":3610},{"style":395},[3611],{"type":45,"value":3612},"Model responded",{"type":40,"tag":134,"props":3614,"children":3615},{"style":358},[3616],{"type":45,"value":402},{"type":40,"tag":134,"props":3618,"children":3619},{"style":657},[3620],{"type":45,"value":840},{"type":40,"tag":134,"props":3622,"children":3623},{"style":358},[3624],{"type":45,"value":407},{"type":40,"tag":134,"props":3626,"children":3627},{"class":136,"line":210},[3628],{"type":40,"tag":134,"props":3629,"children":3630},{"style":358},[3631],{"type":45,"value":3232},{"type":40,"tag":134,"props":3633,"children":3634},{"class":136,"line":219},[3635,3639,3643],{"type":40,"tag":134,"props":3636,"children":3637},{"style":358},[3638],{"type":45,"value":835},{"type":40,"tag":134,"props":3640,"children":3641},{"style":364},[3642],{"type":45,"value":840},{"type":40,"tag":134,"props":3644,"children":3645},{"style":358},[3646],{"type":45,"value":407},{"type":40,"tag":2583,"props":3648,"children":3649},{},[3650,3652,3665,4121,4174],{"type":45,"value":3651},"\n### What You CANNOT Configure\n",{"type":40,"tag":48,"props":3653,"children":3654},{},[3655,3660],{"type":40,"tag":52,"props":3656,"children":3657},{},[3658],{"type":45,"value":3659},"Interrupt after tool execution (must be before)",{"type":40,"tag":52,"props":3661,"children":3662},{},[3663],{"type":45,"value":3664},"Skip checkpointer requirement for HITL\n\n",{"type":40,"tag":3666,"props":3667,"children":3668},"fix-missing-checkpointer",{},[3669,3750],{"type":40,"tag":117,"props":3670,"children":3671},{},[3672,3674],{"type":45,"value":3673},"\nHITL middleware requires a checkpointer to persist state.\n",{"type":40,"tag":123,"props":3675,"children":3677},{"className":125,"code":3676,"language":117,"meta":127,"style":127},"# WRONG\nagent = create_agent(model=\"gpt-4.1\", tools=[send_email], middleware=[HumanInTheLoopMiddleware({...})])\n\n# CORRECT\nagent = create_agent(\n    model=\"gpt-4.1\", tools=[send_email],\n    checkpointer=MemorySaver(),  # Required\n    middleware=[HumanInTheLoopMiddleware({...})]\n)\n",[3678],{"type":40,"tag":130,"props":3679,"children":3680},{"__ignoreMap":127},[3681,3689,3697,3704,3712,3719,3727,3735,3743],{"type":40,"tag":134,"props":3682,"children":3683},{"class":136,"line":137},[3684],{"type":40,"tag":134,"props":3685,"children":3686},{},[3687],{"type":45,"value":3688},"# WRONG\n",{"type":40,"tag":134,"props":3690,"children":3691},{"class":136,"line":146},[3692],{"type":40,"tag":134,"props":3693,"children":3694},{},[3695],{"type":45,"value":3696},"agent = create_agent(model=\"gpt-4.1\", tools=[send_email], middleware=[HumanInTheLoopMiddleware({...})])\n",{"type":40,"tag":134,"props":3698,"children":3699},{"class":136,"line":155},[3700],{"type":40,"tag":134,"props":3701,"children":3702},{"emptyLinePlaceholder":177},[3703],{"type":45,"value":180},{"type":40,"tag":134,"props":3705,"children":3706},{"class":136,"line":164},[3707],{"type":40,"tag":134,"props":3708,"children":3709},{},[3710],{"type":45,"value":3711},"# CORRECT\n",{"type":40,"tag":134,"props":3713,"children":3714},{"class":136,"line":173},[3715],{"type":40,"tag":134,"props":3716,"children":3717},{},[3718],{"type":45,"value":233},{"type":40,"tag":134,"props":3720,"children":3721},{"class":136,"line":183},[3722],{"type":40,"tag":134,"props":3723,"children":3724},{},[3725],{"type":45,"value":3726},"    model=\"gpt-4.1\", tools=[send_email],\n",{"type":40,"tag":134,"props":3728,"children":3729},{"class":136,"line":192},[3730],{"type":40,"tag":134,"props":3731,"children":3732},{},[3733],{"type":45,"value":3734},"    checkpointer=MemorySaver(),  # Required\n",{"type":40,"tag":134,"props":3736,"children":3737},{"class":136,"line":201},[3738],{"type":40,"tag":134,"props":3739,"children":3740},{},[3741],{"type":45,"value":3742},"    middleware=[HumanInTheLoopMiddleware({...})]\n",{"type":40,"tag":134,"props":3744,"children":3745},{"class":136,"line":210},[3746],{"type":40,"tag":134,"props":3747,"children":3748},{},[3749],{"type":45,"value":332},{"type":40,"tag":334,"props":3751,"children":3752},{},[3753,3755],{"type":45,"value":3754},"\nHITL requires a checkpointer to persist state.\n",{"type":40,"tag":123,"props":3756,"children":3758},{"className":341,"code":3757,"language":334,"meta":127,"style":127},"\u002F\u002F WRONG: No checkpointer\nconst agent = createAgent({\n  model: \"anthropic:claude-sonnet-4-5\", tools: [sendEmail],\n  middleware: [humanInTheLoopMiddleware({ interruptOn: { send_email: true } })],\n});\n\n\u002F\u002F CORRECT: Add checkpointer\nconst agent = createAgent({\n  model: \"anthropic:claude-sonnet-4-5\", tools: [sendEmail],\n  checkpointer: new MemorySaver(),\n  middleware: [humanInTheLoopMiddleware({ interruptOn: { send_email: true } })],\n});\n",[3759],{"type":40,"tag":130,"props":3760,"children":3761},{"__ignoreMap":127},[3762,3770,3797,3841,3912,3927,3934,3942,3969,4012,4039,4106],{"type":40,"tag":134,"props":3763,"children":3764},{"class":136,"line":137},[3765],{"type":40,"tag":134,"props":3766,"children":3767},{"style":1450},[3768],{"type":45,"value":3769},"\u002F\u002F WRONG: No checkpointer\n",{"type":40,"tag":134,"props":3771,"children":3772},{"class":136,"line":146},[3773,3777,3781,3785,3789,3793],{"type":40,"tag":134,"props":3774,"children":3775},{"style":543},[3776],{"type":45,"value":546},{"type":40,"tag":134,"props":3778,"children":3779},{"style":364},[3780],{"type":45,"value":882},{"type":40,"tag":134,"props":3782,"children":3783},{"style":358},[3784],{"type":45,"value":556},{"type":40,"tag":134,"props":3786,"children":3787},{"style":559},[3788],{"type":45,"value":367},{"type":40,"tag":134,"props":3790,"children":3791},{"style":364},[3792],{"type":45,"value":742},{"type":40,"tag":134,"props":3794,"children":3795},{"style":358},[3796],{"type":45,"value":899},{"type":40,"tag":134,"props":3798,"children":3799},{"class":136,"line":155},[3800,3804,3808,3812,3816,3820,3824,3829,3833,3837],{"type":40,"tag":134,"props":3801,"children":3802},{"style":657},[3803],{"type":45,"value":907},{"type":40,"tag":134,"props":3805,"children":3806},{"style":358},[3807],{"type":45,"value":665},{"type":40,"tag":134,"props":3809,"children":3810},{"style":358},[3811],{"type":45,"value":392},{"type":40,"tag":134,"props":3813,"children":3814},{"style":395},[3815],{"type":45,"value":920},{"type":40,"tag":134,"props":3817,"children":3818},{"style":358},[3819],{"type":45,"value":402},{"type":40,"tag":134,"props":3821,"children":3822},{"style":358},[3823],{"type":45,"value":372},{"type":40,"tag":134,"props":3825,"children":3826},{"style":657},[3827],{"type":45,"value":3828}," tools",{"type":40,"tag":134,"props":3830,"children":3831},{"style":358},[3832],{"type":45,"value":665},{"type":40,"tag":134,"props":3834,"children":3835},{"style":364},[3836],{"type":45,"value":945},{"type":40,"tag":134,"props":3838,"children":3839},{"style":358},[3840],{"type":45,"value":643},{"type":40,"tag":134,"props":3842,"children":3843},{"class":136,"line":164},[3844,3848,3852,3856,3860,3864,3868,3873,3877,3881,3885,3889,3895,3899,3903,3908],{"type":40,"tag":134,"props":3845,"children":3846},{"style":657},[3847],{"type":45,"value":986},{"type":40,"tag":134,"props":3849,"children":3850},{"style":358},[3851],{"type":45,"value":665},{"type":40,"tag":134,"props":3853,"children":3854},{"style":364},[3855],{"type":45,"value":1054},{"type":40,"tag":134,"props":3857,"children":3858},{"style":559},[3859],{"type":45,"value":67},{"type":40,"tag":134,"props":3861,"children":3862},{"style":364},[3863],{"type":45,"value":742},{"type":40,"tag":134,"props":3865,"children":3866},{"style":358},[3867],{"type":45,"value":747},{"type":40,"tag":134,"props":3869,"children":3870},{"style":657},[3871],{"type":45,"value":3872}," interruptOn",{"type":40,"tag":134,"props":3874,"children":3875},{"style":358},[3876],{"type":45,"value":665},{"type":40,"tag":134,"props":3878,"children":3879},{"style":358},[3880],{"type":45,"value":361},{"type":40,"tag":134,"props":3882,"children":3883},{"style":657},[3884],{"type":45,"value":1032},{"type":40,"tag":134,"props":3886,"children":3887},{"style":358},[3888],{"type":45,"value":665},{"type":40,"tag":134,"props":3890,"children":3892},{"style":3891},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[3893],{"type":45,"value":3894}," true",{"type":40,"tag":134,"props":3896,"children":3897},{"style":358},[3898],{"type":45,"value":382},{"type":40,"tag":134,"props":3900,"children":3901},{"style":358},[3902],{"type":45,"value":382},{"type":40,"tag":134,"props":3904,"children":3905},{"style":364},[3906],{"type":45,"value":3907},")]",{"type":40,"tag":134,"props":3909,"children":3910},{"style":358},[3911],{"type":45,"value":643},{"type":40,"tag":134,"props":3913,"children":3914},{"class":136,"line":173},[3915,3919,3923],{"type":40,"tag":134,"props":3916,"children":3917},{"style":358},[3918],{"type":45,"value":835},{"type":40,"tag":134,"props":3920,"children":3921},{"style":364},[3922],{"type":45,"value":840},{"type":40,"tag":134,"props":3924,"children":3925},{"style":358},[3926],{"type":45,"value":407},{"type":40,"tag":134,"props":3928,"children":3929},{"class":136,"line":183},[3930],{"type":40,"tag":134,"props":3931,"children":3932},{"emptyLinePlaceholder":177},[3933],{"type":45,"value":180},{"type":40,"tag":134,"props":3935,"children":3936},{"class":136,"line":192},[3937],{"type":40,"tag":134,"props":3938,"children":3939},{"style":1450},[3940],{"type":45,"value":3941},"\u002F\u002F CORRECT: Add checkpointer\n",{"type":40,"tag":134,"props":3943,"children":3944},{"class":136,"line":201},[3945,3949,3953,3957,3961,3965],{"type":40,"tag":134,"props":3946,"children":3947},{"style":543},[3948],{"type":45,"value":546},{"type":40,"tag":134,"props":3950,"children":3951},{"style":364},[3952],{"type":45,"value":882},{"type":40,"tag":134,"props":3954,"children":3955},{"style":358},[3956],{"type":45,"value":556},{"type":40,"tag":134,"props":3958,"children":3959},{"style":559},[3960],{"type":45,"value":367},{"type":40,"tag":134,"props":3962,"children":3963},{"style":364},[3964],{"type":45,"value":742},{"type":40,"tag":134,"props":3966,"children":3967},{"style":358},[3968],{"type":45,"value":899},{"type":40,"tag":134,"props":3970,"children":3971},{"class":136,"line":210},[3972,3976,3980,3984,3988,3992,3996,4000,4004,4008],{"type":40,"tag":134,"props":3973,"children":3974},{"style":657},[3975],{"type":45,"value":907},{"type":40,"tag":134,"props":3977,"children":3978},{"style":358},[3979],{"type":45,"value":665},{"type":40,"tag":134,"props":3981,"children":3982},{"style":358},[3983],{"type":45,"value":392},{"type":40,"tag":134,"props":3985,"children":3986},{"style":395},[3987],{"type":45,"value":920},{"type":40,"tag":134,"props":3989,"children":3990},{"style":358},[3991],{"type":45,"value":402},{"type":40,"tag":134,"props":3993,"children":3994},{"style":358},[3995],{"type":45,"value":372},{"type":40,"tag":134,"props":3997,"children":3998},{"style":657},[3999],{"type":45,"value":3828},{"type":40,"tag":134,"props":4001,"children":4002},{"style":358},[4003],{"type":45,"value":665},{"type":40,"tag":134,"props":4005,"children":4006},{"style":364},[4007],{"type":45,"value":945},{"type":40,"tag":134,"props":4009,"children":4010},{"style":358},[4011],{"type":45,"value":643},{"type":40,"tag":134,"props":4013,"children":4014},{"class":136,"line":219},[4015,4019,4023,4027,4031,4035],{"type":40,"tag":134,"props":4016,"children":4017},{"style":657},[4018],{"type":45,"value":957},{"type":40,"tag":134,"props":4020,"children":4021},{"style":358},[4022],{"type":45,"value":665},{"type":40,"tag":134,"props":4024,"children":4025},{"style":358},[4026],{"type":45,"value":966},{"type":40,"tag":134,"props":4028,"children":4029},{"style":559},[4030],{"type":45,"value":423},{"type":40,"tag":134,"props":4032,"children":4033},{"style":364},[4034],{"type":45,"value":773},{"type":40,"tag":134,"props":4036,"children":4037},{"style":358},[4038],{"type":45,"value":643},{"type":40,"tag":134,"props":4040,"children":4041},{"class":136,"line":227},[4042,4046,4050,4054,4058,4062,4066,4070,4074,4078,4082,4086,4090,4094,4098,4102],{"type":40,"tag":134,"props":4043,"children":4044},{"style":657},[4045],{"type":45,"value":986},{"type":40,"tag":134,"props":4047,"children":4048},{"style":358},[4049],{"type":45,"value":665},{"type":40,"tag":134,"props":4051,"children":4052},{"style":364},[4053],{"type":45,"value":1054},{"type":40,"tag":134,"props":4055,"children":4056},{"style":559},[4057],{"type":45,"value":67},{"type":40,"tag":134,"props":4059,"children":4060},{"style":364},[4061],{"type":45,"value":742},{"type":40,"tag":134,"props":4063,"children":4064},{"style":358},[4065],{"type":45,"value":747},{"type":40,"tag":134,"props":4067,"children":4068},{"style":657},[4069],{"type":45,"value":3872},{"type":40,"tag":134,"props":4071,"children":4072},{"style":358},[4073],{"type":45,"value":665},{"type":40,"tag":134,"props":4075,"children":4076},{"style":358},[4077],{"type":45,"value":361},{"type":40,"tag":134,"props":4079,"children":4080},{"style":657},[4081],{"type":45,"value":1032},{"type":40,"tag":134,"props":4083,"children":4084},{"style":358},[4085],{"type":45,"value":665},{"type":40,"tag":134,"props":4087,"children":4088},{"style":3891},[4089],{"type":45,"value":3894},{"type":40,"tag":134,"props":4091,"children":4092},{"style":358},[4093],{"type":45,"value":382},{"type":40,"tag":134,"props":4095,"children":4096},{"style":358},[4097],{"type":45,"value":382},{"type":40,"tag":134,"props":4099,"children":4100},{"style":364},[4101],{"type":45,"value":3907},{"type":40,"tag":134,"props":4103,"children":4104},{"style":358},[4105],{"type":45,"value":643},{"type":40,"tag":134,"props":4107,"children":4108},{"class":136,"line":236},[4109,4113,4117],{"type":40,"tag":134,"props":4110,"children":4111},{"style":358},[4112],{"type":45,"value":835},{"type":40,"tag":134,"props":4114,"children":4115},{"style":364},[4116],{"type":45,"value":840},{"type":40,"tag":134,"props":4118,"children":4119},{"style":358},[4120],{"type":45,"value":407},{"type":40,"tag":4122,"props":4123,"children":4124},"fix-no-thread-id",{},[4125],{"type":40,"tag":117,"props":4126,"children":4127},{},[4128,4130],{"type":45,"value":4129},"\nAlways provide thread_id when using HITL to track conversation state.\n",{"type":40,"tag":123,"props":4131,"children":4133},{"className":125,"code":4132,"language":117,"meta":127,"style":127},"# WRONG\nagent.invoke(input)  # No config!\n\n# CORRECT\nagent.invoke(input, config={\"configurable\": {\"thread_id\": \"user-123\"}})\n",[4134],{"type":40,"tag":130,"props":4135,"children":4136},{"__ignoreMap":127},[4137,4144,4152,4159,4166],{"type":40,"tag":134,"props":4138,"children":4139},{"class":136,"line":137},[4140],{"type":40,"tag":134,"props":4141,"children":4142},{},[4143],{"type":45,"value":3688},{"type":40,"tag":134,"props":4145,"children":4146},{"class":136,"line":146},[4147],{"type":40,"tag":134,"props":4148,"children":4149},{},[4150],{"type":45,"value":4151},"agent.invoke(input)  # No config!\n",{"type":40,"tag":134,"props":4153,"children":4154},{"class":136,"line":155},[4155],{"type":40,"tag":134,"props":4156,"children":4157},{"emptyLinePlaceholder":177},[4158],{"type":45,"value":180},{"type":40,"tag":134,"props":4160,"children":4161},{"class":136,"line":164},[4162],{"type":40,"tag":134,"props":4163,"children":4164},{},[4165],{"type":45,"value":3711},{"type":40,"tag":134,"props":4167,"children":4168},{"class":136,"line":173},[4169],{"type":40,"tag":134,"props":4170,"children":4171},{},[4172],{"type":45,"value":4173},"agent.invoke(input, config={\"configurable\": {\"thread_id\": \"user-123\"}})\n",{"type":40,"tag":4175,"props":4176,"children":4177},"fix-wrong-resume-syntax",{},[4178,4234],{"type":40,"tag":117,"props":4179,"children":4180},{},[4181,4183],{"type":45,"value":4182},"\nUse Command class to resume execution after an interrupt.\n",{"type":40,"tag":123,"props":4184,"children":4186},{"className":125,"code":4185,"language":117,"meta":127,"style":127},"# WRONG\nagent.invoke({\"resume\": {\"decisions\": [...]}})\n\n# CORRECT\nfrom langgraph.types import Command\nagent.invoke(Command(resume={\"decisions\": [{\"type\": \"approve\"}]}), config=config)\n",[4187],{"type":40,"tag":130,"props":4188,"children":4189},{"__ignoreMap":127},[4190,4197,4205,4212,4219,4226],{"type":40,"tag":134,"props":4191,"children":4192},{"class":136,"line":137},[4193],{"type":40,"tag":134,"props":4194,"children":4195},{},[4196],{"type":45,"value":3688},{"type":40,"tag":134,"props":4198,"children":4199},{"class":136,"line":146},[4200],{"type":40,"tag":134,"props":4201,"children":4202},{},[4203],{"type":45,"value":4204},"agent.invoke({\"resume\": {\"decisions\": [...]}})\n",{"type":40,"tag":134,"props":4206,"children":4207},{"class":136,"line":155},[4208],{"type":40,"tag":134,"props":4209,"children":4210},{"emptyLinePlaceholder":177},[4211],{"type":45,"value":180},{"type":40,"tag":134,"props":4213,"children":4214},{"class":136,"line":164},[4215],{"type":40,"tag":134,"props":4216,"children":4217},{},[4218],{"type":45,"value":3711},{"type":40,"tag":134,"props":4220,"children":4221},{"class":136,"line":173},[4222],{"type":40,"tag":134,"props":4223,"children":4224},{},[4225],{"type":45,"value":1184},{"type":40,"tag":134,"props":4227,"children":4228},{"class":136,"line":183},[4229],{"type":40,"tag":134,"props":4230,"children":4231},{},[4232],{"type":45,"value":4233},"agent.invoke(Command(resume={\"decisions\": [{\"type\": \"approve\"}]}), config=config)\n",{"type":40,"tag":334,"props":4235,"children":4236},{},[4237,4238],{"type":45,"value":4182},{"type":40,"tag":123,"props":4239,"children":4241},{"className":341,"code":4240,"language":334,"meta":127,"style":127},"\u002F\u002F WRONG\nawait agent.invoke({ resume: { decisions: [...] } });\n\n\u002F\u002F CORRECT\nimport { Command } from \"@langchain\u002Flanggraph\";\nawait agent.invoke(new Command({ resume: { decisions: [{ type: \"approve\" }] } }), config);\n",[4242],{"type":40,"tag":130,"props":4243,"children":4244},{"__ignoreMap":127},[4245,4253,4329,4336,4344,4383],{"type":40,"tag":134,"props":4246,"children":4247},{"class":136,"line":137},[4248],{"type":40,"tag":134,"props":4249,"children":4250},{"style":1450},[4251],{"type":45,"value":4252},"\u002F\u002F WRONG\n",{"type":40,"tag":134,"props":4254,"children":4255},{"class":136,"line":146},[4256,4261,4265,4269,4273,4277,4281,4285,4289,4293,4297,4301,4305,4309,4313,4317,4321,4325],{"type":40,"tag":134,"props":4257,"children":4258},{"style":352},[4259],{"type":45,"value":4260},"await",{"type":40,"tag":134,"props":4262,"children":4263},{"style":364},[4264],{"type":45,"value":1479},{"type":40,"tag":134,"props":4266,"children":4267},{"style":358},[4268],{"type":45,"value":732},{"type":40,"tag":134,"props":4270,"children":4271},{"style":559},[4272],{"type":45,"value":1488},{"type":40,"tag":134,"props":4274,"children":4275},{"style":364},[4276],{"type":45,"value":742},{"type":40,"tag":134,"props":4278,"children":4279},{"style":358},[4280],{"type":45,"value":747},{"type":40,"tag":134,"props":4282,"children":4283},{"style":657},[4284],{"type":45,"value":1776},{"type":40,"tag":134,"props":4286,"children":4287},{"style":358},[4288],{"type":45,"value":665},{"type":40,"tag":134,"props":4290,"children":4291},{"style":358},[4292],{"type":45,"value":361},{"type":40,"tag":134,"props":4294,"children":4295},{"style":657},[4296],{"type":45,"value":1789},{"type":40,"tag":134,"props":4298,"children":4299},{"style":358},[4300],{"type":45,"value":665},{"type":40,"tag":134,"props":4302,"children":4303},{"style":364},[4304],{"type":45,"value":1054},{"type":40,"tag":134,"props":4306,"children":4307},{"style":358},[4308],{"type":45,"value":2296},{"type":40,"tag":134,"props":4310,"children":4311},{"style":364},[4312],{"type":45,"value":1106},{"type":40,"tag":134,"props":4314,"children":4315},{"style":358},[4316],{"type":45,"value":835},{"type":40,"tag":134,"props":4318,"children":4319},{"style":358},[4320],{"type":45,"value":382},{"type":40,"tag":134,"props":4322,"children":4323},{"style":364},[4324],{"type":45,"value":840},{"type":40,"tag":134,"props":4326,"children":4327},{"style":358},[4328],{"type":45,"value":407},{"type":40,"tag":134,"props":4330,"children":4331},{"class":136,"line":155},[4332],{"type":40,"tag":134,"props":4333,"children":4334},{"emptyLinePlaceholder":177},[4335],{"type":45,"value":180},{"type":40,"tag":134,"props":4337,"children":4338},{"class":136,"line":164},[4339],{"type":40,"tag":134,"props":4340,"children":4341},{"style":1450},[4342],{"type":45,"value":4343},"\u002F\u002F CORRECT\n",{"type":40,"tag":134,"props":4345,"children":4346},{"class":136,"line":173},[4347,4351,4355,4359,4363,4367,4371,4375,4379],{"type":40,"tag":134,"props":4348,"children":4349},{"style":352},[4350],{"type":45,"value":355},{"type":40,"tag":134,"props":4352,"children":4353},{"style":358},[4354],{"type":45,"value":361},{"type":40,"tag":134,"props":4356,"children":4357},{"style":364},[4358],{"type":45,"value":1342},{"type":40,"tag":134,"props":4360,"children":4361},{"style":358},[4362],{"type":45,"value":382},{"type":40,"tag":134,"props":4364,"children":4365},{"style":352},[4366],{"type":45,"value":387},{"type":40,"tag":134,"props":4368,"children":4369},{"style":358},[4370],{"type":45,"value":392},{"type":40,"tag":134,"props":4372,"children":4373},{"style":395},[4374],{"type":45,"value":440},{"type":40,"tag":134,"props":4376,"children":4377},{"style":358},[4378],{"type":45,"value":402},{"type":40,"tag":134,"props":4380,"children":4381},{"style":358},[4382],{"type":45,"value":407},{"type":40,"tag":134,"props":4384,"children":4385},{"class":136,"line":183},[4386,4390,4394,4398,4402,4406,4411,4415,4419,4423,4427,4431,4435,4439,4443,4447,4451,4455,4459,4463,4467,4471,4475,4479,4483,4487,4491,4495,4499],{"type":40,"tag":134,"props":4387,"children":4388},{"style":352},[4389],{"type":45,"value":4260},{"type":40,"tag":134,"props":4391,"children":4392},{"style":364},[4393],{"type":45,"value":1479},{"type":40,"tag":134,"props":4395,"children":4396},{"style":358},[4397],{"type":45,"value":732},{"type":40,"tag":134,"props":4399,"children":4400},{"style":559},[4401],{"type":45,"value":1488},{"type":40,"tag":134,"props":4403,"children":4404},{"style":364},[4405],{"type":45,"value":742},{"type":40,"tag":134,"props":4407,"children":4408},{"style":358},[4409],{"type":45,"value":4410},"new",{"type":40,"tag":134,"props":4412,"children":4413},{"style":559},[4414],{"type":45,"value":1342},{"type":40,"tag":134,"props":4416,"children":4417},{"style":364},[4418],{"type":45,"value":742},{"type":40,"tag":134,"props":4420,"children":4421},{"style":358},[4422],{"type":45,"value":747},{"type":40,"tag":134,"props":4424,"children":4425},{"style":657},[4426],{"type":45,"value":1776},{"type":40,"tag":134,"props":4428,"children":4429},{"style":358},[4430],{"type":45,"value":665},{"type":40,"tag":134,"props":4432,"children":4433},{"style":358},[4434],{"type":45,"value":361},{"type":40,"tag":134,"props":4436,"children":4437},{"style":657},[4438],{"type":45,"value":1789},{"type":40,"tag":134,"props":4440,"children":4441},{"style":358},[4442],{"type":45,"value":665},{"type":40,"tag":134,"props":4444,"children":4445},{"style":364},[4446],{"type":45,"value":1054},{"type":40,"tag":134,"props":4448,"children":4449},{"style":358},[4450],{"type":45,"value":747},{"type":40,"tag":134,"props":4452,"children":4453},{"style":657},[4454],{"type":45,"value":1806},{"type":40,"tag":134,"props":4456,"children":4457},{"style":358},[4458],{"type":45,"value":665},{"type":40,"tag":134,"props":4460,"children":4461},{"style":358},[4462],{"type":45,"value":392},{"type":40,"tag":134,"props":4464,"children":4465},{"style":395},[4466],{"type":45,"value":1063},{"type":40,"tag":134,"props":4468,"children":4469},{"style":358},[4470],{"type":45,"value":402},{"type":40,"tag":134,"props":4472,"children":4473},{"style":358},[4474],{"type":45,"value":382},{"type":40,"tag":134,"props":4476,"children":4477},{"style":364},[4478],{"type":45,"value":1106},{"type":40,"tag":134,"props":4480,"children":4481},{"style":358},[4482],{"type":45,"value":835},{"type":40,"tag":134,"props":4484,"children":4485},{"style":358},[4486],{"type":45,"value":382},{"type":40,"tag":134,"props":4488,"children":4489},{"style":364},[4490],{"type":45,"value":840},{"type":40,"tag":134,"props":4492,"children":4493},{"style":358},[4494],{"type":45,"value":372},{"type":40,"tag":134,"props":4496,"children":4497},{"style":364},[4498],{"type":45,"value":1586},{"type":40,"tag":134,"props":4500,"children":4501},{"style":358},[4502],{"type":45,"value":407},{"type":40,"tag":4504,"props":4505,"children":4506},"style",{},[4507],{"type":45,"value":4508},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":4510,"total":4687},[4511,4532,4543,4560,4573,4588,4605,4620,4634,4644,4655,4674],{"slug":4512,"name":4512,"fn":4513,"description":4514,"org":4515,"tags":4516,"stars":4529,"repoUrl":4530,"updatedAt":4531},"analyze-market","perform market analysis and size estimation","Perform a market analysis for a product category or segment. Trigger on: market analysis, market size, TAM SAM SOM, market opportunity, industry analysis.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4517,4520,4523,4526],{"name":4518,"slug":4519,"type":16},"Marketing","marketing",{"name":4521,"slug":4522,"type":16},"Research","research",{"name":4524,"slug":4525,"type":16},"Sales","sales",{"name":4527,"slug":4528,"type":16},"Strategy","strategy",26592,"https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Fdeepagents","2026-04-18T04:46:54.557115",{"slug":4533,"name":4533,"fn":4534,"description":4535,"org":4536,"tags":4537,"stars":4529,"repoUrl":4530,"updatedAt":4542},"arxiv-search","search arXiv for academic research papers","Searches arXiv for preprints and academic papers, retrieves abstracts, and filters by topic. Use when the user asks to find research papers, search arXiv, look up preprints, find academic articles in physics, math, CS, biology, statistics, or related fields.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4538,4539],{"name":4521,"slug":4522,"type":16},{"name":4540,"slug":4541,"type":16},"Search","search","2026-05-13T06:11:01.203061",{"slug":4544,"name":4544,"fn":4545,"description":4546,"org":4547,"tags":4548,"stars":4529,"repoUrl":4530,"updatedAt":4559},"blog-post","write SEO-optimized blog posts","Write long-form blog posts with SEO optimization and clear structure.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4549,4552,4553,4556],{"name":4550,"slug":4551,"type":16},"Content Creation","content-creation",{"name":4518,"slug":4519,"type":16},{"name":4554,"slug":4555,"type":16},"SEO","seo",{"name":4557,"slug":4558,"type":16},"Writing","writing","2026-04-15T05:00:54.149813",{"slug":4561,"name":4561,"fn":4562,"description":4563,"org":4564,"tags":4565,"stars":4529,"repoUrl":4530,"updatedAt":4572},"competitor-analysis","analyze competitors and market positioning","Analyze competitors in a given market segment. Trigger on: competitive landscape, competitor analysis, market comparison, competitive positioning.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4566,4569,4570,4571],{"name":4567,"slug":4568,"type":16},"Competitive Intelligence","competitive-intelligence",{"name":4518,"slug":4519,"type":16},{"name":4521,"slug":4522,"type":16},{"name":4527,"slug":4528,"type":16},"2026-04-18T04:46:55.79306",{"slug":4574,"name":4574,"fn":4575,"description":4576,"org":4577,"tags":4578,"stars":4529,"repoUrl":4530,"updatedAt":4587},"deepagents-thread-inspector","inspect local Deep Agents conversation threads","Inspect and explain conversations in the local Deep Agents Code SQLite session store. Use as a fallback when LangSmith trace tooling is unavailable, for offline or untraced sessions, or when asked to identify or summarize a local dcode thread, inspect checkpoint metadata, list recent local threads, or parse ~\u002F.deepagents\u002F.state\u002Fsessions.db and a thread UUID or prefix.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4579,4580,4583,4584],{"name":19,"slug":20,"type":16},{"name":4581,"slug":4582,"type":16},"Debugging","debugging",{"name":9,"slug":8,"type":16},{"name":4585,"slug":4586,"type":16},"SQLite","sqlite","2026-07-24T06:08:57.102689",{"slug":4589,"name":4589,"fn":4590,"description":4591,"org":4592,"tags":4593,"stars":4529,"repoUrl":4530,"updatedAt":4604},"langgraph-docs","build stateful agents with LangGraph","Fetches and references LangGraph Python documentation to build stateful agents, create multi-agent workflows, and implement human-in-the-loop patterns. Use when the user asks about LangGraph, graph agents, state machines, agent orchestration, LangGraph API, or needs LangGraph implementation guidance.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4594,4595,4598,4601],{"name":19,"slug":20,"type":16},{"name":4596,"slug":4597,"type":16},"Documentation","documentation",{"name":4599,"slug":4600,"type":16},"LangGraph","langgraph",{"name":4602,"slug":4603,"type":16},"Multi-Agent","multi-agent","2026-05-13T06:11:03.650877",{"slug":4606,"name":4606,"fn":4607,"description":4608,"org":4609,"tags":4610,"stars":4529,"repoUrl":4530,"updatedAt":4619},"remember","capture knowledge into persistent memory","Review the current conversation and capture valuable knowledge — best practices, coding conventions, architecture decisions, workflows, and user feedback — into persistent memory (AGENTS.md) or reusable skills. Use when the user says: (1) remember this, (2) save what we learned, (3) update memory, (4) capture learnings.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4611,4612,4613,4616],{"name":19,"slug":20,"type":16},{"name":4596,"slug":4597,"type":16},{"name":4614,"slug":4615,"type":16},"Knowledge Management","knowledge-management",{"name":4617,"slug":4618,"type":16},"Memory","memory","2026-05-13T06:10:58.510037",{"slug":4621,"name":4621,"fn":4622,"description":4623,"org":4624,"tags":4625,"stars":4529,"repoUrl":4530,"updatedAt":4633},"skill-creator","create agent skills and tool integrations","Guide for creating effective skills that extend agent capabilities with specialized knowledge, workflows, or tool integrations. Use this skill when the user asks to: (1) create a new skill, (2) make a skill, (3) build a skill, (4) set up a skill, (5) initialize a skill, (6) scaffold a skill, (7) update or modify an existing skill, (8) validate a skill, (9) learn about skill structure, (10) understand how skills work, or (11) get guidance on skill design patterns. Trigger on phrases like \"create a skill\", \"new skill\", \"make a skill\", \"skill for X\", \"how do I create a skill\", or \"help me build a skill\".",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4626,4627,4630],{"name":19,"slug":20,"type":16},{"name":4628,"slug":4629,"type":16},"Engineering","engineering",{"name":4631,"slug":4632,"type":16},"Plugin Development","plugin-development","2026-05-13T06:10:59.88449",{"slug":4635,"name":4635,"fn":4636,"description":4637,"org":4638,"tags":4639,"stars":4529,"repoUrl":4530,"updatedAt":4643},"social-media","create optimized social media posts","Create social media posts optimized for engagement across platforms.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4640,4641,4642],{"name":4550,"slug":4551,"type":16},{"name":4518,"slug":4519,"type":16},{"name":4557,"slug":4558,"type":16},"2026-04-15T05:00:55.37452",{"slug":4645,"name":4645,"fn":4646,"description":4647,"org":4648,"tags":4649,"stars":4529,"repoUrl":4530,"updatedAt":4654},"web-research","conduct and synthesize web research","Searches multiple web sources, synthesizes findings, and produces cited research reports using delegated subagents. Use when the user asks to research a topic online, search the web, look something up, find current information, compare options, or produce a research report.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4650,4651,4652,4653],{"name":19,"slug":20,"type":16},{"name":4602,"slug":4603,"type":16},{"name":4521,"slug":4522,"type":16},{"name":4540,"slug":4541,"type":16},"2026-05-13T06:11:04.930044",{"slug":4656,"name":4656,"fn":4657,"description":4658,"org":4659,"tags":4660,"stars":4671,"repoUrl":4672,"updatedAt":4673},"mermaid-diagrams","embed Mermaid diagrams in documentation","Embed Mermaid diagrams in generated wiki pages. Use whenever documenting a runtime or request flow, a call sequence, a state machine or lifecycle, a data model or entity relationships, or non-trivial control flow, since these are clearer as a diagram than as prose. Also use when an update run touches a page that already contains a mermaid fence, or a page that contains a text fence a previous run degraded.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4661,4664,4665,4668],{"name":4662,"slug":4663,"type":16},"Diagrams","diagrams",{"name":4596,"slug":4597,"type":16},{"name":4666,"slug":4667,"type":16},"Markdown","markdown",{"name":4669,"slug":4670,"type":16},"Technical Writing","technical-writing",12181,"https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Fopenwiki","2026-07-24T06:09:01.089597",{"slug":4675,"name":4675,"fn":4676,"description":4677,"org":4678,"tags":4679,"stars":4671,"repoUrl":4672,"updatedAt":4686},"write-connector","implement OpenWiki source connectors","Add a new built-in OpenWiki source connector. Use when a user asks to create or implement an OpenWiki connector.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4680,4683],{"name":4681,"slug":4682,"type":16},"API Development","api-development",{"name":4684,"slug":4685,"type":16},"Integrations","integrations","2026-07-18T05:48:23.961804",41,{"items":4689,"total":326},[4690,4703,4716,4730,4741,4752,4766],{"slug":4691,"name":4691,"fn":4692,"description":4693,"org":4694,"tags":4695,"stars":24,"repoUrl":25,"updatedAt":4702},"deep-agents-core","build applications with LangChain Deep Agents","INVOKE THIS SKILL when building ANY Deep Agents application. Covers create_deep_agent(), harness architecture, SKILL.md format, and configuration options.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4696,4697,4700,4701],{"name":19,"slug":20,"type":16},{"name":4698,"slug":4699,"type":16},"Architecture","architecture",{"name":9,"slug":8,"type":16},{"name":14,"slug":15,"type":16},"2026-04-06T18:26:24.822592",{"slug":4704,"name":4704,"fn":4705,"description":4706,"org":4707,"tags":4708,"stars":24,"repoUrl":25,"updatedAt":4715},"deep-agents-memory","implement memory and persistence for Deep Agents","INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access. Covers StateBackend (ephemeral), StoreBackend (persistent), FilesystemMiddleware, and CompositeBackend for routing.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4709,4710,4711,4712],{"name":19,"slug":20,"type":16},{"name":9,"slug":8,"type":16},{"name":4617,"slug":4618,"type":16},{"name":4713,"slug":4714,"type":16},"Storage","storage","2026-04-06T18:26:26.065654",{"slug":4717,"name":4717,"fn":4718,"description":4719,"org":4720,"tags":4721,"stars":24,"repoUrl":25,"updatedAt":4729},"deep-agents-orchestration","orchestrate subagents and tasks in Deep Agents","INVOKE THIS SKILL when using subagents, task planning, or human approval in Deep Agents. Covers SubAgentMiddleware, TodoList for planning, and HITL interrupts.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4722,4723,4724,4725,4726],{"name":19,"slug":20,"type":16},{"name":22,"slug":23,"type":16},{"name":9,"slug":8,"type":16},{"name":4602,"slug":4603,"type":16},{"name":4727,"slug":4728,"type":16},"Workflow Automation","workflow-automation","2026-04-06T18:26:32.280463",{"slug":4731,"name":4731,"fn":4732,"description":4733,"org":4734,"tags":4735,"stars":24,"repoUrl":25,"updatedAt":4740},"deepagents-python-quickstart","scaffold local Deep Agents","Scaffold a minimal local Deep Agent in Python by following the official quickstart, using provider-native web search instead of Tavily. Use when the user wants to quickly build or try a Deep Agent locally.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4736,4737,4738],{"name":19,"slug":20,"type":16},{"name":9,"slug":8,"type":16},{"name":4739,"slug":117,"type":16},"Python","2026-07-24T06:09:00.291108",{"slug":4742,"name":4742,"fn":4743,"description":4744,"org":4745,"tags":4746,"stars":24,"repoUrl":25,"updatedAt":4751},"deepagents-typescript-quickstart","build Deep Agents in TypeScript","Scaffold a minimal local Deep Agent in TypeScript by following the official quickstart, using provider-native web search instead of Tavily. Use when the user wants to quickly build or try a Deep Agent locally.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4747,4748,4749],{"name":19,"slug":20,"type":16},{"name":9,"slug":8,"type":16},{"name":4750,"slug":334,"type":16},"TypeScript","2026-07-24T06:09:00.673714",{"slug":4753,"name":4753,"fn":4754,"description":4755,"org":4756,"tags":4757,"stars":24,"repoUrl":25,"updatedAt":4765},"ecosystem-primer","select frameworks for LangChain and LangGraph agents","INVOKE FIRST for any LangChain \u002F LangGraph \u002F Deep Agents agent building project before consulting other skills or writing any agent code. Required starting point for up to date info on framework selection (LangChain vs LangGraph vs Deep Agents vs hybrid composition), agent patterns, install, environment setup, and which skill to load next.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4758,4759,4762,4763,4764],{"name":19,"slug":20,"type":16},{"name":4760,"slug":4761,"type":16},"AI Infrastructure","ai-infrastructure",{"name":4698,"slug":4699,"type":16},{"name":9,"slug":8,"type":16},{"name":4599,"slug":4600,"type":16},"2026-07-24T05:42:48.348966",{"slug":4767,"name":4767,"fn":4768,"description":4769,"org":4770,"tags":4771,"stars":24,"repoUrl":25,"updatedAt":4783},"eval-engineering","create and audit Harbor agent evals","Iteratively inspect an agent repository and optional user-provided traces, interview the user, and create, run, and audit Harbor evals one at a time. Use for agent evals, Harbor tasks, benchmark cases, verifier design, or controlled agent environments.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4772,4773,4776,4779,4780],{"name":19,"slug":20,"type":16},{"name":4774,"slug":4775,"type":16},"Code Analysis","code-analysis",{"name":4777,"slug":4778,"type":16},"Evals","evals",{"name":9,"slug":8,"type":16},{"name":4781,"slug":4782,"type":16},"Testing","testing","2026-07-31T05:53:29.552458"]