test_state_passthrough() — langchain Function Reference
Architecture documentation for the test_state_passthrough() function in test_framework.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 06b106f1_6ab1_200e_f08c_ec2f46bbea62["test_state_passthrough()"] 7756726f_6234_5476_ab8e_0716a0d87ec6["TestAgentHooksCombined"] 06b106f1_6ab1_200e_f08c_ec2f46bbea62 -->|defined in| 7756726f_6234_5476_ab8e_0716a0d87ec6 style 06b106f1_6ab1_200e_f08c_ec2f46bbea62 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_framework.py lines 916–928
def test_state_passthrough(self) -> None:
"""Test that state modifications in before_agent are visible to after_agent."""
@before_agent
def modify_in_before(*_args: Any, **_kwargs: Any) -> dict[str, Any]:
return {"messages": [HumanMessage("Added by before_agent")]}
model = GenericFakeChatModel(messages=iter([AIMessage(content="Response")]))
agent = create_agent(model=model, tools=[], middleware=[modify_in_before])
result = agent.invoke({"messages": [HumanMessage("Original")]})
message_contents = [msg.content for msg in result["messages"]]
assert message_contents[1] == "Added by before_agent"
Domain
Subdomains
Source
Frequently Asked Questions
What does test_state_passthrough() do?
test_state_passthrough() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_framework.py.
Where is test_state_passthrough() defined?
test_state_passthrough() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_framework.py at line 916.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free