> ## Documentation Index
> Fetch the complete documentation index at: https://docs.potpie.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Trace

**Trace** is Potpie's incident investigation agent. It uses your [knowledge graph](/concepts/knowledge-graph) as the structural model of **expected system behavior** and investigates failures against that model.

When a failure surfaces, Trace uses the encoded structure of your codebase to **define the investigative scope** immediately, rather than reconstructing it through manual exploration.

## What Trace does

|                          |                                                                                                                                                                                                    |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Call graph traversal** | The **call graph** is traversed from the affected service outward. Every upstream caller and downstream dependency is mapped before a single log is read.                                          |
| **Contract validation**  | Logged requests are validated against `API` and `schema` contracts defined in code. A changed response shape or a silently diverged API surfaces as a `contract violation` with the affected path. |
| **Historical baseline**  | The current repository state is compared with earlier states to identify structural changes and dependency regressions from the last stable version.                                               |
| **Log analysis**         | Provide a log snippet or file. Trace cross-references it against the knowledge graph and constrains the relevant entries to the `call paths` and services already in scope.                        |

Together, these steps estimate **blast radius** before a fix is applied. This eliminates the **grep tax** , the time spent manually searching for context during an incident.

When a latency spike appears in a service, Trace evaluates `contract compliance`, `dependency health`, scaling policies, and recent diffs in a single view. Deviations surface as `contract violations`, `dependency regressions`, or `invalid execution paths`, expressed in terms of impact and causality. Teams move directly from detection to remediation.

## Hypothesis tree

When logs do not establish causality, Trace shifts to structured hypothesis exploration. Instead of following one theory, it builds a **branching investigation tree** where each node is a concrete, testable hypothesis such as **configuration regression** , a **contract mismatch** Using historical baselines, Trace prioritizes promising branches, allocates effort accordingly, and eliminates weak paths early.

## Get Access

Trace is part of Potpie's enterprise offering. <a href="https://potpie.ai/enterprise" className="mode-link" target="_blank" rel="noopener noreferrer">Reach out</a> to learn more or explore the full set of [specialist agents](/build-flow/specialists).
