Skip to main content
XTools allows an Agent to interact with X, providing functionality for posting, messaging, and searching tweets.

Prerequisites

Install the dependencies:
Tweepy is a Python library for interacting with the X API.

Setup

  1. Create X Developer Account
    • Visit developer.x.com and apply for developer access
    • Create a new project and app in your developer portal
  2. Configure App Permissions
    • Select Read and write to create posts and replies
    • Select Read, write, and DMs if the agent will send direct messages
    • Regenerate the access token and secret after changing app permissions
  3. Generate API Credentials
    • Navigate to your app’s “Keys and tokens” section
    • Generate and copy these credentials:
      • API Key & Secret
      • Bearer Token
      • Access Token & Secret
  4. Configure Environment

Example

Replace @AgnoAgi with the X username associated with your access token.
cookbook/91_tools/x_tools.py

Toolkit Params

Toolkit Functions

You can use include_tools or exclude_tools to modify the list of tools the agent has access to. Learn more about selecting tools.

Developer Resources