Skip to content

Commit d5ba5d3

Browse files
feat(langchain): improved HITL patterns (#32996)
# Main changes / new features ## Better support for parallel tool calls 1. Support for multiple tool calls requiring human input 2. Support for combination of tool calls requiring human input + those that are auto-approved 3. Support structured output w/ tool calls requiring human input 4. Support structured output w/ standard tool calls ## Shortcut for allowed actions Adds a shortcut where tool config can be specified as a `bool`, meaning "all actions allowed" ```py HumanInTheLoopMiddleware(tool_configs={"expensive_tool": True}) ``` ## A few design decisions here * We only raise one interrupt w/ all `HumanInterrupt`s, currently we won't be able to execute all tools until all of these are resolved. This isn't super blocking bc we can't re-invoke the model until all tools have finished execution. That being said, if you have a long running auto-approved tool, this could slow things down. ## TODOs * Ideally, we would rename `accept` -> `approve` * Ideally, we would rename `respond` -> `reject` * Docs update (@sydney-runkle to own) * In another PR I'd like to refactor testing to have one file for each prebuilt middleware :) Fast follow to #32962 which was deemed as too breaking
1 parent 76d0758 commit d5ba5d3

File tree

5 files changed

+772
-273
lines changed

5 files changed

+772
-273
lines changed

libs/langchain_v1/langchain/agents/interrupt.py

Lines changed: 0 additions & 97 deletions
This file was deleted.

libs/langchain_v1/langchain/agents/middleware/_utils.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)