Background Agents
Working while you sleep.
Up to now, every agent has waited for someone to ask. But the most useful assistant is the one that notices a problem first. An email comes in from the courier, saying that an order is delayed. Why wait for the customer to complain? A background agent watches for events, and gets to work by itself.

- So far, agents waited to be asked
- A useful one notices first
- It watches for events
Watching an event stream
Here's a simple watcher. On each tick, it looks for new events. A cheap check decides whether each one matters. Most don't. If one does, the agent prepares a draft, and leaves it for a person to review. Run it. The courier's message was flagged, and a draft is ready. The supplier's catalogue was ignored. Notice what's safe about this design. It prepares work, and it doesn't send it. A person wakes up to finished drafts. That's the pattern to start with.
import time
INBOX = [{"from": "courier", "text": "Depot closed, order B42 delayed by two days"},
{"from": "supplier", "text": "New catalogue attached"}]
def triage(event):
if "delayed" in event["text"]:
return "needs_action"
return "ignore"
def handle(event):
return f"Draft ready for review: tell the customer about {event['text'][:24]}..."
seen = 0
for tick in range(2):
new = INBOX[seen:]
seen = len(INBOX)
for event in new:
kind = triage(event)
print(f"Tick {tick}: {event['from']:<9} -> {kind}")
if kind == "needs_action":
print(" ", handle(event))
time.sleep(0.01)Tick 0: courier -> needs_action Draft ready for review: tell the customer about Depot closed, order B42 ... Tick 0: supplier -> ignore
Rules for unattended agents
Nobody's watching these agents, so the limits matter even more. Use a cheap filter first, so that you're not paying for a model on each event. Set a daily budget. Don't let an event trigger itself in a loop. Prepare drafts rather than taking actions. And send a daily summary of what it did, so that people stay informed.
Summary
Notice first, prepare the work, and leave the decision to a person. Next, letting an agent query real data, safely.
Key takeaways- React to events
- Filter cheaply
- Drafts before actions