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
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();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classRepresents a single todo item.static enumTodo item status. -
Method Summary
Modifier and TypeMethodDescriptionstatic TodoListInterceptor.Builderbuilder()getName()List<org.springframework.ai.tool.ToolCallback>getTools()Get tools provided by this interceptor.interceptModel(ModelRequest request, ModelCallHandler handler) Wrap a model call with custom logic.
-
Method Details
-
builder
-
getTools
Description copied from class:ModelInterceptorGet tools provided by this interceptor. Interceptors can provide built-in tools that will be automatically added to the agent.- Overrides:
getToolsin classModelInterceptor- Returns:
- List of tools provided by this interceptor, empty list by default
-
getName
-
interceptModel
Description copied from class:ModelInterceptorWrap 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:
interceptModelin classModelInterceptor- Parameters:
request- The model requesthandler- The next handler in the chain (or base handler)- Returns:
- The model response
-