Skip to main content

Exception Types

The SDK provides typed exceptions for common error scenarios. All exceptions extend the base APIError class.
from reminix import APIError, AuthenticationError, NotFoundError, RateLimitError

APIError (Base)

All SDK errors extend APIError. Catch this to handle any API error.
try:
    response = client.agents.invoke("my-agent", input={"prompt": "Hello"})
except APIError as e:
    print(e.status_code)  # HTTP status code
    print(e.message)      # Error message
    print(e.body)         # Full error response body

Specific Exception Types

ExceptionStatus CodeDescription
AuthenticationError401Invalid or missing API key
NotFoundError404Agent or resource not found
RateLimitError429Too many requests
APIErrorOtherAny other API error

Common Patterns

Use specific exception types to handle different failure modes appropriately.
from reminix import Reminix, APIError, NotFoundError, AuthenticationError

client = Reminix(api_key="your-api-key")

try:
    response = client.agents.invoke("my-agent", input={"prompt": "Hello"})
except AuthenticationError:
    print("Check your API key")
except NotFoundError:
    print("Agent not found — check the name")
except APIError as e:
    if e.status_code == 502:
        print("Agent runtime error — check execution logs")
    elif e.status_code == 504:
        print("Agent timed out")
    else:
        print(f"API error: {e.status_code} {e.message}")
Always catch specific exceptions before the base APIError to ensure proper handling of known error types.

Retry Pattern

Implement exponential backoff for rate limits and transient server errors.
import time
from reminix import APIError, RateLimitError

def invoke_with_retry(client, agent_name, input, max_retries=3):
    for attempt in range(max_retries):
        try:
            return client.agents.invoke(agent_name, input=input)
        except RateLimitError:
            if attempt < max_retries - 1:
                time.sleep(2 ** attempt)
            else:
                raise
        except APIError as e:
            if e.status_code >= 500 and attempt < max_retries - 1:
                time.sleep(2 ** attempt)
            else:
                raise
Only retry on rate limits (429) and server errors (5xx). Retrying on client errors (4xx) other than 429 will always produce the same result.

Async Error Handling

Error handling works the same way with the async client.
from reminix import AsyncReminix, APIError

client = AsyncReminix(api_key="your-api-key")

try:
    response = await client.agents.invoke("my-agent", input={"prompt": "Hello"})
except APIError as e:
    print(f"Error: {e.status_code} {e.message}")

Next steps

Errors

Error format, status codes, and execution metadata.

Troubleshooting

Common failures and how to diagnose them.

invoke()

Back to the invoke reference.

chat()

Back to the chat reference.