Home / Function/ test_agent_graph_with_return_direct_tool() — langchain Function Reference

test_agent_graph_with_return_direct_tool() — langchain Function Reference

Architecture documentation for the test_agent_graph_with_return_direct_tool() function in test_return_direct_graph.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  6a4c9206_866f_6645_4086_578e7b2aa1c9["test_agent_graph_with_return_direct_tool()"]
  038e0dbf_bd54_0b67_ae80_b2983f5ccff8["test_return_direct_graph.py"]
  6a4c9206_866f_6645_4086_578e7b2aa1c9 -->|defined in| 038e0dbf_bd54_0b67_ae80_b2983f5ccff8
  style 6a4c9206_866f_6645_4086_578e7b2aa1c9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_return_direct_graph.py lines 30–47

def test_agent_graph_with_return_direct_tool(snapshot: SnapshotAssertion) -> None:
    """Test that graph WITH return_direct tools has correct edge from tools to end."""

    @tool(return_direct=True)
    def return_direct_tool(input_string: str) -> str:
        """A tool with return_direct=True."""
        return input_string

    agent = create_agent(
        model=FakeToolCallingModel(),
        tools=[return_direct_tool],
        system_prompt="You are a helpful assistant.",
    )

    # The mermaid diagram SHOULD include an edge from tools to __end__
    # when at least one tool has return_direct=True
    mermaid_diagram = agent.get_graph().draw_mermaid()
    assert mermaid_diagram == snapshot

Domain

Subdomains

Frequently Asked Questions

What does test_agent_graph_with_return_direct_tool() do?
test_agent_graph_with_return_direct_tool() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_return_direct_graph.py.
Where is test_agent_graph_with_return_direct_tool() defined?
test_agent_graph_with_return_direct_tool() is defined in libs/langchain_v1/tests/unit_tests/agents/test_return_direct_graph.py at line 30.

Analyze Your Own Codebase

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

Try Supermodel Free