Skip to main content

swarmd-sdk

Python client for the Swarmd Agent Registry API, with OAuth2 client-credentials authentication, thread-safe token caching and automatic retries built in.

pip install swarmd-sdk

Requires Python 3.9+.

Quick start

from uuid import UUID
from swarmd_sdk import SwarmDClient

with SwarmDClient(
    agent_id="your-agent-id",
    client_secret="your-client-secret",
) as client:
    for agent in client.get_agent_subscriptions(UUID("123e4567-e89b-12d3-a456-426614174000")):
        print(f"{agent.name}: {agent.agent_card_url}")

SwarmDClient.from_env() builds the same client from the environment instead:

SWARMD_AGENT_ID=your-agent-id
SWARMD_CLIENT_SECRET=your-client-secret

# Needed only to receive lifecycle callbacks on /admin/webhook
# (subscription / agent / tenant state changes). Issued alongside the
# client secret at registration. Without it your agent still works, but
# won't refresh itself on platform events.
SWARMD_WEBHOOK_SECRET=your-webhook-secret

# Optional
# SWARMD_BASE_URL=https://api.swarmd.ai
# SWARMD_TOKEN_URL=https://auth.swarmd.ai/realms/swarmd/protocol/openid-connect/token
# SWARMD_TIMEOUT=30
# SWARMD_MAX_RETRIES=3

What's in the box

SwarmDClient, SwarmDConfig registry client and its configuration
SwarmDRuntime, create_admin_app agent runtime and its admin/webhook app
AgentDirectory discovery over the agents you are subscribed to
McpClient and friends MCP servers vended through the platform
OAuth2TokenManager token acquisition and refresh, used by the client
CorrelationIdMiddleware, correlation_id_var request correlation across agents
verify_webhook signature verification for lifecycle callbacks

Errors are typed: AuthenticationError, TokenRefreshError and APIError (which carries status_code and response_body), all deriving from SwarmDSDKError.

The package ships type information (py.typed), so it type-checks under mypy and pyright without stubs.

Framework integrations

Documentation and support

Full documentation is at docs.swarmd.ai. For help, email support@swarmd.ai.

MIT licensed.

Download files

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

Source Distribution

swarmd_sdk-0.3.3.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

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

swarmd_sdk-0.3.3-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: swarmd_sdk-0.3.3.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for swarmd_sdk-0.3.3.tar.gz
Algorithm Hash digest
SHA256 d4cc86b3d513ccf908f1977583be746643c91c49ecee7dccd3ea21aeae4ab410
MD5 d2b9758d7681ba7accd2758caa62bdfb
BLAKE2b-256 8e20a5dfbc5a246757ef61f1bac13a565adc4b3fa6880422298b71d23adbdfc7

See more details on using hashes here.

File details

Details for the file swarmd_sdk-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: swarmd_sdk-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for swarmd_sdk-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6f8071ad76b8f0714ba3f1f7c65062741fdeb74d48d5d8bf13b57843a78b68bf
MD5 2db82f9a9bd03d72f4818df06d13553b
BLAKE2b-256 2332a584ccd8a27f1d13762e3bd44d3ec0cfc3e9c1f969a7e9aaf57e84973688

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.3 This release

2 files

0.3.2

2 files

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