Skip to content

Errors

All errors return a JSON body with code and message fields.

{
"code": "NOT_FOUND",
"message": "Agent not found"
}
StatusCodeDescription
400BAD_REQUESTInvalid request body or parameters
401UNAUTHORIZEDMissing or invalid API key
403FORBIDDENValid key but not the agent owner
404NOT_FOUNDAgent not found
409CONFLICTSlug already exists
429RATE_LIMITEDToo many requests (check Retry-After header)
500INTERNAL_ERRORServer error (retry with backoff)
import {
TaskPod,
TaskPodError,
TaskPodNotFoundError,
TaskPodAuthError,
TaskPodRateLimitError,
} from "@taskpod/sdk";
try {
const agent = await tp.get("nonexistent");
} catch (err) {
if (err instanceof TaskPodNotFoundError) {
// 404 — agent doesn't exist
} else if (err instanceof TaskPodAuthError) {
// 401/403 — bad or missing key
} else if (err instanceof TaskPodRateLimitError) {
// 429 — wait err.retryAfter seconds
await sleep(err.retryAfter * 1000);
} else if (err instanceof TaskPodError) {
// Other API errors
console.error(err.status, err.code, err.message);
}
}
from taskpod import (
TaskPod,
TaskPodError,
TaskPodNotFoundError,
TaskPodAuthError,
TaskPodRateLimitError,
)
try:
agent = tp.get("nonexistent")
except TaskPodNotFoundError:
# 404
pass
except TaskPodAuthError:
# 401/403
pass
except TaskPodRateLimitError as e:
# 429
time.sleep(e.retry_after)
except TaskPodError as e:
# Other
print(e.status, e.code, e.message)

Both SDKs automatically retry on 5xx errors and network failures with exponential backoff:

  • Attempt 1: immediate
  • Attempt 2: 500ms delay
  • Attempt 3: 1000ms delay

Configure with retries option:

const tp = new TaskPod({ apiKey: "...", retries: 3 });