Skip to main content

Python-only SDK for Synth containers, tunnels, pools, and Research

Project description

Synth AI SDK

PyPI version License Python versions

Python SDK and CLI for Managed Research, Research Factory, and the infrastructure surfaces that support them.

Documentation: https://docs.usesynth.ai/sdk/overview

Installation

uv add synth-ai

Authenticate

Set SYNTH_API_KEY before using the SDK or CLI:

export SYNTH_API_KEY="sk_..."

Local Workspaces

For local multi-repo development, synth-ai treats workspace resolution as a read-only overlay. .env and Synth home config may provide defaults and secrets; selecting a worktree must not rewrite those defaults.

Use SYNTH_WORKSPACE_MANIFEST or SYNTH_WORKSPACE_ROOT for command-scoped worktree resolution. The resolver in synth_ai.core.utils.workspace returns repo paths and a scoped env mapping for subprocesses without mutating .env.

Pass base_url when you need to pin a production, local, staging, or private backend explicitly:

from synth_ai import SynthClient

client = SynthClient(base_url="http://127.0.0.1:8000")

The CLI also reads SYNTH_BACKEND_URL and accepts --backend-url.

Quickstart

from synth_ai import SynthClient
from synth_ai.core.research.public import SwarmSpec

with SynthClient() as client:
    swarm = client.research.swarms.create(
        SwarmSpec(objective="Assess this repository and produce a concise report.")
    )
    for event in swarm.events():
        print(event.kind, event.telemetry.sequence)
    result = swarm.wait(timeout_seconds=900)
    print(result.swarm_id, result.state)
    resolved = swarm.configuration()
    print(resolved.config_version_id, resolved.snapshot_sha256)
    usage = swarm.usage()
    print(usage.money.nominal_pico_usd, usage.tokens.totals.input_tokens)
    evidence = swarm.evidence()
    print(evidence.artifacts, evidence.work_products)

create returns a durable handle immediately. events() yields typed events, including an explicit UnknownSwarmEvent for forward-compatible server events; wait() uses a monotonic deadline and returns the terminal typed Swarm. configuration() returns the immutable, versioned, secret-redacted launch snapshot bound to that swarm, so replay and audit do not depend on the project's current mutable configuration. usage() returns one typed cost, token, and actor-attribution projection plus its source, record count, observation time, and terminal-state freshness. It does not expose the legacy raw ledger-entry dictionaries. evidence() returns the complete durable artifact and WorkProduct index with strict counts and lifecycle freshness. Artifact and WorkProduct content reads use the same typed transport and return bytes; they do not expose storage authority.

Research SDK

The only customer entrypoint is SynthClient().research. Its stable namespaces are projects, swarms, and factories.

Create a durable project when work needs reusable configuration:

from synth_ai import SynthClient
from synth_ai.core.research.public import EnvironmentKind, ProjectSpec, RuntimeKind, SwarmSpec

with SynthClient() as client:
    project = client.research.projects.create(
        ProjectSpec(
            name="Repository assessment",
            pool_id="pool_default",
            runtime_kind=RuntimeKind("python"),
            environment_kind=EnvironmentKind("docker"),
            orchestrator_profile_id="profile_orchestrator",
            default_worker_profile_id="profile_worker",
        )
    )
    swarm = client.research.swarms.create(
        SwarmSpec(objective="Produce the assessment."),
        project_id=project.project_id,
    )
    print(swarm.wait().state)

Factories provide a typed durable optimization loop with native sync/async parity:

from synth_ai import SynthClient
from synth_ai.core.research.public import EffortSpec, FactorySpec, ProjectId

with SynthClient() as client:
    factory = client.research.factories.create(
        FactorySpec(name="Prompt optimizer")
    )
    effort = client.research.factories.efforts.create(
        EffortSpec(
            factory_id=factory.factory_id,
            project_id=ProjectId("project_existing"),
            name="Improve the system prompt",
        )
    )
    print(effort.effort_id, effort.state)

Limits, economics, secrets, Tag, rich evidence projections, and administrative resource APIs remain available under client.research.advanced while their contracts are stabilized. Advanced APIs are not covered by the stable surface guarantee.

CLI discovery:

synth-ai research --help

CLI

synth-ai --help
synth-ai containers list
synth-ai tunnels health
synth-ai pools list

Public Surface

Use SynthClient as the front door:

Surface Client namespace Use it for
Research / Factory client.research Typed hosted projects, swarms, Factory lifecycles, and Efforts.
Containers client.containers Hosted container records and lifecycle operations.
Tunnels client.tunnels Managed tunnel records, leases, health, and rotation.
Pools client.pools Container pools, tasks, rollouts, artifacts, usage, and events.
CLI synth-ai Terminal access to containers, tunnels, and pools.

Use Managed Research when you want hosted research workers, repo runs, evidence, checkpoints, MCP, or final reports.

Managed Research Billing

Standalone SMR and Managed Factory draw from the same org-level allowance and flex-credit wallet. Free, Standard ($20/month), and Max ($200/month) expose premium and value usage windows with reset times, then use explicit flex credits after included usage is exhausted. Premium models consume allowance faster; value models stretch the same allowance further. Promo, make-good, banked, and override grants are manual audit events rather than automatic resets.

The canonical backend surfaces are GET /smr/billing/catalog, GET /smr/billing/plan, GET /smr/billing/runs/{run_id}/drawdown, and GET /smr/billing/factory-efforts/{factory_effort_id}/drawdown. In the Python SDK, use client.research.advanced.economics for authoritative billing reads while the economics contract remains advanced. Do not infer allowance from legacy Autumn balances or local spend summaries, and do not recompute discounts in the client.

Links

Local Development

Use uv run for Python tools:

uv sync --group dev
uv run ruff format --check .
uv run ruff check .
uv run ty check
make docs-gen   # generate Mintlify SDK reference into docs/
make docs-dev   # preview at http://localhost:3000/overview

Optional: install Lefthook and run lefthook install to run formatting, linting, and type checks on staged Python files.

SMR Handoff X thread — hand agent tasks to Managed Research from Cursor, Codex, or Claude Code (repo).

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

synth_ai-0.17.1.tar.gz (690.4 kB view details)

Uploaded Source

Built Distribution

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

synth_ai-0.17.1-py3-none-any.whl (811.7 kB view details)

Uploaded Python 3

File details

Details for the file synth_ai-0.17.1.tar.gz.

File metadata

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

File hashes

Hashes for synth_ai-0.17.1.tar.gz
Algorithm Hash digest
SHA256 a0c051059da0edcd04d5ef72b97a7630ad830fa225a6cd40308d8df6f3015ecf
MD5 1f1a9c0ea56706db558ffdec413ec3c7
BLAKE2b-256 600578839ccebcf8b21a388053aa7260cfbc8e142f6f3c14c36e279fefc20a82

See more details on using hashes here.

Provenance

The following attestation bundles were made for synth_ai-0.17.1.tar.gz:

Publisher: publish-dev.yml on synth-laboratories/synth-ai

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

File details

Details for the file synth_ai-0.17.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for synth_ai-0.17.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5595946c3b0757b4beac5856f894adfcfeca590200d2d1c312afac129637526d
MD5 fab79cc9d02059a1d5bc68349b376f2d
BLAKE2b-256 6c67cad113c254c80e8013832e4c4c91438f82ffbbfc6f15767b9dcd5db74efb

See more details on using hashes here.

Provenance

The following attestation bundles were made for synth_ai-0.17.1-py3-none-any.whl:

Publisher: publish-dev.yml on synth-laboratories/synth-ai

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