1- import random
2-
3- from veadk import Agent , Runner
4- from google .adk .a2a .utils .agent_to_a2a import to_a2a
5- from google .adk .tools .tool_context import ToolContext
6- from google .genai import types
1+ from a2a .types import AgentCapabilities , AgentCard , AgentProvider , AgentSkill
72from agentkit .apps import AgentkitA2aApp
8- from tools .roll_die import roll_die
9- from tools .check_prime import check_prime
10- from a2a .types import AgentCard , AgentProvider , AgentCapabilities , AgentSkill
113from google .adk .a2a .executor .a2a_agent_executor import A2aAgentExecutor
4+ from tools .check_prime import check_prime
5+ from tools .roll_die import roll_die
6+ from veadk import Agent , Runner
127
138a2a_app = AgentkitA2aApp ()
149root_agent = Agent (
15- name = ' hello_world_agent' ,
10+ name = " hello_world_agent" ,
1611 description = (
17- ' hello world agent that can roll a dice of 8 sides and check prime numbers.'
12+ " hello world agent that can roll a dice of 8 sides and check prime numbers."
1813 ),
1914 instruction = """
2015 You roll dice and answer questions about the outcome of the dice rolls.
3631 tools = [
3732 roll_die ,
3833 check_prime ,
39- ]
34+ ],
4035)
4136
4237runner = Runner (agent = root_agent )
4338
39+
4440@a2a_app .agent_executor (runner = runner )
4541class MyAgentExecutor (A2aAgentExecutor ):
4642 pass
4743
44+
4845agent_card = AgentCard (
49- capabilities = AgentCapabilities (streaming = True ),
50- description = root_agent .description ,
51- name = root_agent .name ,
52- defaultInputModes = ["text" ],
53- defaultOutputModes = ["text" ],
54- provider = AgentProvider (organization = "agentkit" , url = "" ),
55- skills = [AgentSkill (id = "0" , name = "chat" , description = "Chat" , tags = ["chat" ])],
56- url = "http://localhost:8001" ,
57- version = "1.0.0" ,
46+ capabilities = AgentCapabilities (streaming = True ),
47+ description = root_agent .description ,
48+ name = root_agent .name ,
49+ default_input_modes = ["text" ],
50+ default_output_modes = ["text" ],
51+ provider = AgentProvider (organization = "agentkit" , url = "" ),
52+ skills = [AgentSkill (id = "0" , name = "chat" , description = "Chat" , tags = ["chat" ])],
53+ url = "http://localhost:8001" ,
54+ version = "1.0.0" ,
5855)
5956
60- print (' agent start successfully ' , root_agent .name )
57+ print (" agent start successfully " , root_agent .name )
6158
6259# a2a_app = to_a2a(root_agent, port=8001)
63- if __name__ == ' __main__' :
64- a2a_app .run (agent_card = agent_card , host = "0.0.0.0" , port = 8001 )
60+ if __name__ == " __main__" :
61+ a2a_app .run (agent_card = agent_card , host = "0.0.0.0" , port = 8001 )
0 commit comments