Skip to main content
POST
JavaScript
Wire a memory layer into one variation so every objective it runs can read the layer’s entries through get_memory.

position is cascade order

position decides who wins when two layers hold the same key. Lower is more specific, and the lowest position that has the key resolves it, the same idea as the memory cascade as a whole. So a variation with a general company-policy layer at position: 10 and a team-specific one at position: 0 reads the team layer’s version of a shared key, and falls through to the general layer for keys only it has. The numbers are yours to space out; they need not be contiguous. 0 and 10 work as well as 0 and 1, which leaves room to slot a layer between them later without renumbering.

One layer, once

A layer can be attached to a variation only once. Attaching the same memoryLayerId again is a 409, even at a different position, so change the position on the existing assignment rather than adding a second. The response returns the assignment’s own avml_... id. Hold onto it, or read it back from the variation’s info.memoryLayerAssignments, since that is the id you pass to remove or reposition the layer. The assignment carries no external ID; it is a join record.

Memory layers

The cascade, and how position resolves a key.

Update the assignment

Move a layer to a new position.

Remove the assignment

Unwire the layer from the variation.

Add an assignment

The tool-set and sub-agent equivalent.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

workspaceId
string
required

Workspace ID.

Example:

"workspace_01HXKD2E5NQM3T9AYWCF133E3Q"

agentId
string
required

Agent ID. Accepts the canonical agent_… form or the external_id:<value> form.

Example:

"agent_01HXKD2E5NQM3T9AYWCFMGWT9Y"

variationId
string
required

Variation ID. Accepts the canonical agentvar_… form or the external_id:<value> form.

Example:

"agentvar_01HXKD2E5NQM3T9AYWCF32BSPP"

Body

application/json

Attach a memory layer to a variation. The request is rejected when:

  • the layer is system-managed (FailedPrecondition)
  • the layer is already assigned to this variation (AlreadyExists)
  • the variation is already at the 10-assignment cap (FailedPrecondition)
  • the position is already in use on this variation (InvalidArgument)
memoryLayerId
string
required

Layer to attach. Accepts the canonical memlyr_… form or the external_id:<value> form.

Example:

"memlyr_01HXKD2E5NQM3T9AYWCFFFBMJH"

position
integer<int32>

Position in the baseline cascade (lower = more specific). If omitted, the server appends at the most general end (max existing position + 1).

Response

OK

VariationMemoryLayerAssignment attaches a single MemoryLayer to a variation at a given position in the variation's baseline memory cascade. A variation has at most one assignment per memory_layer_id.

Variations only support whole-layer attachments — entry pinning is an objective-level capability.

id
string
read-only

Assignment row id — handle for removing the assignment. Distinct from the referenced memory layer's id.

Example:

"avml_01HXKD2E5NQM3T9AYWCFX8AF59"

memoryLayer
object

The attached memory layer.

position
integer<int32>

Position in the variation's baseline cascade. Position is specificity, CSS-style: a LOWER position is more specific and is consulted first; the highest-position assignment is the most general fallback. Gaps are fine — only relative position matters. Positions must be unique within a variation; a request that would collide with an existing assignment's position is rejected with InvalidArgument.