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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8cdc479c8ed0d9ec580bebdb1c74d5c61e29b095826be0059c6d2122d74d918
|
|
| MD5 |
319b266d3c1f2e297b1ae3064b040a9d
|
|
| BLAKE2b-256 |
ed4a8adabd694c46e117167b8deddb549b6316ec7166437bb2a06a263802c29e
|
Provenance
The following attestation bundles were made for preclinical-0.3.1.tar.gz:
Publisher:
publish-pypi.yml on Mentat-Lab/preclinical
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
preclinical-0.3.1.tar.gz -
Subject digest:
f8cdc479c8ed0d9ec580bebdb1c74d5c61e29b095826be0059c6d2122d74d918 - Sigstore transparency entry: 1212194515
- Sigstore integration time:
-
Permalink:
Mentat-Lab/preclinical@33004af25b5eb8db6e740ca3e78816c925d4a61f -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/Mentat-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@33004af25b5eb8db6e740ca3e78816c925d4a61f -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c2dd72287e8d5316675de3331d157ce38568e96bfc1afd0730f462ad2aff57a
|
|
| MD5 |
033df5d6c39249058d7cd71638545460
|
|
| BLAKE2b-256 |
2a1b2fd40c1a96ed378ceba4f7056dade7067b3561f850a4cddc6b1d87d46a90
|
Provenance
The following attestation bundles were made for preclinical-0.3.1-py3-none-any.whl:
Publisher:
publish-pypi.yml on Mentat-Lab/preclinical
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
preclinical-0.3.1-py3-none-any.whl -
Subject digest:
0c2dd72287e8d5316675de3331d157ce38568e96bfc1afd0730f462ad2aff57a - Sigstore transparency entry: 1212194588
- Sigstore integration time:
-
Permalink:
Mentat-Lab/preclinical@33004af25b5eb8db6e740ca3e78816c925d4a61f -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/Mentat-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@33004af25b5eb8db6e740ca3e78816c925d4a61f -
Trigger Event:
release
-
Statement type: