Skip to navigation

Query a graph

Alpha

Experimental. Smart Query retrieves multi-hop context from a graph in one call. Some agent tasks need multi-hop retrieval: the agent does not know in advance what to search for, so it must retrieve a record, learn from it, and then plan the next retrieval. Zep explores the graph with searches and graph traversals, and it uses the records from each retrieval round to plan the next round. By default, the response has the retrieved records and no answer. Set generate_answer to true to also get an answer that a model writes from the records, with the cited graph items and an answer_status of answered, partial, or refused. Set stream to true to get the retrieval calls as server-sent events. The default mode is fast. fast: Optimized for latency. Retrieves the context for multi-hop queries. The query runs at most 3 search rounds. deep: Runs more retrieval steps, so it can retrieve complete lists, such as the records for a count. It takes longer than fast mode. BYOM and BYOC projects can use fast mode when they have a configured decision model. Other projects can use fast mode without a decision model. BYOM and BYOC projects without a decision model must use deep mode. The operation is experimental and available to every Zep account. The request, the response, the events, and the modes of the operation can change.

Authentication

AuthorizationApi-Key

Type “Api-Key” followed by a space and the project API key.

Request

Graph query
graph_uuidslist of stringsRequired
The graph UUIDs to query. The current release accepts one UUID.
querystringRequired

The natural-language query for the graph.

streamtrueRequired

When true, return the retrieval calls as server-sent events.

generate_answerbooleanOptional

When true, a model also writes an answer from the retrieved records. The default is false: the response has the records and no answer.

guidancestringOptional
Optional caller guidance for the answer. The agent treats it as untrusted text.
modeenumOptional

The retrieval mode. The default is fast. Fast mode is optimized for latency. It retrieves the context for multi-hop queries. The query runs at most 3 search rounds. A BYOM project needs a decision model for fast mode. A BYOC deployment needs a decision model (SystemOne or Gemini Decisions) for fast mode. Deep mode runs more retrieval steps, so it can retrieve complete lists, such as the records for a count. It takes longer than fast mode.

Allowed values:

Response

startedobject
OR
reasoningobject
OR
planobject
OR
tool_callobject
OR
tool_resultobject
OR
tool_errorobject
OR
resultobject
OR
errorobject

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
413
Content Too Large Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error