enterprise_ai.errors
Source: sdks/python/src/enterprise_ai/errors.py. Back to the Python SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Class EaiError
Base error of the SDK. code is the stable machine code from the API.
Exception
Attributes:
| Name | Type | Required | Description |
|---|---|---|---|
code | yes | Stable machine code of the error, for example policy_denied. | |
details | yes | Structured details of the error, secrets redacted (a dict, empty when none). | |
locale | yes | Resolved language of the message, for example en. | |
message | yes | Human readable message in the chosen language. | |
messages | yes | Message per language as sent by the API (message_i18n), empty when absent. | |
request_id | yes | Identifier of the failed request, or None. | |
status | yes | HTTP status of the answer, or None when the error is local. |
Constructor EaiError
EaiError(message: str | None = None, code: str | None = None, status: int | None = None, details: dict[str, Any] | None = None, request_id: str | None = None, locale: str | None = None, messages: dict[str, str] | None = None) -> None
Create the error; without a message, it is looked up from code in the chosen locale, falling back to the code.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
message | str | None | None | no | Human readable message; by default the translated text of code. |
code | str | None | None | no | Stable machine code of the error, for example policy_denied; defaults to the default_code of the class. |
status | int | None | None | no | HTTP status of the answer, or None when the error is local. |
details | dict[str, Any] | None | None | no | Structured details of the error; secrets are redacted before they are stored. |
request_id | str | None | None | no | Identifier of the failed request, shown in str(error). |
locale | str | None | None | no | Language of the message, for example fr; resolved from the environment when not given. |
messages | dict[str, str] | None | None | no | Message per language from message_i18n, for example {"en": "...", "fr": "..."}. |
Class AuthError
Missing, invalid or insufficient credentials (HTTP 401, or 403 without a policy decision).
EaiError
Class PolicyDenied
A policy decision refused the action. details usually carries reasons and decision_id.
EaiError
Class QuotaExceeded
A quota or budget would be exceeded (HTTP 429 with code quota_exceeded or budget codes).
EaiError
Class EffortNotSupported
The requested reasoning effort is not supported by the model and no compatible profile applies.
EaiError
Class ContextOverflow
The assembled context does not fit in the model window after reservations.
EaiError
Class ApprovalRequired
The action needs a human approval. details.approval_id identifies the pending request.
EaiError
Class NotFound
The resource does not exist or is not visible to the caller tenant.
EaiError
Class ValidationError
One invalid field of a request.
EaiError
Class ConflictError
The resource state conflicts with the request (HTTP 409).
EaiError
Class RateLimited
Too many requests (HTTP 429) after every retry was spent.
EaiError
Class ServerError
The control plane failed (HTTP 5xx) after every retry was spent.
EaiError
Class TransportError
The network failed before any HTTP answer was received.
EaiError
Class BudgetExhausted
A local agent budget (steps, tool calls, tokens or cost) is spent.
EaiError
Class AgentStopped
The kill switch stopped the agent (agent suspended, killed or run cancelled).
EaiError
Class EgressDenied
An outbound call to a tenant provided URL was refused by the egress guard (HTTP 403).
EaiError
Attributes:
| Name | Type | Required | Description |
|---|---|---|---|
reason | str | None | yes | Why the action is taken. Written to the audit trail with the actor and the time. |
Class PromptInjectionBlocked
The prompt or untrusted content was blocked by the prompt injection screen (HTTP 403, mode block).
EaiError
Class PayloadTooLarge
The request body exceeds the server limit (HTTP 413).
EaiError
Class AuthzUnconfirmed
An authorization answer carried no explicit decision of OPA or OpenFGA: the SDK never assumes an allow.
EaiError
Functions
error_from_payload
error_from_payload(status: int, payload: Any, locale: str | None = None, request_id: str | None = None) -> EaiError
Build the typed error for an HTTP status and a decoded body (envelope or not).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
status | int | yes | HTTP status of the answer; chooses the class when the error code is unknown (5xx gives ServerError). | |
payload | Any | yes | Decoded error body, normally {"error": {code, message, message_i18n, details, request_id}}; any other value is accepted. | |
locale | str | None | None | no | Language of the message; picks the matching entry of message_i18n when present. |
request_id | str | None | None | no | Request identifier used when the envelope carries none, usually the x-request-id header. |
Returns: EaiError. A EaiError: Base error of the SDK. code is the stable machine code from the API.