Skip to main content

KrakenOps SDK — agent-agnostic OpenTelemetry decorators. Distributed as `krakenops` on PyPI; imported as `tentacle` in Python (Pillow-style; see ADR 0004).

Project description

tentacle

Agent-agnostic OpenTelemetry decorators for KrakenOps.

Heads-up: the PyPI distribution name is krakenops, but the Python module is tentacle (Pillow-style — see ADR 0004 for why). Install with pip install krakenops, import with import tentacle. The unrelated tentacle package on PyPI is not us.

import tentacle

tentacle.init(endpoint="http://localhost:8787/v1/traces")

@tentacle.track_agent
def my_agent(topic: str) -> str:
    return summarize(gather(topic))

@tentacle.tool
def gather(topic: str) -> list[str]: ...

@tentacle.require_human
def summarize(notes: list[str]) -> str:
    if ambiguous(notes):
        raise tentacle.NeedsHumanReview("pick a source", payload={"options": [...]})
    ...

Status

v0.0.1 — first public release. Real OTLP/HTTP export, sync and async decorators, NeedsHumanReview signal, optional OpenAI/Anthropic auto-instrumentation. Wire format described in ADR 0001; APIs and on-the-wire shapes may still shift before 1.0.0.

Install

pip install krakenops                  # core only — no auto-instrumentation
pip install 'krakenops[openai]'        # + OpenAI v2 auto-instrumentation
pip install 'krakenops[anthropic]'     # + Anthropic auto-instrumentation
pip install 'krakenops[all]'           # everything

Then import tentacle (not import krakenops).

Usage

tentacle.init() is idempotent — call it once at the entry point of your script. If you forget, decorators still work; spans just go to OTel's default no-op tracer.

Function Purpose
tentacle.init(endpoint=..., service_name=..., enable_openai=True, ...) Configure the OTLP/HTTP exporter. Reads TENTACLE_ENDPOINT from env if endpoint is omitted.
@tentacle.track_agent Mark an agent entry point. Span carries tentacle.kind = "agent".
@tentacle.tool Mark a tool call. Span carries tentacle.kind = "tool".
@tentacle.require_human Mark a function that may pause for human input. Span carries tentacle.kind = "human_review".
tentacle.NeedsHumanReview(prompt, payload=None) Raise inside any decorated function to pause; backend flips the GH ticket to "Needs Human Review".

Sync and async are both supported — the decorators detect coroutine functions automatically.

What's captured

By default, only span shape and structure. No function arguments, no return values, no environment variables. Token usage and model names are captured automatically from openai/anthropic SDK calls when the corresponding extra is installed. Cost is computed in the backend (not the SDK) so pricing changes don't require a release. See ADR 0001.

Develop

uv sync
uv run pytest
uv run ruff check .

Tests use opentelemetry.sdk.trace.export.InMemorySpanExporter — no network I/O.

Releasing

See ../../docs/RELEASING.md. Pushing a krakenops-v* tag triggers .github/workflows/release-krakenops.yml which builds the wheel + sdist and publishes via OIDC trusted publishing — no API tokens stored. TestPyPI on every tag, real PyPI on stable tags.

Design

See ../../CLAUDE.md §2.2 (overview) and §5.1 (data flow), ADR 0001 (span schema), and ADR 0004 (why the dist name and module name differ).

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

krakenops-0.0.1.tar.gz (40.3 kB view details)

Uploaded Source

Built Distribution

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

krakenops-0.0.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file krakenops-0.0.1.tar.gz.

File metadata

  • Download URL: krakenops-0.0.1.tar.gz
  • Upload date:
  • Size: 40.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for krakenops-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ac6eace530bf47f4ab77f629aa15b55d34b628a89c14a4cd360159f81efaa71d
MD5 257f52e938280f455212c67ca450258f
BLAKE2b-256 b112818e579ea85348ba06fcc3839e66709db6f65382006e0658d83a993510d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for krakenops-0.0.1.tar.gz:

Publisher: release-krakenops.yml on EikeKohl/KrakenOps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file krakenops-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: krakenops-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for krakenops-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ca70111f1254e9cfd0c546d618ee3eb5272debd2e86cb3c68e752248bf8bda71
MD5 65ce4513b6c2219c1372d17a408c0720
BLAKE2b-256 1b564f0ca5284d21416fb6da5a4560a8b491d48ce719bd98cf24095ce261f377

See more details on using hashes here.

Provenance

The following attestation bundles were made for krakenops-0.0.1-py3-none-any.whl:

Publisher: release-krakenops.yml on EikeKohl/KrakenOps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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