-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathexample.py
36 lines (29 loc) · 813 Bytes
/
example.py
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
from solana_agentkit.agent import SolanaAgent
from solana_agentkit.tools import JupiterTradeTool, TokenDeployTool
from langchain.llms import OpenAI
import asyncio
async def main():
# Initialize language model
llm = OpenAI(temperature=0.7)
# Initialize tools
tools = [
JupiterTradeTool(),
TokenDeployTool()
]
# Create agent
agent = SolanaAgent(
llm=llm,
tools=tools,
rpc_url="https://api.mainnet-beta.solana.com"
)
# Initialize agent
await agent.initialize()
# Process a message
response = await agent.process_message(
"Deploy a new token called 'MyToken' with symbol 'MTK'"
)
print(response)
# Cleanup
await agent.cleanup()
if __name__ == "__main__":
asyncio.run(main())