[tools] Break circular import chain between agent_tools/tool_parsing/tool_schemas #903

Closed
sleepy wants to merge 0 commits from fix/circular-import-chain-672 into dev
Owner
No description provided.
Fixes #672.

Extract ToolBlock namedtuple and TOOL_TAGS set into a new leaf module
src/tool_types.py with zero imports from the tool subsystem.  All three
formerly-circular modules (agent_tools, tool_parsing, tool_schemas)
now import these shared types from tool_types instead of from each
other.

Dependency graph (before):
  agent_tools → tool_parsing → agent_tools  (cycle)
  agent_tools → tool_schemas/converter → agent_tools  (cycle, lazy import)

Dependency graph (after):
  agent_tools → tool_types  (leaf, no tool imports)
  tool_parsing → tool_types  (leaf)
  tool_schemas/converter → tool_types  (leaf)

agent_tools still re-exports ToolBlock and TOOL_TAGS for backward
compatibility, so no callers need to change.

Test results: 694 passed, 9 failed (same 9 pre-existing failures).
sleepy closed this pull request 2026-06-04 03:30:12 +02:00

Pull request closed

Sign in to join this conversation.
No description provided.