Code

cookbook/agent_concepts/tools/twitter_tools.py
from agno.agent import Agent
from agno.tools.twitter import TwitterTools

agent = Agent(
    tools=[TwitterTools()],
    show_tool_calls=True,
    markdown=True,
)
agent.print_response("Post a tweet saying 'Hello World from Agno!'")

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.

2

Set your Twitter credentials

export TWITTER_API_KEY=xxx
export TWITTER_API_SECRET=xxx
export TWITTER_ACCESS_TOKEN=xxx
export TWITTER_ACCESS_TOKEN_SECRET=xxx
3

Install libraries

pip install -U tweepy agno
4

Run Agent