Skip to main content
Docs

Search guides and API endpoints, for example “Idempotency-Key” or “submit job”.

    Tools · Custom Modeling

    Python Script Sandbox

    Short RDKit, pandas, NumPy and SciPy analyses of your results, run in isolation with no network access
    On this page

    Prices, workflows, and method papersOpen in the app

    Run it from the API

    Submit with Submit a job and the job_type below. Price it first with Estimate job reservation cost: submitting reserves that amount from your wallet, and the charge settles at the actual runtime.

    python-sandbox python-sandbox

    Job type
    python-sandbox
    Hardware
    cpu (default)
    Typical runtime
    3 min on CPU

    Payload

    Payload fields
    FieldTypeDescription
    coderequiredstring

    Limits: min length 1, max length 20000

    inputsmap<string, artifactRef>

    Default: {}

    timeout_secondsinteger

    Default: 120Limits: ≥ 10, ≤ 600

    summarystring

    Limits: max length 500

    Example

    from cognichem_client import CogniChem
    
    client = CogniChem.from_env()  # reads COGNICHEM_API_KEY
    payload = {
        "code": "import csv\nfrom pathlib import Path\n\nrows = [(\"CCO\", 46.07),… (295 characters)",
        "inputs": {},
        "timeout_seconds": 30,
        "summary": "Write a two-row table of molecular weights",
    }
    
    estimate = client.jobs.estimate(job_type="python-sandbox", payload=payload, resource="cpu")
    print(f"Reserves ${estimate.cost:.2f}")
    
    job = client.jobs.submit(
        job_name="my-python-sandbox-run",
        job_type="python-sandbox",
        payload=payload,
        resource="cpu",
    )
    status = client.jobs.wait(job.process_id)
    if status.status == "completed":
        client.jobs.result(job.process_id, save_path=".")

    Sample data from the job catalog; long values are shortened here. Each job_name must be unique among your jobs.