Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ResearcherAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ public ResearcherAgent(IChatClient llm, ChatOptions chatOptions, AIFunction tavi
},
})
.AsBuilder()
// Function-invocation middleware: fires around every tool call the agent
// makes. We log each time the model invokes the Tavily search tool.
.Use(async (agent, context, next, cancellationToken) =>
{
if (context.Function.Name == tavilyTool.Name)
{
_logger.LogInformation(
"Researcher invoking Tavily tool '{Tool}' with arguments {Arguments}",
context.Function.Name,
context.Arguments);
Comment on lines +59 to +62
}

return await next(context, cancellationToken);
})
.UseOpenTelemetry(sourceName: "BlogWriter.Agents")
.Build();

Expand Down