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=Trueasks Agent Framework to include sensitive prompt, completion, and tool payload data in its native spans. Set it toFalseif 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, andtraceloop.entity.*. It strips Agent Framework raw message/tool payload fields and off-contract aliases before export. - Agent Framework request tools are bridged into its native telemetry only;
provider call arguments are not changed. Tool definitions appear on each
chat request, while
gen_ai.completion.0.tool_callscontains only calls from that response turn. - Agent, workflow, and task wrappers stay common-only. Model, provider, and token attributes belong to their descendant chat spans.
- Explicit provider HTTP failures such as 401/429/503 retain that status; unclassified application exceptions use status 500.
Metadata
Release files for respan-instrumentation-microsoft-agent-framework 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 | |
|---|---|---|---|
| respan_instrumentation_microsoft_agent_framework-0.1.1.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| respan_instrumentation_microsoft_agent_framework-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.5 kB
Release files / respan_instrumentation_microsoft_agent_framework-0.1.1.tar.gz
| Download URL | respan_instrumentation_microsoft_agent_framework-0.1.1.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95ba0d83ecd96aa8d5c8ec4bcf24028b688b97234ce20aa158c35247af7da006
|
|
BLAKE2b-256 checksum How to use checksums |
e3e360741bd4b48dde85f7a4f7d9643a55acef7a6e0df5add95ac163d74c6fa9
|
| 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_microsoft_agent_framework-0.1.1-py3-none-any.whl
| Download URL | respan_instrumentation_microsoft_agent_framework-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47c30c67767f5a624e7e47acf05885c3b2c58074313809e7d4e654239bb44618
|
|
BLAKE2b-256 checksum How to use checksums |
d74852c509f49206daf1d5ada34d13dd7e844db67f76db81a783b65e539f9fef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|