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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

respan_instrumentation_autogen-0.1.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file respan_instrumentation_autogen-0.1.1.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_autogen-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2debcb66df8b279c37128d90a50a150878db5d29ef5f667561fe1f4ea3ac0b96
MD5 bfa9c8023124db020f1b141bfc86f450
BLAKE2b-256 7c54100e2ea0606c75fd396bebd6d5aa6e8c6be17debba44caad1781240eee61

See more details on using hashes here.

File details

Details for the file respan_instrumentation_autogen-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_autogen-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2de8772d66b3163ca2dcc8be07c63855a80e953e0da42de9e9c7c15d26980cf
MD5 808aa1c4ca2c7d579a0a707b90901c7e
BLAKE2b-256 033c8a01a26c4ce1661c514ed04519618c7cc9ccdc451db865455cb28485efed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page