praval.core.exceptions
Custom exceptions for the Praval framework.
These exceptions provide clear error handling and debugging information for common issues in LLM agent operations.
Exceptions
Raised when there are configuration validation issues. |
|
Raised when persistent vectors do not match embedding configuration. |
|
Raised when HITL policy requires approval for a HITL-disabled agent. |
|
|
Raised when a tool call is paused waiting for human intervention. |
Raised when typed application or lifecycle configuration is invalid. |
|
Base exception for all Praval-related errors. |
|
|
The provider rejected the credentials or permissions (401/403). |
|
Raised when there are issues with LLM provider operations. |
|
The provider rejected the request itself (400/404/422). |
|
Raised when a final response fails local structured-output validation. |
|
The account's quota or credit is exhausted; retrying will not help. |
|
The provider throttled the request (429); retry after a delay. |
|
The request did not complete: connection failure or timeout. |
|
The provider failed or is overloaded (5xx, 529). |
Raised when there are issues with state persistence operations. |
|
Raised when there are issues with tool registration or execution. |
|
|
A tool loop exceeded its configured round limit; never retried. |
- exception praval.core.exceptions.PravalError[source]
Bases:
ExceptionBase exception for all Praval-related errors.
- exception praval.core.exceptions.ProviderError(message='', *, provider=None, model=None, operation=None, status_code=None, error_code=None, request_id=None, retryable=None, retry_after_seconds=None)[source]
Bases:
PravalErrorRaised when there are issues with LLM provider operations.
The message stays the exception’s string form, so
ProviderError("...")keeps working. Keyword fields describe a failed provider request when the runtime or an adapter knows them.retryabledefaults to the class policy: rate limits, unavailability and transport failures are retryable, everything else is not.- Parameters:
message (str)
provider (str | None)
model (str | None)
operation (str | None)
status_code (int | None)
error_code (str | None)
request_id (str | None)
retryable (bool | None)
retry_after_seconds (float | None)
- Return type:
None
- default_retryable = False
- __init__(message='', *, provider=None, model=None, operation=None, status_code=None, error_code=None, request_id=None, retryable=None, retry_after_seconds=None)[source]
- Parameters:
message (str)
provider (str | None)
model (str | None)
operation (str | None)
status_code (int | None)
error_code (str | None)
request_id (str | None)
retryable (bool | None)
retry_after_seconds (float | None)
- Return type:
None
- exception praval.core.exceptions.ProviderAuthenticationError(message='', *, provider=None, model=None, operation=None, status_code=None, error_code=None, request_id=None, retryable=None, retry_after_seconds=None)[source]
Bases:
ProviderErrorThe provider rejected the credentials or permissions (401/403).
- Parameters:
message (str)
provider (str | None)
model (str | None)
operation (str | None)
status_code (int | None)
error_code (str | None)
request_id (str | None)
retryable (bool | None)
retry_after_seconds (float | None)
- Return type:
None
- exception praval.core.exceptions.ProviderInvalidRequestError(message='', *, provider=None, model=None, operation=None, status_code=None, error_code=None, request_id=None, retryable=None, retry_after_seconds=None)[source]
Bases:
ProviderErrorThe provider rejected the request itself (400/404/422).
- Parameters:
message (str)
provider (str | None)
model (str | None)
operation (str | None)
status_code (int | None)
error_code (str | None)
request_id (str | None)
retryable (bool | None)
retry_after_seconds (float | None)
- Return type:
None
- exception praval.core.exceptions.ProviderQuotaError(message='', *, provider=None, model=None, operation=None, status_code=None, error_code=None, request_id=None, retryable=None, retry_after_seconds=None)[source]
Bases:
ProviderErrorThe account’s quota or credit is exhausted; retrying will not help.
- Parameters:
message (str)
provider (str | None)
model (str | None)
operation (str | None)
status_code (int | None)
error_code (str | None)
request_id (str | None)
retryable (bool | None)
retry_after_seconds (float | None)
- Return type:
None
- exception praval.core.exceptions.ProviderRateLimitError(message='', *, provider=None, model=None, operation=None, status_code=None, error_code=None, request_id=None, retryable=None, retry_after_seconds=None)[source]
Bases:
ProviderErrorThe provider throttled the request (429); retry after a delay.
- Parameters:
message (str)
provider (str | None)
model (str | None)
operation (str | None)
status_code (int | None)
error_code (str | None)
request_id (str | None)
retryable (bool | None)
retry_after_seconds (float | None)
- Return type:
None
- default_retryable = True
Bases:
ProviderErrorThe provider failed or is overloaded (5xx, 529).
- Parameters:
message (str)
provider (str | None)
model (str | None)
operation (str | None)
status_code (int | None)
error_code (str | None)
request_id (str | None)
retryable (bool | None)
retry_after_seconds (float | None)
- Return type:
None
- exception praval.core.exceptions.ProviderTransportError(message='', *, provider=None, model=None, operation=None, status_code=None, error_code=None, request_id=None, retryable=None, retry_after_seconds=None)[source]
Bases:
ProviderErrorThe request did not complete: connection failure or timeout.
- Parameters:
message (str)
provider (str | None)
model (str | None)
operation (str | None)
status_code (int | None)
error_code (str | None)
request_id (str | None)
retryable (bool | None)
retry_after_seconds (float | None)
- Return type:
None
- default_retryable = True
- exception praval.core.exceptions.ToolRoundLimitError(message='', *, limit=None, provider=None, model=None)[source]
Bases:
ProviderErrorA tool loop exceeded its configured round limit; never retried.
- Parameters:
message (str)
limit (int | None)
provider (str | None)
model (str | None)
- Return type:
None
- exception praval.core.exceptions.ConfigurationError[source]
Bases:
PravalErrorRaised when there are configuration validation issues.
- exception praval.core.exceptions.PravalConfigurationError[source]
Bases:
ConfigurationErrorRaised when typed application or lifecycle configuration is invalid.
- exception praval.core.exceptions.EmbeddingConfigurationError[source]
Bases:
ConfigurationErrorRaised when persistent vectors do not match embedding configuration.
- exception praval.core.exceptions.ToolError[source]
Bases:
PravalErrorRaised when there are issues with tool registration or execution.
- exception praval.core.exceptions.StateError[source]
Bases:
PravalErrorRaised when there are issues with state persistence operations.
- exception praval.core.exceptions.InterventionRequired(intervention_id, run_id, agent_name, tool_name, reason='')[source]
Bases:
PravalErrorRaised when a tool call is paused waiting for human intervention.
- Parameters:
intervention_id (str)
run_id (str)
agent_name (str)
tool_name (str)
reason (str)
- exception praval.core.exceptions.HITLConfigurationError[source]
Bases:
PravalErrorRaised when HITL policy requires approval for a HITL-disabled agent.
- exception praval.core.exceptions.ProviderInvalidResponseError(message='', *, provider=None, model=None, operation=None, status_code=None, error_code=None, request_id=None, retryable=None, retry_after_seconds=None)[source]
Bases:
ProviderErrorRaised when a final response fails local structured-output validation.
Only raised when
StructuredOutputConfig.validate_locallyis true and the final content is not JSON or does not match the requested schema.- Parameters:
message (str)
provider (str | None)
model (str | None)
operation (str | None)
status_code (int | None)
error_code (str | None)
request_id (str | None)
retryable (bool | None)
retry_after_seconds (float | None)
- Return type:
None