IntentKit provides two ways to integrate with X: using it as an entrypoint for your agent, or incorporating X-specific skills into your agent's capabilities.
IntentKit provides a set of X-specific skills that can be added to your agent's toolkit. All skills are built on top of the XBaseTool
base class which handles authentication and client initialization.
The following X skills are available:
- Follow User (
follow_user
): Follow a specified X user - Get Mentions (
get_mentions
): Retrieve mentions of the authenticated user - Get Timeline (
get_timeline
): Fetch tweets from a user's timeline - Like Tweet (
like_tweet
): Like a specific tweet - Post Tweet (
post_tweet
): Post a new tweet - Reply Tweet (
reply_tweet
): Reply to a specific tweet - Retweet (
retweet
): Retweet a specific tweet - Search Tweets (
search_tweets
): Search for tweets based on query
Add X skills to your agent: Just configure the skills you need in your agent's config.
agent.twitter_skills = ["get_mentions", "get_timeline", "post_tweet", "reply_tweet", "follow_user", "like_tweet", "retweet", "search_tweets"]
Before the first use, agent will request you to click the link to authorize the agent to access your twitter account.
If you want to use your own twitter developer account, you can set it as follows:
agent.twitter_config = {
"bearer_token": "your_bearer_token",
"consumer_key": "your_consumer_key",
"consumer_secret": "your_consumer_secret",
"access_token": "your_access_token",
"access_token_secret": "your_access_token_secret"
}
Entrypoint is a type of conversational interface.
The X entrypoint allows your agent to automatically respond to X mentions. When enabled, the agent will monitor mentions every 15 minutes and respond to them all.
We suggest you only use twitter skills, not use it as an entrypoint.
- Enable X Entrypoint for your agent:
agent.twitter_enabled = True
- Configure X credentials in your agent's config: Get your X credentials from your X developer portal.
Notice: Free accounts can only use post_tweet skill, if you want to use other skills, you need to upgrade your account.
agent.twitter_config = {
"bearer_token": "your_bearer_token",
"consumer_key": "your_consumer_key",
"consumer_secret": "your_consumer_secret",
"access_token": "your_access_token",
"access_token_secret": "your_access_token_secret"
}
- Run the X entrypoint: If you have use the docker-compose, it already run.
python -m app.entrypoints.twitter
The X entrypoint:
- Polls for new mentions every 15 minutes
- Uses both
since_id
andstart_time
for reliable mention tracking - Maintains the last processed tweet ID in the agent's plugin data
- Automatically manages API rate limits and quotas
- Responds to mentions as threaded replies
Only when use the OAuth2.0 authentication, intentkit has a built-in rate limit:
- post tweet: 20/day
- reply tweet: 20/day
- retweet: 5/15min
- follow: 5/15min
- like: 100/day
- get mentions: 1/4hr
- get timeline: 3/day
- search: 3/day
You can set the rate limit under the intentkit config in the future. Not released yet.
-
Error Handling
- Always handle X API errors gracefully
- Implement exponential backoff for rate limits
- Log failed interactions for debugging
-
Content Guidelines
- Keep responses within X's character limit
- Handle thread creation for longer responses
- Consider X's content policies
-
Security
- Store X credentials securely
- Use environment variables for sensitive data
- Regularly rotate access tokens
-
Social Media Manager Bot
from models.agent import Agent # Create an agent with X skills agent = Agent( name="Social Media Manager", twitter_enabled=True, twitter_skills=["get_mentions", "post_tweet", "reply_tweet"], twitter_config={ "bearer_token": "your_bearer_token", "consumer_key": "your_consumer_key", "consumer_secret": "your_consumer_secret", "access_token": "your_access_token", "access_token_secret": "your_access_token_secret" }, prompt="You are a helpful social media manager. Monitor mentions and engage with users professionally." )
-
Content Aggregator with Timeline Analysis
# Create an agent that analyzes timeline content agent = Agent( name="Content Analyzer", twitter_enabled=True, twitter_skills=["get_timeline", "post_tweet"], twitter_config={...}, # X credentials prompt="""You are a content analyzer. Monitor the timeline for trending topics and provide insights. When you find interesting patterns, share them as tweets.""" )
-
Interactive Support Assistant
# Create a support agent that handles user queries agent = Agent( name="Support Assistant", twitter_enabled=True, twitter_skills=["get_mentions", "reply_tweet"], twitter_config={...}, # X credentials prompt="""You are a support assistant. Monitor mentions for support queries. Respond helpfully and professionally to user questions. If you can't help, politely explain why and suggest alternatives.""" )
Each example demonstrates:
- Proper agent configuration with X credentials
- Specific skill selection for the use case
- Custom prompts to guide agent behavior
- Integration with IntentKit's agent system
Common issues and solutions:
-
Rate Limit Exceeded
- Check your quota settings
- Implement proper waiting periods
- Use the built-in quota management
-
Authentication Errors
- Verify credential configuration
- Check token expiration
- Ensure proper permission scopes
-
Missing Mentions
- Verify
since_id
tracking - Check
start_time
configuration - Monitor the X entrypoint logs
- Verify