Menu

"Failed" Is a Lie Your .NET Agent Tells the Model: Four Outcomes Every Tool Call Needs
πŸ“°

"Failed" Is a Lie Your .NET Agent Tells the Model: Four Outcomes Every Tool Call Needs

DEV Community: dotnetΒ·MICHAEL-MAURICEΒ·3 days ago
#n6vUi8bf
#devtodotnet#devto#dev#model#failed
Reading 0:00
15s threshold

Most tool functions I see in agent demos return one of two things: a result, or an exception. Microsoft.Extensions.AI then turns that exception into a polite little string for the model, something like Error: Function failed.

For a read, that's fine. For a write, it's a trap.

Picture a refund tool. The HTTP call to billing goes out, billing commits the refund, and the response gets lost on the way back. Your timeout fires. The tool throws. The model reads "failed", does the helpful thing, and calls the refund tool again. The customer is now 40 EUR richer instead of 20.

The model didn't misbehave. You told it something false. It had no way to know "failed" really meant "I have no idea".

This post is about the small vocabulary I now give every tool in a .NET agent so the model never has to guess.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.