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 Integrations
MutagenT provides first-class Python support for tracing AI applications. The Python ecosystem consists of a core tracing SDK and framework-specific adapters that automatically instrument your LLM calls.Architecture
Requirements
- Python >= 3.10
- A MutagenT API key (get one here)
Package Status
| Package | Version | Status | Description |
|---|---|---|---|
mutagent-sdk | 0.1.1 | Available on PyPI | Full Python SDK — prompts, datasets, evaluations, tracing |
mutagent-anthropic | 0.1.0 | Coming soon | Automatic tracing for the Anthropic Python SDK |
mutagent-openai | 0.1.0 | Coming soon | Automatic tracing for the OpenAI Python SDK |
mutagent-langchain | 0.1.0 | Coming soon | Callback handler for LangChain |
mutagent-langgraph | 0.1.0 | Coming soon | Callback handler for LangGraph workflows |
Quick Setup
Install a framework adapter
Environment Variables
| Variable | Description | Default |
|---|---|---|
MUTAGENT_API_KEY | Your MutagenT API key | Required |
MUTAGENT_SERVER_URL | MutagenT API client endpoint (Python SDK client only) | http://localhost:3003 |
The
init_tracing function uses its own endpoint kwarg (defaulting to https://api.mutagent.io) and does not read MUTAGENT_SERVER_URL. Set endpoint explicitly when calling init_tracing for production.Configuration Options
Theinit_tracing function accepts the following parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | Required | MutagenT API key |
endpoint | str | https://api.mutagent.io | API endpoint URL |
environment | str | None | None | Environment name (e.g., production, staging) |
batch_size | int | 10 | Number of spans to buffer before flushing |
batch_interval_ms | int | 5000 | Flush interval in milliseconds |
debug | bool | False | Enable debug logging |
Core SDK: Manual Spans
Themutagent.tracing module also exposes a low-level API for creating custom spans when you need fine-grained control:
Available Span Kinds
| Kind | Value | Use Case |
|---|---|---|
LLM_CHAT | llm.chat | Chat completions |
LLM_COMPLETION | llm.completion | Text completions |
LLM_EMBEDDING | llm.embedding | Embedding generation |
CHAIN | chain | Sequential pipelines |
AGENT | agent | Agent execution |
GRAPH | graph | Graph workflows |
NODE | node | Graph nodes |
EDGE | edge | Graph edges |
WORKFLOW | workflow | Multi-step workflows |
MIDDLEWARE | middleware | Middleware layers |
TOOL | tool | Tool invocations |
RETRIEVAL | retrieval | RAG retrieval |
RERANK | rerank | Reranking operations |
GUARDRAIL | guardrail | Safety checks |
CUSTOM | custom | Custom operations |
Shutdown
Always callshutdown_tracing() before your application exits to flush remaining spans:
The SDK registers an
atexit handler that flushes remaining spans automatically. Calling shutdown_tracing() explicitly is recommended for long-running applications or serverless functions.Framework Guides
Anthropic
wrap_anthropic(client) — zero-change tracing for ClaudeOpenAI
MutagentOpenAI — drop-in OpenAI client replacementLangChain
Callback handler for LangChain chains and agents
LangGraph
Callback handler for LangGraph workflows
TypeScript Equivalents
If you are using TypeScript/Node.js, see the TypeScript integration guides for the equivalent packages:| Python Package | TypeScript Equivalent |
|---|---|
mutagent-sdk (tracing) | @mutagent/sdk |
mutagent-openai | @mutagent/openai |
mutagent-langchain | @mutagent/langchain |
mutagent-langgraph | @mutagent/langgraph |