Developer-facing instrumentation SDK for LLM applications
Project description
Mudipu Python SDK
Instrument, analyze, and optimize your AI agents
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
- Getting Started Guide - Installation and basic usage
- Health Metrics Deep Dive - Understanding context health
- API Reference - Complete API documentation
- Configuration Guide - Customize SDK behavior
- CLI Reference - Command-line tools
- Examples - Real-world use cases
๐ฏ 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:
- Local-first: All data stays on your machine
- Lightweight: Minimal performance overhead
- Framework-agnostic: Works with any LLM library
- 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
- Website: mudipu.dev
- Documentation: ./docs/
- PyPI: https://pypi.org/project/mudipu/
- GitHub: https://github.com/santnayak/mudipu-python
- Issues: https://github.com/santnayak/mudipu-python/issues
โญ Acknowledgments
Built with:
- sentence-transformers for semantic analysis
- Rich for beautiful CLI output
- Click for command-line interface
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mudipu-1.1.0.tar.gz.
File metadata
- Download URL: mudipu-1.1.0.tar.gz
- Upload date:
- Size: 55.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2f30745962ba401a6f7731b64ea4d2fd9cb2965094cd11e9919f5333029174d
|
|
| MD5 |
ade48a3302a57a69e88a53181cecc88d
|
|
| BLAKE2b-256 |
5a1c600904663f8ffb8c0a445e09489d30931cbec08ff9dd94fc6302dfdfdbc3
|
File details
Details for the file mudipu-1.1.0-py3-none-any.whl.
File metadata
- Download URL: mudipu-1.1.0-py3-none-any.whl
- Upload date:
- Size: 50.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be349fed678ea0ae0fbbd9d193a48e85a9f91edcb2b4ac9096b16552beb02481
|
|
| MD5 |
36b0e1c3694add878cefcb6a110edcdf
|
|
| BLAKE2b-256 |
0c1124c6d8e5b2f61cee273223ad3f4d62201217ee98a93d38685d145383f6d9
|