ai_agent package

Subpackages

Submodules

ai_agent.agent module

ai_agent.config module

ai_agent.exceptions module

Custom exceptions for the AI Agent project.

exception ai_agent.exceptions.AIAgentError

Bases: Exception

Base exception for all custom errors in this project.

exception ai_agent.exceptions.ApiKeyError

Bases: AIAgentError

Raised when there is a problem with the API key.

exception ai_agent.exceptions.DirectoryTraversalError(target_path: str)

Bases: AIAgentError

Raised when a file path attempts to access a location outside the allowed directory.

This error is a security measure to prevent the agent from accessing unauthorized parts of the file system.

target_path

The invalid path that triggered the error.

Type:

str

exception ai_agent.exceptions.FunctionError(function_name: str | None)

Bases: AIAgentError

Raised when a function call fails or returns an invalid response.

This error is used to indicate that a function called by the AI agent did not execute successfully or returned an unexpected format.

message

A description of the error.

Type:

str

exception ai_agent.exceptions.InvalidPathError(target_path: str, path_type: PathType = PathType.DIRECTORY)

Bases: AIAgentError

Raised when a path does not exist or is not the expected type (file or directory).

target_path

The path that was found to be invalid.

Type:

str

class ai_agent.exceptions.PathType(*values)

Bases: Enum

Specifies the expected type of a file system path.

DIRECTORY

Represents the Directory type.

FILE

Represents the File type.

DIRECTORY = 1
FILE = 2

Module contents