Skip to content

Commit b332f4c

Browse files
committed
add integ test for a2a
1 parent 09c0e43 commit b332f4c

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

tests_integ/a2a/__init__.py

Whitespace-only changes.

tests_integ/a2a/a2a_server.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from strands import Agent
2+
from strands.multiagent.a2a import A2AServer
3+
4+
# Create an agent and serve it over A2A
5+
agent = Agent(
6+
name="Test agent",
7+
description="Test description here",
8+
callback_handler=None,
9+
)
10+
a2a_server = A2AServer(
11+
agent=agent,
12+
host="localhost",
13+
port=9000,
14+
)
15+
a2a_server.serve()
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import atexit
2+
import os
3+
import subprocess
4+
import time
5+
6+
from strands.agent.a2a_agent import A2AAgent
7+
8+
# Start our A2A server
9+
server_path = os.path.join(os.path.dirname(__file__), "a2a_server.py")
10+
server = subprocess.Popen(["python", server_path])
11+
12+
13+
def cleanup():
14+
server.terminate()
15+
16+
17+
atexit.register(cleanup)
18+
time.sleep(5) # Wait for A2A server to start
19+
20+
# Connect to our A2A server
21+
a2a_agent = A2AAgent(endpoint="http://localhost:9000")
22+
23+
# Invoke our A2A server
24+
result = a2a_agent("Hello there!")
25+
26+
# TODO: assertions on result

0 commit comments

Comments
 (0)