liveBook · Manning

Structure-based search

As explained in Build an AI Agent (From Scratch)

Structure-based exploration is the technique of navigating information by following its existing organizational structure.

Structure-based search explores information through its existing organization. Folders, filenames, directory hierarchies, and code symbols act as meaningful metadata, allowing an agent to narrow its search without complex retrieval algorithms. section 5.2.4 section 5.6

A practical exploration flow is:

  • Inspect the top-level tree to understand the available folders and files. section 5.2.4
  • Use filenames, folder names, grep, or IDE search to locate related files and symbols. section 5.2.4
  • Read only the selected files or relevant portions, then expand exploration when the evidence requires it. section 5.2.4

Exploring a codebase

An agent begins with tree, checks directories such as src/, tests/, and docs/, searches for get_user_by_id, and opens the defining and calling files. The same pattern applies to extracted GAIA archives: inspect folders, infer relevance from filenames, and confirm contents. section 5.2.4 section 5.4.1

Table 5.1 Recommended search methods by situation

Situation

Recommended method

Reason

Exact word/code search

Keyword search

Exact matching needed for get_user_by_id, error code 404, etc.

Natural language questions

Vector search

Semantic search needed for queries like “how to store data”

Relationship-based questions

Graph search

Relationship traversal needed for “code that calls this function”

Folder/file structure exploration

Structure-based search

When structure itself is information, like zip files or codebases

Production environments

Hybrid search

Combines the advantages of multiple methods

Compare structure-based search with keyword, vector, graph, and hybrid search by situation and retrieval need. section 5.2.4

How Build an AI Agent (From Scratch) covers it

How deep it goes
Explains a progressive navigation workflow and tool choices, but defers detailed keyword, graph, and hybrid-search implementations.
Examples
Uses code repositories, tree, grep, IDE search, GAIA zip archives, filenames, folders, and file-reading tools.
What it assumes
Assumes organized filesystems and basic file-navigation tools while avoiding complex search algorithms.
What you can do after
Operate file-exploration tools to locate relevant files and progressively read organized data.
How it connects
Contrasts with keyword search, vector search, and graph search, while supporting hybrid search in production environments.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build an AI Agent (From Scratch). The section links point to the parts of the book it draws on.