Home / Function/ test_agent_graph_with_mixed_tools() — langchain Function Reference

test_agent_graph_with_mixed_tools() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_return_direct_graph.py lines 50–72

def test_agent_graph_with_mixed_tools(snapshot: SnapshotAssertion) -> None:
    """Test that graph with mixed tools (some return_direct, some not) has correct edges."""

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

    @tool
    def normal_tool(input_string: str) -> str:
        """A normal tool without return_direct."""
        return input_string

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

    # The mermaid diagram SHOULD include an edge from tools to __end__
    # because 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_mixed_tools() do?
test_agent_graph_with_mixed_tools() 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_mixed_tools() defined?
test_agent_graph_with_mixed_tools() is defined in libs/langchain_v1/tests/unit_tests/agents/test_return_direct_graph.py at line 50.

Analyze Your Own Codebase

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

Try Supermodel Free