Skip to content

Commit 1c719bb

Browse files
committed
feat(a2a): tools as skills
1 parent 3ae8d77 commit 1c719bb

File tree

5 files changed

+345
-170
lines changed

5 files changed

+345
-170
lines changed

src/strands/multiagent/a2a/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
A2AAgent: A wrapper that adapts a Strands Agent to be A2A-compatible.
1010
"""
1111

12-
from .agent import A2AAgent
12+
from .server import A2AServer
1313

14-
__all__ = ["A2AAgent"]
14+
__all__ = ["A2AServer"]

src/strands/multiagent/a2a/agent.py renamed to src/strands/multiagent/a2a/server.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
logger = logging.getLogger(__name__)
2222

2323

24-
class A2AAgent:
24+
class A2AServer:
2525
"""A2A-compatible wrapper for Strands Agent."""
2626

2727
def __init__(
@@ -98,8 +98,14 @@ def agent_skills(self) -> list[AgentSkill]:
9898
Returns:
9999
list[AgentSkill]: A list of skills this agent provides.
100100
"""
101-
# TODO: translate Strands tools (native & MCP) to skills
102-
return []
101+
skills: list[AgentSkill] = []
102+
tool_configs = self.strands_agent.tool_registry.get_all_tools_config().values()
103+
for config in tool_configs:
104+
skills.append(
105+
AgentSkill(name=config["name"], id=config["name"], description=config["description"], tags=[])
106+
)
107+
108+
return skills
103109

104110
def to_starlette_app(self) -> Starlette:
105111
"""Create a Starlette application for serving this agent via HTTP.
@@ -110,6 +116,7 @@ def to_starlette_app(self) -> Starlette:
110116
Returns:
111117
Starlette: A Starlette application configured to serve this agent.
112118
"""
119+
print(self.public_agent_card)
113120
return A2AStarletteApplication(agent_card=self.public_agent_card, http_handler=self.request_handler).build()
114121

115122
def to_fastapi_app(self) -> FastAPI:

tests/multiagent/a2a/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ def mock_strands_agent():
2222
mock_result.message = {"content": [{"text": "Test response"}]}
2323
agent.return_value = mock_result
2424

25+
# Setup mock tool registry
26+
mock_tool_registry = MagicMock()
27+
mock_tool_registry.get_all_tools_config.return_value = {}
28+
agent.tool_registry = mock_tool_registry
29+
2530
return agent
2631

2732

tests/multiagent/a2a/test_agent.py

Lines changed: 0 additions & 165 deletions
This file was deleted.

0 commit comments

Comments
 (0)