Skip to main content

CLI and SDK for the Preclinical healthcare AI agent testing platform

Project description

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

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

preclinical-0.3.1.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

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

preclinical-0.3.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for preclinical-0.3.1.tar.gz
Algorithm Hash digest
SHA256 f8cdc479c8ed0d9ec580bebdb1c74d5c61e29b095826be0059c6d2122d74d918
MD5 319b266d3c1f2e297b1ae3064b040a9d
BLAKE2b-256 ed4a8adabd694c46e117167b8deddb549b6316ec7166437bb2a06a263802c29e

See more details on using hashes here.

Provenance

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

Publisher: publish-pypi.yml on Mentat-Lab/preclinical

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

File details

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

File metadata

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

File hashes

Hashes for preclinical-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c2dd72287e8d5316675de3331d157ce38568e96bfc1afd0730f462ad2aff57a
MD5 033df5d6c39249058d7cd71638545460
BLAKE2b-256 2a1b2fd40c1a96ed378ceba4f7056dade7067b3561f850a4cddc6b1d87d46a90

See more details on using hashes here.

Provenance

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

Publisher: publish-pypi.yml on Mentat-Lab/preclinical

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