ATI Integration for AutoGen
This package provides OpenTelemetry instrumentation for AutoGen agents using Iocane ATI.
It automatically captures:
- Agent replies: The conversation flow between agents.
- Tool usage: Execution of registered tools and their arguments.
Installation
pip install ati-integrations-autogen opentelemetry-sdk opentelemetry-exporter-otlp
Configuration
Set the standard OpenTelemetry environment variables to point to your Iocane collector:
export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.iocane.ai/v1/traces"
export OTEL_EXPORTER_OTLP_HEADERS="x-iocane-key=YOUR_KEY,x-ati-env=YOUR_ENV_ID"
export OTEL_SERVICE_NAME="my-autogen-agent"
Usage
Here is the robust pattern for instrumenting AutoGen scripts.
Important: Because AutoGen or other libraries might initialize OpenTelemetry internally (or if you are running in a notebook), it is best practice to attempt to set the provider, but always retrieve the active global provider to attach your exporters.
import os
import asyncio
from ati_autogen import AutoGenInstrumentor
from autogen_agentchat.agents import AssistantAgent, UserProxyAgent
# OpenTelemetry Imports
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.resources import Resource, SERVICE_NAME
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
async def main():
# 1. Configure OpenTelemetry (Robust Pattern)
resource = Resource.create(attributes={SERVICE_NAME: "my-autogen-service"})
try:
# Try to set the global provider
provider = TracerProvider(resource=resource)
trace.set_tracer_provider(provider)
except Exception:
# If it fails (e.g., already set), ignore and fetch the active one below
pass
# ALWAYS get the global provider to ensure we attach to the active pipeline
provider = trace.get_tracer_provider()
# 2. Configure Exporter (Iocane)
# Ensure usage of the correct endpoint from env or default
endpoint = os.environ.get("OTEL_EXPORTER_OTLP_ENDPOINT")
if endpoint and endpoint.endswith("/v1/traces"):
exporter = OTLPSpanExporter(endpoint=endpoint)
else:
exporter = OTLPSpanExporter()
if hasattr(provider, "add_span_processor"):
provider.add_span_processor(BatchSpanProcessor(exporter))
else:
print("WARNING: TracerProvider does not support add_span_processor.")
# 3. Instrument AutoGen
instrumentor = AutoGenInstrumentor()
instrumentor.instrument()
try:
# 4. Your AutoGen Code
assistant = AssistantAgent("assistant", system_message="You are helpful.")
user_proxy = UserProxyAgent("user_proxy", code_execution_config=False)
await user_proxy.initiate_chat(assistant, message="Hello!")
finally:
# 5. Flush traces
if hasattr(provider, "shutdown"):
provider.shutdown()
if __name__ == "__main__":
asyncio.run(main())
Environment Variables for Instrumentation
| Variable | Description | Default |
|---|---|---|
ATI_CAPTURE_PAYLOADS |
set to true to capture message content and tool arguments as span events |
false |
Metadata
Release files for ati-integrations-autogen 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ati_integrations_autogen-0.1.1.tar.gz | 6.8 kB | Without provenance | Details for ati_integrations_autogen-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ati_integrations_autogen-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for ati_integrations_autogen-0.1.1-py3-none-any.whl |
Total release size: 10.8 kB
Release files / ati_integrations_autogen-0.1.1.tar.gz
| Download URL | ati_integrations_autogen-0.1.1.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cceb048eef6261d2ad9239bc1985c48d202a0f825dabc2944b67f276dbee52a4
|
|
BLAKE2b-256 checksum How to use checksums |
ef39ce8886fffa3732b2acd934141370bea98593909572ac429d44e1e2920800
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Release files / ati_integrations_autogen-0.1.1-py3-none-any.whl
| Download URL | ati_integrations_autogen-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2351d46a826258ba06a132845b21c3796431b6abe9af224c46c578cdf340b361
|
|
BLAKE2b-256 checksum How to use checksums |
86fe889a6996a123346c055be23e84be809e262bd51945c4e58f11a666c912e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Security for ati-integrations-autogen 0.1.1
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.