distributed-a2a 0.1.9rc0__py3-none-any.whl → 0.1.9rc2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- distributed_a2a/model.py +12 -1
- distributed_a2a/router.py +2 -3
- distributed_a2a/server.py +9 -11
- {distributed_a2a-0.1.9rc0.dist-info → distributed_a2a-0.1.9rc2.dist-info}/METADATA +1 -1
- distributed_a2a-0.1.9rc2.dist-info/RECORD +13 -0
- distributed_a2a-0.1.9rc0.dist-info/RECORD +0 -13
- {distributed_a2a-0.1.9rc0.dist-info → distributed_a2a-0.1.9rc2.dist-info}/WHEEL +0 -0
- {distributed_a2a-0.1.9rc0.dist-info → distributed_a2a-0.1.9rc2.dist-info}/licenses/LICENSE +0 -0
- {distributed_a2a-0.1.9rc0.dist-info → distributed_a2a-0.1.9rc2.dist-info}/top_level.txt +0 -0
distributed_a2a/model.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
-
from typing import List, Any
|
|
2
|
+
from typing import List, Any, Optional
|
|
3
3
|
|
|
4
4
|
from langchain_core.language_models import BaseChatModel
|
|
5
5
|
from langchain_openai import ChatOpenAI
|
|
@@ -13,6 +13,15 @@ class SkillConfig(BaseModel):
|
|
|
13
13
|
tags: List[str] = Field(description="The tags associated with the skill")
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
class RegistryItemConfig(BaseModel):
|
|
17
|
+
url: str = Field(description="The url of the registry")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class RegistryConfig(BaseModel):
|
|
21
|
+
agent: RegistryItemConfig = Field(description="The agent registry configuration")
|
|
22
|
+
mcp: Optional[RegistryItemConfig] = Field(description="The mcp registry configuration", required=False)
|
|
23
|
+
|
|
24
|
+
|
|
16
25
|
class LLMConfig(BaseModel):
|
|
17
26
|
base_url: str = Field(description="The base url of the LLM provider")
|
|
18
27
|
model: str = Field(description="The model to use for the LLM e.g. gpt-3.5-turbo")
|
|
@@ -32,6 +41,7 @@ class CardConfig(BaseModel):
|
|
|
32
41
|
|
|
33
42
|
|
|
34
43
|
class AgentItem(BaseModel):
|
|
44
|
+
registry: Optional[RegistryConfig] = Field(description="The registry configuration node", default=None)
|
|
35
45
|
card: CardConfig = Field(description="The agent card configuration node")
|
|
36
46
|
llm: LLMConfig = Field(description="The LLM configuration node")
|
|
37
47
|
system_prompt: str = Field(description="The system prompt to use for the LLM or a path to a file containing the system prompt")
|
|
@@ -50,6 +60,7 @@ class AgentConfig(BaseModel):
|
|
|
50
60
|
|
|
51
61
|
|
|
52
62
|
class RouterItem(BaseModel):
|
|
63
|
+
registry: Optional[RegistryConfig] = Field(description="The registry configuration node", default=None)
|
|
53
64
|
card: CardConfig = Field(description="The router card configuration node")
|
|
54
65
|
llm: LLMConfig = Field(description="The LLM configuration node")
|
|
55
66
|
|
distributed_a2a/router.py
CHANGED
|
@@ -8,7 +8,7 @@ from fastapi import FastAPI
|
|
|
8
8
|
|
|
9
9
|
from .executors import RoutingExecutor
|
|
10
10
|
from .model import RouterConfig
|
|
11
|
-
from .registry import DynamoDbRegistryLookup
|
|
11
|
+
from .registry import DynamoDbRegistryLookup, AgentRegistryLookup
|
|
12
12
|
from .server import CAPABILITIES, AGENT_CARD_TABLE
|
|
13
13
|
|
|
14
14
|
|
|
@@ -33,8 +33,7 @@ def load_router(router_dic: dict[str, Any]) -> FastAPI:
|
|
|
33
33
|
|
|
34
34
|
executor = RoutingExecutor(
|
|
35
35
|
router_config=router_config,
|
|
36
|
-
routing_tool=
|
|
37
|
-
|
|
36
|
+
routing_tool=AgentRegistryLookup(router_config.router.registry.agent.url).as_tool()
|
|
38
37
|
)
|
|
39
38
|
|
|
40
39
|
return A2ARESTFastAPIApplication(
|
distributed_a2a/server.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os
|
|
1
2
|
import asyncio
|
|
2
3
|
import time
|
|
3
4
|
from contextlib import asynccontextmanager
|
|
@@ -13,7 +14,7 @@ from fastapi import FastAPI
|
|
|
13
14
|
|
|
14
15
|
from .executors import RoutingAgentExecutor
|
|
15
16
|
from .model import AgentConfig
|
|
16
|
-
from .registry import DynamoDbRegistryLookup, registry_heart_beat
|
|
17
|
+
from .registry import DynamoDbRegistryLookup, registry_heart_beat, AgentRegistryLookup
|
|
17
18
|
|
|
18
19
|
CAPABILITIES = AgentCapabilities(streaming=False, push_notifications=False)
|
|
19
20
|
|
|
@@ -21,6 +22,7 @@ HEART_BEAT_INTERVAL_SEC = 5
|
|
|
21
22
|
MAX_HEART_BEAT_MISSES = 3
|
|
22
23
|
|
|
23
24
|
AGENT_CARD_TABLE = "agent-cards"
|
|
25
|
+
AGENT_REGISTRY_URL = ""
|
|
24
26
|
|
|
25
27
|
def get_expire_at() -> int:
|
|
26
28
|
return int(time.time() + MAX_HEART_BEAT_MISSES * HEART_BEAT_INTERVAL_SEC)
|
|
@@ -69,20 +71,16 @@ def load_app(agent_config: Any) -> FastAPI:
|
|
|
69
71
|
preferred_transport=agent_config.agent.card.preferred_transport_protocol,
|
|
70
72
|
capabilities=CAPABILITIES
|
|
71
73
|
)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
agent_registry = AgentRegistryLookup(agent_config.agent.registry.agent.url)
|
|
74
75
|
executor = RoutingAgentExecutor(agent_config=agent_config,
|
|
75
|
-
routing_tool=
|
|
76
|
+
routing_tool=agent_registry.as_tool())
|
|
76
77
|
|
|
77
78
|
@asynccontextmanager
|
|
78
79
|
async def lifespan(_: FastAPI) -> AsyncGenerator[None, Any]:
|
|
79
|
-
asyncio.create_task(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
asyncio.create_task(registry_heart_beat(name=agent_card.name, registry_url=registry_url,
|
|
84
|
-
agent_card=agent_card, interval_sec=HEART_BEAT_INTERVAL_SEC,
|
|
85
|
-
get_expire_at=get_expire_at))
|
|
80
|
+
asyncio.create_task(registry_heart_beat(name=agent_card.name, registry_url=agent_config.agent.registry.agent.url,
|
|
81
|
+
agent_card=agent_card, interval_sec=HEART_BEAT_INTERVAL_SEC,
|
|
82
|
+
get_expire_at=get_expire_at))
|
|
83
|
+
|
|
86
84
|
yield
|
|
87
85
|
|
|
88
86
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
distributed_a2a/__init__.py,sha256=gO8sTT20O6XvDRzj7B322O9v6HxV-_eIlJD1wMlPYoI,171
|
|
2
|
+
distributed_a2a/agent.py,sha256=qY775N3Br2YMuaHLALU4t6MO47syuEoTtFLLPRr8TyA,2910
|
|
3
|
+
distributed_a2a/client.py,sha256=3tEBqu3HKEQyOFk5vsO1YiuKP2pZx-n6SCzsJUYNcyc,4601
|
|
4
|
+
distributed_a2a/executors.py,sha256=1toayqLUan0f1INyMo5v02L9uCHMq6hp1gf0jVdjX6I,7152
|
|
5
|
+
distributed_a2a/model.py,sha256=x-Es1WIm-MMBMizD3CePXf04mpWLiqRCYbz61KGDLRc,3535
|
|
6
|
+
distributed_a2a/registry.py,sha256=hwG3f2eqny6eSNsPdJnxlf6jFA-K8flO3loJXGmc5bg,2144
|
|
7
|
+
distributed_a2a/router.py,sha256=SRYBgLiN4j7JDIKb_9D8ypJxqVYs_fFlG5dgWYIbF7o,1803
|
|
8
|
+
distributed_a2a/server.py,sha256=JVIcdjyjtVhP-YTeoaOb0R7d0honC_JPR0aQfJ4P_SQ,3434
|
|
9
|
+
distributed_a2a-0.1.9rc2.dist-info/licenses/LICENSE,sha256=Btzdu2kIoMbdSp6OyCLupB1aRgpTCJ_szMimgEnpkkE,1056
|
|
10
|
+
distributed_a2a-0.1.9rc2.dist-info/METADATA,sha256=45pKsZUMAPpxE-p-v-k_ek6uSnxANe7aNMSRBIeLHfQ,3198
|
|
11
|
+
distributed_a2a-0.1.9rc2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
12
|
+
distributed_a2a-0.1.9rc2.dist-info/top_level.txt,sha256=23qJ8n5k7796BHDK7a58uuO-X4GV0EgUWcGi8NIn-0k,16
|
|
13
|
+
distributed_a2a-0.1.9rc2.dist-info/RECORD,,
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
distributed_a2a/__init__.py,sha256=gO8sTT20O6XvDRzj7B322O9v6HxV-_eIlJD1wMlPYoI,171
|
|
2
|
-
distributed_a2a/agent.py,sha256=qY775N3Br2YMuaHLALU4t6MO47syuEoTtFLLPRr8TyA,2910
|
|
3
|
-
distributed_a2a/client.py,sha256=3tEBqu3HKEQyOFk5vsO1YiuKP2pZx-n6SCzsJUYNcyc,4601
|
|
4
|
-
distributed_a2a/executors.py,sha256=1toayqLUan0f1INyMo5v02L9uCHMq6hp1gf0jVdjX6I,7152
|
|
5
|
-
distributed_a2a/model.py,sha256=K4ltuBHTm_r5I-viITDt4GrxntwcUj1sOjLenHYB79k,2981
|
|
6
|
-
distributed_a2a/registry.py,sha256=hwG3f2eqny6eSNsPdJnxlf6jFA-K8flO3loJXGmc5bg,2144
|
|
7
|
-
distributed_a2a/router.py,sha256=NV8aKraFNrI53PxJAGXI5NtG3-Oy7x5ofHfgqeqsnsI,1780
|
|
8
|
-
distributed_a2a/server.py,sha256=IZjDBBLYXYDYPFqBTyMxvGW20qMVweWXGSTP5jtgJKg,3540
|
|
9
|
-
distributed_a2a-0.1.9rc0.dist-info/licenses/LICENSE,sha256=Btzdu2kIoMbdSp6OyCLupB1aRgpTCJ_szMimgEnpkkE,1056
|
|
10
|
-
distributed_a2a-0.1.9rc0.dist-info/METADATA,sha256=zbcnqeXDcB8H88TT4apM50DRH7ZBAu9Clbka4UhEz2Y,3198
|
|
11
|
-
distributed_a2a-0.1.9rc0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
12
|
-
distributed_a2a-0.1.9rc0.dist-info/top_level.txt,sha256=23qJ8n5k7796BHDK7a58uuO-X4GV0EgUWcGi8NIn-0k,16
|
|
13
|
-
distributed_a2a-0.1.9rc0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|