OpenRouter published a TypeScript tutorial for an agent that checks a news feed on a schedule, produces a digest, and remembers what it has already seen. The example uses the company's Agent SDK, with explicit limits on steps and spending for each run.
The design also preserves state across restarts and pauses before a tool action that needs approval. Each scheduled check begins with a fresh conversation, while durable files retain the information needed across runs. The example illustrates how a recurring agent can remain bounded without carrying an ever-growing conversation forever.

A schedule is only the beginning
The difficult question is what happens when a scheduled run does not finish cleanly. A process can stop after fetching an item but before recording that it was handled. It can also finish an external action and crash before saving the result. Those two cases require different recovery behavior.
For a read-only digest, duplicate entries may be an inconvenience. For an agent that sends messages or creates tickets, duplicates can affect other people. The workflow should make it possible to identify an action that already happened before retrying it.
State should describe the work, not merely the conversation. Useful records include the item identifier, the last completed step, the result, and whether an approval is pending. This makes recovery easier to reason about than asking a model to infer everything from a long transcript.
Put limits around repetition
A small cost per run can become a substantial bill when a schedule repeats frequently or an error triggers retries. Apply limits to individual runs and to the account or job as a whole. Record how often the limit is reached, because a repeatedly truncated run may be failing quietly.
Attention needs a budget too. A watcher should distinguish a changed condition from an unchanged one and avoid notifying the user merely to prove that it ran. A periodic digest may be useful; a stream of identical messages usually is not.
A practical acceptance test is a controlled restart. Stop the process at several points, start it again, and check whether it resumes without losing work or repeating consequences. Then test what happens when approval remains pending for longer than one schedule interval.
The tutorial's broader value is its focus on ordinary operational mechanics. A background agent becomes dependable when it knows what it has done, what it may do next, and when it must stop or wait for a person.
Have a correction or a useful perspective?
Get in touch with the publication.


