-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathagent.py
More file actions
30 lines (26 loc) · 1.18 KB
/
Copy pathagent.py
File metadata and controls
30 lines (26 loc) · 1.18 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
import asyncio
from mcp_agent.core.fastagent import FastAgent
# Create the application
fast = FastAgent("FastAgent Example")
# Define the agent
@fast.agent(
instruction="You are a helpful AI Agent that is able to look up locations in the " +
"United States by fetching latitude and longitude coordinates for " +
"locations and using that to call the weather tool to answer questions " +
"about the weather of various locations. When fetching latitude and " +
"longitude for a location, try wikipedia first. If you're asked for a location" +
"that is not in the United States, you should respond with a message saying " +
"that the location is outside the United States and you can't help with " +
"that. Always answer as concisely as possible, if you can answer the question" +
"in a single sentence, do so.",
servers=[
"fetch",
"weather"
]
)
async def main():
# use the --model command line switch or agent arguments to change model
async with fast.run() as agent:
await agent()
if __name__ == "__main__":
asyncio.run(main())