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 Quickstart
Get up and running with the MutagenT Python SDK in minutes.
Prerequisites
Python 3.10+
pip install mutagent-sdk
A MutagenT API key — set as MUTAGENT_API_KEY in your environment
Create a Prompt
from mutagent import Mutagent
from mutagent.models import NameDescriptionVersion
client = Mutagent()
# Create a new prompt
prompt = client.prompt.create_prompt(NameDescriptionVersion(
name = "Support Assistant" ,
raw_prompt = "You are a helpful assistant for {company} . Answer questions about {topic} ." ,
input_schema = { "type" : "object" , "properties" : { "company" : { "type" : "string" }, "topic" : { "type" : "string" }}},
))
print ( f "Created: { prompt.id } " )
print ( f "Name: { prompt.name } " )
List Prompts
from mutagent import Mutagent
client = Mutagent()
result = client.prompt.list_prompts()
for p in result.get( "data" , []):
print ( f " { p[ 'id' ] } : { p[ 'name' ] } " )
Get a Specific Prompt
# id_ is a numeric prompt ID (integer)
prompt = client.prompt.get_prompt( id_ = 123 )
print (prompt[ "name" ], prompt.get( "raw_prompt" ) or prompt.get( "human_prompt" ))
Async Version
The same operations work with AsyncMutagent in async contexts:
import asyncio
from mutagent import AsyncMutagent
async def main ():
async with AsyncMutagent() as client:
# Create a prompt
from mutagent.models import NameDescriptionVersion
prompt = await client.prompt.create_prompt(NameDescriptionVersion(
name = "Support Assistant" ,
raw_prompt = "You are a helpful assistant for {company} ." ,
input_schema = { "type" : "object" , "properties" : { "company" : { "type" : "string" }}},
))
print ( f "Created: { prompt[ 'id' ] } " )
# List all prompts
result = await client.prompt.list_prompts()
print ( f "Total prompts: { len (result.get( 'data' , [])) } " )
asyncio.run(main())
Error Handling
All API errors raise MutagentError with the HTTP status code, response body, and headers:
from mutagent import Mutagent
from mutagent.errors import SDKError
client = Mutagent()
try :
prompt = client.prompt.get_prompt( id_ = 999999 ) # nonexistent ID
except SDKError as e:
print ( f "Status: { e.status_code } " )
print ( f "Body: { e.body } " )
Retries
The SDK automatically retries transient failures (429, 5xx) with exponential backoff (250ms → 500ms → 1s → 2s → 4s, 3 retries by default). The retry logic is built in and requires no configuration.
Configure the timeout at construction time:
client = Mutagent(
api_key = "mt_xxxxxxxxxxxx" ,
timeout = 30.0 , # seconds (default: 60)
)
Next Steps
Tracing Add observability to your Python LLM calls
Python Integrations Auto-trace frameworks: Anthropic, OpenAI, LangChain, LangGraph
TypeScript Quickstart TypeScript SDK for comparison
API Reference Full REST API documentation