Skip to main content

PlanSolve for Python

Official Python client for the PlanSolve optimization API. One typed client covers three solvers — field service routing, professional-services task assignment, and shift scheduling — with built-in polling and clean error messages.

Installation

pip install plansolve

Requires Python 3.8+. Type hints are bundled.

Quick start

from plansolve import PlanSolveClient

client = PlanSolveClient(api_key="YOUR_API_KEY")

request = {
    "vehicles": [
        {
            "id": "tech1",
            "location": [40.7128, -74.0060],
            "skills": ["repair"],
            "shifts": [
                {"id": "morning", "minStartTime": "2026-04-02T08:00:00", "maxEndTime": "2026-04-02T17:00:00"}
            ],
        }
    ],
    "visits": [
        {
            "id": "visit1",
            "name": "AC Repair - Downtown Office",
            "location": [40.7589, -73.9851],
            "serviceDuration": "PT60M",
            "priority": "HIGH",
            "requiredSkills": ["repair"],
            "timeWindows": [
                {"minStartTime": "2026-04-02T09:00:00", "maxEndTime": "2026-04-02T17:00:00"}
            ],
        }
    ],
}

# Submit and block until the optimized plan is ready
result = client.field_service.start_and_wait_for_completion(request)

for vehicle in result.vehicles:
    print(f"Vehicle {vehicle.id}: {len(vehicle.visits)} visits")

Requests accept a plain dict (as above) or the typed dataclasses (FieldServiceRequest, Vehicle, Visit, ...).

Solvers

One client, three solvers — all share the same submit → poll → result workflow:

Solver Accessor Use for
Field Service client.field_service Vehicle routing with travel time, time windows, and skills
Professional Services client.professional_services Task assignment by skill, availability, priority, and deadlines
Shift client.shift Shift scheduling across contracts, availability, and fairness

Each accessor exposes start, get_status, get_result, analyze, wait_for_completion, and start_and_wait_for_completion.

Configuration

Pass your API key to the constructor: PlanSolveClient(api_key="..."). It is sent as the X-API-KEY header on every request.

Error handling

API errors raise requests.HTTPError with a readable message (e.g. HTTP 400: vehicles: At least one vehicle is required.):

try:
    result = client.field_service.start_and_wait_for_completion(request)
except Exception as e:
    print(e)

Documentation

Full guides, per-solver data models, and parameter reference live on the docs site:

Package: PyPI

License

Apache-2.0 — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plansolve-0.27.0.tar.gz (34.7 kB view details)

Uploaded Source

Built Distribution

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

plansolve-0.27.0-py3-none-any.whl (40.9 kB view details)

Uploaded Python 3

File details

Details for the file plansolve-0.27.0.tar.gz.

File metadata

  • Download URL: plansolve-0.27.0.tar.gz
  • Upload date:
  • Size: 34.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for plansolve-0.27.0.tar.gz
Algorithm Hash digest
SHA256 6fe10035d9ec8f775b90e18d1d6058bd4cbd90264f2ce269ea6cc1a17162cf94
MD5 7df7e42c6c130d2014bea4d0cc553279
BLAKE2b-256 679531c2864ecb95c6b5e5442e214a8ce0247d263070da4210e81d8e36a9b5be

See more details on using hashes here.

Provenance

The following attestation bundles were made for plansolve-0.27.0.tar.gz:

Publisher: python-publish.yml on plansolve/sdk

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

File details

Details for the file plansolve-0.27.0-py3-none-any.whl.

File metadata

  • Download URL: plansolve-0.27.0-py3-none-any.whl
  • Upload date:
  • Size: 40.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for plansolve-0.27.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff284a490b32291af623b4936efdc9246e5e3e14dd58a627df3f78433f5bc20b
MD5 fbb971a711c62395dca56e54deb9fbac
BLAKE2b-256 c6736fc2e28d403c228a7ec0ee4861936baa7fc948f139095439f2473f7fd9cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for plansolve-0.27.0-py3-none-any.whl:

Publisher: python-publish.yml on plansolve/sdk

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