Skip to main content

pisama-auto

PyPI version Python versions License: MIT CI Downloads

Zero-code auto-instrumentation for LLM applications. Add Pisama failure detection with one line.

Requires Python 3.10 or newer. Python 3.10 through 3.13 are tested.

As of 0.3.0, pisama-auto is a compatibility shim over pisama.auto (part of the pisama package): the implementation lives there now, this distribution just forwards every import path to it, unchanged. See CHANGELOG.md for details. Nothing below changes for existing code.

Quick Start

pip install "pisama[auto]"

pisama[auto] is the recommended install because it keeps the CLI, local detectors, and auto-instrumentation on one compatible dependency path. pip install "pisama-auto[auto]" is equivalent and keeps the pisama_auto import name. Bare pip install pisama-auto still works for import pisama_auto and import pisama_auto.patches -- neither has ever needed OpenTelemetry or wrapt at import time -- but calling init(), or importing pisama_auto._tracer / pisama_auto.patches.anthropic_patch / .openai_patch directly, needs the auto extra installed one way or the other; before 0.3.0 that was guaranteed by this package's own dependencies instead -- see CHANGELOG.md for why.

import pisama.auto as pisama_auto
pisama_auto.init()  # traces locally; set PISAMA_API_KEY to export to Pisama

# All subsequent LLM calls are automatically traced
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
# This call is automatically traced and sent to Pisama if export is configured.

Supported Libraries

Library Status What's Traced
anthropic GA messages.create(), messages.stream()
openai GA chat.completions.create()

Package lifecycle

pisama-auto is a maintained implementation package. Its public API remains supported, but it is not a separate product entry point. New users should install pisama[auto]. Existing direct installations continue to work.

How It Works

  1. pisama_auto.init() sets up an OpenTelemetry tracer that exports to Pisama
  2. It then patches supported LLM libraries to emit spans with gen_ai.* semantic conventions
  3. Pisama's detection engine analyzes the exported traces for failure modes. This package ships traces; the detectors live in pisama-core and the Pisama platform
  4. Results appear in your Pisama dashboard

Configuration

pisama_auto.init(
    api_key="ps_...",                    # or set PISAMA_API_KEY env var
    endpoint="https://your-instance/api/v1/traces/ingest",  # or PISAMA_ENDPOINT env var
    service_name="my-agent",             # OTEL service name
    auto_patch=True,                     # auto-patch all detected libraries
)

With an API key and no explicit endpoint, spans go to the Pisama platform (api.pisama.ai). The exporter exchanges the API key for a short-lived token automatically. Without an API key, traces are generated locally but not exported. Set PISAMA_ENDPOINT to target a self-hosted instance or a custom OTLP collector instead.

Selective Patching

import pisama.auto as pisama_auto
pisama_auto.init(auto_patch=False)  # don't auto-patch

from pisama.auto.patches import patch
patch("anthropic")  # only patch anthropic

Metadata

Release files for pisama-auto 0.3.2

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

Source distribution (sdist)

Source distribution for pisama-auto 0.3.2
File Size Uploaded
pisama_auto-0.3.2.tar.gz 22.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pisama-auto 0.3.2
File Interpreter ABI Platform
pisama_auto-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 33.0 kB

Release files / pisama_auto-0.3.2.tar.gz

Download URL pisama_auto-0.3.2.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9765d22d4746044f35fab3159d42220c87da9505fbeeb3ec6fa4c69b8362bde3
BLAKE2b-256 checksum
How to use checksums
dc7ceb6c2955f19e7a4fd658aac563dc410dfbc01d259ca672f8e63546285f8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / pisama_auto-0.3.2-py3-none-any.whl

Download URL pisama_auto-0.3.2-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98fc5424a69cad24f53f17018f7c2b193e01cdebdbbf177e77f0d606aa99c6d4
BLAKE2b-256 checksum
How to use checksums
a28b4f2a20cbe3f4656039236b7c82d9007ce623479b3abee5ba59180a089dda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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