Skip to main content

Respan instrumentation plugin for Microsoft Agent Framework

Project description

respan-instrumentation-microsoft-agent-framework

Respan instrumentation plugin for Microsoft Agent Framework.

Microsoft Agent Framework emits native OpenTelemetry spans for agents, tools, chat completions, and workflows. This package registers a Respan span processor that normalizes those native spans into the canonical Respan/OpenTelemetry span contract before export.

Install

pip install respan-instrumentation-microsoft-agent-framework

Quickstart

import os

from agent_framework import Agent
from agent_framework.openai import OpenAIChatClient
from respan import Respan
from respan_instrumentation_microsoft_agent_framework import (
    MicrosoftAgentFrameworkInstrumentor,
)

respan_api_key = os.environ["RESPAN_API_KEY"]
respan_base_url = os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api")

respan = Respan(
    api_key=respan_api_key,
    base_url=respan_base_url,
    app_name="microsoft-agent-framework-example",
    instrumentations=[MicrosoftAgentFrameworkInstrumentor(capture_content=True)],
)

os.environ["OPENAI_API_KEY"] = respan_api_key
os.environ["OPENAI_BASE_URL"] = respan_base_url
os.environ["OPENAI_MODEL_ID"] = os.getenv("RESPAN_MODEL", "gpt-4.1-nano")

client = OpenAIChatClient()

agent = Agent(
    client=client,
    name="trace_assistant",
    instructions="Answer concisely.",
)

result = agent.run("Say hello from Microsoft Agent Framework.")
print(result)

respan.flush()
respan.shutdown()

Notes

  • Initialize Respan(...) before running agents or workflows so Agent Framework uses the active Respan OpenTelemetry provider.
  • capture_content=True asks Agent Framework to include sensitive prompt, completion, and tool payload data in its native spans. Set it to False if you only want metadata.
  • The processor emits canonical fields such as respan.entity.log_type, gen_ai.prompt.N.*, gen_ai.completion.N.*, llm.request.functions, and traceloop.entity.*. It strips Agent Framework raw message/tool payload fields and off-contract aliases before export.

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

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_microsoft_agent_framework-0.1.0.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_microsoft_agent_framework-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1f537d7454d06da4229e63ca4a1a5b597ab0fc385175fc0917fbae001af49e8e
MD5 7c78fd0454919b4113973d570f5aad90
BLAKE2b-256 6867e6089ee2b47504b4664622c44f270a53ae8270a97dad7021d17082fd4667

See more details on using hashes here.

File details

Details for the file respan_instrumentation_microsoft_agent_framework-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_microsoft_agent_framework-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3cfcc664efd9b9db2a55c3fe3e273cc8ec7d4522a6b9856cc1dac00cd4d070f0
MD5 a0f0829b37c88bf7c37d50b7cb3e425b
BLAKE2b-256 a9a88fc2fc70e8dd9cf2f6a3e3b67fd210e0cd8b71bedf3b7bdb6904d11ba389

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 Pingdom Monitoring Sentry Error logging StatusPage Status page