forked from a2aproject/a2a-python
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtask_store.py
More file actions
33 lines (25 loc) · 972 Bytes
/
task_store.py
File metadata and controls
33 lines (25 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from abc import ABC, abstractmethod
from a2a.server.context import ServerCallContext
from a2a.types.a2a_pb2 import ListTasksRequest, ListTasksResponse, Task
class TaskStore(ABC):
"""Agent Task Store interface.
Defines the methods for persisting and retrieving `Task` objects.
"""
@abstractmethod
async def save(self, task: Task, context: ServerCallContext) -> None:
"""Saves or updates a task in the store."""
@abstractmethod
async def get(
self, task_id: str, context: ServerCallContext
) -> Task | None:
"""Retrieves a task from the store by ID."""
@abstractmethod
async def list(
self,
params: ListTasksRequest,
context: ServerCallContext,
) -> ListTasksResponse:
"""Retrieves a list of tasks from the store."""
@abstractmethod
async def delete(self, task_id: str, context: ServerCallContext) -> None:
"""Deletes a task from the store by ID."""