Skip to main content
The TypeScript and Python API clients below are generated from the public OpenAPI specs that power this API reference.

TypeScript

@coval/sdk on npm.

Python

coval-sdk on PyPI.
Both API clients use the MIT license. Source: coval-ai/coval-sdk.

Install

Quick start

The TypeScript client groups methods under properties such as coval.agents and coval.simulations. The Python client uses one *Api class per resource, constructed with a shared ApiClient.

Auth

Authenticate with the x-api-key header. The TypeScript client sets it automatically; set it on ApiClient in Python.

Errors

CovalApiError shape: status, code, message, requestId, body, url, method. The requestId is sourced from x-request-id, x-amzn-requestid, or the response body in that order. Include it when you file a support ticket.

Read unvalidated Python responses

The Python client validates responses with Pydantic. If a response fails model validation, use the method’s *_without_preload_content variant to read and parse the raw response:
TypeScript interfaces do not validate response values at runtime.

Retries

The TypeScript SDK retries with exponential backoff and jitter on transient failures. Defaults:
Exhausted transport retries raise CovalNetworkError. Non-retryable HTTP responses raise CovalApiError immediately. Python retry policy is application-controlled. Retry operations only when they are safe to repeat.

Pagination

The Coval v1 API uses next_page_token-style pagination. The TypeScript SDK ships an async iterator that handles the loop for you:
paginate and collectAll work with any list endpoint. Provide fetchPage, items, and nextToken callbacks for the method you are calling.
Pass maxPages to cap iteration. Useful when you want a quick preview of a large list without hitting the full backlog.
For Python, use a while loop on next_page_token.

Customization

Base URL

Both clients accept an API root:

Middleware (TypeScript)

Add request and response middleware for logging, tracing, or request IDs:

Custom fetch

Swap the underlying fetch implementation. For example, to use undici with keepalive in a long-running Node process, or to stub network calls in tests:

Versioning

Review each package’s release notes before upgrading, and pin a version for reproducible builds.

Going deeper

Source repo

SDK implementations, examples, and issue tracking.

OpenAPI specs

The specs that power both SDKs are published at https://api.coval.dev/v1/openapi.

API keys

How to mint and rotate API keys from the dashboard.

CLI

Run Coval commands from your terminal.