Skip to main content

sonic-screwdriver (Python SDK)

pip install sonicscrew

The package is sonicscrew; the module you import is sonic_screwdriver. Set SONIC_URL (default https://app.sonicscrew.click) and SONIC_API_KEY (from the dashboard's API keys page).

Prototype (0.x): the API may change between minor versions.

Project programs and machine installations

from sonic_screwdriver import Sonic, Machine, InstalledProgram, Program

front_desk = Machine("dentist-front-desk", programs={
    "dentasoft": InstalledProgram(
        executable=r"C:\Program Files\DentaSoft\DentaSoft.exe",
        window_title_contains="DentaSoft",
        args=[],
        working_directory=r"C:\Program Files\DentaSoft",
    ),
})
clinic = Sonic(
    project="dental-clinic",
    machine=front_desk.name,
    context="Use DentaSoft for patient records.",
    programs={"dentasoft": Program(
        description="Patient records, appointments and balances.",
        instructions="Open when patient information is needed; log in if prompted.",
    )},
)
# Declare operations with @clinic.operation as usual, then at startup:
await front_desk.sync()
await clinic.sync()
# At shutdown:
await front_desk.aclose()
await clinic.aclose()

These syncs store configuration in the compute-box; neither opens an app. During jobs the AI can inspect running applications and choose when to open a project program by ID. Paths are absolute paths on the named Windows machine. Use the same url / api_key settings for both objects when overriding the environment defaults. For a Python test app, configure the absolute Python executable and pass the absolute script path in args.

Machine sync replaces that machine's complete program registry; configure it once for all projects sharing the machine. An empty registry requires sync(allow_empty=True). Project programs=None (the default) preserves existing configuration; programs={} explicitly clears it. Program and operation syncs are separate HTTP requests. The existing context behavior is unchanged: it is included in each operation's instructions.

Operations

Turn the tasks of a legacy program into typed async functions.

from typing import Annotated
from pydantic import BaseModel, Field
from sonic_screwdriver import Sonic

dentasoft = Sonic(project="dental-clinic", machine="dentist-front-desk")

class BalanceChange(BaseModel):
    previous_balance: float
    new_balance: float

@dentasoft.operation
async def update_balance(patient_id: str, balance: Annotated[float, Field(ge=0)]) -> BalanceChange:
    """Set a patient's Balance Due.

    Find the patient by Patient ID, click Edit, replace Balance Due, click Save,
    answer Yes, then re-read Balance Due to confirm it changed.
    """

await dentasoft.sync()                                  # once, at startup
change = await update_balance("P-1004", balance=0)      # typed result
  • The signature is the input, the return type is the output, the docstring is the description (first paragraph) and the agent's instructions (the rest). The body is never run.
  • sync() makes the project's operations on the compute-box match the ones defined in code, in one call. Safe to repeat.
  • Calls validate arguments before sending and validate the result before returning. Failures raise SonicError with a stable code.
  • Per-call options: await update_balance.with_options(idempotency_key="inv-5521")(...).
  • SONIC_URL and SONIC_API_KEY environment variables configure the connection. Without SONIC_URL, the SDK uses the hosted compute-box at https://app.sonicscrew.click; set it (for example http://localhost:8080) to use your own.

Install locally: pip install -e sdk/python.

dentasoft.definitions() returns the exact JSON that sync() sends, if you want to write it to files instead.

Layout

  • client.py the Sonic project object: declaring, syncing, running jobs
  • operation.py turns a typed, documented function into an operation
  • errors.py the one exception type, SonicError
  • _sse.py reads the job's event stream

Metadata

Release files for sonicscrew 0.1.0

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

Source distribution (sdist)

Source distribution for sonicscrew 0.1.0
File Size Uploaded Provenance Actions
sonicscrew-0.1.0.tar.gz 15.7 kB Without provenance Details for sonicscrew-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 30.9 kB

Release files / sonicscrew-0.1.0.tar.gz

Download URL sonicscrew-0.1.0.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4748134e31a4ab181e294d6b93d972f4afb6ab3d7afb68e2c648c24e2eda7e7a
BLAKE2b-256 checksum
How to use checksums
982d0840f9b48acc82f0534e9416161283049f9a71916b3b92fb54b1540512d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / sonicscrew-0.1.0-py3-none-any.whl

Download URL sonicscrew-0.1.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dec1cc2d95aa69b48b0fa9c7bee9237d0b16ee79251f518d9ad44ef0e592afd
BLAKE2b-256 checksum
How to use checksums
68164b06129c8f16fed22f0b0475d4d6d4f9c5243c0adda975c3480761f295de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for sonicscrew 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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