> ## Documentation Index
> Fetch the complete documentation index at: https://explore.airia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# X Tool

Connect your X (Twitter) account to search and retrieve tweets using OAuth authentication.

## Prerequisites

* Active X (Twitter) account
* Project with agent building permissions

## Add X Tool to Your Project

1. Navigate to **Tools Library** and search for "X"
2. Click **Add Tool** on the X - Search Tweets listing
3. Enter a **Tool Name** for your library
4. Click **Save**

## Configure Authentication

1. In the tool setup page, select **X OAuth** from the authentication dropdown

2. Click **Create a New Credential**

3. Click **Authorize** to connect your X account

4. Grant the required permissions when prompted

5. Save the generated token as a new credential

> 💡 **Note:** Your X account credentials are automatically refreshed in the background through OAuth refresh tokens.

## Add Tool to Agent

1. Open your agent in the **Agent Canvas**
2. Drag the X tool from your library to the agent
3. Configure any additional settings as needed

For detailed setup instructions, see the [Tools Setup Guide](../tools.mdx).

## Using X Search Tool

The X Search tool queries recent tweets from the last 7 days using the X API.

### Search for Tweets by Topic

Ask your agent to search for specific topics:

```
"Search X for tweets about AI development"
```

<img src="https://mintcdn.com/airia/ALXu7UtGeI560bwk/integrations/Images/X_tweets.png?fit=max&auto=format&n=ALXu7UtGeI560bwk&q=85&s=9a48f7fea18aadbe97046dcdabd96afb" alt="X results" width="822" height="753" data-path="integrations/Images/X_tweets.png" />

### Search by User Account

Query tweets from specific users:

```
"Show me recent tweets from @username"
```

<img src="https://mintcdn.com/airia/ALXu7UtGeI560bwk/integrations/Images/X_user_tweets.png?fit=max&auto=format&n=ALXu7UtGeI560bwk&q=85&s=a874486e7035d2ed5308b52f43278ec9" alt="X results" width="779" height="577" data-path="integrations/Images/X_user_tweets.png" />

### Paginate Through Results

Request additional results with follow-up queries:

```
"Show me more results" or "Are there more tweets?"
```

<img src="https://mintcdn.com/airia/ALXu7UtGeI560bwk/integrations/Images/X_more_tweets.png?fit=max&auto=format&n=ALXu7UtGeI560bwk&q=85&s=75001e84119653424d5bffc4fd9430a2" alt="X more results" width="821" height="718" data-path="integrations/Images/X_more_tweets.png" />

### Specify Result Count

Request a specific number of tweets:

```
"Get me 30 recent tweets about machine learning"
```

<img src="https://mintcdn.com/airia/7Fj-j5Zqi0XS-Z57/integrations/Images/X_30_tweets.png?fit=max&auto=format&n=7Fj-j5Zqi0XS-Z57&q=85&s=a90ed74a9c6f1c6bf627c394bde36fd3" alt="X multiple tweets" width="797" height="1085" data-path="integrations/Images/X_30_tweets.png" />

## Best Practices

> 💡 **Tip:** Add a custom prompt to your agent with details about your search use case, specific accounts you monitor, or your industry domain for better results.

> ⚠️ **Limitation:** X Search tool is limited to tweets from the last 7 days due to X API restrictions.
