Home / Function/ test_shell_tool_with_custom_tools() — langchain Function Reference

test_shell_tool_with_custom_tools() — langchain Function Reference

Architecture documentation for the test_shell_tool_with_custom_tools() function in test_shell_tool_integration.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  42f51aa1_eee3_f5fb_f845_045038cef68f["test_shell_tool_with_custom_tools()"]
  16cf511f_16f7_4874_8879_68a3622bd4eb["test_shell_tool_integration.py"]
  42f51aa1_eee3_f5fb_f845_045038cef68f -->|defined in| 16cf511f_16f7_4874_8879_68a3622bd4eb
  354734fe_d7c4_f60e_5bb6_2113b3e8d6ed["_get_model()"]
  42f51aa1_eee3_f5fb_f845_045038cef68f -->|calls| 354734fe_d7c4_f60e_5bb6_2113b3e8d6ed
  style 42f51aa1_eee3_f5fb_f845_045038cef68f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/integration_tests/agents/middleware/test_shell_tool_integration.py lines 115–146

def test_shell_tool_with_custom_tools(tmp_path: Path) -> None:
    """Test shell tool works alongside custom tools."""
    workspace = tmp_path / "workspace"

    @tool
    def custom_greeting(name: str) -> str:
        """Greet someone by name."""
        return f"Hello, {name}!"

    agent: CompiledStateGraph[Any, Any, _InputAgentState, Any] = create_agent(
        model=_get_model("anthropic"),
        tools=[custom_greeting],
        middleware=[ShellToolMiddleware(workspace_root=workspace)],
    )

    result = agent.invoke(
        {
            "messages": [
                HumanMessage(
                    "First, use the custom_greeting tool to greet 'Alice'. "
                    "Then run the shell command 'echo world'."
                )
            ]
        }
    )

    tool_messages = [msg for msg in result["messages"] if msg.type == "tool"]
    assert len(tool_messages) >= 2, "Both tools should have been called"

    tool_outputs = " ".join(msg.content for msg in tool_messages)
    assert "Alice" in tool_outputs, "Custom tool should be used"
    assert "world" in tool_outputs, "Shell tool should be used"

Domain

Subdomains

Calls

Frequently Asked Questions

What does test_shell_tool_with_custom_tools() do?
test_shell_tool_with_custom_tools() is a function in the langchain codebase, defined in libs/langchain_v1/tests/integration_tests/agents/middleware/test_shell_tool_integration.py.
Where is test_shell_tool_with_custom_tools() defined?
test_shell_tool_with_custom_tools() is defined in libs/langchain_v1/tests/integration_tests/agents/middleware/test_shell_tool_integration.py at line 115.
What does test_shell_tool_with_custom_tools() call?
test_shell_tool_with_custom_tools() calls 1 function(s): _get_model.

Analyze Your Own Codebase

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

Try Supermodel Free