nemo_gym.core.typed_exceptions
nemo_gym.core.typed_exceptions
The exception a failure boundary raises, and the conversion of its explicit cause chain to report data.
Flow: a boundary raises NgFailureEvent(...) from cause. failure_report_for turns that
chain into a FailureReport (one FailureEvent per exception, linked by cause_id).
nemo_gym.core.failure_transport sends the report with the HTTP reply; the receiver rebuilds the chain with
rebuild_failure and Collection saves it. Nothing here chooses retries, terminality or scores.
Module Contents
Classes
Functions
Data
API
Bases: Exception
One Gym failure: the exception a boundary raises and the data it serializes, in one object.
The raiser names its own boundary and a registered failure_kind; both are validated here, and
event_id is fixed here and travels unchanged. Raise it from the error it reports. to_record
derives each cause_id from __cause__; from_record rebuilds the chain with the same ids and
boundaries and never imports a type from the payload (the original type name stays data).
Pass message_args only when str() must differ from failure_reason.
This failure’s fields as its saved event, without cause_id (to_record adds it).
The HTTP response that carried a remote failure, separate from its original causal chain.
The failure record["failure_id"] names, with its causes as __cause__ and the same ids.
failure_id and failure_events for this failure.
By default the map holds this failure and every explicit cause once, linked by cause_id. With
unravel_inner=False it holds only this failure and its cause_id; combine it with the cause’s
records before transport or storage.
The agent boundary’s failure for route operation; raise it from cause.
It names the cause’s type, not its text, and takes no kind from it. route_reply_error selects the cause
as the HTTP reply.
error’s Gym failures and their explicit causes as a FailureReport.
Only NgFailureEvents become events, each under its own id. An SDK or builtin exception in the chain is
not an event: its type, bounded SDK-selected message and HTTP status become the
foreign_error of the Gym failure directly above it, unless that failure already selected one. A Gym
failure below a foreign intermediate stays linked by cause_id. failure_id is the outermost Gym
failure.
The outermost failure in error’s explicit cause chain that names a boundary, or None.
The failure report.failure_id names, rebuilt with its causes as __cause__; else None.
Every event becomes a NgFailureEvent with the same event, so serializing it again gives the same ids.
The error whose HTTP reply a route sends: an agent route failure answers with its cause’s reply.
The type, message and HTTP status of a third-party SDK error, without its request or body.
message is the text the adapter selected for this SDK; by default the SDK’s own message field. A
missing or non-string message gives an empty one, so it never hides the original failure. Long text keeps
a visible truncation marker.