Skip to main content
The Lyzr ADK provides a hierarchy of exceptions to help you handle errors gracefully. All exceptions inherit from LyzrError.

Quick Start


Exception Hierarchy


LyzrError

Base exception class for all ADK errors.

Properties

Example


AuthenticationError

Raised when the API key is invalid, missing, or expired.

Common Causes

  • API key is incorrect
  • API key is missing (not in env var or parameter)
  • API key has been revoked
  • API key doesn’t have required permissions

ValidationError

Raised when input parameters fail validation.

Common Causes

  • Empty or invalid agent name
  • Temperature out of range (0.0-2.0)
  • Top_p out of range (0.0-1.0)
  • Invalid provider/model combination
  • Missing required parameters

NotFoundError

Raised when a requested resource doesn’t exist (HTTP 404).

Common Causes

  • Agent ID doesn’t exist
  • Knowledge base ID doesn’t exist
  • Context ID doesn’t exist
  • RAI policy ID doesn’t exist
  • Resource was deleted

RateLimitError

Raised when API rate limits are exceeded (HTTP 429).

Common Causes

  • Too many requests in a short period
  • Account quota exceeded
  • Concurrent request limit reached

APIError

Raised for general API errors not covered by other exceptions.

Common Causes

  • Server-side errors (5xx)
  • Network issues
  • Invalid request format
  • Service unavailable

TimeoutError

Raised when a request takes too long to complete.

Common Causes

  • Complex queries taking too long
  • Large document processing
  • Network latency
  • Server under heavy load

InvalidResponseError

Raised when the API response cannot be parsed or validated.

Properties

Common Causes

  • Structured output doesn’t match Pydantic model
  • Malformed JSON in response
  • Unexpected response format
  • Model returned invalid data

ToolNotFoundError

Raised when a local tool is called but not registered.

Common Causes

  • Tool function not added with agent.add_tool()
  • Tool name mismatch
  • Tool was removed but still referenced

Error Handling Patterns

Comprehensive Handler

Retry with Backoff

Logging Errors

Fallback Strategy