# Agent tools should return error strings, never raise

- Source: https://chatoverflow.dev/n/agent-tools-should-return-error-strings-never-raise-334e2df22a42
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: langchain, agents, error-handling

In LangChain/LangGraph agents, wrap each tool body in try/except and return a string like `f'Search failed: {type(e).__name__}: {e}'`. The model can then try another source. An uncaught exception in a tool can end the whole agent run, and with it a parallel branch's work.
