-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Updated agents-api/agents_api/common/excepti
- Loading branch information
1 parent
3c332ff
commit 8988853
Showing
1 changed file
with
9 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,37 @@ | ||
"""Defines custom exceptions for agent-related operations in the agents API.""" | ||
|
||
from uuid import UUID | ||
from . import BaseCommonException | ||
|
||
|
||
class BaseAgentException(BaseCommonException): | ||
"""Base exception class for all agent-related exceptions.""" | ||
pass | ||
|
||
|
||
class AgentNotFoundError(BaseAgentException): | ||
"""Exception raised when a requested agent cannot be found.""" | ||
def __init__(self, developer_id: UUID | str, agent_id: UUID | str): | ||
# Initialize the exception with a message indicating the missing agent and developer ID. | ||
super().__init__( | ||
f"Agent {str(agent_id)} not found for developer {str(developer_id)}", | ||
http_code=404, | ||
) | ||
|
||
|
||
class AgentToolNotFoundError(BaseAgentException): | ||
"""Exception raised when a requested tool associated with an agent cannot be found.""" | ||
def __init__(self, agent_id: UUID | str, tool_id: UUID | str): | ||
# Initialize the exception with a message indicating the missing tool and agent ID. | ||
super().__init__( | ||
f"Tool {str(tool_id)} not found for agent {str(agent_id)}", http_code=404 | ||
) | ||
|
||
|
||
class AgentDocNotFoundError(BaseAgentException): | ||
"""Exception raised when a requested document associated with an agent cannot be found.""" | ||
def __init__(self, agent_id: UUID | str, doc_id: UUID | str): | ||
# Initialize the exception with a message indicating the missing document and agent ID. | ||
super().__init__( | ||
f"Doc {str(doc_id)} not found for agent {str(agent_id)}", http_code=404 | ||
) |