· Dave Brewster (dave@augustdata.ai) · logicunit · 2 min read
Search Logic Unit: Configuring an agent to search the web
Learn how to use search in an agent.

The search tool is a LogicUnit that can be registered with any APU to provide Google search capabilities to that APU. It uses Google site search and must be configured with a cse_id and a cse_token.
The full specification for Search is:
class SearchSpec(BaseModel): cse_id: str = Field( default_factory=lambda: os.environ["CSE_ID"], validate_default=True, description="Google Custom Search Engine Id.", ) cse_token: str = Field( default_factory=lambda: os.environ["CSE_TOKEN"], validate_default=True, description="Google Project dev token, must have search permissions.", ) name: str = "search" description: str = None defaultDateRestrict: Optional[str] = None params: Optional[dict] = {}- By default, the
cse_idandcse_tokenare read from the environment variablesCSE_IDandCSE_TOKEN. - The
name, optional and defaults tosearch, is the name of the LogicUnit. - The
descriptionis a description of the LogicUnit. This is used by the LLM to determine if this tool is called. The value is optional but hightly recommended. - The
defaultDateRestrictis an optional parameter that can be used to restrict the search to a specific date range. The value is optional. - The
paramsis an optional dictionary of additional parameters that can be passed to the search engine. The value is optional. Theparamsare passed to the Google search engine as its configuration parameters so searches that restrict to a particular domain, etc…, are supported.
The Search tool will execute the query and return a list of SearchResult objects. The full specification for SearchResult is:
class SearchResult(BaseModel): url: str title: str description: Optional[str]These are filled directly from the search with the values returned.
Typically, the Search tool is used in conjunction with the Browser tool so the LLM can scrape the contents of the most relavent web pages in the results.



