Skip to content

Commit b5ceed3

Browse files
committed
mention ai agents in agents getting started section
1 parent c999422 commit b5ceed3

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

docs/platforms/dotnet/common/tracing/instrumentation/ai-agents-module.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ var options = new ChatOptions
6767
MaxOutputTokens = 1024,
6868
Tools =
6969
[
70+
// Sample Tool
7071
AIFunctionFactory.Create(async (string location) =>
7172
{
72-
// Tool implementation
7373
await Task.Delay(500);
7474
return $"The weather in {location} is sunny";
7575
}, "GetWeather", "Gets the current weather for a location")
@@ -104,6 +104,8 @@ Name of the AI Agent. This name will be used to identify the agent in the Sentry
104104

105105
</SdkOption>
106106

107+
<PlatformSection supported={["dotnet.aspnetcore"]}>
108+
107109
## ASP.NET Core Integration
108110

109111
For ASP.NET Core applications, you can integrate Sentry AI Agent monitoring as follows:
@@ -152,3 +154,5 @@ app.MapGet("/chat", async (IChatClient client, string message) =>
152154
app.Run();
153155
```
154156

157+
</PlatformSection>
158+

docs/product/insights/ai/agents/getting-started.mdx

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,58 @@ result = await agents.Runner.run(
194194

195195
```
196196

197+
### .NET - Microsoft.Extensions.AI SDK
198+
199+
The Sentry .NET SDK supports AI agent monitoring through the Microsoft.Extensions.AI integration, which automatically captures spans for your AI agent workflows using the library's built-in telemetry.
200+
201+
#### Supported Platforms
202+
203+
- <LinkWithPlatformIcon
204+
platform="dotnet"
205+
label="Microsoft.Extensions.AI"
206+
url="/platforms/dotnet/tracing/instrumentation/ai-agents-module/"
207+
/>
208+
209+
#### Quick Start with Microsoft.Extensions.AI
210+
211+
```csharp
212+
// Wrap your IChatClient with Sentry instrumentation
213+
var openAiClient = new OpenAI.Chat.ChatClient("gpt-4o-mini", apiKey)
214+
.AsIChatClient()
215+
.AddSentry(options =>
216+
{
217+
options.Experimental.RecordInputs = true;
218+
options.Experimental.RecordOutputs = true;
219+
options.Experimental.AgentName = "MyAgent";
220+
});
221+
222+
// Wrap your client with FunctionInvokingChatClient
223+
var chatClient = new ChatClientBuilder(openAiClient)
224+
.UseFunctionInvocation()
225+
.Build();
226+
227+
// Create chat options with tools and add Sentry instrumentation
228+
var options = new ChatOptions
229+
{
230+
ModelId = "gpt-4o-mini",
231+
MaxOutputTokens = 1024,
232+
Tools =
233+
[
234+
// Sample Tool
235+
AIFunctionFactory.Create(async (string location) =>
236+
{
237+
await Task.Delay(500);
238+
return $"The weather in {location} is sunny";
239+
}, "GetWeather", "Gets the current weather for a location")
240+
]
241+
}.AddSentryToolInstrumentation();
242+
243+
var response = await chatClient.GetResponseAsync(
244+
"What's the weather in New York?",
245+
options);
246+
```
247+
248+
197249
<Alert title="Don't see your SDK?">
198250

199251
You can also instrument AI agents manually by following our [manual instrumentation guides](/platforms/python/tracing/instrumentation/custom-instrumentation/ai-agents-module).

0 commit comments

Comments
 (0)