#[non_exhaustive]pub enum Error {
AgentNotStarted,
BackendError {
message: String,
},
ConnectionError {
message: String,
},
QuotaExceeded {
retry_after: Duration,
},
ChannelClosed {
message: String,
},
Safety,
MaxTokens,
ConnectionClosed {
message: String,
},
Timeout {
duration: Duration,
operation: String,
},
Stream(StreamError),
InvalidConfig {
message: String,
},
Io {
message: String,
kind: ErrorKind,
},
}Expand description
All errors that can occur in the bridge layer.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AgentNotStarted
The agent was not started or has been shut down before an operation was requested.
BackendError
An exception was raised in the backend.
ConnectionError
A connection-level error from the Antigravity SDK.
QuotaExceeded
Quota / rate-limit error (HTTP 429 or equivalent).
ChannelClosed
The internal command channel was closed unexpectedly.
Safety
The agent request was blocked due to safety violations.
MaxTokens
The agent request reached the max tokens limit.
ConnectionClosed
Connection was permanently closed.
Timeout
An operation exceeded its configured timeout.
Fields
Stream(StreamError)
An error originating from the streaming response layer.
InvalidConfig
The provided configuration is invalid or self-contradictory.
Io
An I/O error occurred during a file or socket operation.
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if this error is potentially transient and the
operation may succeed on retry with with_retry.
Currently retryable:
Error::ConnectionError— network-level failuresError::QuotaExceeded— rate-limited, retry after backoff- Backend errors containing HTTP 503 — server overload
Note: The agent’s internal retry loop handles quota errors
automatically via crate::quota::QuotaState. This method is
primarily for consumers who want to retry at a higher level.
Sourcepub fn is_quota_error(&self) -> bool
pub fn is_quota_error(&self) -> bool
Returns true if this error indicates a quota / rate-limit condition.
Matches the structured Error::QuotaExceeded variant as well as
backend errors whose message contains HTTP 429, 503, or
RESOURCE_EXHAUSTED status indicators.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Error> for Error
Converts a Python exception into the most specific Error variant.
impl From<Error> for Error
Converts a Python exception into the most specific Error variant.
Checks for Antigravity SDK errors (connection, validation), Pydantic
validation errors, and Python ImportError before falling back to
Error::BackendError with a formatted traceback.
This impl is always compiled because pyo3 is a mandatory dependency of
the bridge crate — the entire runtime requires it. If you depend on
agy-bridge as a library, pyo3 will be linked transitively.