Skip to content

AAK-LANGGRAPH-TOOLNODE-LIST-REGRESSION-001: langgraph.prebuilt.ToolNode positional-list misuse

Severity
MEDIUM
Category
Agent Config (agent-config)
Scanner
agent_audit_kit/scanners/langgraph_toolnode.py
Auto-fixable
Yes. agent-audit-kit fix can apply it.
SARIF name
LangGraphToolNodePositionalList

What it detects

Source code calls ToolNode([...]) (or ToolNode(some_list)) with a positional list rather than the documented ToolNode(tools=[...]) keyword form. langgraph-prebuilt 1.0.11 (2026-04-24) regressed and silently coerces a positional list into a single-tool node, dropping every tool past the first and producing message-loop bugs in agents that depend on tool-routing behaviour.

How to fix

Switch every ToolNode([t1, t2, ...]) to ToolNode(tools=[t1, t2, ...]). aak fix rewrites the list-literal form in place, through the codemod at agent_audit_kit/autofix/langgraph_toolnode.py (aak fix --dry-run lists the change first); a bare name, ToolNode(tools_list), is left for you to change.

agent-audit-kit fix can apply this change for you; add --dry-run to preview it.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-LANGGRAPH-TOOLNODE-LIST-REGRESSION-001

Limitations

Fires on ToolNode(...) with a list literal or a bare name as its first positional argument, in a file that imports langgraph.prebuilt as from langgraph.prebuilt import ... ToolNode on one line, from langgraph import prebuilt or import langgraph.prebuilt. A parenthesised multi-line import, from langgraph.prebuilt.tool_node import ToolNode, and an argument that is an attribute or a call (ToolNode(self.tools)) are not matched. A Python file over 512 KB is not read.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-LANGGRAPH-TOOLNODE-LIST-REGRESSION-001.md: the page then shows that text, with the registry reference appended under it.