Generate Insights
Reason over stored knowledge in your wisdom graph to surface patterns and recommendations.
POST
/v1/memories/insights— Generate insights by reasoning over stored knowledgeAuthentication
All requests require an Authorization: Bearer <agent-secret> header.
Request Body
When locus_query is omitted, the API uses your task as the search query. Set locus_query separately when your task description is broad but you want to search a specific area of knowledge.
Response
- insight — A synthesized finding drawn from relevant knowledge.
- recommendation — An actionable suggestion based on the insight.
- confidence —
"high","medium", or"low".
Examples
curl
curl -X POST https://api.locusgraph.com/v1/memories/insights \
-H "Authorization: Bearer <agent-secret>" \
-H "Content-Type: application/json" \
-d '{
"task": "What UI preferences have users expressed?",
"graph_id": "graph_01",
"limit": 10,
"context_types": {
"feedback": ["ui", "design"]
}
}'TypeScript
import { LocusGraph } from "@locusgraph/sdk";
const locus = new LocusGraph({ agentSecret: process.env.LOCUS_SECRET });
const result = await locus.generateInsights({
task: "What UI preferences have users expressed?",
graphId: "graph_01",
limit: 10,
contextTypes: { feedback: ["ui", "design"] },
});
console.log(result.insight);
console.log(result.recommendation);
console.log(result.confidence); // "high"Python
from locusgraph import LocusGraph
locus = LocusGraph(agent_secret=os.environ["LOCUS_SECRET"])
result = locus.generate_insights(
task="What UI preferences have users expressed?",
graph_id="graph_01",
limit=10,
context_types={"feedback": ["ui", "design"]},
)
print(result.insight)
print(result.recommendation)
print(result.confidence) # "high"Practical Pattern: Identify Recurring Issues
Use insights to detect patterns across error events:
curl -X POST https://api.locusgraph.com/v1/memories/insights \
-H "Authorization: Bearer <agent-secret>" \
-H "Content-Type: application/json" \
-d '{
"task": "What are the most common failure patterns in the last week?",
"graph_id": "graph_01",
"locus_query": "error failure crash timeout",
"limit": 20,
"context_types": {
"error": []
}
}'Related
Retrieve Memories
Store Event