Skip to main content

ASI Telemetry SDK

The official lightweight observability, runtime metrics, and distributed tracing SDK for AI agents, LLMs (Google Gemini, OpenAI, ASI-1, DeepSeek), and tool execution pipelines.

Installation

pip install asi-telemetry

Zero external dependencies required (built using standard Python libraries).

Architecture & Features

  • Agent & Tool Performance Tracking (MetricsTracker):

    • Measures execution latency, request counts, and success/error status.
    • Asynchronously dispatches metrics to the ASI Telemetry backend and ClickHouse.
    • Zero performance overhead; non-blocking background workers.
    • Clean real-time terminal telemetry reporting.
  • Distributed LLM Tracing (@traceable):

    • Trace multi-hop agent swarms and workflow chains with distributed context propagation (trace_id, span_id, parent_id).
    • Supports both synchronous and asynchronous coroutine functions.
    • Native auto-instrumentation for Google Gemini (instrument_gemini) and OpenAI/ASI (instrument_openai / instrument_client).
    • Real-time token usage calculation and cost estimation per model.

Quick Start

1. Monitoring Agent Tools & Functions

from asi_telemetry import MetricsTracker

tracker = MetricsTracker(agent_name="assistant")

@tracker.track(tool_name="weather_tool")
async def get_weather(city: str):
    return f"Weather in {city}: 72°F Sunny"

(Note: AgentMonitor is retained as a backward-compatible alias for MetricsTracker)

2. Tracing LLMs and Multi-Agent Workflows

from asi_telemetry import traceable, instrument_gemini
from google import genai

client = genai.Client(api_key="YOUR_API_KEY")
instrument_gemini(client)

@traceable(name="generate_summary", run_type="llm")
def summarize(text: str):
    response = client.models.generate_content(
        model="gemini-2.5-flash",
        contents=f"Summarize this: {text}"
    )
    return response.text

3. Distributed Context Propagation Across Swarms

from asi_telemetry import traceable, create_trace_context

@traceable(name="orchestrator", run_type="chain")
async def orchestrate():
    # Generate trace context to pass across network boundaries
    context = create_trace_context()
    # Pass context={"trace_id": ..., "parent_id": ...} to sub-agents

4. Direct Cost Estimation

from asi_telemetry import calculate_cost

# Approximate cost in USD for a model call
cost = calculate_cost(model="gemini-3.8-flash", input_tokens=1200, output_tokens=350)
print(f"Cost: ${cost}")

Metadata

Release files for asi-telemetry 0.2.0

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

Source distribution (sdist)

Source distribution for asi-telemetry 0.2.0
File Size Uploaded Provenance Actions
asi_telemetry-0.2.0.tar.gz 10.7 kB Without provenance Details for asi_telemetry-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for asi-telemetry 0.2.0
File Interpreter ABI Platform Actions
asi_telemetry-0.2.0-py3-none-any.whl Python 3 none any Details for asi_telemetry-0.2.0-py3-none-any.whl

Total release size: 22.0 kB

Release files / asi_telemetry-0.2.0.tar.gz

Download URL asi_telemetry-0.2.0.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
758e8c02fbd42751ddba9aae335665e08f573068f4d4fd61b1a247cf14847a04
BLAKE2b-256 checksum
How to use checksums
ea4c1be855e9c6dbf05881e5e349e2aa457ed388dc1266d8f83d400db276d91c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / asi_telemetry-0.2.0-py3-none-any.whl

Download URL asi_telemetry-0.2.0-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bfd967419fe434ce9958687a4f028943b526de5ebcc5b43b833962cb9767b402
BLAKE2b-256 checksum
How to use checksums
ec6db5f22269ee37d1d876efb7346ded6ea39b5fa01dbfcc3b1afb93e59fb304
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for asi-telemetry 0.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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