-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
67 lines (55 loc) · 2.84 KB
/
main.py
File metadata and controls
67 lines (55 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import asyncio
from agents import Agent, Runner
from agents.extensions.visualization import draw_graph
from agents.mcp import MCPServer, MCPServerStdio
# Removed imports for sub-agents as they are no longer directly used here
# from search_agent import search_agent
# from classify_agent import classify_agent
# from compose_agent import compose_agent
async def run(mcp_server:MCPServer):
sweetheart_agent = Agent(name="sweetheart agent",
instructions="you give compliments and say a nice things about the user. "
"ALWAYS add 'cute' to your response.")
hello_agent = Agent(
name="Hello Agent",
instructions="You are a helpful assistant that says greets user with a friendly message. "
"please mention user's name if you know it "
"ALWAYS ADD COMPLIMENT from sweetheart tool. "
"If the user asks for a greeting, use the greeting mcp server. ",
tools=[sweetheart_agent.as_tool(tool_name="sweetheart",
tool_description="give compliments and say a nice thing")],
mcp_servers=[mcp_server] # Example: Using the original hello_mcp_server
)
from conductor_server import conductor_agent
draw_graph(conductor_agent).view()
# --- Conductor Agent Definition Removed ---
# test_agent = Agent(...)
# --- Runner call for Conductor Agent Removed ---
# result = await Runner.run(test_agent, "Find events in Lusaka and generate push notifications.")
# print(result.final_output)
# Example usage of the original hello_agent
print("Running hello_agent example...")
result_hello = await Runner.run(hello_agent, "Hi, I'm Jane Doe, please greet me!")
print("Hello Agent Output:", result_hello.final_output)
async def main():
# Example connecting to the original hello_mcp_server
async with MCPServerStdio(
params={
"command": "uv",
"args": ["run", "mcp", "run", "hello_mcp_server.py"], # Runs the greeting server
}) as server:
await run(server)
# If you wanted to connect to the new conductor_server.py, you would change the command/args above
# Example:
# async with MCPServerStdio(
# params={
# "command": "uv",
# "args": ["run", "python", "conductor_server.py"], # Runs the conductor server
# }) as conductor_server:
# # Now you could potentially define another agent that USES the conductor server's tool
# # client_agent = Agent(..., mcp_servers=[conductor_server])
# # await Runner.run(client_agent, "Run the event pipeline for London")
# print("Conductor server setup complete (example usage commented out)")
# pass # Placeholder
if __name__ == "__main__":
asyncio.run(main())