crewai-twitterapi-io
CrewAI tools for reading X (Twitter) data through the TwitterAPI.io REST API. No X developer account is needed, only a TwitterAPI.io API key.
| Tool | What it does |
|---|---|
TwitterApiIoSearchTool |
Searches tweets, with X advanced search operators (from:, "exact phrase", lang:, since:, min_faves:, #hashtag ...). Paginates up to 100 results. |
TwitterApiIoUserTool |
Returns a user's public profile (bio, followers, verification) and, optionally, their most recent tweets. |
Both tools are read-only and return compact JSON (text, link, time, engagement counts and author for each tweet), which keeps agent context small.
Install
pip install crewai-twitterapi-io
Get an API key at twitterapi.io and set it as an environment variable:
export TWITTERAPI_IO_API_KEY="your_key"
You can also pass it directly: TwitterApiIoSearchTool(api_key="your_key").
Example
from crewai import Agent, Crew, Task
from crewai_twitterapi_io import TwitterApiIoSearchTool, TwitterApiIoUserTool
researcher = Agent(
role="Social media researcher",
goal="Summarize what people on X are saying about a topic",
backstory="You track conversations on X and report the key points with links.",
tools=[TwitterApiIoSearchTool(), TwitterApiIoUserTool()],
)
task = Task(
description="Find the 30 most recent English tweets about 'crewAI' and summarize the main themes, citing tweet links.",
expected_output="A short summary with 3-5 themes and example tweet links.",
agent=researcher,
)
print(Crew(agents=[researcher], tasks=[task]).kickoff())
Calling a tool directly:
from crewai_twitterapi_io import TwitterApiIoSearchTool, TwitterApiIoUserTool
print(TwitterApiIoSearchTool().run(query="from:OpenAI", query_type="Latest", max_results=10))
print(TwitterApiIoUserTool().run(username="OpenAI", include_tweets=True))
Parameters
TwitterApiIoSearchTool.run(query, query_type="Latest", max_results=20)
query: search text, X advanced search operators supported.query_type:"Latest"(newest first) or"Top"(most relevant).max_results: 1-100.
TwitterApiIoUserTool.run(username, include_tweets=True)
username: X username, with or without@.include_tweets: also return the most recent tweets.
On a network or API error the tools return {"success": false, "error": "..."} instead of raising, so the agent can decide what to do.
Pricing
Requests are billed to your TwitterAPI.io account. See twitterapi.io/pricing.
License
MIT
Metadata
Release files for crewai-twitterapi-io 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| crewai_twitterapi_io-0.1.0.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| crewai_twitterapi_io-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.9 kB
Release files / crewai_twitterapi_io-0.1.0.tar.gz
| Download URL | crewai_twitterapi_io-0.1.0.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35230faf819949176a2894687e14c9600b001e3bfc9c3d1f30a791589a2db80c
|
|
BLAKE2b-256 checksum How to use checksums |
c5252a39d4bed6c4665b193cf8eb6a7d2b74a1c55e9508386f5274f048ad5716
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / crewai_twitterapi_io-0.1.0-py3-none-any.whl
| Download URL | crewai_twitterapi_io-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3779c92fb0ebe33fadbb02d04d432dd824693d91dbd94054a0ba8a1e2c6bebbc
|
|
BLAKE2b-256 checksum How to use checksums |
ce18ca8676c7973f77c58eb0511ee8ba15a34b31a6cde23afb76c539a720295e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|