1+ from veadk import Agent , Runner
12from veadk .a2a .remote_ve_agent import RemoteVeAgent
2- from veadk .agent import Agent
3- from veadk .memory import ShortTermMemory
4- from agentkit .app import AgentkitA2aApp
3+ from agentkit .apps import AgentkitA2aApp
4+ from google .adk .a2a .executor .a2a_agent_executor import A2aAgentExecutor
55from a2a .types import AgentCard , AgentProvider , AgentSkill , AgentCapabilities
66
77remote_agent = RemoteVeAgent (
88 name = "a2a_agent" ,
9- url = "http://localhost:8000 /" , # <--- url from cloud platform
9+ url = "http://localhost:8001 /" , # <--- url from remote agent service
1010)
1111
1212def add (a : int , b : int ) -> int :
@@ -15,33 +15,34 @@ def add(a: int, b: int) -> int:
1515
1616agent = Agent (
1717 name = "a2a_sample_agent" ,
18- instruction = "You are a helpful assistant." ,
18+ instruction = "You are a helpful assistant that can add numbers and delegate tasks to a remote agent that can roll dice and check prime numbers ." ,
1919 tools = [add ],
2020 sub_agents = [remote_agent ],
2121)
2222
23- a2aApp = AgentkitA2aApp (
24- agent = agent ,
25- app_name = "a2a_sample_app" ,
26- short_term_memory = ShortTermMemory (),
27- )
23+ runner = Runner (agent = agent )
24+
25+
26+ a2aApp = AgentkitA2aApp ()
27+
28+ @a2aApp .agent_executor (runner = runner )
29+ class MyAgentExecutor (A2aAgentExecutor ):
30+ pass
2831
2932if __name__ == "__main__" :
30- from a2a .types import AgentCard , AgentProvider , AgentSkill , AgentCapabilities
31-
3233 agent_card = AgentCard (
33- capabilities = AgentCapabilities (streaming = True ), # 启用流式
34+ capabilities = AgentCapabilities (streaming = True ),
3435 description = agent .description ,
3536 name = agent .name ,
3637 defaultInputModes = ["text" ],
3738 defaultOutputModes = ["text" ],
38- provider = AgentProvider (organization = "veadk " , url = "" ),
39+ provider = AgentProvider (organization = "agentkit " , url = "" ),
3940 skills = [AgentSkill (id = "0" , name = "chat" , description = "Chat" , tags = ["chat" ])],
4041 url = "http://0.0.0.0:8000" ,
4142 version = "1.0.0" ,
4243 )
43-
44- a2a_app .run (
44+
45+ a2aApp .run (
4546 agent_card = agent_card ,
4647 host = "0.0.0.0" ,
4748 port = 8000 ,
0 commit comments