Skip to content

About

Haystack integration for Autom: live Google, Bing, Brave, DuckDuckGo and Yahoo results for RAG pipelines and agents.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

autom-haystack

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.

Installation

pip install autom-haystack

Get an API key at app.autom.dev and set it in the environment:

export AUTOM_API_KEY="your-api-key"

Usage

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: one Document per organic result. The content is the snippet, and the metadata holds title, link and position, plus date and source when 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.

In a RAG pipeline

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)

Development

pip install -e ".[test]"
pytest -m "not integration"   # offline
AUTOM_API_KEY=... pytest       # with the live test

License

MIT

About

Haystack integration for Autom: live Google, Bing, Brave, DuckDuckGo and Yahoo results for RAG pipelines and agents.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages