Skip to main content
Potpie queries the knowledge graph and retrieves the nodes based on relevance to what an agent has to understand. a simple image showing code to graph text

Query Entry

Once the knowledge graph is fully annotated, agents can begin querying it.
  • Every node in the graph is both structurally traversable through its relationships and semantically searchable through its description.
  • When an agent receives a question, it evaluates the input and determines which method of querying the graph is most appropriate.

Search and Traversal

Agents have 2 ways to explore nodes in the graph:
  1. Vector search :
    • converts a natural language question into an embedding and finds the nodes whose descriptions are most semantically similar to it.
    • When the agent works within a specific part of the codebase, the search is scoped to nodes connected to that context rather than the entire graph.
  2. Structural traversal :
    • Starts from a known node and follows all relationships outward, returning the complete subgraph of everything connected to it.
    • No filtering is applied, returning the full structure as a nested tree.

Graph Navigation

Agents understand the code flows through the codebase by the use of 2 Tools:
  1. Entry point detection :
    • Identifies every function that nothing else in the codebase calls like API handlers, CLI commands, event listeners, scheduled jobs.
    • These are the natural starting points of execution and give the agent a map of where behavior originates.
  2. Neighbor traversal : Starts from any function and follows its call graph outward, collecting every function reachable from it through any number of hops. This gives the agent the full downstream impact surface of any given function.