Skip to main content

Strait

Python SDK for the Strait API

CI PyPI Python License Types


The official Python SDK for Strait -- an open-source job execution and workflow orchestration platform for humans and AI agents. Define jobs, build DAG workflows, run durable AI agents with cost tracking, and manage the full run lifecycle from Python.

Sync and async clients, 19 domain services (~186 operations), authoring DSL, composition helpers, FSM state machines, and PEP 561 type hints.

Website | Platform Repo | Documentation | PyPI

Installation

pip install strait-python

Requires Python 3.11+.

Quick Start

from strait import Client

client = Client(base_url="https://api.strait.dev", api_key="your-key")

# List jobs
jobs = client.jobs.list()

# Trigger a job
run = client.jobs.trigger(job["id"], {"payload": {"key": "value"}})

# Get a run
run = client.runs.get(run["id"])

Async

from strait import AsyncClient

async with AsyncClient.from_env() as client:
    jobs = await client.jobs.list()
    run = await client.jobs.trigger("job-id", {"payload": {}})

Configuration

Three ways to create a client:

# From environment variables (STRAIT_BASE_URL, STRAIT_API_KEY)
client = Client.from_env()

# From strait.json file (token always from STRAIT_API_KEY env var)
client = Client.from_file()

# Inline
client = Client(base_url="https://api.strait.dev", api_key="your-key")

All methods work with AsyncClient too. See Configuration Guide for details.

Features

Domain Operations (19 Services)

All 186 API operations organized into typed service classes:

Service Examples
client.jobs list, create, get, update, delete, trigger, bulk_trigger
client.runs list, get, delete, replay, bulk_cancel, get_dlq
client.workflows list, create, trigger, get_diff, get_policy
client.workflow_runs list, pause, resume, approve_step, skip_step
client.deployments list, create, finalize, promote, rollback
client.sdk_runs complete_run, heartbeat_run, checkpoint_run
client.rbac list_roles, create_member, seed_roles
+ 12 more environments, secrets, api_keys, webhooks, ...

Authoring DSL

Define jobs, workflows, and AI agents with a type-safe DSL:

from strait.authoring import define_job, define_workflow, JobOptions, WorkflowOptions
from strait.authoring import job_step, approval_step

wf = define_workflow(WorkflowOptions(
    name="Order Pipeline", slug="order-pipeline", project_id="proj-1",
    steps=[
        job_step("validate", "validate-job"),
        job_step("charge", "charge-job", depends_on=["validate"]),
        approval_step("approve", depends_on=["charge"]),
        job_step("ship", "ship-job", depends_on=["approve"]),
    ],
))

See Authoring Guide for AI agents, event definitions, RunContext, and test harness.

Composition Helpers

from strait.composition import with_retry, wait_for_run, paginate, RetryOptions

# Retry with exponential backoff
result = with_retry(lambda: client.jobs.trigger("j1", payload), RetryOptions(attempts=5))

# Wait for a run to complete
run = wait_for_run(
    get_run=lambda rid: client.runs.get(rid),
    get_status=lambda r: r["status"],
    run_id="run-1",
)

See Composition Guide for cost budgets, checkpoint resume, pagination, and more.

Error Handling

All errors inherit from StraitError with typed exceptions for each HTTP status:

from strait import NotFoundError, RateLimitedError

try:
    job = client.jobs.get("nonexistent")
except NotFoundError as e:
    print(f"Not found: {e} (status={e.status})")
except RateLimitedError as e:
    print(f"Rate limited, retry after backoff")

See Error Handling Guide for the full exception hierarchy.

Middleware

from strait import Client, Middleware

mw = Middleware(
    on_request=lambda ctx: print(f"-> {ctx.method} {ctx.url}"),
    on_response=lambda ctx: print(f"<- {ctx.status} ({ctx.duration_ms}ms)"),
)
client = Client.from_env(middleware=[mw])

FSM State Machines

from strait.fsm import transition_run, RunStatus, RunEvent

next_status = transition_run(RunStatus.EXECUTING, RunEvent.COMPLETE)
assert next_status == RunStatus.COMPLETED

Documentation

Guide Description
Configuration Client creation, auth types, strait.json, env vars
Authoring Jobs, workflows, agents, RunContext, test harness
Composition Retry, wait, paginate, cost budget, checkpoint resume
Errors Exception hierarchy, HTTP error mapping
Examples Runnable code examples for all major features

Development

make bootstrap   # Create venv + install deps
make lint        # Run ruff (lint + format check)
make typecheck   # Run mypy (strict mode)
make test        # Run pytest with coverage
make run-all     # lint + typecheck + test

See CONTRIBUTING.md for the full contributor guide.

License

MIT

Metadata

Release files for strait-python 0.1.1

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

Source distribution (sdist)

Source distribution for strait-python 0.1.1
File Size Uploaded Provenance Actions
strait_python-0.1.1.tar.gz 46.0 kB With provenance Details for strait_python-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for strait-python 0.1.1
File Interpreter ABI Platform Actions
strait_python-0.1.1-py3-none-any.whl Python 3 none any Details for strait_python-0.1.1-py3-none-any.whl

Total release size: 102.5 kB

Release files / strait_python-0.1.1.tar.gz

Download URL strait_python-0.1.1.tar.gz
Size 46.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7dbb4577be57684d821f0bb7fb51b42aa6d040ac3cf3fc37fd859378d3f71316
BLAKE2b-256 checksum
How to use checksums
c508724ddad430320b51caacf33dda7cabfa30faa61310d0f601a980f47704b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 2, 2026.

Transparency log

Release files / strait_python-0.1.1-py3-none-any.whl

Download URL strait_python-0.1.1-py3-none-any.whl
Size 56.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9564758df9f31e316ea4f0e0507bcaf8ce33976e2c96eef64f1ce113aa617fe
BLAKE2b-256 checksum
How to use checksums
d42b3d8981a6c884ebea02b889c66c6916886ecc506438ad073571d472d546da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 2, 2026.

Transparency log

Security for strait-python 0.1.1

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for strait_python-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 2, 2026.

Transparency log

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.1 This release

2 release files Full 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