Package com.aispect.agents.flow
Class FallbackAgent
- All Implemented Interfaces:
AiAgentFilter,AiExceptionProxy<String,,String> AiExecutionProxy<String,,String> AiPostExecutionProxy<String,,String> AiPreExecutionProxy<String>,AiUnitAgentHandler<String,String>
Used for disaster recovery and graceful downgrade Fallback Agent。
Intercept method calls and intervene when exceptions occur during normal execution. When the underlying business code throws an exception, it utilizes AI Provide a polite, reasonable fallback response based on the context.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiononException(AiInvocationContext<String> ctx, Throwable ex) When the target method or upstream and downstream Agent This fallback logic is triggered when execution throws an exception.Methods inherited from class com.aispect.agent.core.AbstractUnitAgent
doFilter, execute, getAiOperations, postExecute, preExecute, shouldProcess
-
Constructor Details
-
FallbackAgent
public FallbackAgent()
-
-
Method Details
-
onException
When the target method or upstream and downstream Agent This fallback logic is triggered when execution throws an exception.- Specified by:
onExceptionin interfaceAiExceptionProxy<String,String> - Overrides:
onExceptionin classAbstractUnitAgent<String,String> - Parameters:
ctx- AI Execution context, containing original request parametersex- Exception thrown during target method or processing- Returns:
- Depend on AI generated bottom line/Downgrade friendly response text
- Throws:
AiSpectException- if Fallback An error occurred again during processing
-