Prompt LibraryEngineering

LLM Function-Call Error Recovery Prompt

Give a model a decision tree for handling failed tool calls.

The prompt

The model can call these tools: {{tools}}
Write the error-handling clause for the system prompt covering:
- timeout: retry once with the same args, then escalate
- invalid-argument error: fix the argument if the fix is obvious from context, else ask the user
- not-found result: state it plainly, do not substitute a guess
- rate-limit: wait-and-retry once, then switch to a lower-cost tool if one exists

Return the clause as numbered rules ready to paste into the system prompt.

Replace the {{fields}} with your own context and tighten the rules to match your domain.

Share this prompt