Skip to main content
pb.context compiles a scoped span of the graph for a task. pb.slices saves a scoping as a named, reusable view.

pb.context

MethodDescription
pb.context.discover(input)Find candidate context for a scope.
pb.context.preview(input)Preview what a context spec resolves to.
pb.context.compile(input)Compile a context spec into a usable payload.
pb.context.materialize(input)Materialize compiled context.
const preview = await pb.context.preview({
  spec: { types: ["Account", "Insight"] },
});

const compiled = await pb.context.compile({
  spec: { types: ["Account", "Insight"] },
});
When your key is scoped to a single project, projectId is implicit. When it spans projects, pass projectId (or projectIds on the spec).

pb.slices

A slice is a named, reusable context view. Promote one to make it a durable lens others can reuse.
MethodDescription
pb.slices.list(options?)List slices in scope.
pb.slices.get(id)Read a slice.
pb.slices.create(name, input)Save a new slice.
pb.slices.update(id, input)Update a slice.
pb.slices.promote(id)Promote a slice to a durable view.
pb.slices.demote(id)Demote a promoted slice.
const slice = await pb.slices.create("Enterprise renewals", {
  spec: { types: ["Account"], shapes: ["shp_deal_notes"] },
});

await pb.slices.promote(slice.id);