I’m using CopilotRuntime with a BuiltInAgent, and I’ve added an afterRequestMiddleware to inspect the messages:
return new CopilotRuntime<Parameter[]>({
agents: {
default: new BuiltInAgent({
model,
prompt: AGENT_META_PROMPT,
maxOutputTokens: modelConfig.maxOutputTokens,
maxSteps: 10,
tools,
}),
},
afterRequestMiddleware: async ({ messages }) => {
console.log("AFTER REQUEST MIDDLEWARE", { messages });
},
});
However, I’m consistently receiving an empty messages array in the middleware.
Is this expected behavior in v2, or has there been any change in how/when messages are populated in afterRequestMiddleware?