Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 2 additions & 3 deletions src/strands/multiagent/a2a/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(
agent: SAAgent,
*,
# AgentCard
host: str = "0.0.0.0",
host: str = "127.0.0.1",
port: int = 9000,
http_url: str | None = None,
serve_at_root: bool = False,
Expand All @@ -42,13 +42,12 @@ def __init__(
queue_manager: QueueManager | None = None,
push_config_store: PushNotificationConfigStore | None = None,
push_sender: PushNotificationSender | None = None,

):
"""Initialize an A2A-compatible server from a Strands agent.

Args:
agent: The Strands Agent to wrap with A2A compatibility.
host: The hostname or IP address to bind the A2A server to. Defaults to "0.0.0.0".
host: The hostname or IP address to bind the A2A server to. Defaults to "127.0.0.1".
port: The port to bind the A2A server to. Defaults to 9000.
http_url: The public HTTP URL where this agent will be accessible. If provided,
this overrides the generated URL from host/port and enables automatic
Expand Down
10 changes: 5 additions & 5 deletions tests/strands/multiagent/a2a/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def test_a2a_agent_initialization(mock_strands_agent):
assert a2a_agent.strands_agent == mock_strands_agent
assert a2a_agent.name == "Test Agent"
assert a2a_agent.description == "A test agent for unit testing"
assert a2a_agent.host == "0.0.0.0"
assert a2a_agent.host == "127.0.0.1"
assert a2a_agent.port == 9000
assert a2a_agent.http_url == "http://0.0.0.0:9000/"
assert a2a_agent.http_url == "http://127.0.0.1:9000/"
assert a2a_agent.version == "0.0.1"
assert isinstance(a2a_agent.capabilities, AgentCapabilities)
assert len(a2a_agent.agent_skills) == 1
Expand Down Expand Up @@ -85,7 +85,7 @@ def test_public_agent_card(mock_strands_agent):
assert isinstance(card, AgentCard)
assert card.name == "Test Agent"
assert card.description == "A test agent for unit testing"
assert card.url == "http://0.0.0.0:9000/"
assert card.url == "http://127.0.0.1:9000/"
assert card.version == "0.0.1"
assert card.default_input_modes == ["text"]
assert card.default_output_modes == ["text"]
Expand Down Expand Up @@ -448,7 +448,7 @@ def test_serve_with_starlette(mock_run, mock_strands_agent):
mock_run.assert_called_once()
args, kwargs = mock_run.call_args
assert isinstance(args[0], Starlette)
assert kwargs["host"] == "0.0.0.0"
assert kwargs["host"] == "127.0.0.1"
assert kwargs["port"] == 9000


Expand All @@ -462,7 +462,7 @@ def test_serve_with_fastapi(mock_run, mock_strands_agent):
mock_run.assert_called_once()
args, kwargs = mock_run.call_args
assert isinstance(args[0], FastAPI)
assert kwargs["host"] == "0.0.0.0"
assert kwargs["host"] == "127.0.0.1"
assert kwargs["port"] == 9000


Expand Down
Loading