How to retrieval tools when some tools have dependency?

There are lots of tools, so i retrieval tools for each query, but some query need two or more tools (dependency) to solve it, how to retrieval them together ?

My solution is analysis this query and decompose it to sub-question, then separate retrieval tools each other (supervisor mode can support it ? it seems the supervisor mode can’t decompose the query, it just router the query to sub-agent).

Is there any better solution ?

hi @feng-1985

I think you could store the tools description in a vector db and then just query it with the user input.
See that How to handle large numbers of tools - it’s a legacy doc, but in general the idea is still valid in Langchain v1.

Then you can expand dependencies deterministically after the retrieval.
Add lightweight metadata to your tool registry, e.g. requires=["tool_b","tool_c"]. After select_tools returns a list, expand it by following requires edges. This avoids another LLM hop and makes dependencies explicit and testable.

Allow re‑selection when tool outputs reveal missing dependencies.
If a tool returns “I need X,” route back to the selection step with the new context (the docs call out a “reselect_tools”‑style loop). This covers hidden dependencies you did not encode explicitly.

Use composite tools for common dependency chains.
For stable, repeatable chains (e.g. “search → fetch → summarize”), wrap them as one tool that internally calls its dependencies in sequence. That reduces tool‑selection complexity and makes prompts cleaner. This is a design pattern rather than a LangGraph‑specific feature, but it plays nicely with dynamic tool selection.

About supervisor mode
you’re right that it mainly routes to sub‑agents rather than decomposing a query. If you want explicit decomposition, add a planning node or a dedicated “planner” agent before tool selection. The supervisor can still route, but the actual “break into steps / decide dependencies” logic should live in your graph or planner agent.

1 Like