AgentError (agents/exceptions.py)

ragbits · packages/ragbits-agents/src/ragbits/agents/exceptions.py · python · MIT
ai

Custom exceptions for the Agent framework to handle tool failures, limits, and execution errors.

# Source: https://github.com/deepsense-ai/ragbits | License: MIT | Copyright 2024 deepsense.ai sp. z o.o
# Provided via justclaw.it.com; keep this notice with the code.
from typing import Any, Literal


class AgentError(Exception):
    """
    Base class for all exceptions raised by the Agent.
    """

    def __init__(self, message: str) -> None:
        super().__init__(message)
        self.message = message


class AgentToolNotSupportedError(AgentError):
    """
    Raised when the selected tool type is not supported.
    """

    def __init__(self, tool_type: str) -> None:
        super().__init__(f"The tool call type in LLM response is not supported: {tool_type}")
        self.tool_type = tool_type


class AgentToolNotAvailableError(AgentError):
    """
    Raised when the selected t

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key