Prerequisites
- .NET 10 SDK
- An
OPENAI_API_KEYfrom the OpenAI Platform
Launch Phoenix
- Local
- Container
- Self-Host
pip install arize-phoenix && phoenix serve does the same thing. See Terminal setup for customization.Install
Create a console project and add the Microsoft Agent Framework OpenAI connector and the OpenTelemetry Protocol exporter:Setup
Set the Phoenix endpoint, the project name, and your OpenAI key:Program.cs with the code below. It configures an OTLP HTTP exporter that sends spans to <PHOENIX_COLLECTOR_ENDPOINT>/v1/traces, sets the Phoenix project with the openinference.project.name resource attribute, and builds one agent with a GetWeather function tool. GPT-6.1 Sol requires the Responses API for tool calling, so the agent uses GetResponsesClient().
Program.cs
UseOpenTelemetry instruments the agent and emits spans for the agent invocation, each chat call, and each function execution. The tracer provider listens to the same source name passed to UseOpenTelemetry and exports those spans to Phoenix.
Add a tool
CreateWeatherTools.cs for the function tool the agent calls:
WeatherTools.cs
Run Microsoft Agent Framework
Run the project from theMicrosoftAgentFramework directory:
Observe
Open Phoenix and select themicrosoft-agent-framework-csharp project. Each agent.RunAsync() call appears as one trace:
Troubleshooting
- No traces in Phoenix. Confirm
PHOENIX_COLLECTOR_ENDPOINTpoints at your Phoenix instance and is set in the same shell that runsdotnet run. The exporter appends/v1/tracesto it. If authentication is enabled, setPHOENIX_API_KEY. - No agent spans. The source name passed to
UseOpenTelemetrymust match the source registered with.AddSource(sourceName). - Spans land in the
defaultproject. Confirm theopeninference.project.nameresource attribute is set. - Prompts or tool content are missing. Set
EnableSensitiveData = truein the agent’s OpenTelemetry configuration. 401from OpenAI. VerifyOPENAI_API_KEYis valid and can accessgpt-6.1-sol. Replace the model with one available to your account if needed.

