Files
Auto-GPT/autogpt/agents/utils/exceptions.py
Reinier van der Leer 3fe2246468 Agent loop v2: Prompting improvements & WIP planning (#5077)
* Add categories to command registry

* Fix tests

* Clean up prompt generation

* Rename Performance Evaluations to Best Practices
* Move specification of response format from system prompt to Agent.construct_base_prompt
* Clean up PromptGenerator class

* Add debug logging to AIConfig autogeneration

* Clarify prompting and add support for multiple thought processes to Agent

* WIP: PlanningAgent

* Disable message history by default on BaseAgent

* Add CommandOutput and ThoughtProcessOutput type aliases

* Fix interrupts in main.py

* Use custom exceptions and clean up exception/error handling

* Remove duplicate agent_history.py

* Update PlanningAgent from upstream

* WIP: Support for dynamic in-prompt context

* WIP: response formats for PlanningAgent three-stage cycle

* Remove browsing overlay & separate browsing from extraction code

* Fix human feedback

* Fix tests

* Include history in Agent prompt generation

* Code improvements in agent.py

* Add ask_user command and revise system prompt
2023-08-19 17:44:50 +02:00

57 lines
1.6 KiB
Python

from typing import Optional
class AgentException(Exception):
"""Base class for specific exceptions relevant in the execution of Agents"""
message: str
hint: Optional[str] = None
"""A hint which can be passed to the LLM to reduce reoccurrence of this error"""
def __init__(self, message: str, *args):
self.message = message
super().__init__(message, *args)
class ConfigurationError(AgentException):
"""Error caused by invalid, incompatible or otherwise incorrect configuration"""
class InvalidAgentResponseError(AgentException):
"""The LLM deviated from the prescribed response format"""
class UnknownCommandError(AgentException):
"""The AI tried to use an unknown command"""
hint = "Do not try to use this command again."
class DuplicateOperationError(AgentException):
"""The proposed operation has already been executed"""
class CommandExecutionError(AgentException):
"""An error occured when trying to execute the command"""
class InvalidArgumentError(CommandExecutionError):
"""The command received an invalid argument"""
class OperationNotAllowedError(CommandExecutionError):
"""The agent is not allowed to execute the proposed operation"""
class AccessDeniedError(CommandExecutionError):
"""The operation failed because access to a required resource was denied"""
class CodeExecutionError(CommandExecutionError):
"""The operation (an attempt to run arbitrary code) returned an error"""
class TooMuchOutputError(CommandExecutionError):
"""The operation generated more output than what the Agent can process"""