test_todo_middleware_custom_system_prompt_in_agent() — langchain Function Reference
Architecture documentation for the test_todo_middleware_custom_system_prompt_in_agent() function in test_todo.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e2c78c4c_60a7_ee11_0f87_de0387bf408b["test_todo_middleware_custom_system_prompt_in_agent()"] d2f3bc2a_72aa_59d0_8558_330793eda010["test_todo.py"] e2c78c4c_60a7_ee11_0f87_de0387bf408b -->|defined in| d2f3bc2a_72aa_59d0_8558_330793eda010 style e2c78c4c_60a7_ee11_0f87_de0387bf408b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py lines 416–439
def test_todo_middleware_custom_system_prompt_in_agent() -> None:
"""Test that custom tool executes correctly in an agent."""
middleware = TodoListMiddleware(system_prompt="call the write_todos tool")
model = FakeToolCallingModel(
tool_calls=[
[
{
"args": {"todos": [{"content": "Custom task", "status": "pending"}]},
"name": "write_todos",
"type": "tool_call",
"id": "test_call",
}
],
[],
]
)
agent = create_agent(model=model, middleware=[middleware])
result = agent.invoke({"messages": [HumanMessage("Hello")]})
assert result["todos"] == [{"content": "Custom task", "status": "pending"}]
# assert custom system prompt is in the first AI message
assert "call the write_todos tool" in result["messages"][1].content
Domain
Subdomains
Source
Frequently Asked Questions
What does test_todo_middleware_custom_system_prompt_in_agent() do?
test_todo_middleware_custom_system_prompt_in_agent() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py.
Where is test_todo_middleware_custom_system_prompt_in_agent() defined?
test_todo_middleware_custom_system_prompt_in_agent() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py at line 416.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free