Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mutagent.io/llms.txt

Use this file to discover all available pages before exploring further.

Python SDK Installation

The MutagenT Python SDK (mutagent-sdk) is the official Python client for the MutagenT platform. It provides a type-safe, async-first interface for managing prompts, datasets, evaluations, traces, and more.

Requirements

RequirementVersion
Python3.10+
Package managerpip (standard)

Install

pip install mutagent-sdk
The PyPI distribution is mutagent-sdk. The import path is from mutagent import ....
The package name on PyPI is mutagent-sdk but the Python import root is mutagent (no dash). This is standard Python SDK convention.

API Key

All API calls require a MutagenT API key. Get one at app.mutagent.io or via the CLI:
mutagent auth login
Set it as an environment variable:
export MUTAGENT_API_KEY="mt_xxxxxxxxxxxx"

Verify Installation

from mutagent import Mutagent

# Requires MUTAGENT_API_KEY and MUTAGENT_SERVER_URL env vars to be set
# For production: MUTAGENT_SERVER_URL=https://api.mutagent.io
client = Mutagent()
prompts = client.prompt.list_prompts()
print(f"Connected. Found {len(prompts.data)} prompts.")

Sync and Async Clients

The SDK ships two client classes:
ClassUsage
MutagentSynchronous — works everywhere, no event loop required
AsyncMutagentAsynchronous — use with async/await and asyncio

Sync client

from mutagent import Mutagent

# Pass server_url explicitly for production (default is http://localhost:3003)
client = Mutagent(api_key="mt_xxxxxxxxxxxx", server_url="https://api.mutagent.io")

# Or use the env vars (recommended):
# export MUTAGENT_API_KEY=mt_xxxxxxxxxxxx
# export MUTAGENT_SERVER_URL=https://api.mutagent.io
client = Mutagent()

Async client

import asyncio
from mutagent import AsyncMutagent

async def main():
    async with AsyncMutagent() as client:
        prompts = await client.prompt.list_prompts()
        print(f"Found {len(prompts.data)} prompts")

asyncio.run(main())

Environment Variables

VariableDescriptionDefault
MUTAGENT_API_KEYYour MutagenT API keyRequired
MUTAGENT_SERVER_URLCustom API endpoint for the Python clienthttp://localhost:3003
The Python SDK client defaults to http://localhost:3003 for the API endpoint. For production, set MUTAGENT_SERVER_URL=https://api.mutagent.io or pass server_url="https://api.mutagent.io" to the constructor. Note: the tracing module (init_tracing) uses a separate endpoint kwarg that defaults to https://api.mutagent.io.

Next Steps

Quickstart

Create your first prompt in Python

Tracing

Add observability to your Python LLM calls

Python Integrations

Auto-trace OpenAI, Anthropic, LangChain, and LangGraph

API Reference

Full REST API documentation