11import logging
2- import os
32import sys
43import traceback
54
65import click
76import uvicorn
8- from dotenv import load_dotenv
97
108from agent_executors import ( # type: ignore[import-untyped]
119 EchoAgentExecutor ,
1210 HelloWorldAgentExecutor ,
1311)
12+ from dotenv import load_dotenv
1413
1514from a2a .server .apps import A2AStarletteBuilder , A2AStarletteRouteBuilder
1615from a2a .server .request_handlers import DefaultRequestHandler
@@ -54,19 +53,19 @@ def main(host: str, port: int):
5453 )
5554
5655 echo_skill = AgentSkill (
57- id = " echo" ,
58- name = " Echo input" ,
59- description = " Returns the input text as is" ,
60- tags = [" echo" ],
61- examples = [" Hello!" , " Repeat after me" ],
56+ id = ' echo' ,
57+ name = ' Echo input' ,
58+ description = ' Returns the input text as is' ,
59+ tags = [' echo' ],
60+ examples = [' Hello!' , ' Repeat after me' ],
6261 )
6362 echo_card = AgentCard (
64- name = " Echo Agent" ,
65- description = " An agent that echoes back your input." ,
66- url = f" http://{ host } :{ port } /a2a/echo" ,
67- version = " 1.0.0" ,
68- defaultInputModes = [" text" ],
69- defaultOutputModes = [" text" ],
63+ name = ' Echo Agent' ,
64+ description = ' An agent that echoes back your input.' ,
65+ url = f' http://{ host } :{ port } /a2a/echo' ,
66+ version = ' 1.0.0' ,
67+ defaultInputModes = [' text' ],
68+ defaultOutputModes = [' text' ],
7069 capabilities = AgentCapabilities (streaming = True ),
7170 skills = [echo_skill ],
7271 supportsAuthenticatedExtendedCard = False ,
@@ -80,16 +79,11 @@ def main(host: str, port: int):
8079 http_handler = echo_handler ,
8180 )
8281
83- server = (
84- A2AStarletteBuilder ()
85- .mount (hello_agent )
86- .mount (echo_agent )
87- .build ()
88- )
82+ server = A2AStarletteBuilder ().mount (hello_agent ).mount (echo_agent ).build ()
8983 uvicorn .run (server , host = host , port = port )
9084
9185
92- if __name__ == " __main__" :
86+ if __name__ == ' __main__' :
9387 try :
9488 main ()
9589 except Exception as _ :
0 commit comments