relationship_upsert
Create or update a directed relationship between two entities in the graph. Identify endpoints by entity key or ID, and define the connection with a relation type.
Instructions
Create or update one directed relationship in the graph: subject --relation_type--> object. Mutating. Identify each endpoint by entity_key (preferred) or internal entity_id. The graph is a rebuildable projection over memories — curate structure here, store facts with remember.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| space | No | Memory space (namespace) the relationship belongs to. | |
| status | No | Lifecycle status (e.g. active, tombstoned). | |
| metadata | No | Arbitrary key/value attributes to attach to the relationship. | |
| valid_to | No | RFC 3339 timestamp the relationship stops being valid. | |
| memory_id | No | Id of the memory this relationship was derived from, if any. | |
| confidence | No | Confidence in the relationship, 0.0–1.0. | |
| valid_from | No | RFC 3339 timestamp the relationship starts being valid. | |
| observed_at | No | RFC 3339 timestamp of when this was observed. | |
| relation_type | Yes | The relationship type/predicate (e.g. depends_on, works_with, part_of). Required. | |
| include_source | No | If true, reveal provenance/source metadata in the response. Default false. | |
| object_entity_id | No | Internal id of the object endpoint (alternative to object_entity_key). | |
| object_entity_key | No | Entity key of the object (target) endpoint. Preferred over object_entity_id. | |
| source_episode_id | No | Id of the source episode this relationship was derived from, if any. | |
| subject_entity_id | No | Internal id of the subject endpoint (alternative to subject_entity_key). | |
| subject_entity_key | No | Entity key of the subject (source) endpoint. Preferred over subject_entity_id. |