Skip to content
Notifications
Clear all

Troubleshooting: Web search agent returns irrelevant junk. How to improve the query?

2 Posts
2 Users
0 Reactions
10 Views
(@backend_builder)
Prominent Member
Joined: 6 months ago
Posts: 605
Topic starter   [#28357]

I've been prototyping a research assistant using AutoGen's `WebSurferAgent`. The goal is simple: fetch recent articles or documentation about specific backend tech (think "Go 1.22 release notes" or "Postgres 16 performance changes"). However, more often than not, the agent returns completely irrelevant results—think blog spam, unrelated e-commerce pages, or just low-quality SEO fodder.

My current setup is pretty standard:

```python
from autogen.agentchat.contrib.web_surfer import WebSurferAgent

web_surfer = WebSurferAgent(
"web_surfer",
llm_config={"config_list": config_list},
browser_config={"viewport_size": 1024},
summarization=False # I want the raw content to judge relevance
)

user_proxy.initiate_chat(
web_surfer,
message="Find the official release notes for Go version 1.22 and summarize the major changes.",
)
```

The agent *does* perform a web search and fetches pages, but the initial query it generates seems off. I suspect the issue lies in how the agent translates my request into an actual search engine query. It might be adding unnecessary terms or using a suboptimal format.

Has anyone else run into this and found effective tweaks? I'm considering:

* **Prompt Engineering:** Wrapping my request in more explicit instructions (e.g., "Search using the query: 'Go 1.22 release notes site:go.dev'").
* **Agent Configuration:** Are there specific `WebSurferAgent` parameters that control query formulation or result filtering?
* **Pre-processing:** Creating a dedicated "query refiner" agent that takes my vague request and outputs a precise, keyword-optimized search string before the `WebSurferAgent` executes it.

What's been your experience? Is the web search capability still a bit raw, or are there solid patterns to make it consistently useful for technical research?

--builder


Latency is the enemy, but consistency is the goal.


   
Quote
(@edwardk)
Estimable Member
Joined: 3 months ago
Posts: 162
 

Yeah, the translation step is definitely a leaky abstraction. Have you tried pre-processing the query yourself? Instead of giving a natural language instruction, I feed the WebSurferAgent a ready-to-go search string.

For example, I'd hardcode the query to something like `site:go.dev "Go 1.22" release notes`. Forces it to use a strict search. Might defeat the agent's purpose a bit, but it gets specific results.

What search backend are you using? I found the default one often gives poorer quality compared to, say, a configured Serper API key.



   
ReplyQuote