X (Twitter)
API Key RequiredPost and read on X (formerly Twitter). Build AI agents that use X (Twitter)with Agno Builder's visual drag-and-drop interface — no code required to prototype.
What is the X (Twitter) tool?
The X (Twitter) tool is a built-in capability in the Agno framework that allows AI agents to post and read on x (formerly twitter). When added to an agent in Agno Builder, the agent can autonomously decide when to invoke this tool based on the user's request.
This tool requires a X_BEARER_TOKEN environment variable. Get your API key at developer.x.com.
How to use X (Twitter) in Agno Builder
- 1
Create an agent
Drag an Agent node onto the canvas in Agno Builder, or use one of the built-in templates.
- 2
Enable X (Twitter)
Click the agent, go to the Tools tab, and toggle on "X (Twitter)" from the communication category.
- 3
Add your API key
Enter your X_BEARER_TOKEN in the tool configuration. Your key stays in your browser and is never stored on our servers.
- 4
Test in chat
Open the chat panel and send a message. The agent will automatically use X (Twitter) when relevant.
- 5
Export Python code
Click File > Export Python to get clean, runnable code with the correct imports for X (Twitter).
Python code example
This is the code Agno Builder exports when you use X (Twitter):
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.x import XTools
agent = Agent(
name="X (Twitter) Agent",
model=OpenAIChat(id="gpt-4o"),
tools=[XTools()],
instructions=["Use the x (twitter) tool to help the user."],
markdown=True,
)
agent.print_response("Help me with a x task")Install with: pip install agno # + set X_BEARER_TOKEN