Interface TaskRepository
- All Known Implementing Classes:
DefaultTaskRepository
public interface TaskRepository
Repository for managing background tasks.
Inspired by spring ai TaskRepository, enables the main agent to launch sub-agents in the background and retrieve results later via TaskOutputTool.
- Author:
- Spring AI Alibaba
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all tasks from the repository.Get a background task by its ID.Add a new background task to the repository.voidremoveTask(String taskId) Remove a background task from the repository.
-
Method Details
-
getTask
Get a background task by its ID.- Parameters:
taskId- the task identifier- Returns:
- the background task, or null if not found
-
putTask
Add a new background task to the repository.- Parameters:
taskId- the task identifiertaskExecution- the supplier that executes the task and returns its output- Returns:
- the created background task
-
removeTask
Remove a background task from the repository.- Parameters:
taskId- the task identifier
-
clear
void clear()Clear all tasks from the repository.
-