Skip to main content
╔══════════════════════════════════════════════════════════════════════════════╗
║                                                                              ║
║    ███╗   ███╗██╗   ██╗████████╗ █████╗  ██████╗ ███████╗███╗   ██╗████████╗ ║
║    ████╗ ████║██║   ██║╚══██╔══╝██╔══██╗██╔════╝ ██╔════╝████╗  ██║╚══██╔══╝ ║
║    ██╔████╔██║██║   ██║   ██║   ███████║██║  ███╗█████╗  ██╔██╗ ██║   ██║    ║
║    ██║╚██╔╝██║██║   ██║   ██║   ██╔══██║██║   ██║██╔══╝  ██║╚██╗██║   ██║    ║
║    ██║ ╚═╝ ██║╚██████╔╝   ██║   ██║  ██║╚██████╔╝███████╗██║ ╚████║   ██║    ║
║    ╚═╝     ╚═╝ ╚═════╝    ╚═╝   ╚═╝  ╚═╝ ╚═════╝ ╚══════╝╚═╝  ╚═══╝   ╚═╝    ║
║                                                                              ║
║              ██████╗ ██╗   ██╗████████╗██╗  ██╗ ██████╗ ███╗   ██╗           ║
║              ██╔══██╗╚██╗ ██╔╝╚══██╔══╝██║  ██║██╔═══██╗████╗  ██║           ║
║              ██████╔╝ ╚████╔╝    ██║   ███████║██║   ██║██╔██╗ ██║           ║
║              ██╔═══╝   ╚██╔╝     ██║   ██╔══██║██║   ██║██║╚██╗██║           ║
║              ██║        ██║      ██║   ██║  ██║╚██████╔╝██║ ╚████║           ║
║              ╚═╝        ╚═╝      ╚═╝   ╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═══╝           ║
║                                                                              ║
║                    Python SDK for AI-Native Development.                     ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝

PyPI Python 3.10+ httpx Pydantic v2 Apache 2.0

Type-safe. Async-first. Production-ready.
The official Python SDK for the MutagenT AI platform.


🎯 What is MutagenT Python SDK?

The MutagenT Python SDK is a developer-friendly, fully typed client for the MutagenT AI platform. Built for modern AI applications, it provides:

  • 🔒 Full Type Safety — Pydantic v2 models throughout; passes mypy --strict
  • ⚡ Sync + Async — Mutagent (sync) and AsyncMutagent (async) dual surface
  • 🐍 Python 3.10+ — CPython and PyPy compatible
  • 🔁 Built-in Retries — exponential back-off with jitter, configurable per-call or globally
  • 📡 Live Tracing — OTel-aligned observability via mutagent.tracing

Core Capabilities

Feature Description
Prompt Management Create, version, and iterate on prompts programmatically
Dataset Operations Import, export, and manage evaluation datasets
Evaluation Engine Run automated evaluations against your prompts
Auto-Optimization Let the MetaTuner improve your prompts based on metrics
Trace Collection Native OTel-aligned observability — no external collector needed

📦 Installation

pip install mutagent-sdk

The PyPI distribution is mutagent-sdk; the import path remains from mutagent import ....

from mutagent import Mutagent, AsyncMutagent

🚀 Quick Start

Sync client

from mutagent import Mutagent

client = Mutagent(api_key="YOUR_API_KEY")

prompts = client.prompt.list_prompts()
print(f"Found {len(prompts.data)} prompts")

Set MUTAGENT_API_KEY in your environment and omit the argument entirely:

export MUTAGENT_API_KEY="sk_live_xxxxxxxx"
from mutagent import Mutagent

client = Mutagent()  # reads MUTAGENT_API_KEY automatically

Async client

import asyncio
from mutagent import AsyncMutagent

async def main():
    async with AsyncMutagent(api_key="YOUR_API_KEY") as client:
        # Create a prompt
        prompt = await client.prompt.create_prompt(
            name="Support Template",
            content="You are a helpful agent. User query: {{query}}",
        )
        print(f"Created prompt: {prompt.id}")

        # List datasets for the prompt
        datasets = await client.prompt_datasets.list_datasets_for_prompt(id=prompt.id)
        print(f"Datasets: {len(datasets.data)}")

asyncio.run(main())

🔍 Tracing

The tracing module provides OTel-aligned span instrumentation with no external collector required.

Initialize

from mutagent.tracing import init_tracing, shutdown_tracing

init_tracing(api_key="YOUR_API_KEY")

# ... your application code ...

await shutdown_tracing()  # flushes remaining spans

Decorate functions

from mutagent.tracing import trace

@trace(kind="agent")
async def run_support_agent(query: str) -> str:
    # Function is automatically traced — input, output, and duration captured
    response = await call_llm(query)
    return response

🧪 Testing

The SDK ships a dev extras group with everything needed for testing:

pip install "mutagent[dev]"
# Includes: pytest, pytest-asyncio, pytest-httpx, ruff, mypy

Run the test suite:

pytest tests/

pytest-httpx is used to mock outgoing HTTP calls without spinning up a server. Tests live in tests/ at the package root.


🏗️ Generated by mutagent-xgen

This package is generated by mutagent-xgen — MutagenT's proprietary in-house SDK generator. The generator ensures the Python client stays in sync with the API specification.

To regenerate after API changes:

# Fetch latest spec from running server
bash scripts/dump-spec.sh

# Regenerate SDK
mutagent-xgen run

Note: README.md is intentionally hand-written and is not tracked in gen.lock. It will not be overwritten by regeneration.


📜 License

This SDK is released under the Apache License 2.0.

Copyright 2026 MutagenT. All rights reserved.


Built with care by the MutagenT Team • mutagent.io

Metadata

Release files for mutagent-sdk 0.2.0

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

Source distribution (sdist)

Source distribution for mutagent-sdk 0.2.0
File Size Uploaded Provenance
mutagent_sdk-0.2.0.tar.gz 116.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mutagent-sdk 0.2.0
File Interpreter ABI Platform
mutagent_sdk-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 213.6 kB

Release files / mutagent_sdk-0.2.0.tar.gz

Download URL mutagent_sdk-0.2.0.tar.gz
Size 116.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1b14698031b67d668e72c946e07912d49dcb89a6f8fd6c60b7b49065182d8b4c
BLAKE2b-256 checksum
How to use checksums
a67e4083ca894bd2263e98c753c7258af99cfe2041b25882f94b6332421d6055
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mutagent_sdk-0.2.0-py3-none-any.whl

Download URL mutagent_sdk-0.2.0-py3-none-any.whl
Size 97.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
232136ea275c5a38b6e65a4e9cf0c8885900031a9d2e68fcfeb1c0ca74e24230
BLAKE2b-256 checksum
How to use checksums
424cdbbad5c7654d3228551aa63486caebb552ae86009cb70fe46008a2b43b22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for mutagent-sdk 0.2.0

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.

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