Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/strands/multiagent/a2a/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
A2AAgent: A wrapper that adapts a Strands Agent to be A2A-compatible.
"""

from .agent import A2AAgent
from .server import A2AServer

__all__ = ["A2AAgent"]
__all__ = ["A2AServer"]
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
logger = logging.getLogger(__name__)


class A2AAgent:
class A2AServer:
"""A2A-compatible wrapper for Strands Agent."""

def __init__(
Expand All @@ -32,6 +32,7 @@ def __init__(
host: str = "0.0.0.0",
port: int = 9000,
version: str = "0.0.1",
skills: list[AgentSkill] | None,
):
"""Initialize an A2A-compatible agent from a Strands agent.

Expand All @@ -42,6 +43,7 @@ def __init__(
host: The hostname or IP address to bind the A2A server to. Defaults to "0.0.0.0".
port: The port to bind the A2A server to. Defaults to 9000.
version: The version of the agent. Defaults to "0.0.1".
skills: The list of capabilities or functions the agent can perform.
"""
self.host = host
self.port = port
Expand All @@ -56,6 +58,7 @@ def __init__(
agent_executor=StrandsA2AExecutor(self.strands_agent),
task_store=InMemoryTaskStore(),
)
self._agent_skills = skills or self._get_skills_from_tools()
logger.info("Strands' integration with A2A is experimental. Be aware of frequent breaking changes.")

@property
Expand Down Expand Up @@ -88,18 +91,33 @@ def public_agent_card(self) -> AgentCard:
capabilities=self.capabilities,
)

@property
def agent_skills(self) -> list[AgentSkill]:
"""Get the list of skills this agent provides.
def _get_skills_from_tools(self) -> list[AgentSkill]:
"""Get the list of skills from Strands agent tools.

Skills represent specific capabilities that the agent can perform.
Strands agent tools are adapted to A2A skills.

Returns:
list[AgentSkill]: A list of skills this agent provides.
"""
# TODO: translate Strands tools (native & MCP) to skills
return []
return [
AgentSkill(name=config["name"], id=config["name"], description=config["description"], tags=[])
for config in self.strands_agent.tool_registry.get_all_tools_config().values()
]

@property
def agent_skills(self) -> list[AgentSkill]:
"""Get the list of skills this agent provides."""
return self._agent_skills

@agent_skills.setter
def agent_skills(self, skills: list[AgentSkill]) -> None:
"""Set the list of skills this agent provides.

Args:
skills: A list of AgentSkill objects to set for this agent.
"""
self._agent_skills = skills

def to_starlette_app(self) -> Starlette:
"""Create a Starlette application for serving this agent via HTTP.
Expand Down
5 changes: 5 additions & 0 deletions tests/multiagent/a2a/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def mock_strands_agent():
mock_result.message = {"content": [{"text": "Test response"}]}
agent.return_value = mock_result

# Setup mock tool registry
mock_tool_registry = MagicMock()
mock_tool_registry.get_all_tools_config.return_value = {}
agent.tool_registry = mock_tool_registry

return agent


Expand Down
165 changes: 0 additions & 165 deletions tests/multiagent/a2a/test_agent.py

This file was deleted.

Loading
Loading