Behavioral Impact

Removed direct dependencies on pydantic-ai from the src/tunacode/tools/ directory (specifically ModelRetry).

tools-only Updated 7 repo stars

File contents

Summary

Removed direct dependencies on pydantic-ai from the src/tunacode/tools/ directory (specifically ModelRetry). Tools now raise a domain-specific ToolRetryError, which is intercepted by the tool decorator and translated to ModelRetry for the framework.

Context

Previously, 8 tool files imported ModelRetry from pydantic_ai.exceptions. This coupled the business logic of the tools directly to the specific agent framework we are using.

Changes

  • Added ToolRetryError to src/tunacode/exceptions.py.
  • Updated src/tunacode/tools/decorators.py to catch ToolRetryError and raise ModelRetry. This file now acts as the Adapter.
  • Updated 7 tools to import and raise ToolRetryError instead of ModelRetry:
    • bash.py
    • glob.py
    • grep.py
    • list_dir.py
    • update_file.py
    • web_fetch.py
    • write_file.py

Behavioral Impact

No external behavioral change. The LLM still receives the retry signal exactly as before. The change is purely internal structural improvement.

tools-only/X-Skills/tree/main/development/492-2026-01-28_decoupled-tools_e6c92b6e commit 64c401455b

Frequently asked questions

npx skillmds@latest add tools-only/behavioral-impact-9