File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 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 ()
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments