Prerequisites
- .NET 10 SDK
- An Arize AX account (sign up)
- An
OPENAI_API_KEYfrom the OpenAI Platform
Launch Arize AX
- Sign in to your Arize AX account.
- From Space Settings, copy your Space ID and API Key. You will set them as
ARIZE_SPACE_IDandARIZE_API_KEYbelow.
Install
Create a console project and add the Microsoft Agent Framework OpenAI connector and the OpenTelemetry Protocol exporter:Configure credentials
Setup tracing
The example configures an OTLP gRPC exporter for Arize AX, adds the project name as a resource attribute, and instruments one agent with aGetWeather function tool. GPT-6.1 Sol requires the Responses API for tool calling, so the agent uses GetResponsesClient() (OpenAI model documentation).
EnableSensitiveData = true records prompts, responses, tool arguments, and tool results. Use it only when that data is appropriate for your Arize AX project and its retention policy. Set it to false to omit message content.UseOpenTelemetry and exports those spans directly to Arize AX.
Add a tool
CreateWeatherTools.cs for the function tool used by the agent:
Run Microsoft Agent Framework
Add the agent invocation to the end ofProgram.cs:
MicrosoftAgentFramework directory:
Expected output
Verify in Arize AX
- Open your Arize AX space and select project
microsoft-agent-framework-csharp-example. - You should see a trace with an
invoke_agentroot span, chat spans for the model calls, and anexecute_toolspan forGetWeather. The model spans include provider, model, token usage, and message attributes. - If no traces appear, see Troubleshooting.
- Arize skill (agent)
- AX CLI
- SDK
Install the Arize Skills plugin and let your coding agent check for you:Then prompt your agent:
Use the arize-trace skill to export and analyze recent traces from my project. Confirm spans are arriving, and summarize any errors or latency issues.
Troubleshooting
- No traces in Arize AX. Confirm
ARIZE_SPACE_IDandARIZE_API_KEYare set in the same shell that runsdotnet run, and confirm the exporter endpoint and headers match the example. - No agent spans. The source name passed to
UseOpenTelemetrymust match the source registered with.AddSource(sourceName). - Wrong project. Confirm the
openinference.project.nameresource attribute is set to the value ofARIZE_PROJECT_NAME. - Prompts or tool content are missing. Set
EnableSensitiveData = truefor the agent’s OpenTelemetry configuration. This also records those values in traces, so enable it only when appropriate. 401from OpenAI. VerifyOPENAI_API_KEYis valid and can accessgpt-6.1-sol. Replace the model with one available to your account if needed.- Package restore or build fails. Confirm the .NET 10 SDK is installed and that the package versions in the project file match the versions shown above.