Skip to main content

Developer-facing instrumentation SDK for LLM applications

Project description

Mudipu Python SDK

Instrument, analyze, and optimize your AI agents

Python 3.11+ PyPI version License: MIT

Mudipu is a lightweight Python SDK for tracing, analyzing, and improving LLM-powered applications. Add instrumentation in minutes, detect inefficiencies, and measure context healthโ€”all without sending data to external services.

โœจ Key Features

  • ๐ŸŽฏ Zero-friction instrumentation - Add tracing with simple decorators
  • ๐Ÿ“Š Context health metrics - Detect loops, drift, redundancy, and saturation
  • ๐Ÿ’ฐ Cost tracking - Automatic token usage and cost estimation
  • ๐Ÿ” Rich analysis - CLI tools and programmatic APIs
  • ๐Ÿ”’ Privacy-first - Local-first architecture, no data leaves your machine
  • ๐Ÿ“ค Multiple export formats - JSON, HTML, and more

๐Ÿš€ Quick Start

Installation

# Basic installation
pip install mudipu

# With health metrics support
pip install mudipu[health]

# With all features
pip install mudipu[all]

30-Second Example

from mudipu import trace_session, trace_llm
from openai import OpenAI

client = OpenAI()

@trace_session(name="my-agent")
def run_agent(question: str):
    @trace_llm(model="gpt-4")
    def ask_llm(prompt):
        return client.chat.completions.create(
            model="gpt-4",
            messages=[{"role": "user", "content": prompt}]
        )
    
    response = ask_llm(question)
    return response.choices[0].message.content

# Run and automatically trace
result = run_agent("What is the capital of France?")

# Traces saved to .mudipu/traces/

Analyze with CLI

# View health metrics
mudipu health .mudipu/traces/session_xyz.json

# See statistics
mudipu stats .mudipu/traces/session_xyz.json

# Generate visualization
mudipu health .mudipu/traces/session_xyz.json --visualize

๐Ÿ“Š Context Health Metrics

Mudipu's unique health metrics help detect agent inefficiencies:

Metric What it detects Score Range
Relevance Off-topic context 0.0 - 1.0
Duplicate Ratio Repeated information 0.0 - 1.0
Tool Loops Repeated tool calls 0.0 - 1.0
Drift Goal misalignment 0.0 - 1.0
Novelty Progress tracking 0.0 - 1.0
Overall Health Combined score 0.0 - 1.0

Example output:

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Session Health: 0.687 ๐ŸŸก MODERATE                 โ”‚
โ”‚                                                   โ”‚
โ”‚ โ”œโ”€ Context Growth: +58.1 tokens/turn              โ”‚
โ”‚ โ”œโ”€ Drift Score: 0.024 โœ“                           |
โ”‚ โ”œโ”€ Loop Score: 0.333 โš ๏ธ                           โ”‚
โ”‚ โ”œโ”€ Progress: 0.333                                โ”‚
โ”‚ โ””โ”€ Effectiveness: 0.700                           โ”‚
โ”‚                                                   โ”‚
โ”‚ โš ๏ธ  Tool loops detected                           โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ‘‰ Learn more about health metrics

๐Ÿ“– Documentation

๐ŸŽฏ Use Cases

  • Debug agent loops - Detect when your agent gets stuck
  • Optimize context - Identify redundant information
  • Track costs - Monitor token usage and expenses
  • Improve quality - Measure goal alignment over time
  • Analyze traces - Understand agent behavior patterns

๐Ÿ› ๏ธ Architecture

Mudipu is designed to be:

  1. Local-first: All data stays on your machine
  2. Lightweight: Minimal performance overhead
  3. Framework-agnostic: Works with any LLM library
  4. Extensible: Add custom metrics and exporters
Your Agent Code
    โ†“
[Mudipu Decorators]
    โ†“
[Trace Capture]
    โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ†“             โ†“          โ†“
Local JSON   HTML    Analysis CLI

๐Ÿค Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

๐Ÿ“ License

MIT License - see LICENSE for details.

๐Ÿ”— Links

โญ Acknowledgments

Built with:


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mudipu-1.0.0.tar.gz (50.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mudipu-1.0.0-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

Details for the file mudipu-1.0.0.tar.gz.

File metadata

  • Download URL: mudipu-1.0.0.tar.gz
  • Upload date:
  • Size: 50.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for mudipu-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bf46de9db94c6cef36bb4d0c18d2f44a81c3baba0f900cad29ceaa57a368d7cc
MD5 c33e3567488638af2cffbfd7648a2f6b
BLAKE2b-256 1fd7eb9b344b307a43bee6117d216c5f3e7644912bb34d5996a8c7781eea2bd5

See more details on using hashes here.

File details

Details for the file mudipu-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mudipu-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 45.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for mudipu-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab7df380c112908c48effb65f1b08d2b00ccd5b63cff84a565e0b2e0ab227120
MD5 5f0519b6fddc47558553310a965c75b3
BLAKE2b-256 d0eb02ad0afd81267d7e3be75d12dcf5f5842d6cb91863b362f629c8d37552b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page