Haystack integration for Autom, a SERP API that returns live search engine results as JSON.
AutomWebSearch searches the web with Google (the default), Bing, Brave, DuckDuckGo or Yahoo. It returns the results as Haystack Documents, ready for a RAG pipeline or an agent.
pip install autom-haystackGet an API key at app.autom.dev and set it in the environment:
export AUTOM_API_KEY="your-api-key"from haystack_integrations.components.websearch.autom import AutomWebSearch
search = AutomWebSearch(top_k=5)
result = search.run(query="What is Haystack?")
for doc in result["documents"]:
print(doc.meta["title"], doc.meta["link"])
print(doc.content)run returns two outputs:
documents: oneDocumentper organic result. The content is the snippet, and the metadata holdstitle,linkandposition, plusdateandsourcewhen Autom returns them.links: the result URLs.
| Parameter | Default | Description |
|---|---|---|
api_key |
Secret.from_env_var("AUTOM_API_KEY") |
Autom API key |
top_k |
10 |
Maximum number of results; None keeps the whole page |
engine |
google |
google, bing, brave, duckduckgo or yahoo |
allowed_domains |
Only search these domains, added to the query as site: filters |
|
search_params |
Extra parameters for Autom, such as {"gl": "us", "hl": "en"} or {"tbs": "qdr:w"} (past week) for Google |
|
timeout |
60 |
Seconds to wait for Autom |
A failed request raises AutomError, a Haystack ComponentError with the HTTP status. The API key never appears in the message. Autom reports a rate limit as HTTP 401 with "Rate limit exceeded", and the error says so. run_async is available too.
from haystack import Pipeline
from haystack.components.builders import ChatPromptBuilder
from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.dataclasses import ChatMessage
from haystack_integrations.components.websearch.autom import AutomWebSearch
template = [
ChatMessage.from_user(
"Answer the question from these search results.\n"
"{% for doc in documents %}- {{ doc.content }} ({{ doc.meta.link }})\n{% endfor %}\n"
"Question: {{ question }}"
)
]
pipeline = Pipeline()
pipeline.add_component("search", AutomWebSearch(top_k=5))
pipeline.add_component("prompt", ChatPromptBuilder(template=template, required_variables=["documents", "question"]))
pipeline.add_component("llm", OpenAIChatGenerator(model="gpt-4.1-mini"))
pipeline.connect("search.documents", "prompt.documents")
pipeline.connect("prompt.prompt", "llm.messages")
question = "What is new in Python 3.13?"
result = pipeline.run({"search": {"query": question}, "prompt": {"question": question}})
print(result["llm"]["replies"][0].text)pip install -e ".[test]"
pytest -m "not integration" # offline
AUTOM_API_KEY=... pytest # with the live testMIT