-
Notifications
You must be signed in to change notification settings - Fork 429
Expand file tree
/
Copy pathtask_store.py
More file actions
34 lines (28 loc) · 835 Bytes
/
task_store.py
File metadata and controls
34 lines (28 loc) · 835 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
34
from abc import ABC, abstractmethod
from a2a.server.context import ServerCallContext
from a2a.types import 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 = None
) -> None:
"""Saves or updates a task in the store."""
@abstractmethod
async def get(
self,
task_id: str,
context: ServerCallContext | None = None
) -> Task | None:
"""Retrieves a task from the store by ID."""
@abstractmethod
async def delete(
self,
task_id: str,
context: ServerCallContext | None = None
) -> None:
"""Deletes a task from the store by ID."""