Pattern detection is an experimental feature. The API may change in future releases.
Zep’s pattern detection analyzes the structure of your knowledge graph to discover recurring patterns: frequent relationship types, multi-hop paths, co-occurring entities, highly connected hubs, and tightly interconnected clusters. Unlike graph search, which retrieves content matching a query, pattern detection reveals the shape of your data — surfacing structural insights that aren’t visible from individual nodes or edges.
Pattern detection supports two modes:
Query mode only detects relationship patterns. Use seed mode for path, co-occurrence, hub, and cluster detection.
Provide seeds to focus analysis around specific nodes, node labels, or edge types. At least one seed field (node_uuids, node_labels, or edge_types) is required.
Provide a query string to let Zep automatically discover relevant nodes and detect relationship patterns. The response includes relevance-scored edges per pattern and a deduplicated nodes array.
*Either user_id or graph_id is required
Either query or seeds is required, but not both
Use the detect parameter to choose which pattern types to find. Each key enables that type; its value provides type-specific configuration. Omit detect entirely to run all types with defaults.
Use seeds to specify the starting points for pattern detection in seed mode. At least one seed field is required. When multiple seed fields are provided, seeds are combined (union). Seeds cannot be used together with query.
Apply temporal decay to favor recently created edges. The recency_weight value sets the exponential decay half-life applied to each edge’s created_at timestamp.
When recency weighting is enabled, the weighted_score in each result reflects the decayed sum, while occurrences always reports the raw unweighted count.
Use search_filters to restrict which nodes and edges participate in pattern detection. This uses the same filter format as graph search.
Each pattern in the response contains:
The top-level response also includes:
The metadata object contains:
Patterns are sorted by weighted_score in descending order.