|
19 | 19 | from agent import agent_run_config |
20 | 20 | from fastapi import FastAPI |
21 | 21 | from fastmcp import FastMCP |
22 | | - |
| 22 | +from google.adk.a2a.utils.agent_card_builder import AgentCardBuilder |
23 | 23 | from veadk.a2a.ve_a2a_server import init_app |
24 | 24 | from veadk.runner import Runner |
25 | 25 | from veadk.tracing.telemetry.exporters.apmplus_exporter import APMPlusExporter |
|
39 | 39 | agent = agent_run_config.agent |
40 | 40 | short_term_memory = agent_run_config.short_term_memory |
41 | 41 |
|
| 42 | +agent_card_builder = AgentCardBuilder(agent=agent) |
| 43 | + |
42 | 44 |
|
43 | 45 | def load_tracer() -> None: |
44 | 46 | EXPORTER_REGISTRY = { |
@@ -104,18 +106,25 @@ async def run_agent( |
104 | 106 | return run_agent |
105 | 107 |
|
106 | 108 |
|
| 109 | +async def agent_card() -> dict: |
| 110 | + agent_card = await agent_card_builder.build() |
| 111 | + return agent_card.model_dump() |
| 112 | + |
| 113 | + |
107 | 114 | load_tracer() |
108 | 115 |
|
| 116 | +# Build a run_agent function for building MCP server |
| 117 | +run_agent_func = build_mcp_run_agent_func() |
| 118 | + |
109 | 119 | a2a_app = init_app( |
110 | 120 | server_url="0.0.0.0", |
111 | 121 | app_name=app_name, |
112 | 122 | agent=agent, |
113 | 123 | short_term_memory=short_term_memory, |
114 | 124 | ) |
115 | 125 |
|
116 | | -# Build a run_agent function for building MCP server |
117 | | -run_agent_func = build_mcp_run_agent_func() |
118 | 126 | a2a_app.post("/run_agent", operation_id="run_agent", tags=["mcp"])(run_agent_func) |
| 127 | +a2a_app.get("/agent_card", operation_id="agent_card", tags=["mcp"])(agent_card) |
119 | 128 |
|
120 | 129 |
|
121 | 130 | # === Build mcp server === |
|
0 commit comments