[Python] How do AI Agent workflows (langgraph) know what tools to use?

Discussão em 'Python' iniciado por Stack, Julho 2, 2025.

  1. Stack

    Stack Membro Participativo

    Hi I'm currently trying to start to use langgraph and it's really awesome and incredible. I'm slightly confused on a certain subject though, how does langgraph identify tools?

    How does it know what a tool does? How can I convey the purpose of the tool in order to be clearer?

    From what I understand, its only means is to read the function and the input it gets. Does this mean I should be making super long function names in order to explain the finer details? This might be a very simple solution but I'm confused as to how it's able to fetch further information on the tool provided.

    From the tutorial they use the following example:

    @tool
    def human_assistance(query: str) -> str:
    """Request assistance from a human."""
    human_response = interrupt({"query": query})
    return human_response["data"]



    I don't see how it's able to understand from the function name that human_assitance is capable to interrupt a query and tell the ai graph that it will get a response from a human. For all I know, it could interpret it as "human_assistance" -> "human helps me" -> "human does the work" and not that it will have to continue querying. This is a bit of a far fetch but it's to better understand more complex tools and how to properly convey to an LLM its function.

    Continue reading...

Compartilhe esta Página