Should archival memories be managed by a sleeptime agent?

We get a common question about where to put archival memory when using sleeptime agents. We have plans to make archival memory shared, but this is pending a few core updates.

For now, you have two real options:

  1. Primary archival: Put archival memory insert + search in the primary agent.
  2. Sleeptime archival: Put archival memory into the sleeptime agent and have it place information from archival memory into a block accessibly by the primary.

I recommend primary archival for most use cases, though obviously this varies with your needs.

Primary archival

The primary agent manages archival. This can be slow, but has the advantage of ensuring that archival memory can be available to the agent before it responds, which you cannot guarantee when using sleeptime archival.

Your primary agent will do more tool calls which might not be what you want for a consumer-facing application.

Primary archival management is most useful when conversations can change rapidly or archival memory covers lots of ground, as in companion chatbots.

I strongly recommend primary archival as it is simple and keeps the primary agent up to date.

Sleeptime archival

The sleeptime manages archival.

This requires structural modifications. Both agents should have a block like archival_context. You should leave explicit instructions for the sleeptime agent to (a) search archival memory actively, and (b) constantly re-write the archival_context block to contain information that might be useful to the primary agent.

You could probably set a tool rule for the sleeptime agent requiring it to begin with archival_memory_search as well.

The issue with sleeptime archival is that it is high-latency in message space. For example, if you trigger sleeptime every five messages, your agent may be far behind in the conversation, and archival memories may have been available to the sleeptime agent that would have been useful to the agent at message 2, but now the conversation has moved on.

Sleeptime archival will make your primary agent feel forgetful to users until the sleeptime agent can provide useful information.

Sleeptime archival is useful when archival memory is complex and the conversation doesn’t change topic much. I could imagine this being the case for narrow research agents, centralized knowledge managers, etc.