Skip to content

Agentic Query API

Terminal window
POST /graphs/{graphId}/agentic-query
{
"query": "Who works at technology companies connected to Alice?",
"topK": 5,
"depth": 2,
"direction": "outbound",
"nodeType": "Person"
}
FieldTypeRequiredDefaultDescription
querystringyes—Natural language or semantic text
topKnumberno5Number of vector similarity results
depthnumberno2Traversal depth from each hit
directionstringnooutboundEdge direction for traversal
nodeTypestringnoallRestrict vector search to a node type
{
"query": "Who works at technology companies connected to Alice?",
"vectorHits": [
{ "nodeId": "node_alice", "score": 0.94 }
],
"context": {
"nodes": [ ... ],
"edges": [ ... ]
},
"tokenEstimate": 420
}

tokenEstimate is a rough count of the serialised context size in tokens — useful for LLM prompt budget planning.

const result = await client.agenticQuery(graphId, { query });
const systemPrompt = [
"You are a helpful assistant.",
"Use the following graph context to answer the user's question.",
"Graph nodes: " + JSON.stringify(result.context.nodes),
"Graph edges: " + JSON.stringify(result.context.edges),
].join("\n");