Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

genai-instana

The genai-instana package automatically instruments Python GenAI applications for Instana. It captures end-to-end traces for every LLM call — model identifiers, token usage, cost, latency and errors — without requiring instrumentation code.

Prefix your launch command and the wrapper instruments the LLM SDKs and frameworks your application already uses. It can set up telemetry for an application that has none, or attach alongside one that already uses Traceloop/OpenLLMetry or OpenTelemetry directly, leaving that application's own tracing, service identity and exporter intact.

Built and maintained by the Instana GenAI Observability team at IBM.

Early alpha, published for evaluation. Span names, attribute keys and metric names can change between releases. Pin an exact version if you build dashboards or alerts on them.

Installation

Install your application's own dependencies as usual, then add the wrapper to that same environment:

pip install genai-instana

The wrapper re-executes your command with the same interpreter, so it sees exactly the packages that environment has and never changes them.

Install it into the environment itself. Python does not activate a copy in a pip install --target directory or on PYTHONPATH, nor any copy when it runs with -S or -I. The wrapper checks for this before launching your command. If it cannot activate, it prints ACTIVATION FAILED with the likely cause and the fix, and your application runs without telemetry.

Quick start

Prefix your existing launch command. No code changes, no decorators, no Traceloop.init().

# Standalone script
genai-instana python my_script.py

# FastAPI service
genai-instana uvicorn app:app --port 8000

# Flask service — the wrapper detects Flask and serves the app
genai-instana python app.py

One HTTP request containing one model call arrives in Instana as:

POST /invoke                 SERVER  (HTTP entry)
└── openai.chat              CLIENT  (model call, named for the provider)

Configuration

Set the service name. Without this variable, every wrapped application on the host reports telemetry under the default service name auto_genai_service.

export OTEL_SERVICE_NAME=my-genai-service

Then point the wrapper at Instana. Choose one of the following options — the wrapper reads whichever set of variables is present.

Option A — Traceloop aliases

export TRACELOOP_BASE_URL=https://<otlp-host>:443
export TRACELOOP_HEADERS="x-instana-key=<agent-key>"

Option B — Standard OpenTelemetry variables

# Local Instana agent
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318

# Instana SaaS or agentless OTLP
export OTEL_EXPORTER_OTLP_ENDPOINT=https://<otlp-host>:443
export OTEL_EXPORTER_OTLP_HEADERS="x-instana-key=<agent-key>"

The wrapper exports over OTLP/HTTP: use port 4318 for a local agent and 443 for a SaaS endpoint. The x-instana-host header is set from the host name automatically; override it with OTEL_HOST_NAME. A local agent needs no agent key. A remote endpoint without one warns at startup, because the export would genuinely fail.

For each signal whose pipeline the wrapper sets up itself, it also sets OTEL_TRACES_EXPORTER or OTEL_METRICS_EXPORTER to none when that variable is unset. Frameworks that add exporters from the environment, such as FastAPI 0.142 and later, then leave that pipeline alone instead of exporting everything a second time. A value you set is kept, and a provider your application owns keeps its own configuration.

Coverage

Category Covered
LLM providers OpenAI and OpenAI-compatible gateways, LiteLLM, IBM watsonx, Groq, and OpenRouter
Frameworks LangChain, LangGraph, and CrewAI
Web servers FastAPI (uvicorn) and Flask

Known limitations

Streaming responses are not supported. Gunicorn, distributed tracing across services and coexistence with the Instana Python sensor are not yet validated. A few gaps remain when an application sets up its own instrumentation. Read the current list in the documentation before relying on this anywhere that matters.

Documentation

Auto-instrumentation CLI wrapper for GenAI — setup, supported technologies, what Instana receives, and known issues.

License

MIT — see the LICENSE file included with this package.

Copyright (c) 2026 IBM Corp. Copyright (c) 2026 Instana, Inc. https://www.instana.com/

Metadata

Release files for genai-instana 0.1.0a4

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

Source distribution (sdist)

Source distribution for genai-instana 0.1.0a4
File Size Uploaded
genai_instana-0.1.0a4.tar.gz 274.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for genai-instana 0.1.0a4
File Interpreter ABI Platform
genai_instana-0.1.0a4-py3-none-any.whl Python 3 none any Details

Total release size: 422.4 kB

Release files / genai_instana-0.1.0a4.tar.gz

Download URL genai_instana-0.1.0a4.tar.gz
Size 274.7 kB
Tags Source
SHA-256 checksum
How to use checksums
02b7ea5beb2ff25728e7c432b42824bb01f797a94ff17ee36091760520c644cc
BLAKE2b-256 checksum
How to use checksums
b5125511fecc122dfb3524fb85c2aa5ad485fd7facd785ad260d265aa8973339
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.14

Release files / genai_instana-0.1.0a4-py3-none-any.whl

Download URL genai_instana-0.1.0a4-py3-none-any.whl
Size 147.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45ba96554d7a8613ebc40046c2baad3a9d7ba3be439acfe2c789067c31c66a5e
BLAKE2b-256 checksum
How to use checksums
d1850bfd29ea99c743367cc8d5c37d06ee263dd60ecf2912ca5432a4002b9c66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.14
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