Sébastien Rigaux

Microsoft Agent Framework: choosing where to intercept calls

View resource

jesseliberty.com

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.

Three basketball players illustrate a sequence: the first holds the ball, the second watches through binoculars, and the third shoots toward the hoop.