Annotation Interface Fallback


@Documented @Retention(RUNTIME) @Target(METHOD) public @interface Fallback
Fallback handler invoked when the primary agent or tool fails.

Usage


 @Fallback(forAction = "searchWeb")
 public String searchFallback(String query, Exception error) {
     return "Search unavailable: " + error.getMessage();
 }

 @Fallback  // global fallback
 public String globalFallback(String input, Exception error) { }
 
Since:
0.3.0
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Action or method name this fallback covers.
    int
    Maximum retry attempts before invoking fallback.
  • Element Details

    • forAction

      String forAction
      Action or method name this fallback covers. Empty means global fallback for all failures.
      Returns:
      action name
      Default:
      ""
    • maxRetries

      int maxRetries
      Maximum retry attempts before invoking fallback.
      Returns:
      max retries (default: 0, invoke immediately)
      Default:
      0