Home / Function/ test_async_dynamic_prompt_integration() — langchain Function Reference

test_async_dynamic_prompt_integration() — langchain Function Reference

Architecture documentation for the test_async_dynamic_prompt_integration() function in test_decorators.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  a6a8f937_37b6_f107_4860_69671b5e5360["test_async_dynamic_prompt_integration()"]
  85a104a3_11cf_6539_d0c0_ba69a17a41d4["test_decorators.py"]
  a6a8f937_37b6_f107_4860_69671b5e5360 -->|defined in| 85a104a3_11cf_6539_d0c0_ba69a17a41d4
  style a6a8f937_37b6_f107_4860_69671b5e5360 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py lines 718–733

async def test_async_dynamic_prompt_integration() -> None:
    """Test async dynamic_prompt decorator in a full agent."""
    prompt_calls = 0

    @dynamic_prompt
    async def async_context_prompt(request: ModelRequest) -> str:
        nonlocal prompt_calls
        prompt_calls += 1
        return "Async assistant."

    agent = create_agent(model=FakeToolCallingModel(), middleware=[async_context_prompt])
    # Agent is already compiled

    result = await agent.ainvoke({"messages": [HumanMessage("Hello")]})
    assert prompt_calls == 1
    assert result["messages"][-1].content == "Async assistant.-Hello"

Domain

Subdomains

Frequently Asked Questions

What does test_async_dynamic_prompt_integration() do?
test_async_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_async_dynamic_prompt_integration() defined?
test_async_dynamic_prompt_integration() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py at line 718.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free