-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Describe the bug
by using
@kernel.filter(FilterTypes.AUTO_FUNCTION_INVOCATION)
async def auto_function_invocation_filter(context: AutoFunctionInvocationContext,next) -> None:
await next(context)
context.terminate = True
to terminate a function call just after it gets result.
it terminated after tool gets result, so the 3rd step is not triggered and the Agent finish its job, but when the next agent B is invoked(be selected by group manager as next participant). checking on the chat history(context), the agent A response content is '[]' - an empty list. seems the agent doesn't use tool result as its response in this case.

To Reproduce
running a multi-agent GroupChatOrchestration() in my project.
when an agent A in the groupchat is invoked, the agent will:
1st step: call GPT to suggest a tool;
2nd step: tool response with it result to agent; then as @kernel.filter(FilterTypes.AUTO_FUNCTION_INVOCATION).. terminated the subsequence process, Agent A is job is done.
3rd step: the next agent B is invoked by group manager, check on agent B's messages that send to GPT, Agent A 's response content is '[]'- an empty list.
Expected behavior
now it is running like this:
when an agent A in the groupchat is invoked, the agent will:
1st step: call GPT to suggest a tool;
2nd step: tool response with it result to agent;
3rd step: Agent uses tool's result and sends a subsequence request to GTP to generate the agent (final)response.
what we want is:
we want the 3rd step be ignored and tool result can be used as the Agent's response and can be seen , used by other agent in the rest of agents' invoke in this group chat.
the reason is :
because the 2nd step we are retrieving lots of structure data, we just want the agent to use tool's result as the agent (final)response.(in fact we added instruction to agent prompt to let him do nothing but just use tool's result). but now the 3rd step costs lots of tokens and seconds but just bring tool's result in and return tool's result back(as we request him to do like this).
Platform
- Language: Python
- Source: semantic-kernel==1.35.0
- AI model: OpenAI:GPT-4.1]
- IDE:VS Code
- OS: Windows
Additional context
Add any other context about the problem here.