test_parallel_write_todos_with_other_tools() — langchain Function Reference
Architecture documentation for the test_parallel_write_todos_with_other_tools() function in test_todo.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 5d58126c_58a7_5868_eb3e_422fc64b5dbc["test_parallel_write_todos_with_other_tools()"] d2f3bc2a_72aa_59d0_8558_330793eda010["test_todo.py"] 5d58126c_58a7_5868_eb3e_422fc64b5dbc -->|defined in| d2f3bc2a_72aa_59d0_8558_330793eda010 51077994_451d_5d5c_62d8_c5d5b714096b["_fake_runtime()"] 5d58126c_58a7_5868_eb3e_422fc64b5dbc -->|calls| 51077994_451d_5d5c_62d8_c5d5b714096b style 5d58126c_58a7_5868_eb3e_422fc64b5dbc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py lines 567–623
def test_parallel_write_todos_with_other_tools() -> None:
"""Test that parallel write_todos calls are rejected but other tool calls remain."""
middleware = TodoListMiddleware()
# Create an AI message with two write_todos calls and one other tool call
ai_message = AIMessage(
content="I'll do multiple things",
tool_calls=[
{
"name": "some_other_tool",
"args": {"param": "value"},
"id": "call_other",
"type": "tool_call",
},
{
"name": "write_todos",
"args": {"todos": [{"content": "Task 1", "status": "pending"}]},
"id": "call_1",
"type": "tool_call",
},
{
"name": "write_todos",
"args": {"todos": [{"content": "Task 2", "status": "pending"}]},
"id": "call_2",
"type": "tool_call",
},
],
)
state: PlanningState = {"messages": [HumanMessage(content="Hello"), ai_message]}
# Call after_model hook
result = middleware.after_model(state, _fake_runtime())
# Should return error messages for write_todos calls only
assert result == {
"messages": [
ToolMessage(
content=(
"Error: The `write_todos` tool should never be called multiple times "
"in parallel. Please call it only once per model invocation to update "
"the todo list."
),
tool_call_id="call_1",
status="error",
),
ToolMessage(
content=(
"Error: The `write_todos` tool should never be called multiple times "
"in parallel. Please call it only once per model invocation to update "
"the todo list."
),
tool_call_id="call_2",
status="error",
),
]
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does test_parallel_write_todos_with_other_tools() do?
test_parallel_write_todos_with_other_tools() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py.
Where is test_parallel_write_todos_with_other_tools() defined?
test_parallel_write_todos_with_other_tools() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py at line 567.
What does test_parallel_write_todos_with_other_tools() call?
test_parallel_write_todos_with_other_tools() calls 1 function(s): _fake_runtime.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free