Brain Docs

Reference

Python SDKInstallationHTTP clientWire clientSync vs async
encoderecallforgetencode_vectormemory_listmemory_inspectgraph_fetchlinkunlink
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
Python SDKMemorylink

link

Assert a typed memory-to-memory edge, alongside the ones the write pipeline infers.

PURPOSE

Assert an edge between two memories yourself. The write pipeline infers edges on its own; link is for the ones you know about and it does not.

POST/v1/linksBearer API keystable
link(source: str, target: str, kind: str, weight: float | None = None) -> LinkResult
Handshake credentialstable
link(request: LinkRequest) -> LinkResponse

Parameters

ParameterTypeRequired
sourcestring (wire: 64-bit integer)required

The memory the edge leaves.

targetstring (wire: 64-bit integer)required

The memory it points at.

kindEdgeKindrequired

One of caused, followed_by, derived_from, similar_to, contradicts, supports, references, part_of. Anything else is BadEdgeKind. On the wire these are integer discriminants, not lowercase strings.

weightfloatoptional

Edge strength. Defaults server-side.

Returns

FieldTypePresence
source / target / kind / weight—always

Echoed back as stored.

created_at_unix_nanos64-bit integeralways

When the edge was written.

already_existedbooleanalways

true when the edge was already there. This is what makes link idempotent — a repeat is a success, not a duplicate.

Example

brain.link(source=outage_id, target=rollback_id, kind="caused", weight=0.9)
See also
unlinkmemory_inspect

Was this page helpful?

graph_fetch

A cursor-paged node and edge view of the space, for drawing — not a query.

unlink

Remove a memory-to-memory edge. Removing one that is not there is a success, not an error.

On this page

ParametersReturnsExample
Suggest an editOpen in Playground