Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Main Sequence Logo

Main Sequence Python SDK

Docs Open Issues Last Commit Maintained

The Main Sequence Python SDK is the client and development toolkit for the Main Sequence platform. It provides authentication, typed platform resources, CodeRepository development and release operations, Agent and A2A workflows, jobs, access policies, observability, logging, tracing, and reusable scaffold tooling.

MetaTables is now an independent domain package, installed as mainsequence-metatable and imported as metatables. Table models, time-index table updates, SQLAlchemy schemas, local database interfaces, and Alembic execution are no longer implemented by this distribution.

Repository Status

What This Repository Contains

Main package areas:

  • mainsequence.client: API client models for users, CodeRepositories, jobs, Agents, artifacts, constants, secrets, access policies, releases, and other platform resources
  • mainsequence.cli: the complete mainsequence command-line interface for authentication, platform resources, and local CodeRepository operations
  • mainsequence.instrumentation and mainsequence.logconf: SDK tracing and logging integration
  • mainsequence.server: server-side caller assertion verification
  • mainsequence.scaffold_skills: reusable, version-pinned skill copying for this SDK and extension libraries

Repository areas:

  • agent_scaffold/skills/: version-matched SDK guidance and domain skills; repository-owned AGENTS.md files are never scaffolded or updated
  • docs/: knowledge guides, CLI docs, architecture decisions, and generated reference docs
  • tests/: offline tests plus explicitly marked live-backend tests

Documentation Map

Recommended entry points:

The beginner tutorial is maintained in the separate MainSequence SDK tutorial CodeRepository.

Quick Start

Install and authenticate:

pip install mainsequence
mainsequence login
mainsequence doctor

An already MCP-authenticated coding agent can establish the same persisted CLI session with mainsequence login --mcp, then call the printed auth.cli_authorize tool while the command waits. The backend supplies the callback URI; tokens return directly to the CLI and are never exposed through MCP.

Inspect and create CodeRepositories:

mainsequence code-repository search
mainsequence code-repository create my-first-repository
mainsequence code-repository set-up-locally <CODE_REPOSITORY_UID>
cd my-first-repository
mainsequence code-repository build-local-venv --path .

Use mainsequence --help and mainsequence code-repository --help for the installed command surface. The CLI includes Agent and AgentSession, CodeRepository, jobs and runs, images, resources and releases, constants, secrets, teams, access policies, scaffold, Docker, and local-development commands.

Python Client

mainsequence.client provides AuthLoaders, MainSequenceClient, generic request and response helpers, and typed platform adapters. The platform owns authorization and lifecycle policy. The SDK resolves CodeRepository source identity from the current Git checkout when an operation requires that context.

Discover deployments with ResourceRelease.filter(name=...) or resolve a known release UID with ResourceRelease.get(pk=...). For shared deployments owned by another repository, use the explicitly scoped filter_admin path. See Resource releases for supported filters and examples.

The standard mainsequence installation includes PyJWT and cryptography for the framework-independent caller assertion verifier. Applications remain responsible for resource authorization and storage operations.

Install mainsequence-metatable and import metatables for table-domain work. See the MetaTables migration guide for the install step, old and new imports, retired table CLI commands, and the legacy SDK option.

Development

This repository requires Python 3.13 or newer and uses pyproject.toml with a development dependency group.

uv sync --group dev
pytest
ruff check .
mkdocs build --strict

Live-backend tests are marked live and excluded from a normal test run. Run them explicitly with pytest -m live when credentials and a target backend are available.

Package metadata is defined in pyproject.toml. This repository is licensed under the MIT License; see LICENSE.

Metadata

Release files for mainsequence 9.0.34.dev80

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

Source distribution (sdist)

Source distribution for mainsequence 9.0.34.dev80
File Size Uploaded Provenance Actions
mainsequence-9.0.34.dev80.tar.gz 398.8 kB With provenance Details for mainsequence-9.0.34.dev80.tar.gz

Built distribution (wheel)

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

Total release size: 715.5 kB

Release files / mainsequence-9.0.34.dev80.tar.gz

Download URL mainsequence-9.0.34.dev80.tar.gz
Size 398.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e699d4abb82a8c843d04926f0f5a3a8f00423ff5906532ccdb2a1041a67f3a7c
BLAKE2b-256 checksum
How to use checksums
301a204c0b11fee35cf01dfe06ac1cc4fbe026b3adddb93dbc95c4ed8f7dcb0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / mainsequence-9.0.34.dev80-py3-none-any.whl

Download URL mainsequence-9.0.34.dev80-py3-none-any.whl
Size 316.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df4a7a5676cf504c9ea61084ad50ef99e1a7a078c6e1a3a2b76457818abd6f40
BLAKE2b-256 checksum
How to use checksums
d1e4d4a313e59762eee5ca34bae735deb5ca851efbca9e5fe0228efbf4f33303
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Security for mainsequence 9.0.34.dev80

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 mainsequence-9.0.34.dev80.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 Nov 1, 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
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