Home / Function/ validate_tools() — langchain Function Reference

validate_tools() — langchain Function Reference

Architecture documentation for the validate_tools() function in agent.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  d1c51c9b_5fe1_47a4_af69_4e25bcdad6f1["validate_tools()"]
  493d4ce4_2303_08e0_2337_2bee34fe2662["AgentExecutor"]
  d1c51c9b_5fe1_47a4_af69_4e25bcdad6f1 -->|defined in| 493d4ce4_2303_08e0_2337_2bee34fe2662
  6b79fda4_77b9_fd1f_b200_b7c558fbcf57["get_allowed_tools()"]
  d1c51c9b_5fe1_47a4_af69_4e25bcdad6f1 -->|calls| 6b79fda4_77b9_fd1f_b200_b7c558fbcf57
  style d1c51c9b_5fe1_47a4_af69_4e25bcdad6f1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/agent.py lines 1085–1108

    def validate_tools(self) -> Self:
        """Validate that tools are compatible with agent.

        Args:
            values: Values to validate.

        Returns:
            Validated values.

        Raises:
            ValueError: If allowed tools are different than provided tools.
        """
        agent = self.agent
        tools = self.tools
        allowed_tools = agent.get_allowed_tools()  # type: ignore[union-attr]
        if allowed_tools is not None and set(allowed_tools) != {
            tool.name for tool in tools
        }:
            msg = (
                f"Allowed tools ({allowed_tools}) different than "
                f"provided tools ({[tool.name for tool in tools]})"
            )
            raise ValueError(msg)
        return self

Subdomains

Frequently Asked Questions

What does validate_tools() do?
validate_tools() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/agent.py.
Where is validate_tools() defined?
validate_tools() is defined in libs/langchain/langchain_classic/agents/agent.py at line 1085.
What does validate_tools() call?
validate_tools() calls 1 function(s): get_allowed_tools.

Analyze Your Own Codebase

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

Try Supermodel Free