Class TodoListInterceptor

java.lang.Object
com.alibaba.cloud.ai.graph.agent.interceptor.ModelInterceptor
com.alibaba.cloud.ai.graph.agent.interceptor.todolist.TodoListInterceptor
All Implemented Interfaces:
Interceptor

public class TodoListInterceptor extends ModelInterceptor
Model interceptor that provides todo list management capabilities to agents. This interceptor enhances the system prompt to guide agents on using todo lists for complex multi-step operations. It helps agents: - Track progress on complex tasks - Organize work into manageable steps - Provide users with visibility into task completion The interceptor automatically injects system prompts that guide the agent on when and how to use the todo functionality effectively. Example: TodoListInterceptor interceptor = TodoListInterceptor.builder() .systemPrompt("Custom guidance for using todos...") .build();
  • Method Details

    • builder

      public static TodoListInterceptor.Builder builder()
    • getTools

      public List<org.springframework.ai.tool.ToolCallback> getTools()
      Description copied from class: ModelInterceptor
      Get tools provided by this interceptor. Interceptors can provide built-in tools that will be automatically added to the agent.
      Overrides:
      getTools in class ModelInterceptor
      Returns:
      List of tools provided by this interceptor, empty list by default
    • getName

      public String getName()
    • interceptModel

      public ModelResponse interceptModel(ModelRequest request, ModelCallHandler handler)
      Description copied from class: ModelInterceptor
      Wrap a model call with custom logic. Implementations can: - Modify the request before calling the handler - Call the handler multiple times (retry logic) - Modify the response after handler returns - Handle exceptions and provide fallbacks
      Specified by:
      interceptModel in class ModelInterceptor
      Parameters:
      request - The model request
      handler - The next handler in the chain (or base handler)
      Returns:
      The model response