Update wellbe_agent.py
Browse files- wellbe_agent.py +9 -4
wellbe_agent.py
CHANGED
@@ -42,7 +42,12 @@ def initialize_mcp_servers(whoop_email: str, whoop_password: str) -> None:
|
|
42 |
params=cfg["healthcare-mcp-public"], name="Healthcare MCP Server"
|
43 |
)
|
44 |
# _whoop_server = MCPServerStdio(params=cfg["whoop"], name="Whoop MCP Server")
|
45 |
-
_whoop_server =
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
|
48 |
def select_model() -> Union[str, LitellmModel]:
|
@@ -60,14 +65,14 @@ async def answer_question(
|
|
60 |
if _healthcare_server is None:
|
61 |
return "**Error:** MCP servers not initialized."
|
62 |
|
63 |
-
async with _healthcare_server as hserver
|
64 |
agent = Agent(
|
65 |
name="WellBe+ Assistant",
|
66 |
instructions=PROMPT_TEMPLATE,
|
67 |
model=select_model(),
|
68 |
mcp_servers=[
|
69 |
-
hserver
|
70 |
-
|
71 |
],
|
72 |
)
|
73 |
result = await Runner.run(agent, question)
|
|
|
42 |
params=cfg["healthcare-mcp-public"], name="Healthcare MCP Server"
|
43 |
)
|
44 |
# _whoop_server = MCPServerStdio(params=cfg["whoop"], name="Whoop MCP Server")
|
45 |
+
_whoop_server = MCPServerStreamableHttp(
|
46 |
+
params={
|
47 |
+
"url": "https://agents-mcp-hackathon-whoop-mcp-server.hf.space/gradio_api/mcp/sse"
|
48 |
+
},
|
49 |
+
name="Whoop MCP Server"
|
50 |
+
)
|
51 |
|
52 |
|
53 |
def select_model() -> Union[str, LitellmModel]:
|
|
|
65 |
if _healthcare_server is None:
|
66 |
return "**Error:** MCP servers not initialized."
|
67 |
|
68 |
+
async with _healthcare_server as hserver, _whoop_server as wserver:
|
69 |
agent = Agent(
|
70 |
name="WellBe+ Assistant",
|
71 |
instructions=PROMPT_TEMPLATE,
|
72 |
model=select_model(),
|
73 |
mcp_servers=[
|
74 |
+
hserver,
|
75 |
+
wserver
|
76 |
],
|
77 |
)
|
78 |
result = await Runner.run(agent, question)
|