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.

@FunctionalInterface public interface AiAgentFilter
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 Type
    Method
    Description
    <T, R> R
    filter/intercept the current AI Proxy request.
    default boolean
    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

      <T, R> R doFilter(AiInvocationContext<T> ctx, AiExecutionProxy<T,R> next) throws AiSpectException
      filter/intercept the current AI Proxy request.
      Type Parameters:
      T - Method original return value type
      R - The type of final processing result expected
      Parameters:
      ctx - The context of the current method call
      next - Used to advance the filter chain, executing the next filter or the final AiExecutionProxy
      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

      default boolean shouldProcess(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.
      Parameters:
      args - method parameters
      Returns:
      Does it need to be processed?