gpt-4o
model from OpenAI for language processing.CodeAgent
to orchestrate a series of steps toward a final result.AgentRuntime
to connect clients to the agent and manage execution.SimpleMessageClient
for local testing with predefined messages.TwitterMentionClient
for processing mentions on Twitter.get_coin_price
(CoinGecko) to fetch real-time cryptocurrency prices.get_token_profile
(DexScreener) to retrieve token profiles.template.env
to .env
and populate it with your OpenAI API key, agent wallet address, and optional Twitter API credentials (if using TwitterMentionClient
):
SOLANA_KEY_PATH
in .agents.env file to point the path to your Solana walletagent.py
):
Create a file named agent.py
with the following Python code. Remember to replace placeholders with your actual values.
.env
file.
LiteLLMModel
with the specified model ID and API key.
coingecko.get_coin_price
and dexscreener.get_token_profile
CodeAgent
with the specified toolsSimpleMessageClient
with a sample question and Solana transaction link.AgentRuntime
with the agent, pricing, input, and output.TWITTER_CONSUMER_API_KEY
, TWITTER_CONSUMER_API_SECRET
, TWITTER_ACCESS_TOKEN
and TWITTER_ACCESS_TOKEN_SECRET
environment variables defined inside .env file.
TwitterMentionClient
import statementtwitter_client
initialization with the proper credentialstwitter_client
client to the AgentRuntime
arguments for inputs
and outputs