memory_strategy
Alpha, on the 3.6.x line. The API can still change within 3.x.
Manages strategies: a trigger (the situation) paired with an action
(what to do). This tool names its operation op, because action is the
field that holds the response to run.
Operations
op | Needs | What it does |
|---|---|---|
store | trigger, action | Creates a strategy. create is the same operation. |
recall | Lists the active strategies. It does not search by situation. | |
list | Lists strategies. Filters: statusFilter, scopeRef, validAt, limit. | |
rate | id, outcome | Records that the strategy worked or failed. |
get | id | Returns one strategy. |
patch | id | Changes trigger, action, context, status, validTo or metadata. |
archive | id | Archives the strategy. |
To find a strategy by meaning, use memory_recall: strategies are among
the kinds a default recall returns.
Arguments
| Name | Type | Required | Default | Notes |
|---|---|---|---|---|
op | string | yes | One of create, store, get, list, recall, patch, archive, rate. | |
trigger | string | per operation | The situation. Up to 20,000 characters. | |
action | string | per operation | What to do when the trigger matches. Up to 20,000 characters. | |
id | string | per operation | Strategy id. For get, patch, archive and rate. | |
outcome | string | per operation | success or failure. For rate. | |
context | string | no | When the strategy applies, in free text. | |
agentId | string | no | The agent the strategy belongs to. For create and store. | |
scopeRef | string | no | Project or entity the strategy is scoped to. Also a filter in list and recall. | |
supersedesId | string | no | Id of a strategy this one replaces. That strategy is closed. | |
validFrom | string | no | When the strategy starts to apply. ISO 8601 UTC instant. For create and store. | |
validTo | string | no | When it stops applying. For patch. | |
status | string | no | active, superseded or archived. For patch. | |
statusFilter | string | no | active in recall | For list and recall: only strategies in this status. |
validAt | string | no | For list and recall: only strategies valid at this instant. | |
limit | integer | no | For list and recall. 1 to 500. | |
metadata | object | no | For create, store and patch. | |
sensitivity | string | no | internal | For create and store. |
idempotencyKey | string | no | For create and store. Prevents a duplicate strategy on a retry. | |
targetWorkspaceId | string | no | For create and store. UUID of another workspace where you have write access. |
Example
{
"name": "memory_strategy",
"arguments": {
"op": "store",
"trigger": "A picker robot stalls after a firmware update",
"action": "Restore the torque limit, then run the loaded-bin test before returning the unit to the floor",
"context": "Larkspur warehouse fleet"
}
}Returns
store, create, get, patch and rate return the strategy record:
id, workspaceId, trigger, action, successCount, failureCount,
worth, status, validFrom, createdAt, updatedAt and metadata,
plus the optional fields that are set. list and recall return
{ "items", "total" }. archive returns { "id", "archived": true }.
rate is not idempotent. Each call adds one to successCount or
failureCount, and the server recomputes worth.
Related
- Procedural memory, the concept
- Memory Worth
- REST:
POST /strategies,POST /strategies/{id}/rate