Memory
Give one agent a memory: notes about each person and about the business, taken after every conversation and handed back at the start of the next one.
This page is made from the recipe memory, version 1, and says nothing the recipe does not. How a recipe is composed explains every word it uses.
Its setup
[The agent that remembers] remembers each person and what it learns about the business, and has it in mind when its next conversation starts.
Each phrase in brackets is a parameter the recipe asks for, named as the table of parameters below names it.
Its parts, in the order data travels
- automation
note_each_conversation— Runs the noting when a conversation of the agent ends, tests left out.- set off by
interaction_ended, withagent${param.agent},leave_out_teststrue - runs the flow
noting
- set off by
- placement
before_each_conversation— Hands the agent its newest notes before its first turn.- sits in the
preslot of the agent${param.agent}(the value of the parameteragent) and runs the toolhanding_over
- sits in the
- flow
noting— Notes the business first and then, when the conversation has a contact, the person.- step
businessruns the toolnote_business - step
clean_businessruns the toolredact - step
keep_businessruns the tool${resource.notes.write_tool}(thewrite_toolof this recipe'snotes) - step
personruns the toolnote_person - step
clean_personruns the toolredact - step
keep_personruns the tool${resource.notes.write_tool}(thewrite_toolof this recipe'snotes)
- step
- flow
hand_over— Reads the newest business notes and, when the conversation has a contact, that person's newest notes.- step
businessruns the tool${resource.notes.query_tool}(thequery_toolof this recipe'snotes) - step
personruns the tool${resource.notes.query_tool}(thequery_toolof this recipe'snotes) - step
business_onlyruns the toolgather - step
bothruns the toolgather
- step
- tool
note_person— Asks a model for the notes worth keeping about the person the agent spoke with.- runs the built-in
draft_text
- runs the built-in
- tool
note_business— Asks a model for the notes worth keeping about the business, which reach every conversation.- runs the built-in
draft_text
- runs the built-in
- tool
redact— Replaces each card, bank account and identity number in the notes by a placeholder.- runs the built-in
redact_sensitive_numbers
- runs the built-in
- tool
gather— Hands the business notes and the person's notes back as one answer.- runs the built-in
pass_value
- runs the built-in
- tool
handing_over— Offers the handing-over as one tool, handed the contact of the conversation it runs in.- runs the flow
hand_overoffered as one tool
- runs the flow
- collection
notes— Keeps every note, about a person or about the business, one per row.
Its parameters
| Parameter | Kind | What it asks | Value |
|---|---|---|---|
agent | agent | The agent that remembers | required; fixed once installed |
notice | text | What is worth noticing — Guides the model that takes the notes after each conversation. | default What the person asked for, prefers or told us about themselves that would help next time, and what was promised to them; about the business, what was learnt that will hold for anyone who calls. When nothing is worth keeping, or nobody spoke, note nothing. Never copy a payment card, bank account or identity number into a note. |
person_notes | number | Notes about the person handed over at the start | default 5; from 0 to 20 |
business_notes | number | Notes about the business handed over at the start | default 5; from 0 to 20 |
How its data moves
The flow noting:
| Step | Input | Value | Comes from |
|---|---|---|---|
business | input | $ref:trigger.transcript | transcript of what set the run off |
clean_business | text | $ref:business.rows | rows of the step business's answer |
keep_business | rows | $ref:clean_business.text | text of the step clean_business's answer |
keep_business | about | business | fixed |
keep_business | origin | $ref:trigger.interaction_id | interaction_id of what set the run off |
person | input | $ref:trigger.transcript | transcript of what set the run off |
clean_person | text | $ref:person.rows | rows of the step person's answer |
keep_person | rows | $ref:clean_person.text | text of the step clean_person's answer |
keep_person | contact | $ref:trigger.contact | contact of what set the run off |
keep_person | about | person | fixed |
keep_person | origin | $ref:trigger.interaction_id | interaction_id of what set the run off |
The flow hand_over:
| Step | Input | Value | Comes from |
|---|---|---|---|
business | about | business | fixed |
business | newest_first | true | fixed |
business | limit | ${param.business_notes} | replace with the value of the parameter business_notes |
person | contact | $ref:trigger.conversation_contact | conversation_contact of what set the run off |
person | about | person | fixed |
person | newest_first | true | fixed |
person | limit | ${param.person_notes} | replace with the value of the parameter person_notes |
business_only | value.business | $ref:business.records | records of the step business's answer |
both | value.business | $ref:business.records | records of the step business's answer |
both | value.person | $ref:person.records | records of the step person's answer |
A value written $ref:<step>.<path> is what an earlier step answered, and $ref:trigger.<path> is what set the run off. A value with ${...} in it is a placeholder: building it by hand, replace it with your own.
Build it yourself
To install it as it is: POST /api/v1/recipes/{key}/install with the key memory and a value for each parameter. To build the same thing with your own particulars, make each part in this order -- each one may name the ones before it -- with the operations below.
The YAML under each part is the recipe's declaration, not a request body: the API takes other names for the same things (a tool's builtin is source and config.builtin, a step's tool is tool_id, an edge's from is source_step_id). From a recipe to the API on the lead page maps every field, kind by kind.
1. collection notes
Keeps every note, about a person or about the business, one per row.
POST /api/v1/collectionscreates the collection with its fields.PATCH /api/v1/collections/{collection_id}sets the identity field once the fields exist.
Code
2. tool note_person
Asks a model for the notes worth keeping about the person the agent spoke with.
POST /api/v1/toolscreates the instance: a built-in's, or a flow offered as one tool by itsconfig.flow_id.
Code
3. tool note_business
Asks a model for the notes worth keeping about the business, which reach every conversation.
POST /api/v1/toolscreates the instance: a built-in's, or a flow offered as one tool by itsconfig.flow_id.
Code
4. tool redact
Replaces each card, bank account and identity number in the notes by a placeholder.
POST /api/v1/toolscreates the instance: a built-in's, or a flow offered as one tool by itsconfig.flow_id.
Code
5. tool gather
Hands the business notes and the person's notes back as one answer.
POST /api/v1/toolscreates the instance: a built-in's, or a flow offered as one tool by itsconfig.flow_id.
Code
6. flow noting
Notes the business first and then, when the conversation has a contact, the person.
POST /api/v1/flowscreates the flow.POST /api/v1/flows/{flow_id}/stepsadds each step, naming the tool it runs.POST /api/v1/flows/{flow_id}/edgesadds each edge.PATCH /api/v1/flows/{flow_id}/entry-stepsets the step a run starts at.
Code
7. flow hand_over
Reads the newest business notes and, when the conversation has a contact, that person's newest notes.
POST /api/v1/flowscreates the flow.POST /api/v1/flows/{flow_id}/stepsadds each step, naming the tool it runs.POST /api/v1/flows/{flow_id}/edgesadds each edge.PATCH /api/v1/flows/{flow_id}/entry-stepsets the step a run starts at.
Code
8. tool handing_over
Offers the handing-over as one tool, handed the contact of the conversation it runs in.
POST /api/v1/toolscreates the instance: a built-in's, or a flow offered as one tool by itsconfig.flow_id.
Code
9. automation note_each_conversation
Runs the noting when a conversation of the agent ends, tests left out.
POST /api/v1/automationscreates the automation on its trigger, running the flow.PUT /api/v1/automations/{automation_id}/enabledswitches it on: an automation is created switched off.
Code
10. placement before_each_conversation
Hands the agent its newest notes before its first turn.
No public operation places a tool in an agent's slot outside its versions yet. The nearest by hand puts the tool in the slot of the agent's draft and publishes it, which ties it to that version rather than to the agent:
PATCH /api/v1/agents/versions/{version_id}adds the tool to the draft'spre_hook_tool_idsorpost_hook_tool_ids.POST /api/v1/agents/versions/{version_id}/publishpublishes the draft.
Code
How to adapt it
Choose the agent, say in your own words what is worth noticing, and choose how many notes about the person and about the business reach each conversation. To build your own, keep its two halves -- after a conversation, a drafting step asked for rows, a step that replaces sensitive numbers and a write that fills in what the model must not choose; before one, a query of the newest notes in the agent's pre-conversation slot -- and change what is noted or how it is read.
What cannot change once installed
Installed, every part is the recipe's: it is listed where its kind lives, marked as the recipe's, and refuses every edit and deletion by hand, naming the recipe.
- collection
notes: its fields. - tool
note_person: its configuration and fixed values. - tool
note_business: its configuration and fixed values. - tool
redact: its configuration and fixed values. - tool
gather: its configuration and fixed values. - flow
noting: its steps and edges. - flow
hand_over: its steps and edges. - tool
handing_over: its configuration and fixed values. - automation
note_each_conversation: its trigger and flow. - placement
before_each_conversation: the agent, the slot and the tool it places.
What stays the organization's:
- the records in
notes, read, written and deleted as any records are; - the values of
notice,person_notes,business_notes, changed on the installed recipe and written through to every part that uses them; - not
agent: the agent is fixed once installed, because it says which install this is -- moving the recipe to another agent is uninstalling it and installing it there; - whether the recipe is on, which switches its automations on and off together;
- presentation -- a column's width, a step's position -- which changes nothing it runs.
What retention deletes
The recipe declares the records of notes deleted whole: when the organization's retention window passes, a record with a personal field is deleted whole, rather than kept with its personal fields emptied. Its personal fields: contact, note.
What it costs
What its parts consume -- a tool execution, a model's tokens, a message, storage -- is recorded and charged as those parts are, exactly as your own use of them is; nothing is charged for the recipe itself.