test_dynamic_prompt_integration() — langchain Function Reference
Architecture documentation for the test_dynamic_prompt_integration() function in test_decorators.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD f929d3e7_a9ad_b39c_f7a0_c8b6cf3b6200["test_dynamic_prompt_integration()"] 85a104a3_11cf_6539_d0c0_ba69a17a41d4["test_decorators.py"] f929d3e7_a9ad_b39c_f7a0_c8b6cf3b6200 -->|defined in| 85a104a3_11cf_6539_d0c0_ba69a17a41d4 style f929d3e7_a9ad_b39c_f7a0_c8b6cf3b6200 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py lines 686–702
def test_dynamic_prompt_integration() -> None:
"""Test dynamic_prompt decorator in a full agent."""
prompt_calls = 0
@dynamic_prompt
def context_aware_prompt(request: ModelRequest) -> str:
nonlocal prompt_calls
prompt_calls += 1
return "you are a helpful assistant."
agent = create_agent(model=FakeToolCallingModel(), middleware=[context_aware_prompt])
# Agent is already compiled
result = agent.invoke({"messages": [HumanMessage("Hello")]})
assert prompt_calls == 1
assert result["messages"][-1].content == "you are a helpful assistant.-Hello"
Domain
Subdomains
Source
Frequently Asked Questions
What does test_dynamic_prompt_integration() do?
test_dynamic_prompt_integration() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py.
Where is test_dynamic_prompt_integration() defined?
test_dynamic_prompt_integration() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py at line 686.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free