Back to notes

From watching to delegating: building an always-on agent

On shifting the mental model of work to agents

In my last post, I ended by writing about how we want to make Reef, our internal agent platform, more proactive. I have now built Sentinel, an always-on agent that acts as a personal assistant and manages the user’s work in Reef. Sentinel watches Slack messages, Google Calendar changes, and acts on the user’s behalf.

Now my Sentinel reaches out to me autonomously with a brief and a slide deck whenever I’m invited to a new meeting where I’m expected to present or actively participate. It also keeps track of and manages feedback and requests in our team Slack channel. I also use it to explore ideas and manage notes.

Because Sentinel starts with personal and organizational context, as well as all the user’s previous Reef history, it is much easier to trust the outputs of Sentinel. There’s no longer a need to watch every step the agent takes to derive the output. Delegation and background execution become the default mode, for this we need to shift the mental model of work from the user to the agent.

A channel instead of a trace

In Reef we started out with a standard task view in which users can see all of the tool calls and reasoning the agent does while carrying out work. For on-demand work this is a useful pattern, since users can trace decisions the agent made if something in an analysis is wrong or if an action turned out poorly. For background work and delegation, which Sentinel is built for, this mode of interaction is too noisy.

With delegation, the user is no longer there to watch. It is now Sentinel’s responsibility to know what work needs to be done and what results the user needs, sometimes before the user knows. To support this shift, I redesigned the data model and the user experience around a shared communication channel between the user and their Sentinel. This channel is a persistent thread for each user, which each Sentinel run reads from and writes to. Separating communication from execution this way has three main benefits.

Sentinel diagram

The first benefit is coordination. I often send my Sentinel several Slack messages at once. The platform executes these as separate instances of my Sentinel agent, they share the same context: the shared thread holds the conversation, and a shared filesystem holds what Sentinel has learned. Hence separate instances can coordinate their efforts and any later messages that arrive when an instance is already running can immediately influence that run.

The second benefit is silence. “Always-on” is a simplification. Sentinel runs on scheduled wake-ups and events. Most of these runs find nothing that is of interest to the user. In the previous model, which focused on execution, every agent loop ended with a text response to the user. Now Sentinel makes the choice between staying silent and notifying, and I can set a high bar for communication.

The third benefit is that the thread is the same in every client, because it does not depend on execution. Users can therefore interact with their Sentinel through Slack, our web application, and our browser extension without missing messages or having to jump between them.

Even though the new communication channel has become the default for Sentinel interactions, we have still kept the execution-based traces and outputs. When a user needs to see exactly how Sentinel produced an output, all tool calls and reasoning traces are still there.

Old bets pay off

Underneath the new communication channel, the execution layer is exactly the same as before. I did not have to rebuild it, because of an early decision in Reef: the agent runtime runs on workers that consume jobs from a queue. When I made that decision, it cost me streaming tokens, added latency and I had to write lots of glue code to manage interruptions and stopping runs via database transactions. With background work, clients can fire-and-forget while the agent runtime executes work, and latency becomes a non-issue since users are not waiting for a task to complete.

Another early-ish decision was to build the agent filesystem, which agents use for memory and persistent storage, safe for concurrent use. In regular Reef two runs rarely touched the same files at the same time. With Sentinel it happens all the time since heartbeats, scheduled wake-ups and user messages start runs that overlap.

In total, Sentinel needed three new parts: the thread that holds user interactions, a few tools to message the user and delegate work to other Reef agents, and one new service. That service is an event intake service that records and persists events from Slack and Google Calendar, so that each Sentinel run can know what happened since last time. Everything else runs on what Reef already had.

Islands of context

Delegation and background work are Sentinel’s strength, but they have also caused a new problem. Moving the mental model of work from the user to Sentinel means that knowledge about the work stays in each Sentinel, inaccessible to others. Over time, each Sentinel builds up an island of context for its user. Each of these islands is the filesystem of one Sentinel and it probably holds knowledge that another Sentinel or person could use.

To solve this, I believe the next step is a medium through which Sentinels can communicate with each other. I’m not sure what this medium will look like, but for now I’m experimenting with an agent message board. The hard part is privacy: Sentinel should not leak private details about me that it has learned.

With Sentinel, my colleagues and I have stopped watching the agent work. The open question now is how Sentinels share what they learn while nobody is watching.