Skip to main content

Python SDK for the Musher bundle distribution platform

Project description

Musher Python SDK

CI PyPI

Python SDK for the Musher bundle distribution platform. Pull versioned AI agent asset bundles — prompts, tool definitions, agent specs, and skills — into your Python applications.

Installation

Requires Python 3.13+.

pip install musher-sdk

Authentication

Set your API key as an environment variable:

export MUSHER_API_KEY="msk_..."

The SDK resolves credentials automatically in this order:

  1. MUSHER_API_KEY environment variable
  2. OS keyring (musher/{hostname})
  3. Credential file (<data_dir>/credentials/<host_id>/api-key, must be 0600)

You can also pass a token directly:

musher.configure(token="msk_...")

Quick Start

import musher

bundle = musher.pull("myorg/my-bundle:1.0.0")

for f in bundle.files():
    print(f"{f.logical_path}: {len(f.text())} chars")

Async

import musher

async with musher.AsyncClient() as client:
    bundle = await client.pull("myorg/my-bundle:1.0.0")

Sync Client

import musher

with musher.Client() as client:
    bundle = client.pull("myorg/my-bundle:1.0.0")

    result = client.resolve("myorg/my-bundle:1.0.0")

    asset = client.fetch_asset(
        "prompts/system.md",
        namespace="myorg",
        slug="my-bundle",
        version="1.0.0",
    )

Working with Bundles

Bundles provide typed accessors for each resource type:

bundle = musher.pull("myorg/my-bundle:1.0.0")

# Prompts
prompt = bundle.prompt("system")
print(prompt.text())

# Skills
for skill in bundle.skills():
    print(skill.name, skill.description)

# Toolsets and agent specs
toolset = bundle.toolset("search-tools")
data = toolset.parse_json()

spec = bundle.agent_spec("reviewer")
config = spec.parse_json()

Filter to a subset of resources with select():

selection = bundle.select(skills=["code-review"], prompts=["system"])

Framework Integrations

The SDK integrates with popular AI agent frameworks:

  • Claude — export bundles as Claude plugins or install skills to .claude/skills/ (examples)
  • OpenAI Agents — export skills as local directories or inline zips for the OpenAI shell tool (examples)
  • PydanticAI — use bundle prompts as agent instructions with structured output (examples)

Configuration

Registry URL

export MUSHER_API_URL="https://custom-registry.example.com"

Default: https://api.musher.dev

Programmatic Configuration

from pathlib import Path
import musher

musher.configure(
    token="msk_...",
    registry_url="https://custom-registry.example.com",
    cache_dir=Path("/tmp/musher-cache"),
    verify_checksums=True,
    timeout=30.0,
    max_retries=2,
)

All parameters are optional — omitted values are auto-discovered.

See Configuration for the full reference (directory layout, credential chain, cache structure, TTL defaults).

Cache

The SDK uses a content-addressable disk cache:

  • Blobs stored by SHA-256 hash, shared across registries
  • Manifests and refs partitioned by registry hostname
  • Manifests TTL: 24h; refs TTL: 5min
  • cache_clean() removes expired entries and garbage-collects unreferenced blobs

Cache management functions are available at the module level and on the Client:

import musher

info = musher.cache_info()  # cache statistics
musher.cache_remove("myorg/my-bundle:1.0.0")  # remove cached metadata for a bundle version
musher.cache_clean()  # reclaim expired entries and unreferenced blobs
musher.cache_clear()  # remove all cached data
path = musher.cache_path()  # cache directory path

Features

  • pull() / pull_async() — resolve + fetch all assets + verify checksums
  • resolve() / resolve_async() — resolve bundle references to manifests
  • fetch_asset() — fetch individual assets by logical path
  • Sync (Client) and async (AsyncClient) clients
  • Typed handles: SkillHandle, PromptHandle, ToolsetHandle, AgentSpecHandle
  • bundle.select() — filter resources by type
  • Content-addressable cache with TTL and garbage collection
  • Cache management: cache_info(), cache_remove(), cache_clear(), cache_clean(), cache_path()
  • export_claude_plugin() / install_claude_skills() — Claude integration
  • export_openai_local_skill() / export_openai_inline_skill() — OpenAI Agents integration

Examples

See the examples/ directory for runnable code samples covering basic usage, Claude, OpenAI Agents, and PydanticAI integrations.

License

Apache-2.0

Project details


Download files

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

Source Distribution

musher_sdk-0.3.3.tar.gz (202.7 kB view details)

Uploaded Source

Built Distribution

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

musher_sdk-0.3.3-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

Details for the file musher_sdk-0.3.3.tar.gz.

File metadata

  • Download URL: musher_sdk-0.3.3.tar.gz
  • Upload date:
  • Size: 202.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for musher_sdk-0.3.3.tar.gz
Algorithm Hash digest
SHA256 686cc6e8e0595873e35839251356595f28a28ef4d24a85c2d55bdc8bfee7ed92
MD5 19f4a690f3ba31954830083c44e5ce35
BLAKE2b-256 c25aaf6834cd4d97c5b9527475577e359c1a99ff2f8a4f30890d16c7c579be04

See more details on using hashes here.

Provenance

The following attestation bundles were made for musher_sdk-0.3.3.tar.gz:

Publisher: release.yml on musher-dev/python-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 musher_sdk-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: musher_sdk-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 30.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for musher_sdk-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 28f11753b8717de2440387390ef81d0a4a4c14e7406d5fa928e4591b72e6be1a
MD5 2ac4a35a5849aeebe8d5cc28ef43c43a
BLAKE2b-256 0ff21daaaee2606d57b749967973dcd9314e6adbc1276df6c5ce64f378763a73

See more details on using hashes here.

Provenance

The following attestation bundles were made for musher_sdk-0.3.3-py3-none-any.whl:

Publisher: release.yml on musher-dev/python-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