academy.exception¶
ActionCancelledError
¶
ActionCancelledError(name: str)
Bases: Exception
Action was cancelled by the agent.
This often happens when an agent is shutdown mid-action execution and configured to cancel running actions.
Source code in academy/exception.py
AgentNotInitializedError
¶
Bases: Exception
Agent runtime context has not been initialized.
This error is typically raised when accessing the runtime context for an agent before the agent has been executed.
Source code in academy/exception.py
BadEntityIdError
¶
BadEntityIdError(uid: EntityId)
Bases: ExchangeError
Entity associated with the identifier is unknown.
Source code in academy/exception.py
ForbiddenError
¶
Bases: ExchangeError
Exchange client does not have permission to access resources.
MailboxTerminatedError
¶
MailboxTerminatedError(uid: EntityId)
Bases: ExchangeError
Entity mailbox is terminated and cannot send or receive messages.
Constructing this error type implicitly returns one of the derived types,
AgentTerminatedError
or
UserTerminatedError
, based
on the entity type.
Source code in academy/exception.py
AgentTerminatedError
¶
Bases: MailboxTerminatedError
Agent mailbox is terminated and cannot send or receive messages.
Source code in academy/exception.py
UserTerminatedError
¶
UserTerminatedError(uid: UserId)
Bases: MailboxTerminatedError
User mailbox is terminated and cannot send or receive messages.
Source code in academy/exception.py
UnauthorizedError
¶
Bases: ExchangeError
Exchange client has not provided valid authentication credentials.
HandleClosedError
¶
ExchangeClientNotFoundError
¶
Bases: Exception
Handle to agent can not find an exchange client to use.
A RemoteHandle
is
initialized with a target agent ID, but was not initialized with an
exchange client, and is not used in a context where an exchange
client could be inferred. Typically this can be resolved by using a
ExchangeClient
or
Manager
as a context manager.
Source code in academy/exception.py
HandleReuseError
¶
Bases: Exception
Handle to agent used by multiple clients/agents.
A RemoteHandle
is used by multiple
clients or agents. This means the handle would try to send and
receive at multiple mailbox addresses. This can be resolved by
calling handle.clone() (usually at agent initialization).
Source code in academy/exception.py
raise_exceptions
¶
raise_exceptions(
exceptions: Iterable[BaseException],
*,
message: str | None = None
) -> None
Raise exceptions as a group.
Raises a set of exceptions as an ExceptionGroup
in Python 3.11 and later. If only one exception is provided, it is raised
directly. In Python 3.10 and older, only one exception is raised.
This is a no-op if the size of exceptions
is zero.
Parameters:
-
exceptions
(Iterable[BaseException]
) –An iterable of exceptions to raise.
-
message
(str | None
, default:None
) –Custom error message for the exception group.