Quick Start
How It Works
Each result line uses the format@author: text (tweet_id) so agents can reference specific posts downstream.
Configuration
Prerequisites
| Requirement | Detail |
|---|---|
XQUIK_API_KEY | Obtain from xquik.com |
OPENAI_API_KEY (or other LLM) | For the agent’s reasoning |
httpx | pip install httpx |
Function Signature
| Parameter | Type | Default | Description |
|---|---|---|---|
query | str | (required) | Search query for X posts |
limit | int | 5 | Results to return; clamped to [1, 10] |
availability= decorator pattern
The @tool(availability=_xquik_api_key_available) decorator hides search_x_posts from the agent’s tool list when XQUIK_API_KEY is not set. This pattern works for any API-key-gated tool:
Common Patterns
Multiple queries in one agent run
Combine with a summariser
Best Practices
Always set XQUIK_API_KEY before starting the agent
Always set XQUIK_API_KEY before starting the agent
The tool returns a clear error message if the key is missing, but the agent cannot search. Export the key in your shell or
.env before running.Keep limit between 1 and 10
Keep limit between 1 and 10
The
limit parameter is clamped server-side to [1, 10]. Passing 0 returns 1 result; passing 50 returns 10. Be explicit in your agent instructions.Use specific queries for better results
Use specific queries for better results
Vague queries like “AI” return broad results. Use specific phrases like “AI agent frameworks 2025” or include relevant hashtags.
Handle empty results gracefully
Handle empty results gracefully
When no posts match, the tool returns
"No results found for '...'". Instruct agents to try alternative queries in that case.Related
Tavily Search
Web search with AI-optimised results
Exa Search
Neural search for the web
Tool Availability
Gate tools on env vars with the
availability= decoratorCustom Tools
Build your own tool functions

