Skip to main content

respan-instrumentation-autogen

Respan instrumentation plugin for AutoGen AgentChat. Wraps OpenInference's AutoGen AgentChat instrumentor and translates spans into the Respan tracing shape automatically.

Configuration

1. Install

pip install respan-ai respan-instrumentation-autogen

2. Set Environment Variables

Variable Required Description
RESPAN_API_KEY Yes Your Respan API key. Authenticates gateway requests and trace export.
RESPAN_BASE_URL No Defaults to https://api.respan.ai/api.
RESPAN_MODEL No Defaults to gpt-4o-mini.

Quickstart

import asyncio
import os

from dotenv import load_dotenv

load_dotenv()

from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from respan import Respan
from respan_instrumentation_autogen import AutoGenInstrumentor

respan_api_key = os.environ["RESPAN_API_KEY"]
respan_base_url = os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api")
respan_model = os.getenv("RESPAN_MODEL", "gpt-4o-mini")

respan = Respan(
    api_key=respan_api_key,
    base_url=respan_base_url,
    instrumentations=[AutoGenInstrumentor()],
)

model_client = OpenAIChatCompletionClient(
    model=respan_model,
    api_key=respan_api_key,
    base_url=respan_base_url,
)


async def main() -> None:
    agent = AssistantAgent(
        name="assistant",
        model_client=model_client,
        system_message="You are a helpful assistant.",
    )
    result = await agent.run(task="Write one sentence about recursive functions.")
    print(result.messages[-1].content)
    await model_client.close()
    respan.flush()


asyncio.run(main())

Further Reading

See the Respan example projects for runnable scripts.

Metadata

Release files for respan-instrumentation-autogen 0.1.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 respan-instrumentation-autogen 0.1.2
File Size Uploaded
respan_instrumentation_autogen-0.1.2.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for respan-instrumentation-autogen 0.1.2
File Interpreter ABI Platform
respan_instrumentation_autogen-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.8 kB

Release files / respan_instrumentation_autogen-0.1.2.tar.gz

Download URL respan_instrumentation_autogen-0.1.2.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
de289894ca26a2236efe758859da38bed21d38957c9258b23592d4f6ca45da83
BLAKE2b-256 checksum
How to use checksums
8e44c8204c1f83d264737a22fb08c0b9709065bc990f50a823e5f4895e0c6d69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / respan_instrumentation_autogen-0.1.2-py3-none-any.whl

Download URL respan_instrumentation_autogen-0.1.2-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
855cf24d4b1f654f4ddfc027e5207394c02c59a5c3c79336ac7b5b5425f0266a
BLAKE2b-256 checksum
How to use checksums
cbde623c004bd39925fb22ab0c75d49a5fa1caf14cd3f709cefc7a2585b04391
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

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