Skip to main content

Preclinical

Python SDK and CLI for Preclinical — adversarial testing for healthcare AI agents.

Installation

pip install preclinical

SDK

from preclinical import Preclinical

with Preclinical() as client:
    # Start a test run
    started = client.start_run(agent_id="...", max_turns=5, tags=["cardiac"])

    # Watch live events
    for event in client.watch(started.id):
        print(event.event, event.data)

    # Or poll manually
    run = client.get_run(started.id)
    print(f"Status: {run.status}")

    # Get detailed results
    results = client.list_scenario_runs(started.id)
    for r in results.items:
        print(f"{r.status} — {r.scenario_name}")

Async

from preclinical import AsyncPreclinical

async with AsyncPreclinical() as client:
    started = await client.start_run(agent_id="...", max_turns=5)
    async for event in client.watch(started.id):
        print(event.event, event.data)

More examples

with Preclinical() as client:
    # Agents
    agents = client.list_agents()
    agent = client.create_agent(provider="openai", name="My Agent", config={...})

    # Scenarios
    scenarios = client.list_scenarios(tag="cardiac")
    scenario = client.generate_scenario(text="Patient presents with chest pain...")

CLI

# Run tests
preclinical run <agent_id> --max-turns 5 --tags cardiac

# Watch live
preclinical runs watch <run_id>

# Results
preclinical results list <run_id>

# Agents
preclinical agents list
preclinical agents create --provider openai --name "My Agent"

# Scenarios
preclinical scenarios list
preclinical scenarios generate --text "Patient presents with..."

# Health
preclinical health

All commands support --json for machine-readable output.

Configuration

Resolved in order: CLI flags > env vars > config file > defaults.

export PRECLINICAL_API_URL=http://localhost:3000
export PRECLINICAL_API_KEY=your-key
# ~/.preclinical/config.toml
api_url = "https://your-server.example.com"
api_key = "your-api-key"

Docs

docs.preclinical.co

Metadata

Release files for preclinical 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for preclinical 0.3.1
File Size Uploaded Provenance
preclinical-0.3.1.tar.gz 18.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for preclinical 0.3.1
File Interpreter ABI Platform
preclinical-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 36.7 kB

Release files / preclinical-0.3.1.tar.gz

Download URL preclinical-0.3.1.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f8cdc479c8ed0d9ec580bebdb1c74d5c61e29b095826be0059c6d2122d74d918
BLAKE2b-256 checksum
How to use checksums
ed4a8adabd694c46e117167b8deddb549b6316ec7166437bb2a06a263802c29e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 2, 2026.

Transparency log

Release files / preclinical-0.3.1-py3-none-any.whl

Download URL preclinical-0.3.1-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0c2dd72287e8d5316675de3331d157ce38568e96bfc1afd0730f462ad2aff57a
BLAKE2b-256 checksum
How to use checksums
2a1b2fd40c1a96ed378ceba4f7056dade7067b3561f850a4cddc6b1d87d46a90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 2, 2026.

Transparency log

Security for preclinical 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for preclinical-0.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page