10
10
11
11
import uvicorn
12
12
from a2a .server .apps import A2AFastAPIApplication , A2AStarletteApplication
13
+ from a2a .server .events import QueueManager
13
14
from a2a .server .request_handlers import DefaultRequestHandler
14
- from a2a .server .tasks import InMemoryTaskStore
15
+ from a2a .server .tasks import InMemoryTaskStore , PushNotificationConfigStore , PushNotificationSender , TaskStore
15
16
from a2a .types import AgentCapabilities , AgentCard , AgentSkill
16
17
from fastapi import FastAPI
17
18
from starlette .applications import Starlette
@@ -36,6 +37,12 @@ def __init__(
36
37
serve_at_root : bool = False ,
37
38
version : str = "0.0.1" ,
38
39
skills : list [AgentSkill ] | None = None ,
40
+ # RequestHandler
41
+ task_store : TaskStore | None = None ,
42
+ queue_manager : QueueManager | None = None ,
43
+ push_config_store : PushNotificationConfigStore | None = None ,
44
+ push_sender : PushNotificationSender | None = None ,
45
+
39
46
):
40
47
"""Initialize an A2A-compatible server from a Strands agent.
41
48
@@ -52,6 +59,14 @@ def __init__(
52
59
Defaults to False.
53
60
version: The version of the agent. Defaults to "0.0.1".
54
61
skills: The list of capabilities or functions the agent can perform.
62
+ task_store: Custom task store implementation for managing agent tasks. If None,
63
+ uses InMemoryTaskStore.
64
+ queue_manager: Custom queue manager for handling message queues. If None,
65
+ no queue management is used.
66
+ push_config_store: Custom store for push notification configurations. If None,
67
+ no push notification configuration is used.
68
+ push_sender: Custom push notification sender implementation. If None,
69
+ no push notifications are sent.
55
70
"""
56
71
self .host = host
57
72
self .port = port
@@ -77,7 +92,10 @@ def __init__(
77
92
self .capabilities = AgentCapabilities (streaming = True )
78
93
self .request_handler = DefaultRequestHandler (
79
94
agent_executor = StrandsA2AExecutor (self .strands_agent ),
80
- task_store = InMemoryTaskStore (),
95
+ task_store = task_store or InMemoryTaskStore (),
96
+ queue_manager = queue_manager ,
97
+ push_config_store = push_config_store ,
98
+ push_sender = push_sender ,
81
99
)
82
100
self ._agent_skills = skills
83
101
logger .info ("Strands' integration with A2A is experimental. Be aware of frequent breaking changes." )
0 commit comments