Introduction

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 atrace and aspan
  • 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:

FrameworkAuto-InstrumentationStatus
OpenAI✅ YesSupported
Anthropic✅ YesGuide
Claude Code SDK✅ YesGuide
DSPy✅ YesGuide
Google ADK✅ YesGuide
LangChain✅ YesSupported
LlamaIndex✅ YesSupported
LiteLLM✅ YesSupported
Groq✅ YesSupported
Mistral✅ YesSupported
Instructor✅ YesSupported

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

Agent Downloads