Brain Docs

Reference

TypeScript SDKInstallationHTTP clientWire client
createEntitygetEntityresolveEntitylistEntitiesupdateEntityrenameEntitymergeEntitiesunmergeEntitytombstoneEntity
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
TypeScript SDKEntitiesresolveEntity

resolveEntity

Ask Brain which entity a surface form means — the four outcomes, and why Ambiguous writes nothing.

PURPOSE

Ask Brain which entity a surface form means. This is the verb extraction uses internally, exposed so you can run it yourself.

POST/v1/entities/resolveBearer API keystable
resolveEntity(input: ResolveEntityInput): Promise<ResolveEntityResult>
Handshake credentialstable
resolveEntity(request: EntityResolveRequest): Promise<EntityResolveResponse>

Parameters

ParameterTypeRequired
candidateNamestringrequired

The surface form to resolve — "Priya", "P. Raman".

resolutionContextstringoptional

Surrounding text to disambiguate with. This is what separates two people called Priya.

typeHintintegeroptional

Restrict candidates to one entity type. On the wire the field is entityTypeHint.

allowCreatebooleanoptional

Create the entity when nothing matches, instead of answering NotFound.

Returns

FieldTypePresence
outcomeResolved | Created | Ambiguous | NotFoundalways

Resolved — matched an existing entity. Created — creation was allowed and nothing matched. Ambiguous — several candidates tied. NotFound — nothing matched and creation was not allowed.

tierintegeralways

Which resolution tier produced the answer — exact alias, normalised form, embedding similarity, and so on. Low tiers are cheap and certain.

confidencefloatalways

Confidence in [0, 1].

entityIdstring | nullalways

The resolved entity — null on Ambiguous. On the wire the field is resolvedEntity.

candidateIdsstring[]always

The tied candidates, populated on Ambiguous.

Example

const r = await brain.resolveEntity({
  candidateName: "Priya",
  resolutionContext: "the engineer who moved to Lisbon",
  allowCreate: false,
});

if (r.outcome === "Ambiguous") {
  const options = await Promise.all(r.candidateIds.map((id) => brain.getEntity(id)));
  return askUser(options);
}
Ambiguous writes nothing, silently

When resolution is ambiguous Brain does not pick, and it does not link. The statement that triggered the resolution is stored with no entity attached, and nothing is logged as an error. Reading candidateIds and deciding is the caller's job; ignoring the outcome is how a graph quietly loses its edges.

The wire response also carries an auditId for the resolution, which the HTTP result omits.

On the wire

Ids are fixed-width UUID bytes rather than strings, attributes is an opaque attributesBlob, and every request carries a requestId plus an optional actAs. See Wire client.

See also
getEntityEntities, in depth

Was this page helpful?

getEntity

Read one entity — its canonical name, aliases, mention count and merge lineage.

listEntities

Enumerate entities by type and name prefix — cursor-paged, with a required type filter.

On this page

ParametersReturnsExampleOn the wire
Suggest an editOpen in Playground