Skip to main content
Every write to the graph goes through a delta: a reviewable set of changes. pb.capture and pb.extract open one, stage into it, and commit it for you in a single call; pb.deltas.* is that same primitive, exposed for when you want to stage and review before anything lands.
Captures commit by default. Pass apply: false only when you want to stage the change as a delta and inspect it before it touches the committed graph.

pb.capture

Stage a single structured entity.
const receipt = await pb.capture({
  type: "Insight",
  properties: {
    content: "Enterprise buyers stall on procurement, not price.",
  },
});

console.log(receipt.status, receipt.entityIds); // "applied", [...]
Common fields:
type
string
required
The entity type.
properties
object
The entity’s fields, matching the shape for its type.
name
string
A display name. Derived from content when omitted.
relationships
array
Edges to other entities, by index within this capture or by existing node id.
apply
boolean
default:"true"
Commit immediately. Set false to stage only.
projectId
string
Required when your key spans more than one project.
The receipt reports status ("staged" or "applied"), deltaId, entityIds, and a validation summary.

pb.extract

Run text through a shape to extract entities and relationships into a delta. Requires a shape that exists in the target project and an extraction-capable key.
const receipt = await pb.extract({
  source: "Acme renewed for 12 months after a procurement review led by their CFO.",
  shapeId: "shp_deal_notes",
  apply: false,
});
source
string | object
required
The text to extract from — a plain string, or an object with text plus optional type, external_id, timestamp, and metadata.
shapeId
string
The id of the shape to extract through. Use shape to reference a shape by name instead.
apply
boolean
Commit the extracted entities, or stage them with false.
dryRun
boolean
Run extraction without staging anything.

pb.deltas

The staged-write primitive. Build a delta, add entities and relationships, then submit and apply.
MethodDescription
pb.deltas.create(input)Open a new delta.
pb.deltas.get(id)Read a delta and its staged contents.
pb.deltas.addEntities(id, entities)Stage entities.
pb.deltas.addRelationships(id, rels)Stage relationships.
pb.deltas.submit(id)Mark the delta ready.
pb.deltas.plan(id)Preview how applying it would change the graph.
pb.deltas.apply(id)Commit the delta.
pb.deltas.revertPreview(id)Preview a revert.
pb.deltas.revert(id)Revert an applied delta.
const delta = await pb.deltas.create({ name: "Q3 deal notes" });
await pb.deltas.addEntities(delta.id, [
  { type: "Account", name: "Acme", properties: { tier: "enterprise" } },
]);
await pb.deltas.submit(delta.id);
const plan = await pb.deltas.plan(delta.id);
await pb.deltas.apply(delta.id);