/api/query endpoint accepts natural language queries and returns structured results from the knowledge graph.
Endpoint
Request Body
The natural language query to process.Examples:
- “Who owns the payment service?”
- “What breaks if redis goes down?”
- “What does order-service depend on?”
Optional session identifier for tracking conversation context.
Request Schema
Fromchat/app.py:46-48:
Response
Human-readable response formatted by the LLM.
The type of query that was executed. Possible values:
get_nodeget_nodesdownstreamupstreamblast_radiuspathget_ownerget_team_assetsfind_by_propertyservices_using_database
Confidence score from the LLM’s intent parsing (0.0 to 1.0).Lower scores indicate the query may have been ambiguous.
Optional raw data from the query engine before LLM formatting.
Response Schema
Fromchat/app.py:51-55:
Examples
Ownership Query
Dependency Query
Blast Radius Query
Error Handling
Query Parser Not Initialized
- Neo4j is accessible
- GEMINI_API_KEY is valid
- Configuration files are present
Query Processing Failed
Implementation
Fromchat/app.py:143-166:
Query Types
The endpoint supports these query patterns:| Query Type | Example | Description |
|---|---|---|
get_owner | ”Who owns payment-service?” | Find team ownership |
downstream | ”What does X depend on?” | Get dependencies |
upstream | ”What depends on X?” | Get dependents |
blast_radius | ”What breaks if X fails?” | Impact analysis |
path | ”How does X connect to Y?” | Find paths |
get_team_assets | ”What does team X own?” | List team assets |
get_nodes | ”List all services” | List entities |
Best Practices
Be specific
Use exact service names from your configuration:
- Good: “What does order-service depend on?”
- Bad: “What does the order thing need?”
Related
Query Engine
Learn about the underlying query methods
Querying Guide
Complete guide to querying patterns