Skip to content

Commit d1c89f1

Browse files
mcavdarlnhsingh
andauthored
docs: Enhance HumanInTheLoopMiddleware configuration for email review (#1205)
## Overview The current config produces an issue: ``` Traceback (most recent call last): File "<stdin>", line 4, in <module> File "/home/mc/.venv-langchain-v1/lib/python3.10/site-packages/langchain/agents/middleware/human_in_the_loop.py", line 193, in __init__ elif tool_config.get("allowed_decisions"): AttributeError: 'str' object has no attribute 'get' ``` The old example conflicts with the configuration options described in [LangChain’s documentation](https://docs.langchain.com/oss/python/langchain/middleware#human-in-the-loop) The description field is part of InterruptOnConfig, so the dictionary value should be an InterruptOnConfig object. ## Type of change **Type:** [Update existing documentation /bug/Remove outdated content] ## Related issues/PRs <!-- Link to related issues, feature PRs, or discussions (if applicable) To automatically close an issue when this PR is merged, use closing keywords: - "closes #123" or "fixes #123" or "resolves #123" For regular references without auto-closing, just use: - "#123" or "See issue #123" Examples: - closes #456 (will auto-close issue #456 when PR is merged) - See #789 for context (will reference but not auto-close issue #789) --> - GitHub issue: - Feature PR: <!-- For LangChain employees, if applicable: --> - Linear issue: - Slack thread: ## Checklist <!-- Put an 'x' in all boxes that apply --> - [x] I have read the [contributing guidelines](README.md) - [x] I have tested my changes locally using `docs dev` - [x] All code examples have been tested and work correctly - [x] I have used **root relative** paths for internal links - [x] I have updated navigation in `src/docs.json` if needed - I have gotten approval from the relevant reviewers - (Internal team members only / optional) I have created a preview deployment using the [Create Preview Branch workflow](https://github.com/langchain-ai/docs/actions/workflows/create-preview-branch.yml) ## Additional notes <!-- Any other information that would be helpful for reviewers --> --------- Co-authored-by: Lauren Hirata Singh <[email protected]>
1 parent 5b50105 commit d1c89f1

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/oss/python/migrate/langchain-v1.mdx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,16 @@ from langchain.agents.middleware import HumanInTheLoopMiddleware
310310
agent = create_agent(
311311
model="claude-sonnet-4-5-20250929",
312312
tools=[read_email, send_email],
313-
middleware=[HumanInTheLoopMiddleware(
314-
interrupt_on={
315-
"send_email": True,
316-
"description": "Please review this email before sending"
317-
},
318-
)]
313+
middleware=[
314+
HumanInTheLoopMiddleware(
315+
interrupt_on={
316+
"send_email": {
317+
"description": "Please review this email before sending",
318+
"allowed_decisions": ["approve", "reject"]
319+
}
320+
}
321+
)
322+
]
319323
)
320324
```
321325

0 commit comments

Comments
 (0)