This repository was archived by the owner on Dec 23, 2025. It is now read-only.
forked from RDI-Foundation/agentbeats-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.py
More file actions
55 lines (45 loc) · 1.76 KB
/
server.py
File metadata and controls
55 lines (45 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import argparse
import uvicorn
from a2a.server.apps import A2AStarletteApplication
from a2a.server.request_handlers import DefaultRequestHandler
from a2a.server.tasks import InMemoryTaskStore
from a2a.types import (
AgentCapabilities,
AgentCard,
AgentSkill,
)
from executor import Executor
def main():
parser = argparse.ArgumentParser(description="Run the debate participant (purple agent).")
parser.add_argument("--host", type=str, default="127.0.0.1", help="Host to bind the server")
parser.add_argument("--port", type=int, default=9019, help="Port to bind the server")
parser.add_argument("--card-url", type=str, help="URL to advertise in the agent card")
args = parser.parse_args()
skill = AgentSkill(
id="debate_participant",
name="Debate Participant",
description="Participates in a debate as either Pro or Con given role instructions.",
tags=["debate"],
examples=["Debate topic: Should artificial intelligence be regulated? Present your opening argument."],
)
agent_card = AgentCard(
name="Debater",
description="A debater agent that produces persuasive arguments given role instructions.",
url=args.card_url or f"http://{args.host}:{args.port}/",
version="1.0.0",
default_input_modes=["text"],
default_output_modes=["text"],
capabilities=AgentCapabilities(streaming=True),
skills=[skill],
)
request_handler = DefaultRequestHandler(
agent_executor=Executor(),
task_store=InMemoryTaskStore(),
)
server = A2AStarletteApplication(
agent_card=agent_card,
http_handler=request_handler,
)
uvicorn.run(server.build(), host=args.host, port=args.port)
if __name__ == "__main__":
main()