# CrewAI

Call a search constructor and place the resulting tool directly on a CrewAI `Agent`.


# Install

Use Python 3.10 through 3.13:

``` bash
pip install "serpapi-search-tools[crewai]"
```

If CrewAI is already installed in your project, use `pip install serpapi-search-tools` instead.

``` bash
export SERPAPI_API_KEY="your-serpapi-key"
export OPENAI_API_KEY="your-openai-key"
```


# Run it

``` python
import crewai
from serpapi_search_tools import news_search, shopping_search, web_search

agent = crewai.Agent(
    role="News researcher",
    goal="Find and summarize current developer news.",
    backstory="You verify current claims with live search.",
    llm=crewai.LLM(model="openai/gpt-5.4-mini"),
    tools=[
        news_search(),
        web_search(),
    ],
    verbose=False,
)
task = crewai.Task(
    description="Find three recent Python packaging stories and summarize them.",
    expected_output="Three concise, sourced findings.",
    agent=agent,
)
print(crewai.Crew(agents=[agent], tasks=[task]).kickoff())
```


# Try it

Ask the crew to find three recent Python packaging stories and explain the practical impact of each.


# Customize the search

``` python
products = shopping_search(
    allowed_engines=["google_shopping", "amazon"],
    default_engine="google_shopping",
    result_limit=3,
)
```

Use `products` on a product-research agent instead of the news tool.
