Skip to main content

Typed Python client for the Coval evaluation platform API.

Project description

coval-sdk (Python)

Typed Python client for the Coval evaluation platform API. The API classes and Pydantic v2 models are generated from the same public OpenAPI specs that power the API reference. CovalClient adds authentication, safe retries, pagination, and one entry point for every public v1 resource.

Install

pip install coval-sdk

Requires Python 3.9+.

Quick start

import os

from coval_sdk import CovalClient, paginate

with CovalClient(os.environ["COVAL_API_KEY"]) as coval:
  for agent in paginate(
    coval.agents.list_agents,
    items_field="agents",
    page_size=50,
  ):
    print(agent.id, agent.display_name)

The client sends the required lowercase x-api-key header and defaults to https://api.coval.dev/v1.

Retries

GET, HEAD, and OPTIONS requests retry 408, 429, and transient 5xx responses up to three total attempts with exponential backoff. Mutating requests are not retried by default, which avoids duplicating side effects.

from coval_sdk import CovalClient

# Disable transport retries.
coval = CovalClient(api_key, retries=False)

# Use a custom base URL.
staging = CovalClient(api_key, base_url="https://staging.api.coval.dev/v1")

Generated client

All generated API classes, models, ApiClient, Configuration, and typed exceptions remain available for lower-level usage:

from coval_sdk import AgentsApi, ApiClient, Configuration

config = Configuration(host="https://api.coval.dev/v1")
with ApiClient(config) as client:
  client.set_default_header("x-api-key", api_key)
  page = AgentsApi(client).list_agents(page_size=50)

Malformed list resources

List responses validate each resource independently. If one resource does not match the published schema, the SDK omits that item, returns the remaining typed resources, and emits InvalidListItemWarning. The warning identifies the response field and list index but does not include resource contents.

Applications that prefer strict failure can enable it on the client:

from coval_sdk import CovalClient

coval = CovalClient(api_key, strict_response_validation=True)

Single-resource and malformed top-level responses still raise Pydantic validation errors.

What's included

  • 25 typed API classes, including agents, conversations, runs, run templates, metrics, monitors, reports, tags, webhooks, and organization configuration
  • Pydantic v2 request and response models
  • Lowercase API-key authentication and connection pooling
  • Safe retry and token-pagination helpers
  • Warning-backed isolation for malformed resources in list responses

Development

From the repository root:

COVAL_SPECS_DIR=../docs/api-reference/v1 node scripts/bundle-spec.mjs
bash scripts/generate-sdks.sh
python -m pytest python-sdk/tests

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coval_sdk-0.3.1.tar.gz (226.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coval_sdk-0.3.1-py3-none-any.whl (693.3 kB view details)

Uploaded Python 3

File details

Details for the file coval_sdk-0.3.1.tar.gz.

File metadata

  • Download URL: coval_sdk-0.3.1.tar.gz
  • Upload date:
  • Size: 226.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for coval_sdk-0.3.1.tar.gz
Algorithm Hash digest
SHA256 00774ee6cbfce4256eb1c74dd4c1715aa3c6eeb52bc4ce790deb5aa72a1029b7
MD5 3716c11d043b51ba19d5541243c5b921
BLAKE2b-256 2239860a967e6837ac3dfb345b5a3ede17601f5e0f379d0a348ba80679deeef4

See more details on using hashes here.

Provenance

The following attestation bundles were made for coval_sdk-0.3.1.tar.gz:

Publisher: publish-coval-sdk.yml on coval-ai/coval-examples

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file coval_sdk-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: coval_sdk-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 693.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for coval_sdk-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4cc5ae8c6e885aa655a9a1c5259f597166321d7c533bfd02e859e91afb403225
MD5 998c8e34a623039c81f8f9fd7e169df3
BLAKE2b-256 bc8c887ef0546b31c6186d00ff38c97ead65aa0b489f72fc13a193f06261b103

See more details on using hashes here.

Provenance

The following attestation bundles were made for coval_sdk-0.3.1-py3-none-any.whl:

Publisher: publish-coval-sdk.yml on coval-ai/coval-examples

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page