Brain Docs

Reference

Rust SDKInstallationHTTP clientWire client
encoderecallforgetencode_vectormemory_listmemory_inspectgraph_fetchlinkunlink
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
Rust 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
async fn link(&self, input: &LinkInput) -> Result<LinkResult, BrainHttpError>
Handshake credentialstable
async fn link(&self, request: &LinkRequest) -> Result<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(&LinkInput {
    source: outage_id.clone(),
    target: rollback_id.clone(),
    kind: EdgeKind::Caused,
    weight: Some(0.9),
}).await?;
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