mantisdk
OpenTelemetry-based distributed tracing for AI agents.
Built by Metis (opens in a new tab), mantisdk provides a simple, zero-config way to add observability to your AI applications. Trace LLM calls, tool executions, and agent workflows with automatic instrumentation for popular frameworks.
Native Insight Integration — Traces export directly to Insight (opens in a new tab), our AI observability and evaluation platform, for visualization, debugging, and analysis.
Why mantisdk?
- Zero-Config Setup — Auto-detect credentials from environment variables
- Native Insight Export — Built-in integration with Metis Insight platform
- Auto-Instrumentation — Support for DSPy, Anthropic, Google ADK, LangChain, and more
- Flexible APIs — Decorators (
@trace) and context managers (span(),tool()) - Full Async Support — Native async/await with
atraceandaspan - Rich Metadata — Capture inputs, outputs, user IDs, sessions, and custom attributes
Quick Example
import mantisdk.tracing as tracing
# Initialize - auto-detects Insight credentials from environment
tracing.init()
# Use as a decorator - auto-captures input/output
@tracing.trace
def process_query(query: str) -> dict:
result = my_llm_call(query)
return {"response": result}
# Use as a context manager - explicit control
with tracing.trace("workflow", input=user_query) as span:
result = process_query(user_query)
span.set_attribute(tracing.semconv.USER_ID, "user-123")
# Ensure spans are exported to Insight
tracing.shutdown()Supported Frameworks
mantisdk provides auto-instrumentation via OpenInference (opens in a new tab) for all major AI/LLM frameworks:
| Framework | Auto-Instrumentation | Status |
|---|---|---|
| OpenAI | ✅ Yes | Supported |
| Anthropic | ✅ Yes | Guide |
| Claude Code SDK | ✅ Yes | Guide |
| DSPy | ✅ Yes | Guide |
| Google ADK | ✅ Yes | Guide |
| LangChain | ✅ Yes | Supported |
| LlamaIndex | ✅ Yes | Supported |
| LiteLLM | ✅ Yes | Supported |
| Groq | ✅ Yes | Supported |
| Mistral | ✅ Yes | Supported |
| Instructor | ✅ Yes | Supported |
Get Started
Connect to Insight
Set these environment variables to export traces to Insight:
export INSIGHT_HOST="https://insight.withmetis.ai"
export INSIGHT_PUBLIC_KEY="pk-lf-..."
export INSIGHT_SECRET_KEY="sk-lf-..."Then view your traces, analyze LLM performance, and debug agent behavior in the Insight dashboard (opens in a new tab).
Links
- PyPI Package (opens in a new tab) — Install via pip
- Insight Platform (opens in a new tab) — AI observability dashboard
- Metis (opens in a new tab) — Company website
Agent Downloads
/mantis-docs-mdx.zip— original public MDX files with directory structure preserved/llms.txt— compact agent-readable documentation index/llms-full.txt— complete public docs corpus in one text file