Skip to main content

Fixed: Microsoft Agent Framework Agent Calls a Rejected Tool Approval a Failure

· 8 min read
Jagdish Kumawat
Founder @ Dewiride

A person said no to a tool call, and my agent answered as if something had gone wrong: Sorry, I couldn't place the cappuccino order. In another agent it even said Please try again later. Nothing failed: the person decided. One line in the agent's instructions makes it say so.

What I Was Doing​

I was adding a password reset to an IT service desk agent built with Microsoft Agent Framework: Part 13 of the IT Service Desk series. The reset tool is wrapped in ApprovalRequiredAIFunction, so the employee approves or rejects each call before it runs. My first instructions for it said: If they decline the reset, accept it and say nothing changed.

Then I rejected a reset. The tool didn't run, and the agent answered:

The agent's answer
I couldn’t complete the password reset. No changes were made. Please try again later or contact the IT Service Desk for help.

The same happens in a much smaller agent: a coffee-order API with one tool, place_order, wrapped the same way, and the instructions You take coffee orders. Use your tools to place them. It's the example from How to Approve or Reject an AG-UI Tool Call Interrupt in ASP.NET Core. I ordered One cappuccino, please. and rejected the call.

What I Expected​

An answer that matches what happened: the person decided not to order, so the order wasn't placed. No apology, and no suggestion to try again, because there's nothing to fix.

What I Got​

The rejected run (shortened)
data: {"type":"TOOL_CALL_RESULT","messageId":"call_7XtlaGrcPm9NDcTcRqWTAFcL","toolCallId":"call_7XtlaGrcPm9NDcTcRqWTAFcL","content":"Tool call invocation was rejected by the approver and must not be retried.","rawEvent":{…}}

… the agent's answer, "Sorry, I couldn’t place the cappuccino order." …

macOS-style window with two panes. Above, the agent's instructions in Program.cs: You take coffee orders. Use your tools to place them. Below, the rejected order: the TOOL_CALL_RESULT of place_order, Tool call invocation was rejected by the approver and must not be retried., and the agent's answer, Sorry, I couldn't place the cappuccino order.

I rejected two more cappuccinos in new conversations, to see whether it was a one-off. It wasn't:

RunThe agent's answer
1Sorry, I couldn’t place the cappuccino order.
2Sorry, I couldn’t place the cappuccino order.
3I’m sorry, but I couldn’t place your cappuccino order.

What I Checked​

1. That the approval worked. It did. There's no result from place_order in the stream, only the result Agent Framework puts in its place for a rejected call. The decision reached the agent, and the tool didn't run.

2. What the model reads. That result is all the model learns about the decision: Tool call invocation was rejected by the approver and must not be retried. It doesn't say who the approver is. To the model, a call that was rejected and must not be retried looks like something that went wrong somewhere else.

3. The documentation. Microsoft's guide to tool approval in Agent Framework covers how to create the approval response and send it back, with true to approve or false to reject. How the agent then words its answer is up to the agent's instructions, like any other answer.

4. The service desk's instructions. They did mention a decline, If they decline the reset, accept it and say nothing changed, but they never told the model that a rejected call is the decline. The answer said No changes were made, so the model followed half of the rule, and still called it a failure.

Why It Happens​

The rejection arrives as a tool result, the same place where errors from the tool would arrive, phrased like a message from a system: rejected by the approver. Nothing tells the model that the approver is the person in the conversation, so it answers the way it answers a failed call: it apologizes, and sometimes suggests trying again. Asking the person to try again is the worst part, because they said no a moment ago.

The Fix​

Tell the agent, in its instructions, what a rejected call means and how to answer it. For the coffee agent:

Program.cs (the agent's instructions)
instructions: """
You take coffee orders. Use your tools to place them.
If a tool call is rejected, the customer declined it: say what wasn't done. Don't apologize or call it a failure.
""",
  • "the customer declined it" tells the model who the approver is.
  • "say what wasn't done" gives it something true to say instead.
  • "Don't apologize or call it a failure" rules out the answer it gave before.

The service desk got the same rule in its own words: If the reset is rejected, the employee declined it: say that their password wasn't reset and nothing changed. Don't call it a failure or ask them to try again.

After the Fix​

The same three rejections, with the new instructions:

macOS-style window with two panes. Above, the agent's instructions with a second line: If a tool call is rejected, the customer declined it: say what wasn't done. Don't apologize or call it a failure. Below, the rejected order: the same TOOL_CALL_RESULT, Tool call invocation was rejected by the approver and must not be retried., and the agent's answer, The cappuccino order wasn't placed.

RunThe agent's answer
1The cappuccino order wasn’t placed.
2Your cappuccino order wasn’t placed.
3Your cappuccino order wasn’t placed.

The service desk, rejecting a reset with its new rule, answered: Your password wasn't reset, and nothing changed.

Common Mistakes​

MistakeWhat happensDo this instead
Saying only "if they decline, accept it"The model doesn't connect a rejected call to the person's decisionSay that a rejected call means the person declined
Rewriting the rejection message in codeYou'd be changing Agent Framework's own result, which also tells the model not to retryLeave the result, and guide the answer with the instructions
Testing only the approvalThe rejection's wording goes unnoticed until a real person says noReject at least once whenever you add an approval

Troubleshooting​

SymptomLikely causeFix
The agent apologizes or says it couldn't do it after a rejectionNothing in the instructions explains what a rejected call meansAdd the rule from The Fix
The agent suggests trying again after a rejectionThe model treats the rejection as an errorAdd Don't ... ask them to try again to the rule
The tool's result also says No approval response was provided for this approval required tool call.The approval never reached the agent, so this isn't a wording problemSee Fixed: No approval response was provided for this approval required tool call

FAQ​

Does the agent ever call the tool again by itself after a rejection?​

Not in any of my runs. Agent Framework's result for a rejected call ends with must not be retried, and the agent answered from it instead.

Why not tell the model in the tool's description?​

The description is about what the tool does, and the model reads it when it decides whether to call the tool. How to talk to the person after a decision is behavior, and behavior goes in the instructions, where it covers every tool that needs approval.

Conclusion​

A rejected tool call reaches the model as Tool call invocation was rejected by the approver and must not be retried., and without more context the model answers as if something failed. One line in the instructions, saying that a rejected call means the person declined, and that the agent should say what wasn't done without apologizing, turned Sorry, I couldn't place the cappuccino order. into The cappuccino order wasn't placed. in every run I tried.

Additional Resources​