langchain.tools.base.ToolException¶

class langchain.tools.base.ToolException[source]¶

Bases: Exception

An optional exception that tool throws when execution error occurs.

When this exception is thrown, the agent will not stop working, but will handle the exception according to the handle_tool_error variable of the tool, and the processing result will be returned to the agent as observation, and printed in red on the console.

add_note()¶

Exception.add_note(note) – add a note to the exception

with_traceback()¶

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args¶

Examples using ToolException¶