AI Search API integration for CrewAI - Enable intelligent web search in your crews
Project description
AI Search API for CrewAI - Developer & SEO Guide
A Python integration for CrewAI that connects your agents to the AI Search API.
It enables semantic search, contextual queries, SEO‑friendly content generation, and intelligent answers with sources.
👉 To start, get your free API key from the AI Search API dashboard.
Features
- 🔍 AI-Powered Web Search: Let CrewAI agents search the web with natural language
- 🎯 Context Awareness: Add history messages for better, more relevant answers
- ⚡ Seamless CrewAI Integration: Works out of the box with
Agent,Task, andCrew - 🛡️ Strong Typing: Includes dataclasses and type hints for safe development
- 💡 SEO Use Cases: Generate SEO‑optimized content, product descriptions, FAQs
- 📊 Sources: Always returns sources for transparency
- 🖥️ Local LLM Support: Combine with free Ollama models for offline reasoning
Installation
pip install crewai-aisearchapi
Quick Start (with Ollama + CrewAI)
from crewai import Agent, Task, Crew, Process, LLM
from crewai_aisearchapi import AISearchTool
# Use a local free model (Ollama)
llm = LLM(
model="ollama/llama3.2:3b", # or llama3.1:8b
base_url="http://localhost:11434", # Ollama default
temperature=0.2,
)
# Add the AI Search tool
tool = AISearchTool(api_key="your-api-key")
agent = Agent(
role="Researcher",
goal="Short, correct answers with sources when available.",
backstory="Careful and concise.",
tools=[tool],
llm=llm,
verbose=True,
)
task = Task(
description="Answer: '{question}'. Keep it short.",
expected_output="2–4 sentences.",
agent=agent,
markdown=True,
)
crew = Crew(agents=[agent], tasks=[task], process=Process.sequential, verbose=True)
if __name__ == "__main__":
print(crew.kickoff(inputs={"question": "What is RLHF in AI?"}))
Configuration Options
from crewai_aisearchapi import AISearchTool, AISearchToolConfig
config = AISearchToolConfig(
default_response_type="markdown", # or "text"
include_sources=True,
timeout=30,
verbose=True
)
tool = AISearchTool(api_key="your-key", config=config)
Contextual Search
You can pass multiple context messages (all must be role "user"):
result = tool.run({
"prompt": "Summarize quantum dots for displays.",
"context": [
{"role": "user", "content": "Be concise."},
{"role": "user", "content": "Focus on consumer TVs."}
],
"response_type": "markdown"
})
SEO Use Cases
The AI Search API is not just for research — it’s also great for SEO content generation:
- 📈 Write product descriptions with live data & sources
- 📝 Generate blog posts enriched with context and citations
- ❓ Build FAQ sections that adapt to user intent
- 🌍 Research competitor content and summarize strengths/weaknesses
- ⚙️ Automate content briefs for writers using CrewAI agents
Example:
seo_agent = Agent(
role="SEO Writer",
goal="Generate SEO-optimized product descriptions.",
backstory="Expert in e-commerce SEO content.",
tools=[tool],
llm=llm
)
seo_task = Task(
description="Write a 150-word SEO product description for '{product}'",
expected_output="SEO-rich product description with 2 citations.",
agent=seo_agent
)
Handling Responses
The tool automatically formats results:
The current Bitcoin price is approximately $45,000 USD...
**Sources:**
- [1] https://coinmarketcap.com
- [2] https://finance.yahoo.com
*Response time: 150ms*
Environment Variables
export AISEARCH_API_KEY="your-api-key"
In Python:
import os
from crewai_aisearchapi import AISearchTool
tool = AISearchTool(api_key=os.getenv("AISEARCH_API_KEY"))
Development (for contributors)
git clone https://github.com/aisearchapi/crewai-aisearchapi.git
cd crewai-aisearchapi
python -m venv venv
source venv/bin/activate
pip install -e ".[dev,test]"
pytest
License
MIT License - see the LICENSE file.
Support
- Dashboard & API Key: AI Search API Dashboard
- Docs: docs.aisearchapi.io
- Homepage: aisearchapi.io
- Issues: GitHub Issues
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crewai_aisearchapi-1.0.7.tar.gz.
File metadata
- Download URL: crewai_aisearchapi-1.0.7.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b42594c065cfb603a7ef05e146cb87339f052bd08a7e0da7a9eb378a05bbfc3
|
|
| MD5 |
cceae7cb0c9aedce17355e02f0a8810d
|
|
| BLAKE2b-256 |
03809873d7ef01ad5fdaf115d619f1edfeb37233a579b932281f327b6d4928d7
|
File details
Details for the file crewai_aisearchapi-1.0.7-py3-none-any.whl.
File metadata
- Download URL: crewai_aisearchapi-1.0.7-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59ae8302ac604525dd25ede24a170f0e4dd1fbfaf5e30b5be053fbdc13eee687
|
|
| MD5 |
c105b45f900d2b397ad86c8eab7ab9b0
|
|
| BLAKE2b-256 |
8c512288a68da139477617d854e16faa0afd916e420724fbd0ea3ee091e4f5cf
|