from __future__ import annotations from typing import Optional class AgentKitPluginError(Exception): """Base class for exceptions in the agent plugin module.""" def __init__(self, message, code=None): self.message = message self.code = code def __str__(self): return f"[{self.code}] ${self.message}" def __repr__(self): return f"AgentPluginError({self.message}, {self.code})" class AgentKitNotFoundError(Exception): def __init__(self, message, resource_type: str = "", resource_id: Optional[str] = None): self.message = message self.resource_type = resource_type self.resource_id = resource_id def __str__(self): err_str = "AgentNotFoundError " if self.resource_type and self.resource_id: err_str += f"[{self.resource_type}/{self.resource_id}]" elif self.resource_type: err_str += f"[{self.resource_type}]" err_str += f": {self.message}" return err_str def __repr__(self): return f"AgentNotFoundError({self.message}, {self.resource_type}, {self.resource_id})"