Refining
Step 1: Monitor Agent Performance
# monitor_agent.py
from database import XynaeDatabase
import os
from dotenv import load_dotenv
from datetime import datetime, timedelta
load_dotenv()
db = XynaeDatabase(
mongodb_uri=os.getenv("MONGODB_URI"),
database_name="defi_sage"
)
if db.is_connected():
print("π DeFi Sage Performance Dashboard\n")
print("=" * 50)
# Get statistics
stats = db.get_stats()
print(f"\nπ Overall Statistics:")
print(f" Total Tweets: {stats['tweets_count']}")
print(f" Total Replies: {stats['replies_count']}")
print(f" Total Mentions: {stats['mentions_count']}")
# Recent activity
print(f"\nπ Recent Activity (Last 24 hours):")
recent_tweets = db.get_recent_tweets(limit=10)
print(f" Recent Tweets: {len(recent_tweets)}")
recent_replies = db.get_recent_replies(limit=10)
print(f" Recent Replies: {len(recent_replies)}")
# Show last 5 tweets
print(f"\nπ Last 5 Tweets:")
for i, tweet in enumerate(recent_tweets[:5], 1):
timestamp = tweet.get('timestamp', 'Unknown')
content = tweet.get('tweet_content', '')[:60] + "..."
print(f" {i}. [{timestamp}] {content}")
print("\n" + "=" * 50)
else:
print("β Cannot connect to database")Step 2: Analyze and Refine Content
Step 3: Adjust Based on Feedback
Step 4: A/B Test Different Approaches
Last updated