Skip to main content
Loss of provenance

A previous release had provenance metadata, but this release does not. View details.

Moduna Python SDK

PyPI version Python versions Package status License GitHub release Upload Python Package Downloads

Moduna is a small Python SDK that brands and simplifies Traceloop setup for AI agent frameworks. It gives applications a stable moduna import path, framework-aware instrumentation, and Moduna API-key resolution from configuration, exported environment variables, or .env.

Installation

Install the SDK with all supported framework integrations:

uv add moduna
pip install moduna

The framework extras are also available for teams that prefer explicit dependency declarations:

uv add "moduna[langchain]"
pip install "moduna[langchain]"

uv add "moduna[crewai]"
pip install "moduna[crewai]"

Quick Start

from moduna import Instruments, Moduna

moduna = Moduna()
moduna.init(
    {
        "app_name": "customer support",
        "framework": Instruments.LANGCHAIN,
        "api_key": "mod_...",
    }
)

Set a conversation ID using the Moduna-branded tracing namespace:

from moduna.sdk.tracing import set_conversation_id

set_conversation_id("customer-123")

Configuration

Moduna resolves the API key in this order:

  1. api_key passed to Moduna().init(...)
  2. exported MODUNA_API_KEY
  3. MODUNA_API_KEY=... in a local .env file

The production Moduna endpoint is used by default. For local development, create an ignored config.toml in the project root to switch to a local collector:

[sdk]
base_url = "http://localhost:4318"

You can also override the endpoint per application:

from moduna import Instruments, Moduna

Moduna().init(
    {
        "app_name": "support-agent",
        "framework": Instruments.LANGCHAIN,
        "base_url": "http://localhost:4318",
    }
)

Frameworks

LangChain

from langchain_core.prompts import ChatPromptTemplate
from moduna import Instruments, Moduna
from moduna.sdk.tracing import set_conversation_id

Moduna().init({"app_name": "langchain-app", "framework": Instruments.LANGCHAIN})
set_conversation_id("conversation-1")

prompt = ChatPromptTemplate.from_messages([("human", "{question}")])

CrewAI

from moduna import Instruments, Moduna
from moduna.sdk.tracing import set_conversation_id

Moduna().init({"app_name": "crewai-app", "framework": Instruments.CREWAI})
set_conversation_id("crew-run-1")

Moduna installs the Traceloop/OpenTelemetry CrewAI instrumentation. Install the CrewAI runtime separately in your application when you build CrewAI agents.

Development

Activate the local virtual environment before running checks:

source .venv/bin/activate
uv sync
uv run ruff format .
uv run ruff check .
uv run pytest
uv build

Use uv run ruff format --check . in CI when you want formatting verification without rewriting files.

Publishing

GitHub Actions validates pull requests and every push to main. A successful main build publishes only when the version in pyproject.toml does not already exist on PyPI.

Configure the PyPI token once:

  1. Open the GitHub repository.
  2. Go to Settings → Secrets and variables → Actions.
  3. Add a repository secret named PYPI_TOKEN.
  4. Paste the PyPI token value from your local .env.

Never commit .env or the token.

Prepare a release with uv:

source .venv/bin/activate
uv version --bump patch
git add pyproject.toml uv.lock
git commit -m "Release Moduna $(uv version --short)"
git push origin main

Changes that do not bump the version still run the full CI pipeline and skip the PyPI upload successfully.

Metadata

Release files for moduna 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Loss of provenance

These files do not have provenance metadata, despite files in a prior release including this data.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for moduna 0.1.9
File Size Uploaded Provenance Actions
moduna-0.1.9.tar.gz 90.9 kB Without provenance Details for moduna-0.1.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for moduna 0.1.9
File Interpreter ABI Platform Actions
moduna-0.1.9-py3-none-any.whl Python 3 none any Details for moduna-0.1.9-py3-none-any.whl

Total release size: 110.1 kB

Release files / moduna-0.1.9.tar.gz

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL moduna-0.1.9.tar.gz
Size 90.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d0bf826d2181362f965f00d0e9b14090ea2d70cedae99781678ccae96bebf41a
BLAKE2b-256 checksum
How to use checksums
f415df4b7ea26677ee042173f897c95c396d91758fd5565bd8ba6971843b18b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / moduna-0.1.9-py3-none-any.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL moduna-0.1.9-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
075d0233ea9758b06742349797db0ac98a19f4b31985a69d9104f5fe86ca7466
BLAKE2b-256 checksum
How to use checksums
0255eb6593ac7ba2ccb90006851994ec0265e8c50a093bfe4c4612abe1f9ea15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for moduna 0.1.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Loss of provenance

A previous release of these files had provenance metadata, but this release does not.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Release comparison

  • Removed 0.1.6 2 files With provenance
  • Added 0.1.9 2 files Without provenance

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page