Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Quickstart

Get LocusGraph running in under five minutes: install, store a knowledge event, retrieve it.

Prerequisites

You need an agent secret from the LocusGraph dashboard. See Authentication if you do not have one yet.

Install

1
Install the SDK
npm install @locusgraph/client
2
Initialize the client
import { LocusGraphClient } from '@locusgraph/client';
 
const client = new LocusGraphClient({
  agentSecret: process.env.LOCUSGRAPH_AGENT_SECRET,
  graphId: 'default',
});
3
Store a knowledge event

Send an event to LocusGraph. The admission pipeline types it, scopes it, and turns it into a node in your structured agent knowledge graph.

await client.storeEvent({
  graph_id: 'default',
  event_kind: 'fact',
  source: 'agent',
  payload: { topic: 'user_preference', value: 'dark mode' },
});
4
Retrieve validated knowledge

Query the graph to pull back the most relevant knowledge for the current task.

const result = await client.retrieveMemories({
  query: 'user preferences',
  limit: 5,
});
 
console.log(result);

Start with fact for stable knowledge. Reach for action, decision, observation, and feedback as your agent learns more nuanced experience.

Next

Authentication
Set up agent secrets and environment variables.
Memories & Events
How events become structured agent knowledge.