# Microsoft Agent Framework: choosing where to intercept calls

Canonical source : [Microsoft Agent Framework: choosing where to intercept calls](<https://sebastien.rigaux.be/en/tech-watch/links/microsoft-agent-framework-choosing-where-to-intercept-calls>)

In Microsoft Agent Framework, `ChatClient` middleware intercepts messages exchanged with the LLM, while agent middleware operates on the agent’s overall run, including session, identity, or token-budget management. This distinction helps place logging or modification at the right level.

The C# example adds function-invocation middleware to log calls to the Researcher agent’s Tavily tool, without changing the other agents. The trace shows the function name and its arguments.

- Selected on : 2026-11-01

- Resource publication : 2026-08-08

- Entry updated : 2026-11-07T20:32:37+0000

- Format : Article

- Source language : EN

- Found via : [C\# Digest](<https://csharpdigest.net/>)

Original resource : [Microsoft Agent Framework: choosing where to intercept calls](<https://jesseliberty.com/2026/08/08/chatclient-middleware-vs-agent-middleware/>)

Tags : Microsoft Agent Framework · [AI Agents](<https://sebastien.rigaux.be/en/tech-watch/tags/ai-agents>) · [C\#](<https://sebastien.rigaux.be/en/tech-watch/tags/c-sharp>) · [Observability](<https://sebastien.rigaux.be/en/tech-watch/tags/observability>)

Available versions : [Français](<https://sebastien.rigaux.be/veille/liens/microsoft-agent-framework-choisir-ou-intercepter-les-appels>) · [English](<https://sebastien.rigaux.be/en/tech-watch/links/microsoft-agent-framework-choosing-where-to-intercept-calls>)

[Back to tech watch](<https://sebastien.rigaux.be/en/tech-watch>)
