Skip to main content

Error Handling

from terminaluse import TerminalUse, UnprocessableEntityError

client = TerminalUse()

try:
    agent = client.agents.retrieve("id")
except UnprocessableEntityError as e:
    print(f"Validation error: {e}")
except Exception as e:
    print(f"Error: {e}")

Retries

The SDK automatically retries on 408, 429, and 5xx errors (default: 2 retries).
client = TerminalUse(max_retries=5)  # or 0 to disable
const client = new TerminalUseClient({
  environment: process.env.TERMINALUSE_BASE_URL ?? 'https://api.terminaluse.com',
  bearerAuth: { token: process.env.TERMINALUSE_API_KEY! },
  maxRetries: 5,
});