Package com.aispect.api
Interface AiAgentFilter
- All Known Subinterfaces:
AiGraphAgentHandler<T,,R, F> AiUnitAgentHandler<T,R>
- All Known Implementing Classes:
AbstractGraphAgent,AbstractUnitAgent,ContentModerationAgent,DataCleanAgent,DynamicWorkflowGraphAgent,FallbackAgent,ImageProcessAgent,ImageStoryAgent,JsonExtractorAgent
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
AI Global interceptor for agent execution flow/filter.
with specific prefixes/The post-processor is different,AiAgentFilter Acts on a more macro orchestration link. It can be used to achieve global perspective logging, call link tracking, indicator burying, security interception and authentication, rate limit (Rate Limiting)Cross-cutting logic.
-
Method Summary
Modifier and TypeMethodDescription<T,R> R doFilter(AiInvocationContext<T> ctx, AiExecutionProxy<T, R> next) filter/intercept the current AI Proxy request.default booleanshouldProcess(Object[] args) Assertion filter: Based on the input parameters of the native method, determine whether the current call needs to go through AI Agent processing.
-
Method Details
-
doFilter
filter/intercept the current AI Proxy request.- Type Parameters:
T- Method original return value typeR- The type of final processing result expected- Parameters:
ctx- The context of the current method callnext- Used to advance the filter chain, executing the next filter or the finalAiExecutionProxy- Returns:
- The final result after executing the filter chain and proxy
- Throws:
AiSpectException- Triggered when the interception logic rejects the request or a subsequent call chain throws an exception
-
shouldProcess
Assertion filter: Based on the input parameters of the native method, determine whether the current call needs to go through AI Agent processing.- Parameters:
args- method parameters- Returns:
- Does it need to be processed?
-