Skip to main content

Package maintenance with Docker and restartable approval

Run real Ruff and pytest checks in Docker with PackageMaintenanceAgent. Its AgentRunner stores the pending approval in SQLite, so you can review it after the Python process exits and apply your decision from a fresh process.

This example is maintained with the Swarmauri SDK examples. To share it, copy this directory or link to it at a specific SDK commit. The host uses the published versions declared in pyproject.toml. The Docker image contains a small fixture package with an intentional formatting issue. A scripted model selects the tool calls from the transcript, so the demo needs no LLM account or API key.

Install and start

Use Python 3.12, uv, and a running Docker engine in Linux container mode. From the repository root, run:

cd docs/examples/package-maintenance
uv sync
uv run python -m swarmauri_package_maintenance_demo start

The Python demo builds the image from its packaged Dockerfile and fixture, starts a disposable container, and runs the checks through the SDK's Docker backend. The build downloads its dependencies. The running container uses its installed tools offline and has no host mounts.

The agent calls RunPackageChecks with fix=false. Ruff streams a Would reformat message and exits with code 1. The agent proposes the same tool with fix=true. The SDK policy asks for approval, and the runner saves the invocation and its approval ID in .state/runs.sqlite3. The terminal shows the run ID, approval ID, tool arguments, and Docker scope. Enter a to approve or d to deny. The demo submits your answer and the approval ID to the runner. Enter e or press Enter to exit and decide later. Closing input or pressing Ctrl+C at the prompt also leaves the request pending. Save the run ID. The demo keeps the container running while it waits for your decision.

Resume in a new process

Use the run ID to reopen the same approval prompt:

run_id='paste-run-id'
uv run python -m swarmauri_package_maintenance_demo resume "$run_id"

If you restart your terminal, return to the same working directory. If you set --db before the start subcommand, pass the same path before resume.

The new agent constructs a fresh runner, recovers the Docker container ID from SQLite, and verifies the approval against that container and the saved tool arguments. It streams Ruff formatting, lint, and pytest output to the terminal. Pytest prints Checking fixture addition... and then Fixture addition passed. before the final completed: Package checks passed. The read-only check from the first command has already finished and is not replayed.

The demo stops and removes the container after approval or denial completes. Each start creates a fresh workspace. Restart recovery applies at the saved approval checkpoint.

When standard input is redirected, start and resume print the pending request and exit. For a decision without a prompt, use the exact approval ID shown in the request and choose approve or deny:

approval_id='paste-approval-id'
uv run python -m swarmauri_package_maintenance_demo decide "$run_id" "$approval_id" approve

Build the Python distributable

uv build

The swarmauri-demo-package-maintenance wheel and source distribution include the Dockerfile and fixture. The installed module uses those files when it builds the workspace, so the wheel can run independently of the SDK checkout.

The CLI uses swarmauri_runstore_sqlite.SqliteRunStore for checkpoints. To test restart, leave a request pending, exit the CLI, then reopen it with resume <run_id> using the same database.

Metadata

Release files for swarmauri-demo-package-maintenance 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 swarmauri-demo-package-maintenance 0.1.1
File Size Uploaded Provenance Actions
swarmauri_demo_package_maintenance-0.1.1.tar.gz 5.4 kB Without provenance Details for swarmauri_demo_package_maintenance-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for swarmauri-demo-package-maintenance 0.1.1
File Interpreter ABI Platform Actions
swarmauri_demo_package_maintenance-0.1.1-py3-none-any.whl Python 3 none any Details for swarmauri_demo_package_maintenance-0.1.1-py3-none-any.whl

Total release size: 12.6 kB

Release files / swarmauri_demo_package_maintenance-0.1.1.tar.gz

Download URL swarmauri_demo_package_maintenance-0.1.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5bbfadba0dfe42e9453fdff821ecd51cf4c95853624de94b495b446fbcd2f7f3
BLAKE2b-256 checksum
How to use checksums
bc1e11657fae516995976257212339af31bc126756c73f464e96e4f85a9dbdbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL swarmauri_demo_package_maintenance-0.1.1-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49a482a0db763898acb0138b9e62a46fd20cea02ae023ff5343346e6e14c910d
BLAKE2b-256 checksum
How to use checksums
37743116599f9fd6e554cb06b630b6863014a6abde6514c20ea7fda82d0ecb70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for swarmauri-demo-package-maintenance 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.

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